link-rep 0.0.2__tar.gz → 0.0.4__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,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: link-rep
3
+ Version: 0.0.4
4
+ Summary: representation for a composite topological link.
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: GGN_2015
8
+ Author-email: premierbob@qq.com
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: typing_extensions
18
+ Description-Content-Type: text/markdown
19
+
20
+ # link-rep
21
+
22
+ Parse and serialize the textual link-representation format used by the TopLink pipeline.
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install linkrep
28
+ ```
29
+
30
+ ## Quick start
31
+
32
+ Create `link_rep.LinkRep()` and call `deserialize(text)` or `serialize()`.
33
+
34
+ PD codes are lists of four-entry crossings. Each arc label must occur exactly twice. Functions validate their inputs and do not mutate caller-owned PD-code lists unless explicitly documented.
35
+
36
+ ## Development
37
+
38
+ Use Python 3.10 or newer for Python packages. Build distributions with `poetry build`. Run the package's tests or examples before publishing. C++ projects require a modern standards-compliant compiler.
39
+
40
+ ## License
41
+
42
+ MIT. See `LICENSE`.
43
+
@@ -0,0 +1,23 @@
1
+ # link-rep
2
+
3
+ Parse and serialize the textual link-representation format used by the TopLink pipeline.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install linkrep
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ Create `link_rep.LinkRep()` and call `deserialize(text)` or `serialize()`.
14
+
15
+ PD codes are lists of four-entry crossings. Each arc label must occur exactly twice. Functions validate their inputs and do not mutate caller-owned PD-code lists unless explicitly documented.
16
+
17
+ ## Development
18
+
19
+ Use Python 3.10 or newer for Python packages. Build distributions with `poetry build`. Run the package's tests or examples before publishing. C++ projects require a modern standards-compliant compiler.
20
+
21
+ ## License
22
+
23
+ MIT. See `LICENSE`.
@@ -1,4 +1,5 @@
1
1
  from .Comment import Comment
2
+ from .LinkId import LinkId
2
3
  from .LinkMethod import LinkMethod
3
4
  from .LinkRep import LinkRep
4
5
  from .LinkSet import LinkSet
@@ -7,6 +8,7 @@ from .VarDef import VarDef
7
8
 
8
9
  __all__ = [
9
10
  "Comment",
11
+ "LinkId",
10
12
  "LinkMethod",
11
13
  "LinkRep", # 其中最重要的是 LinkRep
12
14
  "LinkSet",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "link-rep"
3
- version = "0.0.2"
3
+ version = "0.0.4"
4
4
  description = "representation for a composite topological link."
5
5
  authors = [
6
6
  {name = "GGN_2015",email = "premierbob@qq.com"}
@@ -15,4 +15,4 @@ dependencies = [
15
15
 
16
16
  [build-system]
17
17
  requires = ["poetry-core>=2.0.0,<3.0.0"]
18
- build-backend = "poetry.core.masonry.api"
18
+ build-backend = "poetry.core.masonry.api"
link_rep-0.0.2/PKG-INFO DELETED
@@ -1,156 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: link-rep
3
- Version: 0.0.2
4
- Summary: representation for a composite topological link.
5
- License: MIT
6
- License-File: LICENSE
7
- Author: GGN_2015
8
- Author-email: premierbob@qq.com
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: typing_extensions
18
- Description-Content-Type: text/markdown
19
-
20
- # LinkRep
21
- A Cross-Platform Universal Representation for Composite Links
22
-
23
- ## Installation
24
-
25
- ```bash
26
- pip install link-rep
27
- ```
28
-
29
- ## Usage
30
-
31
- ```python
32
- from link_rep import LinkRep
33
-
34
- real_serial = ( # human readable presentation
35
- """
36
- // this is comment line 1
37
- // this is comment line 2
38
- L2a1: [[4, 1, 3, 2], [2, 3, 1, 4]]
39
- L4a1: [[6, 1, 7, 2], [8, 3, 5, 4], [2, 5, 3, 6], [4, 7, 1, 8]]
40
- K3a1: [[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]
41
- [L2a1, L4a1, K3a1]
42
- L[1, 1]#L[2, 1]
43
- L[2, 2]#L[3, 1]
44
- """).lstrip()
45
-
46
- link_r = LinkRep()
47
- link_r.deserialize(real_serial)
48
-
49
- print(link_r.json_serialize()) # machine readable presentation
50
- print(link_r.serialize()) # human readable presentation
51
-
52
- json_str = link_r.json_serialize()
53
- new_link_r = LinkRep()
54
- new_link_r.json_deserialize(json_str) # get data from json serial
55
- ```
56
-
57
- ## LinkRep Format
58
-
59
- The content of LinkRep consists of four parts:
60
-
61
- 1. Comment Lines: Lines starting with `//`, as well as lines containing only whitespace characters, are comment lines. Lines containing only whitespace should be ignored during parsing, while comment lines should be retained as informational content.
62
-
63
- 2. Variable Definitions (VarDef): Used to define variables that represent PdCodes (Planar Diagram Codes), for example:
64
-
65
- ```
66
- L2a1: [[4, 1, 3, 2], [2, 3, 1, 4]]
67
- ```
68
-
69
- The above statement defines a variable named `L2a1` that stores a PdCode `[[4, 1, 3, 2], [2, 3, 1, 4]]`. The variable name (VarName) should be a string composed of letters, numbers, and underscores, and must not start with a number. Multiple variables with different names can be defined.
70
-
71
- While the rules allow arbitrary variable naming, in practice it is recommended to use standard knot or link names to name PdCodes. Warnings should be issued for variable definitions using non-standard PdCodes.
72
-
73
- 3. Link Set Description (LinkSet): A sequence of variable names describing all links used, where the order affects subsequent usage. This description can only appear once in LinkRep.
74
-
75
- ```
76
- [L2a1, L4a1, K3a1]
77
- ```
78
-
79
- This line describes the knot information before performing connected sums. In the connection method descriptor, `L[i, j]` is used to denote the j-th connected component of the i-th link variable. Both `i` and `j` are numbered starting from 1 and increment upwards.
80
-
81
- 4. Connection Method Descriptor (LinkMethod): Describes which connected components of which links should be connected together, for example:
82
-
83
- ```
84
- L[1, 1]#L[2, 2]
85
- ```
86
-
87
- This can be used to indicate that the first connected component of the first link should be connected (via connected sum) with the second connected component of the second link.
88
-
89
- ```
90
- L[1, 2]#L[2, 2]#L[3, 1]
91
- ```
92
-
93
- This can be used to indicate that the second connected component of the first link should be connected (via connected sum) with the second connected component of the second link, and this connected component should then be connected (via connected sum) with the first connected component of the third link. The order of the components is defined by the order of minimal arc number in the component.
94
-
95
- ## Formal Definition
96
-
97
- Lexical Units:
98
- ```
99
- CommentLine => "//[^\n]*\n"
100
- VarName => "[A-Za-z_][A-Za-z0-9_]*"
101
- PdCode => "\[\[\d+,\s*\d+,\s*\d+,\s*\d+\](,\[\d+,\s*\d+,\s*\d+,\s*\d+\])*\]"
102
- PosName => "L\[\d+,\s*\d+\]"
103
- ```
104
-
105
- VarLine: Defines a single variable
106
- ```
107
- VarLine -> VarName ":\s*" PdCode "\n"
108
- ```
109
-
110
- VarDef: Defines all variables
111
- ```
112
- VarDef -> VarLine
113
- VarDef -> VarLine VarDef
114
- ```
115
-
116
- VarNameList: List of variable names
117
- ```
118
- VarNameList -> VarName
119
- VarNameList -> VarName "," VarNameList
120
- ```
121
-
122
- LinkSet: Defines all links to be used
123
- ```
124
- LinkSet -> "[" VarNameList "]" "\n"
125
- ```
126
-
127
- LinkLineList: Connects connected components without line breaks
128
- ```
129
- LinkLineList -> PosName "#" PosName
130
- LinkLineList -> PosName "#" PosName "#" LinkLineList
131
- ```
132
-
133
- LinkLine: Describes the connection of connected components
134
- ```
135
- LinkLine -> LinkLineList "\n"
136
- ```
137
-
138
- LinkMethod: Describes the connection of connected components
139
- ```
140
- LinkMethod ->
141
- LinkMethod -> LinkLine
142
- LinkMethod -> LinkLine LinkMethod
143
- ```
144
-
145
- Comment:
146
- ```
147
- Comment ->
148
- Comment -> CommentLine
149
- Comment -> CommentLine Comment
150
- ```
151
-
152
- LinkRep:
153
- ```
154
- LinkRep -> Comment VarDef LinkSet LinkMethod
155
- ```
156
-
link_rep-0.0.2/README.md DELETED
@@ -1,136 +0,0 @@
1
- # LinkRep
2
- A Cross-Platform Universal Representation for Composite Links
3
-
4
- ## Installation
5
-
6
- ```bash
7
- pip install link-rep
8
- ```
9
-
10
- ## Usage
11
-
12
- ```python
13
- from link_rep import LinkRep
14
-
15
- real_serial = ( # human readable presentation
16
- """
17
- // this is comment line 1
18
- // this is comment line 2
19
- L2a1: [[4, 1, 3, 2], [2, 3, 1, 4]]
20
- L4a1: [[6, 1, 7, 2], [8, 3, 5, 4], [2, 5, 3, 6], [4, 7, 1, 8]]
21
- K3a1: [[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]
22
- [L2a1, L4a1, K3a1]
23
- L[1, 1]#L[2, 1]
24
- L[2, 2]#L[3, 1]
25
- """).lstrip()
26
-
27
- link_r = LinkRep()
28
- link_r.deserialize(real_serial)
29
-
30
- print(link_r.json_serialize()) # machine readable presentation
31
- print(link_r.serialize()) # human readable presentation
32
-
33
- json_str = link_r.json_serialize()
34
- new_link_r = LinkRep()
35
- new_link_r.json_deserialize(json_str) # get data from json serial
36
- ```
37
-
38
- ## LinkRep Format
39
-
40
- The content of LinkRep consists of four parts:
41
-
42
- 1. Comment Lines: Lines starting with `//`, as well as lines containing only whitespace characters, are comment lines. Lines containing only whitespace should be ignored during parsing, while comment lines should be retained as informational content.
43
-
44
- 2. Variable Definitions (VarDef): Used to define variables that represent PdCodes (Planar Diagram Codes), for example:
45
-
46
- ```
47
- L2a1: [[4, 1, 3, 2], [2, 3, 1, 4]]
48
- ```
49
-
50
- The above statement defines a variable named `L2a1` that stores a PdCode `[[4, 1, 3, 2], [2, 3, 1, 4]]`. The variable name (VarName) should be a string composed of letters, numbers, and underscores, and must not start with a number. Multiple variables with different names can be defined.
51
-
52
- While the rules allow arbitrary variable naming, in practice it is recommended to use standard knot or link names to name PdCodes. Warnings should be issued for variable definitions using non-standard PdCodes.
53
-
54
- 3. Link Set Description (LinkSet): A sequence of variable names describing all links used, where the order affects subsequent usage. This description can only appear once in LinkRep.
55
-
56
- ```
57
- [L2a1, L4a1, K3a1]
58
- ```
59
-
60
- This line describes the knot information before performing connected sums. In the connection method descriptor, `L[i, j]` is used to denote the j-th connected component of the i-th link variable. Both `i` and `j` are numbered starting from 1 and increment upwards.
61
-
62
- 4. Connection Method Descriptor (LinkMethod): Describes which connected components of which links should be connected together, for example:
63
-
64
- ```
65
- L[1, 1]#L[2, 2]
66
- ```
67
-
68
- This can be used to indicate that the first connected component of the first link should be connected (via connected sum) with the second connected component of the second link.
69
-
70
- ```
71
- L[1, 2]#L[2, 2]#L[3, 1]
72
- ```
73
-
74
- This can be used to indicate that the second connected component of the first link should be connected (via connected sum) with the second connected component of the second link, and this connected component should then be connected (via connected sum) with the first connected component of the third link. The order of the components is defined by the order of minimal arc number in the component.
75
-
76
- ## Formal Definition
77
-
78
- Lexical Units:
79
- ```
80
- CommentLine => "//[^\n]*\n"
81
- VarName => "[A-Za-z_][A-Za-z0-9_]*"
82
- PdCode => "\[\[\d+,\s*\d+,\s*\d+,\s*\d+\](,\[\d+,\s*\d+,\s*\d+,\s*\d+\])*\]"
83
- PosName => "L\[\d+,\s*\d+\]"
84
- ```
85
-
86
- VarLine: Defines a single variable
87
- ```
88
- VarLine -> VarName ":\s*" PdCode "\n"
89
- ```
90
-
91
- VarDef: Defines all variables
92
- ```
93
- VarDef -> VarLine
94
- VarDef -> VarLine VarDef
95
- ```
96
-
97
- VarNameList: List of variable names
98
- ```
99
- VarNameList -> VarName
100
- VarNameList -> VarName "," VarNameList
101
- ```
102
-
103
- LinkSet: Defines all links to be used
104
- ```
105
- LinkSet -> "[" VarNameList "]" "\n"
106
- ```
107
-
108
- LinkLineList: Connects connected components without line breaks
109
- ```
110
- LinkLineList -> PosName "#" PosName
111
- LinkLineList -> PosName "#" PosName "#" LinkLineList
112
- ```
113
-
114
- LinkLine: Describes the connection of connected components
115
- ```
116
- LinkLine -> LinkLineList "\n"
117
- ```
118
-
119
- LinkMethod: Describes the connection of connected components
120
- ```
121
- LinkMethod ->
122
- LinkMethod -> LinkLine
123
- LinkMethod -> LinkLine LinkMethod
124
- ```
125
-
126
- Comment:
127
- ```
128
- Comment ->
129
- Comment -> CommentLine
130
- Comment -> CommentLine Comment
131
- ```
132
-
133
- LinkRep:
134
- ```
135
- LinkRep -> Comment VarDef LinkSet LinkMethod
136
- ```
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes