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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datarepr
3
- Version: 1.2.0
3
+ Version: 1.2.2
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
@@ -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``. Open your terminal and run:
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 (not strictly) to ``mypy``.
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: Any, /, *args: Any, **kwargs: Any) -> str``
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: Any, conj: Any = "and", default: Any = "") -> Any``
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.0"
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 = false
44
+ strict = true
@@ -0,0 +1,3 @@
1
+ from datarepr.core import datarepr, oxford
2
+
3
+ __all__ = ["datarepr", "oxford"]
@@ -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(*args: object, conj: object = "and", default: Any = "") -> Any:
19
- ans: str
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(result, "test_function([1, 2], {3, 4}, {'key': 'value'})")
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(result, "test_function('a\\nb', '\\t', key='val\\nue')")
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", [1, 2], {3: 4}, a=5, b=[6, 7], c={"key": "value"}
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datarepr
3
- Version: 1.2.0
3
+ Version: 1.2.2
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
@@ -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