diff --git a/.gitignore b/.gitignore
index eea95f6..695c689 100644
--- a/.gitignore
+++ b/.gitignore
@@ -379,4 +379,3 @@ $RECYCLE.BIN/
# End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,linux,macos,pycharm+all,python,sublimetext,vim,vscode
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
-
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..5a764b8
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,25 @@
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.0.1
+ hooks:
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - id: check-yaml
+ - id: debug-statements
+ - id: check-ast
+ - id: check-docstring-first
+ - id: check-merge-conflict
+ - id: check-toml
+- repo: https://github.com/asottile/setup-cfg-fmt
+ rev: v1.17.0
+ hooks:
+ - id: setup-cfg-fmt
+- repo: https://github.com/pycqa/flake8
+ rev: 3.9.2
+ hooks:
+ - id: flake8
+- repo: https://github.com/asottile/add-trailing-comma
+ rev: v2.1.0
+ hooks:
+ - id: add-trailing-comma
+ args: [--py36-plus]
diff --git a/LICENSE b/LICENSE
index 30ecbe5..33d34e8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
+SOFTWARE.
diff --git a/README.md b/README.md
index 779cede..91c770c 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,8 @@
# squiral
-![](https://img.shields.io/pypi/v/squiral)
-[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
-![]( https://img.shields.io/pypi/pyversions/squiral.svg )
+[![](https://img.shields.io/pypi/v/squiral)](https://pypi.org/project/squiral/)
+[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
+[![](https://img.shields.io/pypi/pyversions/squiral.svg)](https://pypi.org/project/squiral/)
+[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sadikkuzu/squiral/main.svg)](https://results.pre-commit.ci/latest/github/sadikkuzu/squiral/main)
**squ**are sp**iral**
@@ -17,12 +18,12 @@ Here is an example:
The basic idea behind printing this matrix is
to start from the middle of the matrix and then moving:
-```right```>> ```down```>>``` left```>>``` up```
+`right` >> `down` >> `left` >> `up`
and not returning to the same row again.
### Install
-````pip install squiral````
+`pip install squiral`
#### Usage
diff --git a/poetry.lock b/poetry.lock
index 154e281..52a0983 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -8,17 +8,17 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "attrs"
-version = "20.3.0"
+version = "21.2.0"
description = "Classes Without Boilerplate"
category = "dev"
optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[package.extras]
-dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "furo", "sphinx", "pre-commit"]
-docs = ["furo", "sphinx", "zope.interface"]
-tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
-tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"]
+dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"]
+docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"]
+tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"]
+tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"]
[[package]]
name = "colorama"
@@ -41,7 +41,7 @@ toml = ["toml"]
[[package]]
name = "flake8"
-version = "3.9.0"
+version = "3.9.2"
description = "the modular source code checker: pep8 pyflakes and co"
category = "dev"
optional = false
@@ -55,7 +55,7 @@ pyflakes = ">=2.3.0,<2.4.0"
[[package]]
name = "importlib-metadata"
-version = "3.9.0"
+version = "4.6.0"
description = "Read metadata from Python packages"
category = "dev"
optional = false
@@ -67,7 +67,8 @@ zipp = ">=0.5"
[package.extras]
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
-testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]
+perf = ["ipython"]
+testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]
[[package]]
name = "iniconfig"
@@ -87,11 +88,11 @@ python-versions = "*"
[[package]]
name = "packaging"
-version = "20.9"
+version = "21.0"
description = "Core utilities for Python packages"
category = "dev"
optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+python-versions = ">=3.6"
[package.dependencies]
pyparsing = ">=2.0.2"
@@ -144,7 +145,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "pytest"
-version = "6.2.2"
+version = "6.2.4"
description = "pytest: simple powerful testing with Python"
category = "dev"
optional = false
@@ -166,7 +167,7 @@ testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xm
[[package]]
name = "pytest-cov"
-version = "2.11.1"
+version = "2.12.1"
description = "Pytest plugin for measuring coverage."
category = "dev"
optional = false
@@ -175,9 +176,10 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[package.dependencies]
coverage = ">=5.2.1"
pytest = ">=4.6"
+toml = "*"
[package.extras]
-testing = ["fields", "hunter", "process-tests (==2.0.2)", "six", "pytest-xdist", "virtualenv"]
+testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"]
[[package]]
name = "toml"
@@ -189,7 +191,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "typing-extensions"
-version = "3.7.4.3"
+version = "3.10.0.0"
description = "Backported and Experimental Type Hints for Python 3.5+"
category = "dev"
optional = false
@@ -197,7 +199,7 @@ python-versions = "*"
[[package]]
name = "zipp"
-version = "3.4.1"
+version = "3.5.0"
description = "Backport of pathlib-compatible object wrapper for zip files"
category = "dev"
optional = false
@@ -205,7 +207,7 @@ python-versions = ">=3.6"
[package.extras]
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
-testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
+testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
[metadata]
lock-version = "1.1"
@@ -218,8 +220,8 @@ atomicwrites = [
{file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"},
]
attrs = [
- {file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"},
- {file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"},
+ {file = "attrs-21.2.0-py2.py3-none-any.whl", hash = "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1"},
+ {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"},
]
colorama = [
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
@@ -280,12 +282,12 @@ coverage = [
{file = "coverage-5.5.tar.gz", hash = "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c"},
]
flake8 = [
- {file = "flake8-3.9.0-py2.py3-none-any.whl", hash = "sha256:12d05ab02614b6aee8df7c36b97d1a3b2372761222b19b58621355e82acddcff"},
- {file = "flake8-3.9.0.tar.gz", hash = "sha256:78873e372b12b093da7b5e5ed302e8ad9e988b38b063b61ad937f26ca58fc5f0"},
+ {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"},
+ {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"},
]
importlib-metadata = [
- {file = "importlib_metadata-3.9.0-py3-none-any.whl", hash = "sha256:6fd684b4c6c7bb36d57e93d57fc244b5ffc08faa1c298bcda3dfbbbf19d7550a"},
- {file = "importlib_metadata-3.9.0.tar.gz", hash = "sha256:036eae7ebbd41db176774c42e80f3288a1e41c7ebfc8ed099a94653973ebd00f"},
+ {file = "importlib_metadata-4.6.0-py3-none-any.whl", hash = "sha256:c6513572926a96458f8c8f725bf0e00108fba0c9583ade9bd15b869c9d726e33"},
+ {file = "importlib_metadata-4.6.0.tar.gz", hash = "sha256:4a5611fea3768d3d967c447ab4e93f567d95db92225b43b7b238dbfb855d70bb"},
]
iniconfig = [
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
@@ -296,8 +298,8 @@ mccabe = [
{file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"},
]
packaging = [
- {file = "packaging-20.9-py2.py3-none-any.whl", hash = "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"},
- {file = "packaging-20.9.tar.gz", hash = "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"},
+ {file = "packaging-21.0-py3-none-any.whl", hash = "sha256:c86254f9220d55e31cc94d69bade760f0847da8000def4dfe1c6b872fd14ff14"},
+ {file = "packaging-21.0.tar.gz", hash = "sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7"},
]
pluggy = [
{file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"},
@@ -320,23 +322,23 @@ pyparsing = [
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
]
pytest = [
- {file = "pytest-6.2.2-py3-none-any.whl", hash = "sha256:b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"},
- {file = "pytest-6.2.2.tar.gz", hash = "sha256:9d1edf9e7d0b84d72ea3dbcdfd22b35fb543a5e8f2a60092dd578936bf63d7f9"},
+ {file = "pytest-6.2.4-py3-none-any.whl", hash = "sha256:91ef2131a9bd6be8f76f1f08eac5c5317221d6ad1e143ae03894b862e8976890"},
+ {file = "pytest-6.2.4.tar.gz", hash = "sha256:50bcad0a0b9c5a72c8e4e7c9855a3ad496ca6a881a3641b4260605450772c54b"},
]
pytest-cov = [
- {file = "pytest-cov-2.11.1.tar.gz", hash = "sha256:359952d9d39b9f822d9d29324483e7ba04a3a17dd7d05aa6beb7ea01e359e5f7"},
- {file = "pytest_cov-2.11.1-py2.py3-none-any.whl", hash = "sha256:bdb9fdb0b85a7cc825269a4c56b48ccaa5c7e365054b6038772c32ddcdc969da"},
+ {file = "pytest-cov-2.12.1.tar.gz", hash = "sha256:261ceeb8c227b726249b376b8526b600f38667ee314f910353fa318caa01f4d7"},
+ {file = "pytest_cov-2.12.1-py2.py3-none-any.whl", hash = "sha256:261bb9e47e65bd099c89c3edf92972865210c36813f80ede5277dceb77a4a62a"},
]
toml = [
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
]
typing-extensions = [
- {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"},
- {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"},
- {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
+ {file = "typing_extensions-3.10.0.0-py2-none-any.whl", hash = "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497"},
+ {file = "typing_extensions-3.10.0.0-py3-none-any.whl", hash = "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"},
+ {file = "typing_extensions-3.10.0.0.tar.gz", hash = "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342"},
]
zipp = [
- {file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"},
- {file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"},
+ {file = "zipp-3.5.0-py3-none-any.whl", hash = "sha256:957cfda87797e389580cb8b9e3870841ca991e2125350677b2ca83a0e99390a3"},
+ {file = "zipp-3.5.0.tar.gz", hash = "sha256:f5812b1e007e48cff63449a5e9f4e7ebea716b4111f9c4f9a645f91d579bf0c4"},
]
diff --git a/pyproject.toml b/pyproject.toml
index b974e54..951c863 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -3,6 +3,7 @@ name = "squiral"
version = "0.1.2"
description = "squiral - square spiral"
authors = ["SADIK KUZU "]
+homepage = "https://github.com/sadikkuzu/squiral"
readme = "README.md"
license = "MIT"
diff --git a/squiral/__init__.py b/squiral/__init__.py
index b6f1971..aa78481 100644
--- a/squiral/__init__.py
+++ b/squiral/__init__.py
@@ -2,11 +2,11 @@
from .squiral import (
produce,
- printout
+ printout,
)
__all__ = [
'__version__',
'produce',
- 'printout'
- ]
+ 'printout',
+]
diff --git a/tests/testdata_squiral.py b/tests/testdata_squiral.py
index ddd538a..31d2392 100644
--- a/tests/testdata_squiral.py
+++ b/tests/testdata_squiral.py
@@ -1,110 +1,110 @@
data_to_where = [
- (1, "right"),
- (2, "down"),
- (3, "left"),
- (4, "left"),
- (5, "up"),
- (6, "up"),
- (7, "right"),
- (8, "right"),
- (9, "right"),
- (10, "down"),
- (11, "down"),
- (12, "down"),
- (13, "left"),
- (14, "left"),
- (15, "left"),
- (16, "left"),
- (17, "up"),
- (18, "up"),
- (19, "up"),
- (20, "up"),
- (21, "right"),
- (22, "right"),
- (23, "right"),
- (24, "right"),
- (25, "right"),
- (26, "down"),
- (27, "down"),
- (28, "down"),
- (29, "down"),
- (30, "down"),
- (31, "left"),
- (32, "left"),
- (33, "left"),
- (34, "left"),
- (35, "left"),
- (36, "left"),
- (37, "up"),
- (38, "up"),
- (39, "up"),
- (40, "up"),
- (41, "up"),
- (42, "up"),
- (43, "right"),
- (44, "right"),
- (45, "right"),
- (46, "right"),
- (47, "right"),
- (48, "right"),
- (49, "right"),
- (50, "down"),
- (51, "down"),
- (52, "down"),
- (53, "down"),
- (54, "down"),
- (55, "down"),
- (56, "down"),
- (57, "left"),
- (58, "left"),
- (59, "left"),
- (60, "left"),
- (61, "left"),
- (62, "left"),
- (63, "left"),
- (64, "left"),
- (65, "up"),
- (66, "up"),
- (67, "up"),
- (68, "up"),
- (69, "up"),
- (70, "up"),
- (71, "up"),
- (72, "up"),
- (73, "right"),
- (74, "right"),
- (75, "right"),
- (76, "right"),
- (77, "right"),
- (78, "right"),
- (79, "right"),
- (80, "right"),
- (81, "right"),
- (82, "down"),
- (83, "down"),
- (84, "down"),
- (85, "down"),
- (86, "down"),
- (87, "down"),
- (88, "down"),
- (89, "down"),
- (90, "down"),
- (91, "left"),
- (92, "left"),
- (93, "left"),
- (94, "left"),
- (95, "left"),
- (96, "left"),
- (97, "left"),
- (98, "left"),
- (99, "left"),
- (100, "left")
- ]
+ (1, "right"),
+ (2, "down"),
+ (3, "left"),
+ (4, "left"),
+ (5, "up"),
+ (6, "up"),
+ (7, "right"),
+ (8, "right"),
+ (9, "right"),
+ (10, "down"),
+ (11, "down"),
+ (12, "down"),
+ (13, "left"),
+ (14, "left"),
+ (15, "left"),
+ (16, "left"),
+ (17, "up"),
+ (18, "up"),
+ (19, "up"),
+ (20, "up"),
+ (21, "right"),
+ (22, "right"),
+ (23, "right"),
+ (24, "right"),
+ (25, "right"),
+ (26, "down"),
+ (27, "down"),
+ (28, "down"),
+ (29, "down"),
+ (30, "down"),
+ (31, "left"),
+ (32, "left"),
+ (33, "left"),
+ (34, "left"),
+ (35, "left"),
+ (36, "left"),
+ (37, "up"),
+ (38, "up"),
+ (39, "up"),
+ (40, "up"),
+ (41, "up"),
+ (42, "up"),
+ (43, "right"),
+ (44, "right"),
+ (45, "right"),
+ (46, "right"),
+ (47, "right"),
+ (48, "right"),
+ (49, "right"),
+ (50, "down"),
+ (51, "down"),
+ (52, "down"),
+ (53, "down"),
+ (54, "down"),
+ (55, "down"),
+ (56, "down"),
+ (57, "left"),
+ (58, "left"),
+ (59, "left"),
+ (60, "left"),
+ (61, "left"),
+ (62, "left"),
+ (63, "left"),
+ (64, "left"),
+ (65, "up"),
+ (66, "up"),
+ (67, "up"),
+ (68, "up"),
+ (69, "up"),
+ (70, "up"),
+ (71, "up"),
+ (72, "up"),
+ (73, "right"),
+ (74, "right"),
+ (75, "right"),
+ (76, "right"),
+ (77, "right"),
+ (78, "right"),
+ (79, "right"),
+ (80, "right"),
+ (81, "right"),
+ (82, "down"),
+ (83, "down"),
+ (84, "down"),
+ (85, "down"),
+ (86, "down"),
+ (87, "down"),
+ (88, "down"),
+ (89, "down"),
+ (90, "down"),
+ (91, "left"),
+ (92, "left"),
+ (93, "left"),
+ (94, "left"),
+ (95, "left"),
+ (96, "left"),
+ (97, "left"),
+ (98, "left"),
+ (99, "left"),
+ (100, "left"),
+]
data_next_point = [
- (1, 1, "right", 1, 2),
- (1, 1, "left", 1, 0),
- (1, 1, "up", 0, 1),
- (1, 1, "down", 2, 1),
- (0, 0, "left", 0, -1)
- ]
+ (1, 1, "right", 1, 2),
+ (1, 1, "left", 1, 0),
+ (1, 1, "up", 0, 1),
+ (1, 1, "down", 2, 1),
+ (0, 0, "left", 0, -1),
+]