offset-poly 0.1.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,140 @@
1
+ ci:
2
+ skip: [pyright]
3
+
4
+ exclude: "tests"
5
+
6
+ repos:
7
+
8
+ - repo: https://github.com/pre-commit/pre-commit-hooks
9
+ rev: v4.4.0
10
+ hooks:
11
+ - id: check-added-large-files
12
+ - id: check-ast
13
+ - id: check-case-conflict
14
+ - id: check-docstring-first
15
+ - id: check-executables-have-shebangs
16
+ - id: check-json
17
+ - id: check-merge-conflict
18
+ args:
19
+ - --assume-in-merge
20
+ - id: check-shebang-scripts-are-executable
21
+ - id: check-symlinks
22
+ - id: check-toml
23
+ - id: check-vcs-permalinks
24
+ - id: check-xml
25
+ - id: check-yaml
26
+ - id: debug-statements
27
+ - id: destroyed-symlinks
28
+ - id: detect-aws-credentials
29
+ - id: detect-private-key
30
+ - id: end-of-file-fixer
31
+ - id: mixed-line-ending
32
+ - id: requirements-txt-fixer
33
+ - id: trailing-whitespace
34
+ - id: fix-encoding-pragma
35
+ args:
36
+ - --remove
37
+ - id: name-tests-test
38
+ args:
39
+ - --pytest-test-first
40
+ - id: no-commit-to-branch
41
+ - id: pretty-format-json
42
+ # - id: sort-simple-yaml
43
+ # files: .pre-commit-config.yaml
44
+
45
+ - repo: https://github.com/pre-commit/mirrors-mypy
46
+ rev: v1.5.1
47
+ hooks:
48
+ - id: mypy
49
+ name: mypy
50
+ language: python
51
+ language_version: python 3.11
52
+ types: [python]
53
+ require_serial: true
54
+ verbose: true
55
+ additional_dependencies: ['types-requests']
56
+ # exclude: "tests"
57
+ # args:
58
+ # - --ignore-missing-imports
59
+ # files: ^(src/|tests/)
60
+
61
+ - repo: https://github.com/PyCQA/isort
62
+ rev: 5.12.0
63
+ hooks:
64
+ - id: isort
65
+ args: ["--profile", "black", "--filter-files", "--combine-as"]
66
+
67
+ - repo: https://github.com/psf/black
68
+ rev: 23.7.0
69
+ hooks:
70
+ - id: black
71
+ language_version: python3.9
72
+ args: ["--skip-magic-trailing-comma"]
73
+
74
+ - repo: https://github.com/asottile/pyupgrade
75
+ rev: v3.10.1
76
+ hooks:
77
+ - args:
78
+ - --py39-plus
79
+ id: pyupgrade
80
+
81
+ - repo: https://github.com/Lucas-C/pre-commit-hooks
82
+ rev: v1.5.4
83
+ hooks:
84
+ - id: remove-tabs
85
+
86
+ # - repo: https://github.com/commitizen-tools/commitizen
87
+ # rev: v2.40.0
88
+ # hooks:
89
+ # - id: commitizen
90
+
91
+ - repo: https://github.com/pre-commit/mirrors-pylint
92
+ rev: v3.0.0a5
93
+ hooks:
94
+ - id: pylint
95
+ exclude: "tests"
96
+ name: pylint
97
+ args:
98
+ - --good-names=i,j,_,f
99
+ - --disable=protected-access
100
+ - --disable=no-member
101
+ - --disable=import-error
102
+ - --disable=no-name-in-module
103
+ - --disable=missing-return-doc
104
+ - --load-plugins=pylint.extensions.docparams
105
+ - --accept-no-param-doc=n
106
+ - --accept-no-raise-doc=n
107
+ - --accept-no-return-doc=n
108
+ - --accept-no-yields-doc=n
109
+
110
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
111
+ # ignores
112
+ # ANN101 Missing type annotation for self in method
113
+ # ANN102 Missing type annotation for cls in classmethod
114
+ # ANN201 Missing return type annotation for public function
115
+ # ANN202 Missing return type annotation for private function (wants -> None everywhere)
116
+ # B905 zip() without an explicit strict= parameter
117
+ # COM812 Trailing comma missing
118
+ # D203 1 blank line required before class docstring
119
+ # D213 multi line summary second line
120
+ # I001 Inport block is un-sorted or un-formatted
121
+ # ISC003 Explicitly concatenated string should be implicitly concatenated
122
+ # N802 Function name should be lowercase
123
+ # N806 Variable in function should be lowercase
124
+ # PGH003 Use specific rule codes when ignoring type issues
125
+ # PLR0913 Too many arguments to function call
126
+ # PTH108 os.unlink should be replaced by .unlink()
127
+ rev: 'v0.0.285'
128
+ hooks:
129
+ - id: ruff
130
+ exclude: "tests"
131
+ args:
132
+ - --select=ALL
133
+ - --ignore=ANN101,ANN102,ANN201,ANN202,B905,COM812,D203,D213,I001,ISC003,N802,N806,PGH003,PLR0913,PTH108
134
+ - --fix
135
+
136
+ # reads pyproject.toml for additional config
137
+ - repo: https://github.com/RobertCraigie/pyright-python
138
+ rev: v1.1.324
139
+ hooks:
140
+ - id: pyright
@@ -1,55 +1,52 @@
1
- Metadata-Version: 2.1
2
- Name: offset-poly
3
- Version: 0.1.0
4
- Summary:
5
- Author: Shay Hill
6
- Author-email: shay_public@hotmail.com
7
- Requires-Python: >=3.9,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Description-Content-Type: text/markdown
13
-
14
- # offset_poly
15
-
16
- Move a polyline or polygon (left) by a given offset.
17
-
18
- A counterclockwise polygon will be offset to the inside. I clockwise polygon will be offset to the outside.
19
-
20
- ## offset_polygon
21
-
22
- ~~~python
23
- def offset_polygon(polyline: Sequence[_Vec2], offset: float) -> list[_Vec2]:
24
- """Offset polygon edges (to the left) by a constant amount.
25
-
26
- :param polyline: polyline
27
- :param offset: distance to offset from each edge
28
- :return: polygon offset by offset
29
- """
30
- ~~~
31
-
32
- ## offset_polyline
33
-
34
- ~~~python
35
- def offset_polyline(polyline: Sequence[_Vec2], offset: float) -> list[_Vec2]:
36
- """Offset polygon edges (to the left) by a constant amount.
37
-
38
- :param polyline: polyline
39
- :param offset: distance to offset from each edge
40
- :return: polyline offset by offset
41
- """
42
- ~~~
43
-
44
- The difference between the two is that `offset_polygon` will close the polygon if it is not already closed, whereas `offset_polyline` will leave the polyline open even if the first and last points are identical.
45
-
46
- This package is the simplest version of polyline offsetting, it does not anticipate or account for self intersections that may come up when offsetting a polyline.
47
-
48
- This is not nearly as sophisticated as curve offsetting, but you can use this for control polygon offsetting, which will be nearly as good in some instances.
49
-
50
- * multiple points (knots in your control points) are preserved.
51
- * if input[0] == input[-1], output[0] will equal output[-1]
52
-
53
- ## You may see (nan, nan) in the result.
54
-
55
- If you pass two adjacent, opposite, parallel edges, you will get a (nan, nan) in the result. With points A -> B -> A, for instance, there is no point that would be any given distance (except 0) left of both A B and B A.
1
+ Metadata-Version: 2.1
2
+ Name: offset-poly
3
+ Version: 0.3.0
4
+ Summary: offset a polyline or polygon in 2D space
5
+ Author-email: Shay Hill <shay_public@hotmail.com>
6
+ License: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ Provides-Extra: dev
10
+
11
+ # offset_poly
12
+
13
+ Move a polyline or polygon (left) by a given offset.
14
+
15
+ A counterclockwise polygon will be offset to the inside. I clockwise polygon will be offset to the outside.
16
+
17
+ ## offset_polygon
18
+
19
+ ~~~python
20
+ def offset_polygon(polyline: Sequence[_Vec2], offset: float) -> list[_Vec2]:
21
+ """Offset polygon edges (to the left) by a constant amount.
22
+
23
+ :param polyline: polyline
24
+ :param offset: distance to offset from each edge
25
+ :return: polygon offset by offset
26
+ """
27
+ ~~~
28
+
29
+ ## offset_polyline
30
+
31
+ ~~~python
32
+ def offset_polyline(polyline: Sequence[_Vec2], offset: float) -> list[_Vec2]:
33
+ """Offset polygon edges (to the left) by a constant amount.
34
+
35
+ :param polyline: polyline
36
+ :param offset: distance to offset from each edge
37
+ :return: polyline offset by offset
38
+ """
39
+ ~~~
40
+
41
+ The difference between the two is that `offset_polygon` will close the polygon if it is not already closed, whereas `offset_polyline` will leave the polyline open even if the first and last points are identical.
42
+
43
+ This package is the simplest version of polyline offsetting, it does not anticipate or account for self intersections that may come up when offsetting a polyline.
44
+
45
+ This is not nearly as sophisticated as curve offsetting, but you can use this for control polygon offsetting, which will be nearly as good in some instances.
46
+
47
+ * multiple points (knots in your control points) are preserved.
48
+ * if input[0] == input[-1], output[0] will equal output[-1]
49
+
50
+ ## You may see (nan, nan) in the result.
51
+
52
+ If you pass two adjacent, opposite, parallel edges, you will get a (nan, nan) in the result. With points A -> B -> A, for instance, there is no point that would be any given distance (except 0) left of both A B and B A.
@@ -39,4 +39,4 @@ This is not nearly as sophisticated as curve offsetting, but you can use this fo
39
39
 
40
40
  ## You may see (nan, nan) in the result.
41
41
 
42
- If you pass two adjacent, opposite, parallel edges, you will get a (nan, nan) in the result. With points A -> B -> A, for instance, there is no point that would be any given distance (except 0) left of both A B and B A.
42
+ If you pass two adjacent, opposite, parallel edges, you will get a (nan, nan) in the result. With points A -> B -> A, for instance, there is no point that would be any given distance (except 0) left of both A B and B A.