printToStderr 0.0.3.dev0__py3-none-any.whl
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.
- printtostderr/__init__.py +5 -0
- printtostderr/__main__.py +4 -0
- printtostderr/core/__init__.py +22 -0
- printtostderr/tests/__init__.py +12 -0
- printtostderr/tests/test_0.py +48 -0
- printtostderr-0.0.3.dev0.dist-info/LICENSE.txt +21 -0
- printtostderr-0.0.3.dev0.dist-info/METADATA +78 -0
- printtostderr-0.0.3.dev0.dist-info/RECORD +10 -0
- printtostderr-0.0.3.dev0.dist-info/WHEEL +5 -0
- printtostderr-0.0.3.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
from typing import *
|
|
4
|
+
|
|
5
|
+
__all__ = ["main", "printtostderr"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main(args: Optional[Iterable] = None) -> None:
|
|
9
|
+
"""This function parses the args and hands them to the printtostderr function."""
|
|
10
|
+
if args is not None:
|
|
11
|
+
args = [str(x) for x in args]
|
|
12
|
+
parser = argparse.ArgumentParser()
|
|
13
|
+
parser.add_argument(
|
|
14
|
+
"args", nargs="*", help="These arguments will be printed to sys.stderr."
|
|
15
|
+
)
|
|
16
|
+
ns = parser.parse_args(args)
|
|
17
|
+
printtostderr(*ns.args)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def printtostderr(*args: Any, **kwargs: Any) -> None:
|
|
21
|
+
"This function prints to sys.stderr."
|
|
22
|
+
print(*args, **kwargs, file=sys.stderr)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
__all__ = ["test"]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test() -> unittest.TextTestRunner:
|
|
7
|
+
"This function runs all the tests."
|
|
8
|
+
loader = unittest.TestLoader()
|
|
9
|
+
tests = loader.discover(start_dir="printtostderr.tests")
|
|
10
|
+
runner = unittest.TextTestRunner()
|
|
11
|
+
result = runner.run(tests)
|
|
12
|
+
return result
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import sys
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from raisefunction.core import main, printtostderr
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestMainAndPrintToStderr(unittest.TestCase):
|
|
9
|
+
|
|
10
|
+
def test_printtostderr(self):
|
|
11
|
+
"""Test if printtostderr prints correctly to sys.stderr."""
|
|
12
|
+
stderr = io.StringIO()
|
|
13
|
+
original_stderr = sys.stderr
|
|
14
|
+
try:
|
|
15
|
+
sys.stderr = stderr
|
|
16
|
+
printtostderr("This is a test", 123, "!", sep="-", end="\n")
|
|
17
|
+
output = stderr.getvalue()
|
|
18
|
+
finally:
|
|
19
|
+
sys.stderr = original_stderr
|
|
20
|
+
self.assertEqual(output, "This is a test-123-!\n")
|
|
21
|
+
|
|
22
|
+
def test_main_with_args(self):
|
|
23
|
+
"""Test main with specific arguments."""
|
|
24
|
+
stderr = io.StringIO()
|
|
25
|
+
original_stderr = sys.stderr
|
|
26
|
+
try:
|
|
27
|
+
sys.stderr = stderr
|
|
28
|
+
main(["arg1", "arg2", "arg3"])
|
|
29
|
+
output = stderr.getvalue()
|
|
30
|
+
finally:
|
|
31
|
+
sys.stderr = original_stderr
|
|
32
|
+
self.assertEqual(output, "arg1 arg2 arg3\n")
|
|
33
|
+
|
|
34
|
+
def test_main_without_args(self):
|
|
35
|
+
"""Test main with no arguments."""
|
|
36
|
+
stderr = io.StringIO()
|
|
37
|
+
original_stderr = sys.stderr
|
|
38
|
+
try:
|
|
39
|
+
sys.stderr = stderr
|
|
40
|
+
main(args=())
|
|
41
|
+
output = stderr.getvalue()
|
|
42
|
+
finally:
|
|
43
|
+
sys.stderr = original_stderr
|
|
44
|
+
self.assertEqual(output, "\n")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
unittest.main()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 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,78 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: printtostderr
|
|
3
|
+
Version: 0.0.3.dev0
|
|
4
|
+
Summary: printtostderr
|
|
5
|
+
Author-email: Johannes <johannes-programming@mailfence.com>
|
|
6
|
+
License: The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Johannes
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Download, https://pypi.org/project/printtostderr/#files
|
|
28
|
+
Project-URL: Index, https://pypi.org/project/printtostderr/
|
|
29
|
+
Project-URL: Source, https://github.com/johannes-programming/printtostderr/
|
|
30
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Natural Language :: English
|
|
33
|
+
Classifier: Operating System :: OS Independent
|
|
34
|
+
Classifier: Programming Language :: Python
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
37
|
+
Classifier: Typing :: Typed
|
|
38
|
+
Requires-Python: >=3.12.7
|
|
39
|
+
Description-Content-Type: text/x-rst
|
|
40
|
+
License-File: LICENSE.txt
|
|
41
|
+
|
|
42
|
+
=============
|
|
43
|
+
printtostderr
|
|
44
|
+
=============
|
|
45
|
+
|
|
46
|
+
Overview
|
|
47
|
+
--------
|
|
48
|
+
|
|
49
|
+
printtostderr
|
|
50
|
+
|
|
51
|
+
Installation
|
|
52
|
+
------------
|
|
53
|
+
|
|
54
|
+
To install ``printtostderr``, you can use ``pip``. Open your terminal and run:
|
|
55
|
+
|
|
56
|
+
.. code-block:: bash
|
|
57
|
+
|
|
58
|
+
pip install printtostderr
|
|
59
|
+
|
|
60
|
+
License
|
|
61
|
+
-------
|
|
62
|
+
|
|
63
|
+
This project is licensed under the MIT License.
|
|
64
|
+
|
|
65
|
+
Links
|
|
66
|
+
-----
|
|
67
|
+
|
|
68
|
+
* `Download <https://pypi.org/project/printtostderr/#files>`_
|
|
69
|
+
* `Index <https://pypi.org/project/printtostderr/>`_
|
|
70
|
+
* `Source <https://github.com/johannes-programming/printtostderr/>`_
|
|
71
|
+
|
|
72
|
+
Credits
|
|
73
|
+
-------
|
|
74
|
+
|
|
75
|
+
* Author: Johannes
|
|
76
|
+
* Email: `johannes-programming@mailfence.com <mailto:johannes-programming@mailfence.com>`_
|
|
77
|
+
|
|
78
|
+
Thank you for using ``printtostderr``!
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
printtostderr/__init__.py,sha256=0y2s5cvKeaQc16M9cNBkuZKmNyxmer_zpr-ugly86uc,106
|
|
2
|
+
printtostderr/__main__.py,sha256=6G1Dyv-N-17IAIcKx1GqUC6f8UJByfMTgUakc98FGPA,70
|
|
3
|
+
printtostderr/core/__init__.py,sha256=2DsqNupX43MfhpwsH2fNx20jgG1RHSsQsx_en7jPNG8,641
|
|
4
|
+
printtostderr/tests/__init__.py,sha256=-3z7VLOt2LyPwSfGers2RUSxEqVtFYdJT5fP2jKATXA,301
|
|
5
|
+
printtostderr/tests/test_0.py,sha256=viam1xX1zPF6M9BK6FUh3iZxz36jb18E8RnwQBCSaJE,1384
|
|
6
|
+
printtostderr-0.0.3.dev0.dist-info/LICENSE.txt,sha256=fOh9FHccUt9OcJPBaVJ482GX4yrl_FxCUk9YRZ53JOI,1074
|
|
7
|
+
printtostderr-0.0.3.dev0.dist-info/METADATA,sha256=R-WLULO3SHhUBCYKaPSCy01mMqDIa0K-ikmGKRrTeCk,2713
|
|
8
|
+
printtostderr-0.0.3.dev0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
+
printtostderr-0.0.3.dev0.dist-info/top_level.txt,sha256=Iro1O_SJsd-IDEt96oPEhZ9tV00iFp1iuDmOBsCfOno,14
|
|
10
|
+
printtostderr-0.0.3.dev0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
printtostderr
|