superparsing 0.2.2__tar.gz → 0.3.1__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.
- {superparsing-0.2.2 → superparsing-0.3.1}/PKG-INFO +1 -1
- {superparsing-0.2.2 → superparsing-0.3.1}/pyproject.toml +1 -1
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing/core/SuperParser.py +11 -6
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing.egg-info/PKG-INFO +1 -1
- {superparsing-0.2.2 → superparsing-0.3.1}/LICENSE.txt +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/MANIFEST.in +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/README.rst +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/run_tests.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/setup.cfg +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing/__init__.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing/core/SubCommand.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing/core/SuperFlag.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing/core/SuperParseError.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing/core/__init__.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing/py.typed +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing.egg-info/SOURCES.txt +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing.egg-info/dependency_links.txt +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/src/superparsing.egg-info/top_level.txt +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/tests/test_0.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/tests/test_comprehensive_TestParseArgs.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/tests/test_comprehensive_TestSubCommand.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/tests/test_comprehensive_TestSuperFlag.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/tests/test_comprehensive_TestSuperParserBasics.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/tests/test_comprehensive_TestSuperParserText.py +0 -0
- {superparsing-0.2.2 → superparsing-0.3.1}/tests/test_patch.py +0 -0
|
@@ -21,6 +21,7 @@ ARGS_MESSAGE: Final[str] = (
|
|
|
21
21
|
|
|
22
22
|
@dataclass
|
|
23
23
|
class SuperParser:
|
|
24
|
+
description: object = field(default=None, kw_only=True)
|
|
24
25
|
fromfile_prefix_chars: object = field(default="", kw_only=True)
|
|
25
26
|
helpFlag: SuperFlag = field(
|
|
26
27
|
default_factory=partial(SuperFlag, help="print this message and exit"),
|
|
@@ -33,6 +34,12 @@ class SuperParser:
|
|
|
33
34
|
kw_only=True,
|
|
34
35
|
)
|
|
35
36
|
|
|
37
|
+
def _description(self: Self) -> Optional[str]:
|
|
38
|
+
if self.description is None:
|
|
39
|
+
return None
|
|
40
|
+
else:
|
|
41
|
+
return str(self.description)
|
|
42
|
+
|
|
36
43
|
def _keys_message(self: Self) -> Optional[str]:
|
|
37
44
|
ans: str
|
|
38
45
|
help_intro: str
|
|
@@ -87,6 +94,7 @@ class SuperParser:
|
|
|
87
94
|
if intro is not None:
|
|
88
95
|
return intro
|
|
89
96
|
ans = list()
|
|
97
|
+
ans.append(self._description())
|
|
90
98
|
ans.append(self.usage())
|
|
91
99
|
ans.append(self._keys_message())
|
|
92
100
|
ans.append(self._subCommands_message())
|
|
@@ -112,12 +120,9 @@ class SuperParser:
|
|
|
112
120
|
args_.extend(stream.read().splitlines())
|
|
113
121
|
shortopts = self.helpFlag.shortopts() + self.versionFlag.shortopts()
|
|
114
122
|
longopts = self.helpFlag.longopts() + self.versionFlag.longopts()
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
)
|
|
119
|
-
except Exception:
|
|
120
|
-
raise SuperParseError("Failed getopt!")
|
|
123
|
+
optitems, args_ = getopt.getopt(
|
|
124
|
+
args=args_, shortopts=shortopts, longopts=longopts
|
|
125
|
+
)
|
|
121
126
|
if set(self.helpFlag._keys()).intersection(dict(optitems).keys()):
|
|
122
127
|
_print(self.help())
|
|
123
128
|
return list()
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|