open-arg 0.0.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
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Johannes
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,4 @@
1
+ include run_tests.py
2
+ recursive-include docs *.rst
3
+ recursive-include src *.toml
4
+ recursive-include tests *.toml
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: open-arg
3
+ Version: 0.0.2
4
+ Summary: Open arg that is a file.
5
+ Author-email: Johannes <johannes.programming@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Download, https://pypi.org/project/open-arg/#files
8
+ Project-URL: Index, https://pypi.org/project/open-arg/
9
+ Project-URL: Source, https://github.com/johannes-programming/open-arg/
10
+ Project-URL: Website, https://open-arg.johannes-programming.online/
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3.15
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/x-rst
24
+ License-File: LICENSE.txt
25
+ Dynamic: license-file
26
+
27
+ ========
28
+ open-arg
29
+ ========
30
+
31
+ Each minor version has its own documentation.
32
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
33
+ They can also be viewed on the website `https://open-arg.johannes-programming.online/ <https://open-arg.johannes-programming.online/>`_.
@@ -0,0 +1,7 @@
1
+ ========
2
+ open-arg
3
+ ========
4
+
5
+ Each minor version has its own documentation.
6
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
7
+ They can also be viewed on the website `https://open-arg.johannes-programming.online/ <https://open-arg.johannes-programming.online/>`_.
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = [
4
+ "setuptools>=77.0",
5
+ ]
6
+
7
+ [project]
8
+ name = "open-arg"
9
+ version = "0.0.2"
10
+ description = "Open arg that is a file."
11
+ readme.content-type = "text/x-rst"
12
+ readme.file = "README.rst"
13
+ keywords = []
14
+ license = "MIT"
15
+ license-files = [
16
+ "LICENSE.txt",
17
+ ]
18
+ authors = [
19
+ { name = "Johannes", email = "johannes.programming@gmail.com" },
20
+ ]
21
+ requires-python = ">=3.11"
22
+ classifiers = [
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/open-arg/#files"
37
+ urls.Index = "https://pypi.org/project/open-arg/"
38
+ urls.Source = "https://github.com/johannes-programming/open-arg/"
39
+ urls.Website = "https://open-arg.johannes-programming.online/"
40
+
41
+ [tool.ruff]
42
+ line-length = 79
43
+ lint.select = [
44
+ "ANN001",
45
+ "ANN002",
46
+ "ANN003",
47
+ "F",
48
+ "I",
49
+ "PLE0604",
50
+ "PLE0605",
51
+ "RUF022",
52
+ "RUF068",
53
+ "UP035",
54
+ ]
55
+
56
+ [tool.pyproject-fmt]
57
+ indent = 4
58
+ keep_full_version = true
59
+ max_supported_python = "3.15"
60
+
61
+ [tool.mypy]
62
+ files = [
63
+ ".",
64
+ ]
65
+ python_version = "3.11"
66
+ strict = true
@@ -0,0 +1,28 @@
1
+ """Test the package."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __all__: list[str] = ["main", "run"]
6
+
7
+ import sys
8
+ import unittest
9
+
10
+
11
+ def main() -> int:
12
+ """Exit with the test-suite status."""
13
+ return int(not run().wasSuccessful())
14
+
15
+
16
+ def run() -> unittest.TextTestResult:
17
+ """Run the discovered unit tests."""
18
+ loader: unittest.TestLoader
19
+ runner: unittest.TextTestRunner
20
+ suite: unittest.TestSuite
21
+ loader = unittest.TestLoader()
22
+ suite = loader.discover("tests")
23
+ runner = unittest.TextTestRunner(verbosity=2)
24
+ return runner.run(suite)
25
+
26
+
27
+ if __name__ == "__main__":
28
+ sys.exit(main())
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,42 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = ["open_arg"]
4
+
5
+ import inspect
6
+ import sys
7
+ from contextlib import contextmanager
8
+ from gettext import gettext
9
+ from typing import TYPE_CHECKING
10
+
11
+ if TYPE_CHECKING:
12
+ from typing import Any
13
+
14
+
15
+ @contextmanager
16
+ def open_arg(*args: Any, **kwargs: Any) -> Any:
17
+ bound: inspect.BoundArguments
18
+ file: Any
19
+ mode: Any
20
+ msg: str
21
+ stream: Any
22
+ bound = inspect.signature(open).bind(*args, **kwargs)
23
+ bound.apply_defaults()
24
+ file = bound.arguments["file"]
25
+ if file != "-":
26
+ with open(*args, **kwargs) as stream:
27
+ yield stream
28
+ return
29
+ mode = bound.arguments["mode"]
30
+ if "r" in mode:
31
+ if "b" in mode:
32
+ yield sys.stdin.buffer
33
+ else:
34
+ yield sys.stdin
35
+ elif any(c in mode for c in "wax"):
36
+ if "b" in mode:
37
+ yield sys.stdout.buffer
38
+ else:
39
+ yield sys.stdout
40
+ else:
41
+ msg = gettext('argument "-" with mode %r') % mode
42
+ raise ValueError(msg)
File without changes
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: open-arg
3
+ Version: 0.0.2
4
+ Summary: Open arg that is a file.
5
+ Author-email: Johannes <johannes.programming@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Download, https://pypi.org/project/open-arg/#files
8
+ Project-URL: Index, https://pypi.org/project/open-arg/
9
+ Project-URL: Source, https://github.com/johannes-programming/open-arg/
10
+ Project-URL: Website, https://open-arg.johannes-programming.online/
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3.15
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/x-rst
24
+ License-File: LICENSE.txt
25
+ Dynamic: license-file
26
+
27
+ ========
28
+ open-arg
29
+ ========
30
+
31
+ Each minor version has its own documentation.
32
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
33
+ They can also be viewed on the website `https://open-arg.johannes-programming.online/ <https://open-arg.johannes-programming.online/>`_.
@@ -0,0 +1,13 @@
1
+ LICENSE.txt
2
+ MANIFEST.in
3
+ README.rst
4
+ pyproject.toml
5
+ run_tests.py
6
+ setup.cfg
7
+ src/open_arg/__init__.py
8
+ src/open_arg/py.typed
9
+ src/open_arg.egg-info/PKG-INFO
10
+ src/open_arg.egg-info/SOURCES.txt
11
+ src/open_arg.egg-info/dependency_links.txt
12
+ src/open_arg.egg-info/top_level.txt
13
+ tests/test_version.py
@@ -0,0 +1 @@
1
+ open_arg
@@ -0,0 +1,8 @@
1
+ from __future__ import annotations
2
+
3
+ __all__: list[str] = []
4
+
5
+ import unittest
6
+
7
+ if __name__ == "__main__":
8
+ unittest.main()