datarepr 1.2.7__tar.gz → 1.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,4 @@
1
+ include run_tests.py
2
+ recursive-include docs *.rst
3
+ recursive-include src *.toml
4
+ recursive-include tests *.toml
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datarepr
3
- Version: 1.2.7
3
+ Version: 1.3.0
4
4
  Summary: This project allows for common sense data representation.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
@@ -13,8 +13,12 @@ Classifier: Intended Audience :: Developers
13
13
  Classifier: Natural Language :: English
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 3
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
18
22
  Classifier: Typing :: Typed
19
23
  Requires-Python: >=3.11
20
24
  Description-Content-Type: text/x-rst
@@ -0,0 +1,102 @@
1
+ Introduction
2
+ ------------
3
+
4
+ This project allows to store the arguments for callables.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ To install ``datarepr``, you can use ``pip``.
10
+ Open your terminal and run:
11
+
12
+ .. code-block:: shell
13
+
14
+ pip install datarepr
15
+
16
+ Typing
17
+ ------
18
+
19
+ The typing conforms strictly to ``mypy``.
20
+
21
+ .. container:: versionadded
22
+
23
+ **Added in version 1.2.**
24
+
25
+ Features
26
+ --------
27
+
28
+ ``datarepr.core``
29
+ """""""""""""""""
30
+
31
+ The functions in ``datarepr.core`` can also be imported from ``datarepr`` directly.
32
+
33
+ ``datarepr(name: object, /, *args: object, **kwargs: object) -> str``
34
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35
+
36
+ This function allows for common sense representation.
37
+
38
+ It is implemented as follows:
39
+
40
+ .. code-block:: python
41
+
42
+ def datarepr(name: Any, /, *args: Any, **kwargs: Any) -> str:
43
+ "This function allows for common sense representation."
44
+ parts = list()
45
+ for a in args:
46
+ parts.append(repr(a))
47
+ for i in kwargs.items():
48
+ parts.append("%s=%r" % i)
49
+ content = ", ".join(parts)
50
+ ans = "%s(%s)" % (name, content)
51
+ return ans
52
+
53
+ ``oxford(*args: object, conj: object = "and", default: Default | str = "") -> Default | str``
54
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
+
56
+ This function returns a string coordination of ``args`` using the given conjunction.
57
+ The Oxford comma is used for more than two ``args``.
58
+ If no ``args`` are given, then the function returns default.
59
+
60
+ .. container:: versionadded
61
+
62
+ **Added in version 1.1.**
63
+
64
+ ``datarepr.tests``
65
+ """"""""""""""""""
66
+
67
+ ``test() -> unittest.TextTestResult``
68
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
+
70
+ This project can be tested through its ``test`` function.
71
+
72
+ .. code-block:: python
73
+
74
+ import datarepr.tests
75
+ datarepr.tests.test()
76
+
77
+ .. container:: versionchanged
78
+
79
+ **Changed in version 1.2:** The ``tests`` can now also be run through ``run_tests.py``.
80
+
81
+ License
82
+ -------
83
+
84
+ This project is licensed under the MIT License.
85
+
86
+ Links
87
+ -----
88
+
89
+ - Download: https://pypi.org/project/datarepr/#files
90
+ - Index: https://pypi.org/project/datarepr/
91
+ - Source: https://github.com/johannes-programming/datarepr/
92
+ - Website: https://datarepr.johannes-programming.online/
93
+
94
+ Impressum
95
+ ---------
96
+
97
+ **Johannes Programming**
98
+
99
+ - Name: Johannes
100
+ - Email: johannes.programming@gmail.com
101
+ - Homepage: https://www.johannes-programming.online/
102
+ - Gravatar: https://www.johannes-programming.fyi/
@@ -5,36 +5,49 @@ requires = [
5
5
  ]
6
6
 
7
7
  [project]
8
+ name = "datarepr"
9
+ version = "1.3.0"
10
+ description = "This project allows for common sense data representation."
11
+ readme = "README.rst"
12
+ keywords = []
13
+ license = "MIT"
14
+ license-files = [
15
+ "LICENSE.txt",
16
+ ]
8
17
  authors = [
9
- { email = "johannes.programming@gmail.com", name = "Johannes" },
18
+ { name = "Johannes", email = "johannes.programming@gmail.com" },
10
19
  ]
20
+ requires-python = ">=3.11"
11
21
  classifiers = [
12
22
  "Development Status :: 5 - Production/Stable",
13
23
  "Intended Audience :: Developers",
14
24
  "Natural Language :: English",
15
25
  "Operating System :: OS Independent",
16
26
  "Programming Language :: Python",
17
- "Programming Language :: Python :: 3",
18
27
  "Programming Language :: Python :: 3 :: Only",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Programming Language :: Python :: 3.13",
31
+ "Programming Language :: Python :: 3.14",
32
+ "Programming Language :: Python :: 3.15",
19
33
  "Typing :: Typed",
20
34
  ]
21
35
  dependencies = []
22
- description = "This project allows for common sense data representation."
23
- keywords = []
24
- license = "MIT"
25
- license-files = [
26
- "LICENSE.txt",
36
+ urls.Download = "https://pypi.org/project/datarepr/#files"
37
+ urls.Index = "https://pypi.org/project/datarepr/"
38
+ urls.Source = "https://github.com/johannes-programming/datarepr/"
39
+ urls.Website = "https://datarepr.johannes-programming.online/"
40
+
41
+ [tool.ruff]
42
+ line-length = 79
43
+ lint.select = [
44
+ "I",
27
45
  ]
28
- name = "datarepr"
29
- readme = "README.rst"
30
- requires-python = ">=3.11"
31
- version = "1.2.7"
32
46
 
33
- [project.urls]
34
- Download = "https://pypi.org/project/datarepr/#files"
35
- Index = "https://pypi.org/project/datarepr/"
36
- Source = "https://github.com/johannes-programming/datarepr/"
37
- Website = "https://datarepr.johannes-programming.online/"
47
+ [tool.pyproject-fmt]
48
+ indent = 4
49
+ keep_full_version = true
50
+ max_supported_python = "3.15"
38
51
 
39
52
  [tool.mypy]
40
53
  files = [
@@ -0,0 +1,13 @@
1
+ __all__: list[str] = ["main", "test"]
2
+
3
+ import sys
4
+
5
+ from datarepr.tests import test
6
+
7
+
8
+ def main() -> int:
9
+ return int(not test().wasSuccessful())
10
+
11
+
12
+ if __name__ == "__main__":
13
+ sys.exit(main())
@@ -1,5 +1,5 @@
1
1
  """Provide data representation utilities."""
2
2
 
3
- __all__ = ["datarepr", "oxford"]
3
+ __all__: list[str] = ["datarepr", "oxford"]
4
4
 
5
5
  from datarepr.core import datarepr, oxford
@@ -1,6 +1,6 @@
1
1
  """Provide core data representation utilities."""
2
2
 
3
- __all__ = ["datarepr", "oxford"]
3
+ __all__: list[str] = ["datarepr", "oxford"]
4
4
 
5
5
  from typing import TypeVar
6
6
 
@@ -1,6 +1,6 @@
1
1
  """Provide test utilities for the datarepr package."""
2
2
 
3
- __all__ = ["test"]
3
+ __all__: list[str] = ["test"]
4
4
 
5
5
  import unittest
6
6
 
@@ -1,6 +1,6 @@
1
1
  """Test the datarepr function."""
2
2
 
3
- __all__ = ["TestDatareprFunction"]
3
+ __all__: list[str] = ["TestDatareprFunction"]
4
4
 
5
5
  import enum
6
6
  import io
@@ -18,7 +18,7 @@ class Lazy(enum.Enum):
18
18
  lazy = None
19
19
 
20
20
  @cached_property
21
- def data(self: Self) -> dict[str, Any]:
21
+ def data(self: Self, /) -> dict[str, Any]:
22
22
  file: Path
23
23
  stream: io.BufferedReader
24
24
  file = Path(__file__).parent / "testdata.toml"
@@ -26,7 +26,7 @@ class Lazy(enum.Enum):
26
26
  return tomllib.load(stream)
27
27
 
28
28
  @cached_property
29
- def test_0(self: Self) -> dict[str, Any]:
29
+ def test_0(self: Self, /) -> dict[str, Any]:
30
30
  return cast(dict[str, Any], self.lazy.data["test_0"])
31
31
 
32
32
 
@@ -38,9 +38,9 @@ class TestDatareprFunction(unittest.TestCase):
38
38
  name: str,
39
39
  /,
40
40
  *,
41
- solution: str,
42
41
  args: Sequence[Any],
43
42
  kwargs: Any = (),
43
+ solution: str,
44
44
  ) -> None:
45
45
  """Test the datarepr function with valid parameters."""
46
46
  result: str
@@ -48,12 +48,14 @@ class TestDatareprFunction(unittest.TestCase):
48
48
  result = datarepr(*args, **dict(kwargs))
49
49
  self.assertEqual(result, solution)
50
50
 
51
- def test_0(self: Self) -> None:
51
+ def test_0(self: Self, /) -> None:
52
52
  """Test the testdata."""
53
+ x: Any
54
+ y: Any
53
55
  for x, y in Lazy.lazy.test_0.items():
54
56
  self.go_valid(x, **y)
55
57
 
56
- def test_combination_of_all(self: Self) -> None:
58
+ def test_combination_of_all(self: Self, /) -> None:
57
59
  """Test a complex combination of types and structures."""
58
60
  result: str
59
61
  solution: str
@@ -71,13 +73,13 @@ class TestDatareprFunction(unittest.TestCase):
71
73
  )
72
74
  self.assertEqual(result, solution)
73
75
 
74
- def test_name_as_non_string(self: Self) -> None:
76
+ def test_name_as_non_string(self: Self, /) -> None:
75
77
  """Test with the 'name' parameter as a non-string type."""
76
78
  result: str
77
79
  result = datarepr(None, "arg1")
78
80
  self.assertEqual(result, "None('arg1')")
79
81
 
80
- def test_no_args_at_all(self: Self) -> None:
82
+ def test_no_args_at_all(self: Self, /) -> None:
81
83
  """Test with no arguments, not even the name."""
82
84
  args: Any
83
85
  args = ()
@@ -85,7 +87,7 @@ class TestDatareprFunction(unittest.TestCase):
85
87
  # Raise TypeError: missing required 'name' argument.
86
88
  datarepr(*args)
87
89
 
88
- def test_special_characters(self: Self) -> None:
90
+ def test_special_characters(self: Self, /) -> None:
89
91
  """Test with special characters in arguments."""
90
92
  result: str
91
93
  result = datarepr("test_function", "a\nb", "\t", key="val\nue")
@@ -93,7 +95,7 @@ class TestDatareprFunction(unittest.TestCase):
93
95
  result, "test_function('a\\nb', '\\t', key='val\\nue')"
94
96
  )
95
97
 
96
- def test_various_types(self: Self) -> None:
98
+ def test_various_types(self: Self, /) -> None:
97
99
  """Test with various types of arguments."""
98
100
  result: str
99
101
  result = datarepr("test_function", 1, 2.0, True, None)
@@ -1,6 +1,6 @@
1
1
  """Test the oxford function."""
2
2
 
3
- __all__ = ["TestOxfordFunction"]
3
+ __all__: list[str] = ["TestOxfordFunction"]
4
4
 
5
5
  import unittest
6
6
  from typing import Self
@@ -11,7 +11,7 @@ from datarepr.core import oxford
11
11
  class TestOxfordFunction(unittest.TestCase):
12
12
  """Test the oxford function comprehensively."""
13
13
 
14
- def test_no_args_at_all(self: Self) -> None:
14
+ def test_no_args_at_all(self: Self, /) -> None:
15
15
  """Test oxford with varying numbers of arguments."""
16
16
  self.assertEqual("", oxford())
17
17
  self.assertEqual(42, oxford(default=42))
@@ -0,0 +1,191 @@
1
+ [test_0.test_empty_args_kwargs]
2
+ args = [
3
+ "test_function",
4
+ ]
5
+ solution = "test_function()"
6
+
7
+ [test_0.test_empty_name]
8
+ args = [
9
+ "",
10
+ 1,
11
+ 2,
12
+ ]
13
+ solution = "(1, 2, a=3)"
14
+
15
+ [test_0.test_empty_name.kwargs]
16
+ a = 3
17
+
18
+ [test_0.test_large_number_of_args]
19
+ args = [
20
+ "test_function",
21
+ 0,
22
+ 1,
23
+ 2,
24
+ 3,
25
+ 4,
26
+ 5,
27
+ 6,
28
+ 7,
29
+ 8,
30
+ 9,
31
+ 10,
32
+ 11,
33
+ 12,
34
+ 13,
35
+ 14,
36
+ 15,
37
+ 16,
38
+ 17,
39
+ 18,
40
+ 19,
41
+ 20,
42
+ 21,
43
+ 22,
44
+ 23,
45
+ 24,
46
+ 25,
47
+ 26,
48
+ 27,
49
+ 28,
50
+ 29,
51
+ 30,
52
+ 31,
53
+ 32,
54
+ 33,
55
+ 34,
56
+ 35,
57
+ 36,
58
+ 37,
59
+ 38,
60
+ 39,
61
+ 40,
62
+ 41,
63
+ 42,
64
+ 43,
65
+ 44,
66
+ 45,
67
+ 46,
68
+ 47,
69
+ 48,
70
+ 49,
71
+ 50,
72
+ 51,
73
+ 52,
74
+ 53,
75
+ 54,
76
+ 55,
77
+ 56,
78
+ 57,
79
+ 58,
80
+ 59,
81
+ 60,
82
+ 61,
83
+ 62,
84
+ 63,
85
+ 64,
86
+ 65,
87
+ 66,
88
+ 67,
89
+ 68,
90
+ 69,
91
+ 70,
92
+ 71,
93
+ 72,
94
+ 73,
95
+ 74,
96
+ 75,
97
+ 76,
98
+ 77,
99
+ 78,
100
+ 79,
101
+ 80,
102
+ 81,
103
+ 82,
104
+ 83,
105
+ 84,
106
+ 85,
107
+ 86,
108
+ 87,
109
+ 88,
110
+ 89,
111
+ 90,
112
+ 91,
113
+ 92,
114
+ 93,
115
+ 94,
116
+ 95,
117
+ 96,
118
+ 97,
119
+ 98,
120
+ 99,
121
+ ]
122
+ solution = "test_function(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99)"
123
+
124
+ [test_0.test_positional_args_only]
125
+ args = [
126
+ "test_function",
127
+ 1,
128
+ 2,
129
+ 3,
130
+ ]
131
+ solution = "test_function(1, 2, 3)"
132
+
133
+ [test_0.test_keyword_args_only_1]
134
+ args = [
135
+ "test_function",
136
+ ]
137
+ solution = "test_function(x='x', y='y')"
138
+
139
+ [test_0.test_keyword_args_only_1.kwargs]
140
+ x = "x"
141
+ y = "y"
142
+
143
+ [test_0.test_positional_args_only_1]
144
+ args = [
145
+ "test_function",
146
+ "a",
147
+ "b",
148
+ "c",
149
+ ]
150
+ solution = "test_function('a', 'b', 'c')"
151
+
152
+ [test_0.test_mixed_args]
153
+ args = [
154
+ "test_function",
155
+ 1,
156
+ 2,
157
+ ]
158
+ solution = "test_function(1, 2, a=3, b=4)"
159
+
160
+ [test_0.test_mixed_args.kwargs]
161
+ a = 3
162
+ b = 4
163
+
164
+ [test_0.test_mixed_args_1]
165
+ args = [
166
+ "test_function",
167
+ "x",
168
+ "y",
169
+ ]
170
+ solution = "test_function('x', 'y', z=5)"
171
+
172
+ [test_0.test_mixed_args_1.kwargs]
173
+ z = 5
174
+
175
+ [test_0.test_keyword_args_only]
176
+ args = [
177
+ "test_function",
178
+ ]
179
+ solution = "test_function(a=1, b=2, c=3)"
180
+
181
+ [test_0.test_keyword_args_only.kwargs]
182
+ a = 1
183
+ b = 2
184
+ c = 3
185
+
186
+ [test_0.test_name_as_non_string]
187
+ args = [
188
+ 123,
189
+ "arg1",
190
+ ]
191
+ solution = "123('arg1')"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datarepr
3
- Version: 1.2.7
3
+ Version: 1.3.0
4
4
  Summary: This project allows for common sense data representation.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
@@ -13,8 +13,12 @@ Classifier: Intended Audience :: Developers
13
13
  Classifier: Natural Language :: English
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 3
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
18
22
  Classifier: Typing :: Typed
19
23
  Requires-Python: >=3.11
20
24
  Description-Content-Type: text/x-rst
@@ -2,10 +2,12 @@ LICENSE.txt
2
2
  MANIFEST.in
3
3
  README.rst
4
4
  pyproject.toml
5
+ run_tests.py
5
6
  setup.cfg
6
7
  docs/v1.0.rst
7
8
  docs/v1.1.rst
8
9
  docs/v1.2.rst
10
+ docs/v1.3.rst
9
11
  src/datarepr/__init__.py
10
12
  src/datarepr/core.py
11
13
  src/datarepr/py.typed
@@ -1,2 +0,0 @@
1
- recursive-include docs *.rst
2
- recursive-include src/datarepr *.toml
@@ -1,58 +0,0 @@
1
- [test_0.test_empty_args_kwargs]
2
- args=["test_function"]
3
- solution = "test_function()"
4
-
5
- [test_0.test_empty_name]
6
- args = ["", 1, 2]
7
- kwargs = { a=3}
8
- solution = "(1, 2, a=3)"
9
-
10
- [test_0.test_large_number_of_args]
11
- args = ["test_function", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
12
- solution='test_function(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99)'
13
-
14
-
15
- [test_0.test_positional_args_only]
16
- args=["test_function", 1, 2, 3]
17
- solution = "test_function(1, 2, 3)"
18
-
19
-
20
-
21
- [test_0.test_keyword_args_only_1]
22
- args=["test_function"]
23
- kwargs = { x="x", y="y"}
24
- solution="test_function(x='x', y='y')"
25
-
26
-
27
-
28
- [test_0.test_positional_args_only_1]
29
- args = ["test_function", "a", "b", "c"]
30
- solution="test_function('a', 'b', 'c')"
31
-
32
-
33
- [test_0.test_mixed_args]
34
- args = ["test_function", 1, 2]
35
- kwargs = {a=3, b=4}
36
- solution = "test_function(1, 2, a=3, b=4)"
37
-
38
-
39
-
40
-
41
- [test_0.test_mixed_args_1]
42
-
43
- args = ["test_function", "x", "y"]
44
- kwargs={ z=5}
45
- solution="test_function('x', 'y', z=5)"
46
-
47
-
48
-
49
-
50
- [test_0.test_keyword_args_only]
51
- args=["test_function"]
52
- kwargs={ a=1, b=2, c=3}
53
- solution="test_function(a=1, b=2, c=3)"
54
-
55
-
56
- [test_0.test_name_as_non_string]
57
- args=[123, "arg1"]
58
- solution="123('arg1')"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes