identityfunction 1.1.4.post0__tar.gz → 1.2.0.post0__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.
Files changed (28) hide show
  1. identityfunction-1.2.0.post0/MANIFEST.in +4 -0
  2. {identityfunction-1.1.4.post0/src/identityfunction.egg-info → identityfunction-1.2.0.post0}/PKG-INFO +6 -4
  3. identityfunction-1.2.0.post0/docs/v1.2.rst +87 -0
  4. identityfunction-1.2.0.post0/pyproject.toml +57 -0
  5. identityfunction-1.2.0.post0/run_tests.py +15 -0
  6. identityfunction-1.2.0.post0/src/identityfunction/__init__.py +10 -0
  7. identityfunction-1.2.0.post0/src/identityfunction/__main__.py +10 -0
  8. identityfunction-1.2.0.post0/src/identityfunction/core/__init__.py +67 -0
  9. identityfunction-1.2.0.post0/src/identityfunction/tests/__init__.py +16 -0
  10. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/src/identityfunction/tests/test_0.py +14 -8
  11. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/src/identityfunction/tests/test_1984.py +5 -1
  12. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0/src/identityfunction.egg-info}/PKG-INFO +6 -4
  13. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/src/identityfunction.egg-info/SOURCES.txt +2 -1
  14. identityfunction-1.1.4.post0/MANIFEST.in +0 -2
  15. identityfunction-1.1.4.post0/pyproject.toml +0 -47
  16. identityfunction-1.1.4.post0/src/identityfunction/__init__.py +0 -6
  17. identityfunction-1.1.4.post0/src/identityfunction/__main__.py +0 -4
  18. identityfunction-1.1.4.post0/src/identityfunction/core/__init__.py +0 -23
  19. identityfunction-1.1.4.post0/src/identityfunction/tests/__init__.py +0 -14
  20. identityfunction-1.1.4.post0/src/identityfunction.egg-info/requires.txt +0 -2
  21. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/LICENSE.txt +0 -0
  22. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/README.rst +0 -0
  23. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/docs/v1.0.rst +0 -0
  24. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/docs/v1.1.rst +0 -0
  25. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/setup.cfg +0 -0
  26. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/src/identityfunction/py.typed +0 -0
  27. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/src/identityfunction.egg-info/dependency_links.txt +0 -0
  28. {identityfunction-1.1.4.post0 → identityfunction-1.2.0.post0}/src/identityfunction.egg-info/top_level.txt +0 -0
@@ -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: identityfunction
3
- Version: 1.1.4.post0
3
+ Version: 1.2.0.post0
4
4
  Summary: This project provides the identity function.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
@@ -13,14 +13,16 @@ 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
21
25
  License-File: LICENSE.txt
22
- Requires-Dist: click<9,>=8.2
23
- Requires-Dist: preparse<2,>=1.1
24
26
  Dynamic: license-file
25
27
 
26
28
  ================
@@ -0,0 +1,87 @@
1
+ Introduction
2
+ ------------
3
+
4
+ This project provides the ``identityfunction``.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ To install ``identityfunction``, you can use ``pip``.
10
+ Open your terminal and run:
11
+
12
+ .. code-block:: shell
13
+
14
+ pip install identityfunction
15
+
16
+ Typing
17
+ ------
18
+
19
+ This project is strictly typed with ``mypy``.
20
+
21
+ .. container:: versionadded
22
+
23
+ **Added in version 1.1.**
24
+
25
+ Features
26
+ --------
27
+
28
+ ``identityfunction.core``
29
+ """""""""""""""""""""""""
30
+
31
+ ``identityfunction[Value](value: Value, /) -> Value``
32
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
+
34
+ This function returns the value given to it.
35
+
36
+ ``main(args: Iterable[str] | None = None) -> int``
37
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
+
39
+ ``parse_args(args: Iterable[str] | None = None) -> Namespace``
40
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
+
42
+ .. container:: versionadded
43
+
44
+ **Added in version 1.2.**
45
+
46
+ ``run(value: Value) -> None``
47
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
+
49
+ .. container:: versionadded
50
+
51
+ **Added in version 1.2.**
52
+
53
+ ``identityfunction.tests``
54
+ """"""""""""""""""""""""""
55
+
56
+ ``test() -> unittest.TextTestResult``
57
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
+
59
+ This project can be tested through its test function.
60
+
61
+ .. code-block:: shell
62
+
63
+ import identityfunction.tests
64
+ identityfunction.tests.test()
65
+
66
+ License
67
+ -------
68
+
69
+ This project is licensed under the MIT License.
70
+
71
+ Links
72
+ -----
73
+
74
+ - Download: https://pypi.org/project/identityfunction/#files
75
+ - Index: https://pypi.org/project/identityfunction/
76
+ - Source: https://github.com/johannes-programming/identityfunction/
77
+ - Website: https://identityfunction.johannes-programming.online/
78
+
79
+ Impressum
80
+ ---------
81
+
82
+ **Johannes Programming**
83
+
84
+ - Name: Johannes
85
+ - Email: johannes.programming@gmail.com
86
+ - Homepage: https://www.johannes-programming.online/
87
+ - Gravatar: https://www.johannes-programming.fyi/
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = [
4
+ "setuptools>=77.0",
5
+ ]
6
+
7
+ [project]
8
+ name = "identityfunction"
9
+ version = "1.2.0.post0"
10
+ description = "This project provides the identity function."
11
+ readme = "README.rst"
12
+ keywords = []
13
+ license = "MIT"
14
+ license-files = [
15
+ "LICENSE.txt",
16
+ ]
17
+ authors = [
18
+ { name = "Johannes", email = "johannes.programming@gmail.com" },
19
+ ]
20
+ requires-python = ">=3.11"
21
+ classifiers = [
22
+ "Development Status :: 5 - Production/Stable",
23
+ "Intended Audience :: Developers",
24
+ "Natural Language :: English",
25
+ "Operating System :: OS Independent",
26
+ "Programming Language :: Python",
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",
33
+ "Typing :: Typed",
34
+ ]
35
+ dependencies = []
36
+ urls.Download = "https://pypi.org/project/identityfunction/#files"
37
+ urls.Index = "https://pypi.org/project/identityfunction/"
38
+ urls.Source = "https://github.com/johannes-programming/identityfunction/"
39
+ urls.Website = "https://identityfunction.johannes-programming.online/"
40
+
41
+ [tool.ruff]
42
+ line-length = 79
43
+ lint.select = [
44
+ "I",
45
+ ]
46
+
47
+ [tool.pyproject-fmt]
48
+ indent = 4
49
+ keep_full_version = true
50
+ max_supported_python = "3.15"
51
+
52
+ [tool.mypy]
53
+ files = [
54
+ ".",
55
+ ]
56
+ python_version = "3.11"
57
+ strict = true
@@ -0,0 +1,15 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = []
4
+
5
+ import sys
6
+
7
+ import identityfunction.tests
8
+
9
+
10
+ def main() -> int:
11
+ return int(not identityfunction.tests.test())
12
+
13
+
14
+ if __name__ == "__main__":
15
+ sys.exit(main())
@@ -0,0 +1,10 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = ["identityfunction", "main", "parse_args", "run"]
4
+
5
+ import sys
6
+
7
+ from identityfunction.core import identityfunction, main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())
@@ -0,0 +1,10 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = ["main"]
4
+
5
+ import sys
6
+
7
+ from identityfunction import main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())
@@ -0,0 +1,67 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = ["identityfunction", "main", "parse_args", "run"]
4
+
5
+ import argparse
6
+ from collections import abc
7
+ from importlib import metadata
8
+ from typing import Any, TypeVar
9
+
10
+ Value = TypeVar("Value")
11
+
12
+
13
+ def identityfunction(value: Value, /) -> Value:
14
+ "This function returns the value given to it."
15
+ return value
16
+
17
+
18
+ def main(args: abc.Iterable[str] | None = None) -> int:
19
+ "This command applies the identity function to value."
20
+ kwargs: dict[str, Any]
21
+ space: argparse.Namespace
22
+ value: str
23
+ try:
24
+ space = parse_args(args)
25
+ kwargs = vars(space)
26
+ value = kwargs.pop("value")
27
+ run(value, **kwargs)
28
+ except SystemExit as exit:
29
+ if isinstance(exit.code, int):
30
+ return int(exit.code)
31
+ else:
32
+ return int(bool(exit.code))
33
+ except BaseException:
34
+ return 1
35
+ else:
36
+ return 0
37
+
38
+
39
+ def parse_args(args: abc.Iterable[str] | None = None) -> argparse.Namespace:
40
+ parser: argparse.ArgumentParser
41
+ version: str
42
+ parser = argparse.ArgumentParser(
43
+ add_help=False,
44
+ description="This command applies the identity function.",
45
+ fromfile_prefix_chars="@",
46
+ prog="identityfunction",
47
+ )
48
+ version = "%(prog)s, version " + metadata.version("identityfunction")
49
+ parser.add_argument(
50
+ "-V",
51
+ "--version",
52
+ action="version",
53
+ help="show the version and abort",
54
+ version=version,
55
+ )
56
+ parser.add_argument(
57
+ "-h",
58
+ "--help",
59
+ action="help",
60
+ help="show this message and abort",
61
+ )
62
+ parser.add_argument("value")
63
+ return parser.parse_args(args)
64
+
65
+
66
+ def run(value: object, /) -> None:
67
+ print(value)
@@ -0,0 +1,16 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = ["test"]
4
+
5
+ import unittest
6
+
7
+
8
+ def test() -> unittest.TextTestResult:
9
+ "This function runs all the tests."
10
+ loader: unittest.TestLoader
11
+ runner: unittest.TextTestRunner
12
+ suite: unittest.TestSuite
13
+ loader = unittest.TestLoader()
14
+ suite = loader.discover(start_dir="identityfunction.tests")
15
+ runner = unittest.TextTestRunner()
16
+ return runner.run(suite)
@@ -1,3 +1,8 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = ["TestIdentityFunction"]
4
+
5
+
1
6
  import unittest
2
7
  from typing import Self
3
8
 
@@ -5,46 +10,47 @@ from identityfunction.core import identityfunction
5
10
 
6
11
 
7
12
  class TestIdentityFunction(unittest.TestCase):
8
- def test_with_integers(self: Self) -> None:
13
+ def test_with_integers(self: Self, /) -> None:
9
14
  "Test the identity function with integer values."
10
15
  self.assertEqual(identityfunction(42), 42)
11
16
  self.assertEqual(identityfunction(-1), -1)
12
17
  self.assertEqual(identityfunction(0), 0)
13
18
 
14
- def test_with_strings(self: Self) -> None:
19
+ def test_with_strings(self: Self, /) -> None:
15
20
  "Test the identity function with string values."
16
21
  self.assertEqual(identityfunction("hello"), "hello")
17
22
  self.assertEqual(identityfunction(""), "") # Empty string
18
23
 
19
- def test_with_lists(self: Self) -> None:
24
+ def test_with_lists(self: Self, /) -> None:
20
25
  "Test the identity function with list values."
21
26
  self.assertEqual(identityfunction([1, 2, 3]), [1, 2, 3])
22
27
  self.assertEqual(identityfunction([]), []) # Empty list
23
28
 
24
- def test_with_dictionaries(self: Self) -> None:
29
+ def test_with_dictionaries(self: Self, /) -> None:
25
30
  "Test the identity function with dictionary values."
26
31
  self.assertEqual(identityfunction({"key": "value"}), {"key": "value"})
27
32
  self.assertEqual(identityfunction({}), {}) # Empty dictionary
28
33
 
29
- def test_with_none(self: Self) -> None:
34
+ def test_with_none(self: Self, /) -> None:
30
35
  "Test the identity function with None."
31
36
  self.assertIs(identityfunction(None), None)
32
37
 
33
- def test_with_custom_objects(self: Self) -> None:
38
+ def test_with_custom_objects(self: Self, /) -> None:
34
39
  "Test the identity function with custom objects."
35
40
 
36
41
  class CustomObject:
37
42
  pass
38
43
 
44
+ obj: CustomObject
39
45
  obj = CustomObject()
40
46
  self.assertIs(identityfunction(obj), obj)
41
47
 
42
- def test_with_booleans(self: Self) -> None:
48
+ def test_with_booleans(self: Self, /) -> None:
43
49
  "Test the identity function with boolean values."
44
50
  self.assertIs(identityfunction(True), True)
45
51
  self.assertIs(identityfunction(False), False)
46
52
 
47
- def test_with_floats(self: Self) -> None:
53
+ def test_with_floats(self: Self, /) -> None:
48
54
  "Test the identity function with float values."
49
55
  self.assertEqual(identityfunction(3.14), 3.14)
50
56
  self.assertEqual(identityfunction(-2.718), -2.718)
@@ -1,9 +1,13 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = ["Test1984"]
4
+
1
5
  import unittest
2
6
  from typing import Self
3
7
 
4
8
 
5
9
  class Test1984(unittest.TestCase):
6
- def test_1984(self: Self) -> None:
10
+ def test_1984(self: Self, /) -> None:
7
11
  self.assertEqual(2 + 2, 4, "Ignorance is Strength")
8
12
 
9
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: identityfunction
3
- Version: 1.1.4.post0
3
+ Version: 1.2.0.post0
4
4
  Summary: This project provides the identity function.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
@@ -13,14 +13,16 @@ 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
21
25
  License-File: LICENSE.txt
22
- Requires-Dist: click<9,>=8.2
23
- Requires-Dist: preparse<2,>=1.1
24
26
  Dynamic: license-file
25
27
 
26
28
  ================
@@ -2,16 +2,17 @@ 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
9
+ docs/v1.2.rst
8
10
  src/identityfunction/__init__.py
9
11
  src/identityfunction/__main__.py
10
12
  src/identityfunction/py.typed
11
13
  src/identityfunction.egg-info/PKG-INFO
12
14
  src/identityfunction.egg-info/SOURCES.txt
13
15
  src/identityfunction.egg-info/dependency_links.txt
14
- src/identityfunction.egg-info/requires.txt
15
16
  src/identityfunction.egg-info/top_level.txt
16
17
  src/identityfunction/core/__init__.py
17
18
  src/identityfunction/tests/__init__.py
@@ -1,2 +0,0 @@
1
- recursive-include docs *.rst
2
- recursive-include src/identityfunction *.toml
@@ -1,47 +0,0 @@
1
- [build-system]
2
- build-backend = "setuptools.build_meta"
3
- requires = [
4
- "setuptools>=77.0",
5
- ]
6
-
7
- [project]
8
- authors = [
9
- { email = "johannes.programming@gmail.com", name = "Johannes" },
10
- ]
11
- classifiers = [
12
- "Development Status :: 5 - Production/Stable",
13
- "Intended Audience :: Developers",
14
- "Natural Language :: English",
15
- "Operating System :: OS Independent",
16
- "Programming Language :: Python",
17
- "Programming Language :: Python :: 3",
18
- "Programming Language :: Python :: 3 :: Only",
19
- "Typing :: Typed",
20
- ]
21
- dependencies = [
22
- "click>=8.2,<9",
23
- "preparse>=1.1,<2",
24
- ]
25
- description = "This project provides the identity function."
26
- keywords = []
27
- license = "MIT"
28
- license-files = [
29
- "LICENSE.txt",
30
- ]
31
- name = "identityfunction"
32
- readme = "README.rst"
33
- requires-python = ">=3.11"
34
- version = "1.1.4.post0"
35
-
36
- [project.urls]
37
- Download = "https://pypi.org/project/identityfunction/#files"
38
- Index = "https://pypi.org/project/identityfunction/"
39
- Source = "https://github.com/johannes-programming/identityfunction/"
40
- Website = "https://identityfunction.johannes-programming.online/"
41
-
42
- [tool.mypy]
43
- files = [
44
- ".",
45
- ]
46
- python_version = "3.11"
47
- strict = true
@@ -1,6 +0,0 @@
1
- from identityfunction.core import identityfunction, main
2
-
3
- __all__ = ["main", "identityfunction"]
4
-
5
- if __name__ == "__main__":
6
- main()
@@ -1,4 +0,0 @@
1
- from identityfunction import main
2
-
3
- if __name__ == "__main__":
4
- main()
@@ -1,23 +0,0 @@
1
- from typing import TypeVar
2
-
3
- import click
4
- import preparse
5
-
6
- __all__ = ["identityfunction", "main"]
7
-
8
- Value = TypeVar("Value")
9
-
10
-
11
- def identityfunction(value: Value, /) -> Value:
12
- "This function returns the value given to it."
13
- return value
14
-
15
-
16
- @preparse.PreParser().click()
17
- @click.command(add_help_option=False)
18
- @click.help_option("-h", "--help")
19
- @click.version_option(None, "-V", "--version")
20
- @click.argument("value", type=str)
21
- def main(value: str) -> None:
22
- "This command applies the identity function to value."
23
- click.echo(identityfunction(value))
@@ -1,14 +0,0 @@
1
- import unittest
2
-
3
- __all__ = ["test"]
4
-
5
-
6
- def test() -> unittest.TextTestResult:
7
- "This function runs all the tests."
8
- loader: unittest.TestLoader = unittest.TestLoader()
9
- tests: unittest.TestSuite = loader.discover(
10
- start_dir="identityfunction.tests"
11
- )
12
- runner: unittest.TextTestRunner = unittest.TextTestRunner()
13
- result: unittest.TextTestResult = runner.run(tests)
14
- return result
@@ -1,2 +0,0 @@
1
- click<9,>=8.2
2
- preparse<2,>=1.1