datarepr 1.2.0__tar.gz → 1.2.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.
- {datarepr-1.2.0/src/datarepr.egg-info → datarepr-1.2.2}/PKG-INFO +1 -1
- {datarepr-1.2.0 → datarepr-1.2.2}/docs/v1.2.rst +7 -6
- {datarepr-1.2.0 → datarepr-1.2.2}/pyproject.toml +2 -2
- datarepr-1.2.2/src/datarepr/__init__.py +3 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr/core.py +8 -3
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr/tests/test_0.py +12 -3
- {datarepr-1.2.0 → datarepr-1.2.2/src/datarepr.egg-info}/PKG-INFO +1 -1
- datarepr-1.2.0/src/datarepr/__init__.py +0 -1
- {datarepr-1.2.0 → datarepr-1.2.2}/LICENSE.txt +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/MANIFEST.in +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/README.rst +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/docs/v1.0.rst +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/docs/v1.1.rst +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/setup.cfg +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr/py.typed +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr/tests/__init__.py +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr/tests/test_oxford.py +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr.egg-info/SOURCES.txt +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr.egg-info/dependency_links.txt +0 -0
- {datarepr-1.2.0 → datarepr-1.2.2}/src/datarepr.egg-info/top_level.txt +0 -0
|
@@ -6,7 +6,8 @@ This project allows to store the arguments for callables.
|
|
|
6
6
|
Installation
|
|
7
7
|
------------
|
|
8
8
|
|
|
9
|
-
To install ``datarepr``, you can use ``pip``.
|
|
9
|
+
To install ``datarepr``, you can use ``pip``.
|
|
10
|
+
Open your terminal and run:
|
|
10
11
|
|
|
11
12
|
.. code-block:: shell
|
|
12
13
|
|
|
@@ -15,7 +16,7 @@ To install ``datarepr``, you can use ``pip``. Open your terminal and run:
|
|
|
15
16
|
Typing
|
|
16
17
|
------
|
|
17
18
|
|
|
18
|
-
The typing conforms
|
|
19
|
+
The typing conforms strictly to ``mypy``.
|
|
19
20
|
|
|
20
21
|
.. container:: versionadded
|
|
21
22
|
|
|
@@ -24,8 +25,8 @@ The typing conforms (not strictly) to ``mypy``.
|
|
|
24
25
|
Features
|
|
25
26
|
--------
|
|
26
27
|
|
|
27
|
-
``datarepr.datarepr(name:
|
|
28
|
-
|
|
28
|
+
``datarepr.datarepr(name: object, /, *args: object, **kwargs: object) -> str``
|
|
29
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
29
30
|
|
|
30
31
|
This function allows for common sense representation.
|
|
31
32
|
|
|
@@ -44,8 +45,8 @@ It is implemented as follows:
|
|
|
44
45
|
ans = "%s(%s)" % (name, content)
|
|
45
46
|
return ans
|
|
46
47
|
|
|
47
|
-
``datarepr.oxford(*args:
|
|
48
|
-
|
|
48
|
+
``datarepr.oxford(*args: object, conj: object = "and", default: Default | str = "") -> Default | str``
|
|
49
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
49
50
|
|
|
50
51
|
This function returns a string coordination of ``args`` using the given conjunction.
|
|
51
52
|
The Oxford comma is used for more than two ``args``.
|
|
@@ -28,7 +28,7 @@ license-files = [
|
|
|
28
28
|
name = "datarepr"
|
|
29
29
|
readme = "README.rst"
|
|
30
30
|
requires-python = ">=3.11"
|
|
31
|
-
version = "1.2.
|
|
31
|
+
version = "1.2.2"
|
|
32
32
|
|
|
33
33
|
[project.urls]
|
|
34
34
|
Download = "https://pypi.org/project/datarepr/#files"
|
|
@@ -41,4 +41,4 @@ files = [
|
|
|
41
41
|
".",
|
|
42
42
|
]
|
|
43
43
|
python_version = "3.11"
|
|
44
|
-
strict =
|
|
44
|
+
strict = true
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import TypeVar
|
|
2
2
|
|
|
3
3
|
__all__ = ["datarepr", "oxford"]
|
|
4
4
|
|
|
5
|
+
Default = TypeVar("Default")
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
def datarepr(name: object, /, *args: object, **kwargs: object) -> str:
|
|
7
9
|
"This function allows for common sense representation."
|
|
@@ -15,8 +17,11 @@ def datarepr(name: object, /, *args: object, **kwargs: object) -> str:
|
|
|
15
17
|
return "%s(%s)" % (name, content)
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
def oxford(
|
|
19
|
-
|
|
20
|
+
def oxford(
|
|
21
|
+
*args: object,
|
|
22
|
+
conj: object = "and",
|
|
23
|
+
default: Default | str = "",
|
|
24
|
+
) -> Default | str:
|
|
20
25
|
if len(args) == 0:
|
|
21
26
|
return default
|
|
22
27
|
if len(args) == 1:
|
|
@@ -53,7 +53,9 @@ class TestDatareprFunction(unittest.TestCase):
|
|
|
53
53
|
result = datarepr("test_function", 1, 2.0, True, None)
|
|
54
54
|
self.assertEqual(result, "test_function(1, 2.0, True, None)")
|
|
55
55
|
result = datarepr("test_function", [1, 2], {3, 4}, {"key": "value"})
|
|
56
|
-
self.assertEqual(
|
|
56
|
+
self.assertEqual(
|
|
57
|
+
result, "test_function([1, 2], {3, 4}, {'key': 'value'})"
|
|
58
|
+
)
|
|
57
59
|
|
|
58
60
|
def test_name_as_non_string(self: Self) -> None:
|
|
59
61
|
"This test tests with the 'name' parameter as a non-string type."
|
|
@@ -73,7 +75,9 @@ class TestDatareprFunction(unittest.TestCase):
|
|
|
73
75
|
"This test tests with special characters in arguments."
|
|
74
76
|
result: str
|
|
75
77
|
result = datarepr("test_function", "a\nb", "\t", key="val\nue")
|
|
76
|
-
self.assertEqual(
|
|
78
|
+
self.assertEqual(
|
|
79
|
+
result, "test_function('a\\nb', '\\t', key='val\\nue')"
|
|
80
|
+
)
|
|
77
81
|
|
|
78
82
|
def test_large_number_of_args(self: Self) -> None:
|
|
79
83
|
"This test tests with a large number of arguments."
|
|
@@ -89,7 +93,12 @@ class TestDatareprFunction(unittest.TestCase):
|
|
|
89
93
|
"This test tests with a complex combination of different types and structures."
|
|
90
94
|
result: str
|
|
91
95
|
result = datarepr(
|
|
92
|
-
"complex_function",
|
|
96
|
+
"complex_function",
|
|
97
|
+
[1, 2],
|
|
98
|
+
{3: 4},
|
|
99
|
+
a=5,
|
|
100
|
+
b=[6, 7],
|
|
101
|
+
c={"key": "value"},
|
|
93
102
|
)
|
|
94
103
|
self.assertEqual(
|
|
95
104
|
result,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from datarepr.core import *
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|