preparse 0.1.0.dev0__tar.gz → 0.1.0.dev2__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.
- {preparse-0.1.0.dev0/src/preparse.egg-info → preparse-0.1.0.dev2}/PKG-INFO +2 -1
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/pyproject.toml +2 -1
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/core/Click.py +20 -10
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/core/PreParser.py +1 -1
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/core/enums.py +1 -1
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/core/warnings.py +8 -8
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2/src/preparse.egg-info}/PKG-INFO +2 -1
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse.egg-info/requires.txt +1 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/LICENSE.txt +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/MANIFEST.in +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/README.rst +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/setup.cfg +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/__init__.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/_parsing/Parsing.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/_parsing/__init__.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/core/__init__.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/__init__.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_expit.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_extra.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_extra_no_permutation.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_extra_posix.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_features.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_long_only.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_long_only_no_permutation.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_long_only_posix.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_parse.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_parse_no_permutation.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_parse_posix.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_warn_9001.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_warn_9002.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_warn_9005.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_warn_9006.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_warn_9007.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_warn_even_more.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_warn_more.py +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse.egg-info/SOURCES.txt +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse.egg-info/dependency_links.txt +0 -0
- {preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: preparse
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev2
|
|
4
4
|
Summary: This project preparses args for further parsing later on.
|
|
5
5
|
Author-email: Johannes <johannes-programming@mailfence.com>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -42,6 +42,7 @@ License-File: LICENSE.txt
|
|
|
42
42
|
Requires-Dist: click>=8.1.7
|
|
43
43
|
Requires-Dist: datarepr>=0.0.4
|
|
44
44
|
Requires-Dist: makeprop>=0.1
|
|
45
|
+
Requires-Dist: overloadable>=1.0.9
|
|
45
46
|
Requires-Dist: tofunc>=1.0
|
|
46
47
|
Dynamic: license-file
|
|
47
48
|
|
|
@@ -22,6 +22,7 @@ dependencies = [
|
|
|
22
22
|
"click>=8.1.7",
|
|
23
23
|
"datarepr>=0.0.4",
|
|
24
24
|
"makeprop>=0.1",
|
|
25
|
+
"overloadable>=1.0.9",
|
|
25
26
|
"tofunc>=1.0",
|
|
26
27
|
]
|
|
27
28
|
description = "This project preparses args for further parsing later on."
|
|
@@ -29,7 +30,7 @@ keywords = []
|
|
|
29
30
|
name = "preparse"
|
|
30
31
|
readme = "README.rst"
|
|
31
32
|
requires-python = ">=3.11"
|
|
32
|
-
version = "0.1.0.
|
|
33
|
+
version = "0.1.0.dev2"
|
|
33
34
|
|
|
34
35
|
[project.license]
|
|
35
36
|
file = "LICENSE.txt"
|
|
@@ -3,6 +3,8 @@ import functools
|
|
|
3
3
|
import types
|
|
4
4
|
from typing import *
|
|
5
5
|
|
|
6
|
+
import overloadable
|
|
7
|
+
|
|
6
8
|
__all__ = ["Click"]
|
|
7
9
|
|
|
8
10
|
|
|
@@ -13,16 +15,19 @@ class Click:
|
|
|
13
15
|
cmd: Any = True
|
|
14
16
|
ctx: Any = True
|
|
15
17
|
|
|
16
|
-
@
|
|
17
|
-
def __call__(self, target: Any) -> Any:
|
|
18
|
+
@overloadable.overloadable
|
|
19
|
+
def __call__(self: Self, target: Any) -> Any:
|
|
18
20
|
"This magic method implements self(target)."
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if isinstance(target, types.FunctionType):
|
|
22
|
+
return "function"
|
|
23
|
+
if isinstance(target, types.MethodType):
|
|
24
|
+
return "method"
|
|
25
|
+
return "other"
|
|
26
|
+
|
|
27
|
+
@__call__.overload("function")
|
|
28
|
+
def __call__(self: Self, target: types.FunctionType) -> types.FunctionType:
|
|
24
29
|
@functools.wraps(target)
|
|
25
|
-
def ans(cmd, ctx, args):
|
|
30
|
+
def ans(cmd: Any, ctx: Any, args: Any) -> Any:
|
|
26
31
|
p = self.parser.copy()
|
|
27
32
|
if self.cmd:
|
|
28
33
|
p.reflectClickCommand(cmd)
|
|
@@ -32,8 +37,13 @@ class Click:
|
|
|
32
37
|
|
|
33
38
|
return ans
|
|
34
39
|
|
|
35
|
-
@__call__.
|
|
36
|
-
def
|
|
40
|
+
@__call__.overload("method")
|
|
41
|
+
def __call__(self: Self, target: types.MethodType) -> types.MethodType:
|
|
37
42
|
func = self(target.__func__)
|
|
38
43
|
ans = types.MethodType(func, target.__self__)
|
|
39
44
|
return ans
|
|
45
|
+
|
|
46
|
+
@__call__.overload("other")
|
|
47
|
+
def __call__(self: Self, target: Any) -> Any:
|
|
48
|
+
target.parse_args = self(target.parse_args)
|
|
49
|
+
return target
|
|
@@ -119,7 +119,7 @@ class PreParser:
|
|
|
119
119
|
"This method causes the current instance to reflect a click.Context object."
|
|
120
120
|
self.prog = ctx.info_name
|
|
121
121
|
|
|
122
|
-
def todict(self) -> dict:
|
|
122
|
+
def todict(self: Self) -> dict:
|
|
123
123
|
"This method returns a dict representing the current instance."
|
|
124
124
|
ans = dict()
|
|
125
125
|
for slot in type(self).__slots__:
|
|
@@ -19,23 +19,23 @@ class PreparseWarning(Warning, metaclass=abc.ABCMeta):
|
|
|
19
19
|
for k, v in kwargs.items():
|
|
20
20
|
setattr(self, k, v)
|
|
21
21
|
|
|
22
|
-
def __str__(self) -> str:
|
|
22
|
+
def __str__(self: Self) -> str:
|
|
23
23
|
"This magic method implements str(self)."
|
|
24
24
|
return f"{self.prog}: {self.getmsg()}"
|
|
25
25
|
|
|
26
26
|
@property
|
|
27
|
-
def args(self):
|
|
27
|
+
def args(self: Self):
|
|
28
28
|
"This property returns (str(self),)."
|
|
29
29
|
return (str(self),)
|
|
30
30
|
|
|
31
31
|
@abc.abstractmethod
|
|
32
|
-
def getmsg(self) -> str: ...
|
|
32
|
+
def getmsg(self: Self) -> str: ...
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class PreparseAmbiguousOptionWarning(PreparseWarning):
|
|
36
36
|
__slots__ = ("prog", "option", "possibilities")
|
|
37
37
|
|
|
38
|
-
def getmsg(self) -> str:
|
|
38
|
+
def getmsg(self: Self) -> str:
|
|
39
39
|
"This method returns the core message."
|
|
40
40
|
ans = "option %r is ambiguous; possibilities:" % self.option
|
|
41
41
|
for x in self.possibilities:
|
|
@@ -46,7 +46,7 @@ class PreparseAmbiguousOptionWarning(PreparseWarning):
|
|
|
46
46
|
class PreparseInvalidOptionWarning(PreparseWarning):
|
|
47
47
|
__slots__ = ("prog", "option")
|
|
48
48
|
|
|
49
|
-
def getmsg(self) -> str:
|
|
49
|
+
def getmsg(self: Self) -> str:
|
|
50
50
|
"This method returns the core message."
|
|
51
51
|
return "invalid option -- %r" % self.option
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ class PreparseInvalidOptionWarning(PreparseWarning):
|
|
|
54
54
|
class PreparseRequiredArgumentWarning(PreparseWarning):
|
|
55
55
|
__slots__ = ("prog", "option")
|
|
56
56
|
|
|
57
|
-
def getmsg(self) -> str:
|
|
57
|
+
def getmsg(self: Self) -> str:
|
|
58
58
|
"This method returns the core message."
|
|
59
59
|
return "option requires an argument -- %r" % self.option
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ class PreparseRequiredArgumentWarning(PreparseWarning):
|
|
|
62
62
|
class PreparseUnallowedArgumentWarning(PreparseWarning):
|
|
63
63
|
__slots__ = ("prog", "option")
|
|
64
64
|
|
|
65
|
-
def getmsg(self) -> str:
|
|
65
|
+
def getmsg(self: Self) -> str:
|
|
66
66
|
"This method returns the core message."
|
|
67
67
|
return "option %r doesn't allow an argument" % self.option
|
|
68
68
|
|
|
@@ -70,6 +70,6 @@ class PreparseUnallowedArgumentWarning(PreparseWarning):
|
|
|
70
70
|
class PreparseUnrecognizedOptionWarning(PreparseWarning):
|
|
71
71
|
__slots__ = ("prog", "option")
|
|
72
72
|
|
|
73
|
-
def getmsg(self) -> str:
|
|
73
|
+
def getmsg(self: Self) -> str:
|
|
74
74
|
"This method returns the core message."
|
|
75
75
|
return "unrecognized option %r" % self.option
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: preparse
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev2
|
|
4
4
|
Summary: This project preparses args for further parsing later on.
|
|
5
5
|
Author-email: Johannes <johannes-programming@mailfence.com>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -42,6 +42,7 @@ License-File: LICENSE.txt
|
|
|
42
42
|
Requires-Dist: click>=8.1.7
|
|
43
43
|
Requires-Dist: datarepr>=0.0.4
|
|
44
44
|
Requires-Dist: makeprop>=0.1
|
|
45
|
+
Requires-Dist: overloadable>=1.0.9
|
|
45
46
|
Requires-Dist: tofunc>=1.0
|
|
46
47
|
Dynamic: license-file
|
|
47
48
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{preparse-0.1.0.dev0 → preparse-0.1.0.dev2}/src/preparse/tests/test_long_only_no_permutation.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|