pd-code-rotate 0.0.1__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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TopologicalKnotIndexer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: pd-code-rotate
3
+ Version: 0.0.1
4
+ Summary: given a link or knot,rotate its 2d diagram by changing its pd_code.
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: GGN_2015
8
+ Author-email: neko@jlulug.org
9
+ Requires-Python: >=3.10
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Dist: pd_code_pre_nxt
18
+ Requires-Dist: pd_code_sanity
19
+ Description-Content-Type: text/markdown
20
+
21
+ # pd_code_rotate
22
+ given a link or knot,rotate its 2d diagram by changing its pd_code.
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ pip install pd-code-rotate
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```python
33
+ import pd_code_rotate
34
+
35
+ pd_code = [[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]
36
+ print(pd_code_rotate.rotate(pd_code))
37
+ ```
38
+
@@ -0,0 +1,17 @@
1
+ # pd_code_rotate
2
+ given a link or knot,rotate its 2d diagram by changing its pd_code.
3
+
4
+ ## Install
5
+
6
+ ```bash
7
+ pip install pd-code-rotate
8
+ ```
9
+
10
+ ## Usage
11
+
12
+ ```python
13
+ import pd_code_rotate
14
+
15
+ pd_code = [[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]
16
+ print(pd_code_rotate.rotate(pd_code))
17
+ ```
File without changes
@@ -0,0 +1,24 @@
1
+ import pd_code_sanity
2
+ import pd_code_pre_nxt
3
+
4
+ def rotate(pd_code:list[list]) -> list[list]:
5
+
6
+ # 检查是不是合法的 pd_code
7
+ if not pd_code_sanity.sanity(pd_code):
8
+ raise ValueError()
9
+
10
+ # 获得前驱后继
11
+ _, nxt = pd_code_pre_nxt.get_pre_nxt(pd_code)
12
+
13
+ new_pd_code = []
14
+ for crossing in pd_code: # 对所有 crossing 进行翻面
15
+ ax, bx, cx, dx = crossing
16
+ if nxt[bx] == dx:
17
+ new_pd_code.append([bx, ax, dx, cx])
18
+ else:
19
+ new_pd_code.append([dx, cx, bx, ax])
20
+
21
+ return new_pd_code
22
+
23
+ if __name__ == "__main__":
24
+ print(rotate([[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]))
@@ -0,0 +1,19 @@
1
+ [project]
2
+ name = "pd-code-rotate"
3
+ version = "0.0.1"
4
+ description = "given a link or knot,rotate its 2d diagram by changing its pd_code."
5
+ authors = [
6
+ {name = "GGN_2015",email = "neko@jlulug.org"}
7
+ ]
8
+ license = {text = "MIT"}
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "pd_code_sanity",
13
+ "pd_code_pre_nxt"
14
+ ]
15
+
16
+
17
+ [build-system]
18
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
19
+ build-backend = "poetry.core.masonry.api"