k3pattern 0.1.0__tar.gz → 0.1.2__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) 2020 张炎泼
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,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: k3pattern
3
+ Version: 0.1.2
4
+ Summary: Find common prefix of strings, tuples, and nested structures
5
+ Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/pykit3/k3pattern
8
+ Project-URL: Documentation, https://k3pattern.readthedocs.io
9
+ Keywords: prefix,common-prefix,string,pattern
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Libraries
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0; extra == "dev"
24
+ Requires-Dist: ruff; extra == "dev"
25
+ Requires-Dist: coverage; extra == "dev"
26
+ Requires-Dist: k3ut; extra == "dev"
27
+ Provides-Extra: publish
28
+ Requires-Dist: build; extra == "publish"
29
+ Requires-Dist: twine; extra == "publish"
30
+ Requires-Dist: pk3; extra == "publish"
31
+ Provides-Extra: docs
32
+ Requires-Dist: mkdocs>=1.5; extra == "docs"
33
+ Requires-Dist: mkdocs-material>=9.0; extra == "docs"
34
+ Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
35
+ Dynamic: license-file
36
+
37
+ # k3pattern
38
+
39
+ [![Action-CI](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml)
40
+ [![Build Status](https://travis-ci.com/pykit3/k3pattern.svg?branch=master)](https://travis-ci.com/pykit3/k3pattern)
41
+ [![Documentation Status](https://readthedocs.org/projects/k3pattern/badge/?version=stable)](https://k3pattern.readthedocs.io/en/stable/?badge=stable)
42
+ [![Package](https://img.shields.io/pypi/pyversions/k3pattern)](https://pypi.org/project/k3pattern)
43
+
44
+ Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.
45
+
46
+ k3pattern is a component of [pykit3] project: a python3 toolkit set.
47
+
48
+
49
+ Find common prefix of several string, tuples of string, or other nested structure, recursively by default.
50
+ It returns the shortest prefix: empty string or empty tuple is removed.
51
+
52
+
53
+
54
+ # Install
55
+
56
+ ```
57
+ pip install k3pattern
58
+ ```
59
+
60
+ # Synopsis
61
+
62
+ ```python
63
+
64
+ import k3pattern
65
+
66
+ k3pattern.common_prefix('abc', 'abd') # 'ab'
67
+ k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')
68
+ k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
69
+ k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
70
+ k3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two
71
+ ```
72
+
73
+ # Author
74
+
75
+ Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
76
+
77
+ # Copyright and License
78
+
79
+ The MIT License (MIT)
80
+
81
+ Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
82
+
83
+
84
+ [pykit3]: https://github.com/pykit3
@@ -0,0 +1,48 @@
1
+ # k3pattern
2
+
3
+ [![Action-CI](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml)
4
+ [![Build Status](https://travis-ci.com/pykit3/k3pattern.svg?branch=master)](https://travis-ci.com/pykit3/k3pattern)
5
+ [![Documentation Status](https://readthedocs.org/projects/k3pattern/badge/?version=stable)](https://k3pattern.readthedocs.io/en/stable/?badge=stable)
6
+ [![Package](https://img.shields.io/pypi/pyversions/k3pattern)](https://pypi.org/project/k3pattern)
7
+
8
+ Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.
9
+
10
+ k3pattern is a component of [pykit3] project: a python3 toolkit set.
11
+
12
+
13
+ Find common prefix of several string, tuples of string, or other nested structure, recursively by default.
14
+ It returns the shortest prefix: empty string or empty tuple is removed.
15
+
16
+
17
+
18
+ # Install
19
+
20
+ ```
21
+ pip install k3pattern
22
+ ```
23
+
24
+ # Synopsis
25
+
26
+ ```python
27
+
28
+ import k3pattern
29
+
30
+ k3pattern.common_prefix('abc', 'abd') # 'ab'
31
+ k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')
32
+ k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
33
+ k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
34
+ k3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two
35
+ ```
36
+
37
+ # Author
38
+
39
+ Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
40
+
41
+ # Copyright and License
42
+
43
+ The MIT License (MIT)
44
+
45
+ Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
46
+
47
+
48
+ [pykit3]: https://github.com/pykit3
@@ -3,8 +3,9 @@ Find common prefix of several string, tuples of string, or other nested structur
3
3
  It returns the shortest prefix: empty string or empty tuple is removed.
4
4
  """
5
5
 
6
- __version__ = "0.1.0"
7
- __name__ = "k3pattern"
6
+ from importlib.metadata import version
7
+
8
+ __version__ = version("k3pattern")
8
9
 
9
10
  from .strutil import (
10
11
  common_prefix,
@@ -12,5 +13,5 @@ from .strutil import (
12
13
 
13
14
 
14
15
  __all__ = [
15
- 'common_prefix',
16
+ "common_prefix",
16
17
  ]
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: k3pattern
3
+ Version: 0.1.2
4
+ Summary: Find common prefix of strings, tuples, and nested structures
5
+ Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/pykit3/k3pattern
8
+ Project-URL: Documentation, https://k3pattern.readthedocs.io
9
+ Keywords: prefix,common-prefix,string,pattern
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Libraries
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0; extra == "dev"
24
+ Requires-Dist: ruff; extra == "dev"
25
+ Requires-Dist: coverage; extra == "dev"
26
+ Requires-Dist: k3ut; extra == "dev"
27
+ Provides-Extra: publish
28
+ Requires-Dist: build; extra == "publish"
29
+ Requires-Dist: twine; extra == "publish"
30
+ Requires-Dist: pk3; extra == "publish"
31
+ Provides-Extra: docs
32
+ Requires-Dist: mkdocs>=1.5; extra == "docs"
33
+ Requires-Dist: mkdocs-material>=9.0; extra == "docs"
34
+ Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
35
+ Dynamic: license-file
36
+
37
+ # k3pattern
38
+
39
+ [![Action-CI](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml)
40
+ [![Build Status](https://travis-ci.com/pykit3/k3pattern.svg?branch=master)](https://travis-ci.com/pykit3/k3pattern)
41
+ [![Documentation Status](https://readthedocs.org/projects/k3pattern/badge/?version=stable)](https://k3pattern.readthedocs.io/en/stable/?badge=stable)
42
+ [![Package](https://img.shields.io/pypi/pyversions/k3pattern)](https://pypi.org/project/k3pattern)
43
+
44
+ Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.
45
+
46
+ k3pattern is a component of [pykit3] project: a python3 toolkit set.
47
+
48
+
49
+ Find common prefix of several string, tuples of string, or other nested structure, recursively by default.
50
+ It returns the shortest prefix: empty string or empty tuple is removed.
51
+
52
+
53
+
54
+ # Install
55
+
56
+ ```
57
+ pip install k3pattern
58
+ ```
59
+
60
+ # Synopsis
61
+
62
+ ```python
63
+
64
+ import k3pattern
65
+
66
+ k3pattern.common_prefix('abc', 'abd') # 'ab'
67
+ k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')
68
+ k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
69
+ k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
70
+ k3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two
71
+ ```
72
+
73
+ # Author
74
+
75
+ Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
76
+
77
+ # Copyright and License
78
+
79
+ The MIT License (MIT)
80
+
81
+ Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
82
+
83
+
84
+ [pykit3]: https://github.com/pykit3
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ __init__.py
4
+ pyproject.toml
5
+ strutil.py
6
+ synopsis.py
7
+ ./__init__.py
8
+ ./strutil.py
9
+ ./synopsis.py
10
+ k3pattern.egg-info/PKG-INFO
11
+ k3pattern.egg-info/SOURCES.txt
12
+ k3pattern.egg-info/dependency_links.txt
13
+ k3pattern.egg-info/requires.txt
14
+ k3pattern.egg-info/top_level.txt
15
+ test/test_doctest.py
16
+ test/test_k3pattern.py
@@ -0,0 +1,16 @@
1
+
2
+ [dev]
3
+ pytest>=7.0
4
+ ruff
5
+ coverage
6
+ k3ut
7
+
8
+ [docs]
9
+ mkdocs>=1.5
10
+ mkdocs-material>=9.0
11
+ mkdocstrings[python]>=0.24
12
+
13
+ [publish]
14
+ build
15
+ twine
16
+ pk3
@@ -0,0 +1,58 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "k3pattern"
7
+ version = "0.1.2"
8
+ description = "Find common prefix of strings, tuples, and nested structures"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ { name = "Zhang Yanpo", email = "drdr.xp@gmail.com" }
14
+ ]
15
+ keywords = ["prefix", "common-prefix", "string", "pattern"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Topic :: Software Development :: Libraries",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ ]
27
+ dependencies = []
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/pykit3/k3pattern"
31
+ Documentation = "https://k3pattern.readthedocs.io"
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=7.0",
36
+ "ruff",
37
+ "coverage",
38
+ "k3ut",
39
+ ]
40
+ publish = [
41
+ "build",
42
+ "twine",
43
+ "pk3",
44
+ ]
45
+ docs = [
46
+ "mkdocs>=1.5",
47
+ "mkdocs-material>=9.0",
48
+ "mkdocstrings[python]>=0.24",
49
+ ]
50
+
51
+ [tool.setuptools]
52
+ packages = ["k3pattern"]
53
+
54
+ [tool.setuptools.package-dir]
55
+ k3pattern = "."
56
+
57
+ [tool.ruff]
58
+ line-length = 120
@@ -1,4 +1,3 @@
1
-
2
1
  def common_prefix(a, *others, **options):
3
2
  """
4
3
  Find common prefix of several `string`s, tuples of string, or other nested
@@ -8,10 +7,10 @@ def common_prefix(a, *others, **options):
8
7
  if field `recursive` in `options` is set to `False`, it will run non-recursively.
9
8
  :return: a common prefix of the same type of `a`.
10
9
  """
11
- recursive = options.get('recursive', True)
10
+ recursive = options.get("recursive", True)
12
11
  for b in others:
13
- if type(a) != type(b):
14
- raise TypeError('a and b has different type: ' + repr((a, b)))
12
+ if type(a) is not type(b):
13
+ raise TypeError("a and b has different type: " + repr((a, b)))
15
14
  a = _common_prefix(a, b, recursive)
16
15
 
17
16
  return a
@@ -23,8 +22,8 @@ def _common_prefix(a, b, recursive=True):
23
22
  if i == len(b):
24
23
  break
25
24
 
26
- if type(elt) != type(b[i]):
27
- raise TypeError('a and b has different type: ' + repr((elt, b[i])))
25
+ if type(elt) is not type(b[i]):
26
+ raise TypeError("a and b has different type: " + repr((elt, b[i])))
28
27
 
29
28
  if elt == b[i]:
30
29
  rst.append(elt)
@@ -37,8 +36,7 @@ def _common_prefix(a, b, recursive=True):
37
36
  # down.
38
37
  # And non-iterable element is skipped, such as int.
39
38
  i = len(rst)
40
- if recursive and i < len(a) and i < len(b) and not isinstance(a, str) and hasattr(a[i], '__len__'):
41
-
39
+ if recursive and i < len(a) and i < len(b) and not isinstance(a, str) and hasattr(a[i], "__len__"):
42
40
  last_prefix = _common_prefix(a[i], b[i])
43
41
 
44
42
  # discard empty tuple, list or string
@@ -50,7 +48,4 @@ def _common_prefix(a, b, recursive=True):
50
48
  elif isinstance(a, list):
51
49
  return rst
52
50
  else:
53
- return ''.join(rst)
54
-
55
-
56
-
51
+ return "".join(rst)
@@ -0,0 +1,7 @@
1
+ import k3pattern
2
+
3
+ k3pattern.common_prefix("abc", "abd") # 'ab'
4
+ k3pattern.common_prefix((1, 2, "abc"), (1, 2, "abd")) # (1, 2, 'ab')
5
+ k3pattern.common_prefix((1, 2, "abc"), (1, 2, "xyz")) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
6
+ k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
7
+ k3pattern.common_prefix("abc", "abd", "abe") # 'ab'; common prefix of more than two
@@ -0,0 +1,8 @@
1
+ import doctest
2
+
3
+ import k3pattern
4
+
5
+
6
+ def load_tests(loader, tests, ignore):
7
+ tests.addTests(doctest.DocTestSuite(k3pattern))
8
+ return tests
@@ -0,0 +1,242 @@
1
+ import os
2
+ import unittest
3
+
4
+ import k3ut
5
+ import k3pattern
6
+
7
+ dd = k3ut.dd
8
+
9
+ this_base = os.path.dirname(__file__)
10
+
11
+
12
+ class TestK3pattern(unittest.TestCase):
13
+ def test_common_prefix_invalid_arg(self):
14
+ cases = (
15
+ (1, []),
16
+ ("a", 1),
17
+ ("a", True),
18
+ ("a", ("a",)),
19
+ (
20
+ (
21
+ "a",
22
+ (),
23
+ ),
24
+ (
25
+ "a",
26
+ 2,
27
+ ),
28
+ ),
29
+ )
30
+
31
+ for a, b in cases:
32
+ dd("wrong type: ", repr(a), " ", repr(b))
33
+ self.assertRaises(TypeError, k3pattern.common_prefix, a, b)
34
+
35
+ def test_common_prefix(self):
36
+ cases = (
37
+ (
38
+ "abc",
39
+ "abc",
40
+ ),
41
+ (
42
+ "",
43
+ "",
44
+ "",
45
+ ),
46
+ (
47
+ (),
48
+ (),
49
+ (),
50
+ (),
51
+ ),
52
+ (
53
+ "abc",
54
+ "ab",
55
+ "ab",
56
+ ),
57
+ (
58
+ "ab",
59
+ "abd",
60
+ "ab",
61
+ ),
62
+ (
63
+ "abc",
64
+ "abd",
65
+ "ab",
66
+ ),
67
+ (
68
+ "abc",
69
+ "def",
70
+ "",
71
+ ),
72
+ (
73
+ "abc",
74
+ "",
75
+ "",
76
+ ),
77
+ (
78
+ "",
79
+ "def",
80
+ "",
81
+ ),
82
+ (
83
+ "abc",
84
+ "abd",
85
+ "ag",
86
+ "a",
87
+ ),
88
+ (
89
+ "abc",
90
+ "abd",
91
+ "ag",
92
+ "yz",
93
+ "",
94
+ ),
95
+ (
96
+ (
97
+ 1,
98
+ 2,
99
+ ),
100
+ (
101
+ 1,
102
+ 3,
103
+ ),
104
+ (1,),
105
+ ),
106
+ (
107
+ (
108
+ 1,
109
+ 2,
110
+ ),
111
+ (
112
+ 2,
113
+ 3,
114
+ ),
115
+ (),
116
+ ),
117
+ (
118
+ (
119
+ 1,
120
+ 2,
121
+ "abc",
122
+ ),
123
+ (
124
+ 1,
125
+ 2,
126
+ "abd",
127
+ ),
128
+ (
129
+ 1,
130
+ 2,
131
+ "ab",
132
+ ),
133
+ ),
134
+ (
135
+ (
136
+ 1,
137
+ 2,
138
+ "abc",
139
+ ),
140
+ (
141
+ 1,
142
+ 2,
143
+ "xyz",
144
+ ),
145
+ (
146
+ 1,
147
+ 2,
148
+ ),
149
+ ),
150
+ (
151
+ (
152
+ 1,
153
+ 2,
154
+ (5, 6),
155
+ ),
156
+ (
157
+ 1,
158
+ 2,
159
+ (5, 7),
160
+ ),
161
+ (
162
+ 1,
163
+ 2,
164
+ (5,),
165
+ ),
166
+ ),
167
+ (
168
+ (
169
+ "abc",
170
+ "45",
171
+ ),
172
+ ("abc", "46", "xyz"),
173
+ (
174
+ "abc",
175
+ "4",
176
+ ),
177
+ ),
178
+ (
179
+ ("abc", ("45", "xyz"), 3),
180
+ ("abc", ("45", "xz"), 5),
181
+ ("abc", ("45", "x-"), 5),
182
+ (
183
+ "abc",
184
+ ("45", "x"),
185
+ ),
186
+ ),
187
+ (
188
+ ("abc", ("45", "xyz"), 3),
189
+ ("abc", ("45", "xz"), 5),
190
+ (
191
+ "abc",
192
+ ("x",),
193
+ ),
194
+ ("abc",),
195
+ ),
196
+ (
197
+ [1, 2, 3],
198
+ [1, 2, 4],
199
+ [1, 2],
200
+ ),
201
+ )
202
+
203
+ for args in cases:
204
+ expected = args[-1]
205
+ args = args[:-1]
206
+
207
+ dd("input: ", args, "expected: ", expected)
208
+ rst = k3pattern.common_prefix(*args)
209
+ dd("rst: ", rst)
210
+
211
+ self.assertEqual(expected, rst)
212
+
213
+ def test_common_prefix_no_recursive(self):
214
+ cases = (
215
+ (
216
+ ("abc", ("45", "xyz"), 3),
217
+ ("abc", ("45", "xz"), 5),
218
+ ("abc", ("45", "x-"), 5),
219
+ ("abc",),
220
+ ),
221
+ (
222
+ "abc",
223
+ "abd",
224
+ "ag",
225
+ "a",
226
+ ),
227
+ (
228
+ (1, 2, "abc"),
229
+ (1, 2, "abd"),
230
+ (1, 2),
231
+ ),
232
+ )
233
+
234
+ for args in cases:
235
+ expected = args[-1]
236
+ args = args[:-1]
237
+
238
+ dd("input: ", args, "expected: ", expected)
239
+ rst = k3pattern.common_prefix(*args, recursive=False)
240
+ dd("rst: ", rst)
241
+
242
+ self.assertEqual(expected, rst)
k3pattern-0.1.0/PKG-INFO DELETED
@@ -1,64 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: k3pattern
3
- Version: 0.1.0
4
- Summary: Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.
5
- Home-page: https://github.com/pykit3/k3pattern
6
- Author: Zhang Yanpo
7
- Author-email: drdr.xp@gmail.com
8
- License: MIT
9
- Description: # k3pattern
10
-
11
- [![Action-CI](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml)
12
- [![Build Status](https://travis-ci.com/pykit3/k3pattern.svg?branch=master)](https://travis-ci.com/pykit3/k3pattern)
13
- [![Documentation Status](https://readthedocs.org/projects/k3pattern/badge/?version=stable)](https://k3pattern.readthedocs.io/en/stable/?badge=stable)
14
- [![Package](https://img.shields.io/pypi/pyversions/k3pattern)](https://pypi.org/project/k3pattern)
15
-
16
- Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.
17
-
18
- k3pattern is a component of [pykit3] project: a python3 toolkit set.
19
-
20
-
21
- Find common prefix of several string, tuples of string, or other nested structure, recursively by default.
22
- It returns the shortest prefix: empty string or empty tuple is removed.
23
-
24
-
25
-
26
- # Install
27
-
28
- ```
29
- pip install k3pattern
30
- ```
31
-
32
- # Synopsis
33
-
34
- ```python
35
-
36
- import k3pattern
37
-
38
- k3pattern.common_prefix('abc', 'abd') # 'ab'
39
- k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')
40
- k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
41
- k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
42
- k3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two
43
- ```
44
-
45
- # Author
46
-
47
- Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
48
-
49
- # Copyright and License
50
-
51
- The MIT License (MIT)
52
-
53
- Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
54
-
55
-
56
- [pykit3]: https://github.com/pykit3
57
- Keywords: python,pattern
58
- Platform: UNKNOWN
59
- Classifier: Development Status :: 4 - Beta
60
- Classifier: Intended Audience :: Developers
61
- Classifier: Topic :: Software Development :: Libraries
62
- Classifier: Programming Language :: Python :: 3
63
- Requires-Python: >=3.0
64
- Description-Content-Type: text/markdown
@@ -1,23 +0,0 @@
1
- # DO NOT EDIT!!! built with `python _building/build_setup.py`
2
- import setuptools
3
- setuptools.setup(
4
- name="k3pattern",
5
- packages=["k3pattern"],
6
- version="0.1.0",
7
- license='MIT',
8
- description='Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.',
9
- long_description="# k3pattern\n\n[![Action-CI](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml)\n[![Build Status](https://travis-ci.com/pykit3/k3pattern.svg?branch=master)](https://travis-ci.com/pykit3/k3pattern)\n[![Documentation Status](https://readthedocs.org/projects/k3pattern/badge/?version=stable)](https://k3pattern.readthedocs.io/en/stable/?badge=stable)\n[![Package](https://img.shields.io/pypi/pyversions/k3pattern)](https://pypi.org/project/k3pattern)\n\nFind common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.\n\nk3pattern is a component of [pykit3] project: a python3 toolkit set.\n\n\nFind common prefix of several string, tuples of string, or other nested structure, recursively by default.\nIt returns the shortest prefix: empty string or empty tuple is removed.\n\n\n\n# Install\n\n```\npip install k3pattern\n```\n\n# Synopsis\n\n```python\n\nimport k3pattern\n\nk3pattern.common_prefix('abc', 'abd') # 'ab'\nk3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')\nk3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed\nk3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )\nk3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two\n```\n\n# Author\n\nZhang Yanpo (张炎泼) <drdr.xp@gmail.com>\n\n# Copyright and License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>\n\n\n[pykit3]: https://github.com/pykit3",
10
- long_description_content_type="text/markdown",
11
- author='Zhang Yanpo',
12
- author_email='drdr.xp@gmail.com',
13
- url='https://github.com/pykit3/k3pattern',
14
- keywords=['python', 'pattern'],
15
- python_requires='>=3.0',
16
-
17
- install_requires=['k3ut<0.2,>=0.1.15'],
18
- classifiers=[
19
- 'Development Status :: 4 - Beta',
20
- 'Intended Audience :: Developers',
21
- 'Topic :: Software Development :: Libraries',
22
- ] + ['Programming Language :: Python :: 3'],
23
- )
@@ -1,7 +0,0 @@
1
- import k3pattern
2
-
3
- k3pattern.common_prefix('abc', 'abd') # 'ab'
4
- k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')
5
- k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
6
- k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
7
- k3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two
@@ -1,64 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: k3pattern
3
- Version: 0.1.0
4
- Summary: Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.
5
- Home-page: https://github.com/pykit3/k3pattern
6
- Author: Zhang Yanpo
7
- Author-email: drdr.xp@gmail.com
8
- License: MIT
9
- Description: # k3pattern
10
-
11
- [![Action-CI](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml)
12
- [![Build Status](https://travis-ci.com/pykit3/k3pattern.svg?branch=master)](https://travis-ci.com/pykit3/k3pattern)
13
- [![Documentation Status](https://readthedocs.org/projects/k3pattern/badge/?version=stable)](https://k3pattern.readthedocs.io/en/stable/?badge=stable)
14
- [![Package](https://img.shields.io/pypi/pyversions/k3pattern)](https://pypi.org/project/k3pattern)
15
-
16
- Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.
17
-
18
- k3pattern is a component of [pykit3] project: a python3 toolkit set.
19
-
20
-
21
- Find common prefix of several string, tuples of string, or other nested structure, recursively by default.
22
- It returns the shortest prefix: empty string or empty tuple is removed.
23
-
24
-
25
-
26
- # Install
27
-
28
- ```
29
- pip install k3pattern
30
- ```
31
-
32
- # Synopsis
33
-
34
- ```python
35
-
36
- import k3pattern
37
-
38
- k3pattern.common_prefix('abc', 'abd') # 'ab'
39
- k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')
40
- k3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
41
- k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
42
- k3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two
43
- ```
44
-
45
- # Author
46
-
47
- Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
48
-
49
- # Copyright and License
50
-
51
- The MIT License (MIT)
52
-
53
- Copyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>
54
-
55
-
56
- [pykit3]: https://github.com/pykit3
57
- Keywords: python,pattern
58
- Platform: UNKNOWN
59
- Classifier: Development Status :: 4 - Beta
60
- Classifier: Intended Audience :: Developers
61
- Classifier: Topic :: Software Development :: Libraries
62
- Classifier: Programming Language :: Python :: 3
63
- Requires-Python: >=3.0
64
- Description-Content-Type: text/markdown
@@ -1,10 +0,0 @@
1
- setup.py
2
- k3pattern/__init__.py
3
- k3pattern/setup.py
4
- k3pattern/strutil.py
5
- k3pattern/synopsis.py
6
- k3pattern.egg-info/PKG-INFO
7
- k3pattern.egg-info/SOURCES.txt
8
- k3pattern.egg-info/dependency_links.txt
9
- k3pattern.egg-info/requires.txt
10
- k3pattern.egg-info/top_level.txt
@@ -1 +0,0 @@
1
- k3ut<0.2,>=0.1.15
k3pattern-0.1.0/setup.py DELETED
@@ -1,23 +0,0 @@
1
- # DO NOT EDIT!!! built with `python _building/build_setup.py`
2
- import setuptools
3
- setuptools.setup(
4
- name="k3pattern",
5
- packages=["k3pattern"],
6
- version="0.1.0",
7
- license='MIT',
8
- description='Find common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.',
9
- long_description="# k3pattern\n\n[![Action-CI](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3pattern/actions/workflows/python-package.yml)\n[![Build Status](https://travis-ci.com/pykit3/k3pattern.svg?branch=master)](https://travis-ci.com/pykit3/k3pattern)\n[![Documentation Status](https://readthedocs.org/projects/k3pattern/badge/?version=stable)](https://k3pattern.readthedocs.io/en/stable/?badge=stable)\n[![Package](https://img.shields.io/pypi/pyversions/k3pattern)](https://pypi.org/project/k3pattern)\n\nFind common prefix of several `string`s, tuples of string, or other nested structure, recursively by default.\n\nk3pattern is a component of [pykit3] project: a python3 toolkit set.\n\n\nFind common prefix of several string, tuples of string, or other nested structure, recursively by default.\nIt returns the shortest prefix: empty string or empty tuple is removed.\n\n\n\n# Install\n\n```\npip install k3pattern\n```\n\n# Synopsis\n\n```python\n\nimport k3pattern\n\nk3pattern.common_prefix('abc', 'abd') # 'ab'\nk3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'abd')) # (1, 2, 'ab')\nk3pattern.common_prefix((1, 2, 'abc'), (1, 2, 'xyz')) # (1, 2); empty prefix of 'abc' and 'xyz' is removed\nk3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )\nk3pattern.common_prefix('abc', 'abd', 'abe') # 'ab'; common prefix of more than two\n```\n\n# Author\n\nZhang Yanpo (张炎泼) <drdr.xp@gmail.com>\n\n# Copyright and License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Zhang Yanpo (张炎泼) <drdr.xp@gmail.com>\n\n\n[pykit3]: https://github.com/pykit3",
10
- long_description_content_type="text/markdown",
11
- author='Zhang Yanpo',
12
- author_email='drdr.xp@gmail.com',
13
- url='https://github.com/pykit3/k3pattern',
14
- keywords=['python', 'pattern'],
15
- python_requires='>=3.0',
16
-
17
- install_requires=['k3ut<0.2,>=0.1.15'],
18
- classifiers=[
19
- 'Development Status :: 4 - Beta',
20
- 'Intended Audience :: Developers',
21
- 'Topic :: Software Development :: Libraries',
22
- ] + ['Programming Language :: Python :: 3'],
23
- )
File without changes