nuclear 2.2.0__tar.gz → 2.2.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.
- {nuclear-2.2.0 → nuclear-2.2.2}/PKG-INFO +16 -7
- {nuclear-2.2.0 → nuclear-2.2.2}/README.md +15 -6
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/inspection/inspection.py +5 -5
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/sublog/context_error.py +1 -1
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/sublog/exception.py +1 -1
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/sublog/logging.py +1 -1
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/collections.py +2 -2
- nuclear-2.2.2/nuclear/version.py +1 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear.egg-info/PKG-INFO +16 -7
- nuclear-2.2.0/nuclear/version.py +0 -1
- {nuclear-2.2.0 → nuclear-2.2.2}/LICENSE +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/args/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/args/args_que.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/args/container.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/autocomplete/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/autocomplete/autocomplete.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/autocomplete/install.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/builder/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/builder/builder.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/builder/decorator_builder.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/builder/rule.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/builder/rule_factory.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/builder/typedef.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/completers/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/completers/file.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/help.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/context.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/error.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/inject.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/internal_vars.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/keyword.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/matcher.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/parser.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/transform.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/validate.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/parser/value.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/types/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/types/boolean.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/types/filesystem.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/cli/types/time.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/inspection/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/py.typed +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/shell/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/shell/background_cmd.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/shell/shell_utils.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/sublog/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/sublog/catch.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/__init__.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/config.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/datamodel.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/env.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/files.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/functools.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/input.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/regex.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/strings.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/time.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear/utils/url.py +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear.egg-info/SOURCES.txt +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear.egg-info/dependency_links.txt +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear.egg-info/requires.txt +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/nuclear.egg-info/top_level.txt +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/setup.cfg +0 -0
- {nuclear-2.2.0 → nuclear-2.2.2}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nuclear
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Declarative parser for command line interfaces
|
|
5
5
|
Home-page: https://github.com/igrek51/nuclear
|
|
6
6
|
Author: igrek51
|
|
@@ -136,13 +136,13 @@ with the following **modifiers**:
|
|
|
136
136
|
- `.nodocs` to hide documentation for functions and classes
|
|
137
137
|
- `.all` to include all available information
|
|
138
138
|
|
|
139
|
-
You can chain modifiers, e.g. `wat.long.dunder / object`.
|
|
139
|
+
You can chain modifiers, e.g. `wat.long.dunder.nodocs / object`.
|
|
140
140
|
|
|
141
141
|
Call `wat()` to inspect `locals()` variables.
|
|
142
142
|
|
|
143
143
|
Type `wat` in the interpreter to learn more about this object itself.
|
|
144
144
|
|
|
145
|
-
## Use
|
|
145
|
+
## Use Cases Examples
|
|
146
146
|
|
|
147
147
|
### Determine type
|
|
148
148
|
In a dynamic typing language like Python, it's often hard to determine the type of an object. WAT Inspector can help you with that by showing the name of the type with the module it comes from.
|
|
@@ -162,12 +162,14 @@ type: django.contrib.auth.models.User
|
|
|
162
162
|
parents: django.contrib.auth.models.AbstractUser, django.contrib.auth.base_user.AbstractBaseUser, django.contrib.auth.models.PermissionsMixin, django.db.models.base.Model, django.db.models.utils.AltersData
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
Now that you've identified the actual type, you can put the type annotations in your code to reduce the confusion.
|
|
166
|
+
|
|
165
167
|
### Look up methods
|
|
166
168
|
Listing methods, functions and looking up their signature is extremely beneficial to see how to use them.
|
|
167
169
|
Plus, you can read their docstrings.
|
|
168
170
|
|
|
169
171
|
```python
|
|
170
|
-
wat
|
|
172
|
+
wat / 'stringy'
|
|
171
173
|
```
|
|
172
174
|
|
|
173
175
|

|
|
@@ -176,13 +178,13 @@ wat('stringy')
|
|
|
176
178
|
See the docstrings and the signature of a function or a method to see how to use it.
|
|
177
179
|
|
|
178
180
|
```python
|
|
179
|
-
wat
|
|
181
|
+
wat / str.split
|
|
180
182
|
```
|
|
181
183
|
|
|
182
184
|

|
|
183
185
|
|
|
184
|
-
### Look up
|
|
185
|
-
|
|
186
|
+
### Look up attributes
|
|
187
|
+
List the attribues and their types to see what's really inside the inspected object.
|
|
186
188
|
```python
|
|
187
189
|
wat / re.match('(\d)_(.*)', '1_title')
|
|
188
190
|
```
|
|
@@ -244,6 +246,13 @@ wat / __builtins__
|
|
|
244
246
|
### Look up local variables
|
|
245
247
|
```python
|
|
246
248
|
wat()
|
|
249
|
+
# or
|
|
250
|
+
wat.locals
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Look up global variables
|
|
254
|
+
```python
|
|
255
|
+
wat.globals
|
|
247
256
|
```
|
|
248
257
|
|
|
249
258
|
|
|
@@ -121,13 +121,13 @@ with the following **modifiers**:
|
|
|
121
121
|
- `.nodocs` to hide documentation for functions and classes
|
|
122
122
|
- `.all` to include all available information
|
|
123
123
|
|
|
124
|
-
You can chain modifiers, e.g. `wat.long.dunder / object`.
|
|
124
|
+
You can chain modifiers, e.g. `wat.long.dunder.nodocs / object`.
|
|
125
125
|
|
|
126
126
|
Call `wat()` to inspect `locals()` variables.
|
|
127
127
|
|
|
128
128
|
Type `wat` in the interpreter to learn more about this object itself.
|
|
129
129
|
|
|
130
|
-
## Use
|
|
130
|
+
## Use Cases Examples
|
|
131
131
|
|
|
132
132
|
### Determine type
|
|
133
133
|
In a dynamic typing language like Python, it's often hard to determine the type of an object. WAT Inspector can help you with that by showing the name of the type with the module it comes from.
|
|
@@ -147,12 +147,14 @@ type: django.contrib.auth.models.User
|
|
|
147
147
|
parents: django.contrib.auth.models.AbstractUser, django.contrib.auth.base_user.AbstractBaseUser, django.contrib.auth.models.PermissionsMixin, django.db.models.base.Model, django.db.models.utils.AltersData
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
+
Now that you've identified the actual type, you can put the type annotations in your code to reduce the confusion.
|
|
151
|
+
|
|
150
152
|
### Look up methods
|
|
151
153
|
Listing methods, functions and looking up their signature is extremely beneficial to see how to use them.
|
|
152
154
|
Plus, you can read their docstrings.
|
|
153
155
|
|
|
154
156
|
```python
|
|
155
|
-
wat
|
|
157
|
+
wat / 'stringy'
|
|
156
158
|
```
|
|
157
159
|
|
|
158
160
|

|
|
@@ -161,13 +163,13 @@ wat('stringy')
|
|
|
161
163
|
See the docstrings and the signature of a function or a method to see how to use it.
|
|
162
164
|
|
|
163
165
|
```python
|
|
164
|
-
wat
|
|
166
|
+
wat / str.split
|
|
165
167
|
```
|
|
166
168
|
|
|
167
169
|

|
|
168
170
|
|
|
169
|
-
### Look up
|
|
170
|
-
|
|
171
|
+
### Look up attributes
|
|
172
|
+
List the attribues and their types to see what's really inside the inspected object.
|
|
171
173
|
```python
|
|
172
174
|
wat / re.match('(\d)_(.*)', '1_title')
|
|
173
175
|
```
|
|
@@ -229,6 +231,13 @@ wat / __builtins__
|
|
|
229
231
|
### Look up local variables
|
|
230
232
|
```python
|
|
231
233
|
wat()
|
|
234
|
+
# or
|
|
235
|
+
wat.locals
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Look up global variables
|
|
239
|
+
```python
|
|
240
|
+
wat.globals
|
|
232
241
|
```
|
|
233
242
|
|
|
234
243
|
|
|
@@ -141,7 +141,7 @@ def _iter_attributes(obj: Any, config: InspectConfig) -> Iterable[InspectAttribu
|
|
|
141
141
|
def _get_attribute_value(obj: Any, key: str) -> Any:
|
|
142
142
|
try:
|
|
143
143
|
return getattr(obj, key)
|
|
144
|
-
except
|
|
144
|
+
except BaseException as e:
|
|
145
145
|
return e
|
|
146
146
|
|
|
147
147
|
|
|
@@ -171,8 +171,8 @@ def _get_callable_signature(name: str, obj: Any) -> Optional[str]:
|
|
|
171
171
|
def _get_source_code(obj: Any) -> Optional[str]:
|
|
172
172
|
try:
|
|
173
173
|
return std_inspect.getsource(obj)
|
|
174
|
-
except (OSError, TypeError, IndentationError):
|
|
175
|
-
return
|
|
174
|
+
except (OSError, TypeError, IndentationError) as e:
|
|
175
|
+
return f'failed to get source code: {type(e)}: {e}'
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
def _get_doc(obj: Any, long: bool) -> Optional[str]:
|
|
@@ -244,9 +244,9 @@ def _format_dict_value(dic: Dict, indent: int) -> str:
|
|
|
244
244
|
return f'{STYLE_YELLOW}{{}}{RESET}'
|
|
245
245
|
|
|
246
246
|
|
|
247
|
-
def _format_list_value(
|
|
247
|
+
def _format_list_value(lst: List, indent: int) -> str:
|
|
248
248
|
lines: List[str] = []
|
|
249
|
-
for value in
|
|
249
|
+
for value in lst:
|
|
250
250
|
value_str = _format_value(value, indent)
|
|
251
251
|
lines.append(' ' * indent + f'{value_str},')
|
|
252
252
|
if lines:
|
|
@@ -17,7 +17,7 @@ def exception_details(e: BaseException) -> str:
|
|
|
17
17
|
traceback_str = ', '.join(traceback_lines)
|
|
18
18
|
cause = _root_cause_type(e)
|
|
19
19
|
error_msg = _error_message(e)
|
|
20
|
-
return f'{error_msg}
|
|
20
|
+
return f'{error_msg}, cause={cause}, traceback={traceback_str}'
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def extended_exception_details(e: BaseException) -> Tuple[str, Dict]:
|
|
@@ -9,7 +9,7 @@ def chunks(lst: List[T], n: int) -> Iterable[List[T]]:
|
|
|
9
9
|
yield lst[i:i + n]
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def deduplicate_latest(items:
|
|
12
|
+
def deduplicate_latest(items: List[T], key: Callable[[T], Any]) -> List[T]:
|
|
13
13
|
"""Deduplicate items in the list by key. Keep the earliest items first, remove the latest duplicates"""
|
|
14
14
|
ids = set()
|
|
15
15
|
dedup_items: List[T] = []
|
|
@@ -21,7 +21,7 @@ def deduplicate_latest(items: list[T], key: Callable[[T], Any]) -> list[T]:
|
|
|
21
21
|
return dedup_items
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def deduplicate_earliest(items:
|
|
24
|
+
def deduplicate_earliest(items: List[T], key: Callable[[T], Any]) -> List[T]:
|
|
25
25
|
"""Deduplicate items in the list by key. Keep the latest items, remove the earliest duplicates"""
|
|
26
26
|
ids = set()
|
|
27
27
|
dedup_items: List[T] = []
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.2"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nuclear
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Declarative parser for command line interfaces
|
|
5
5
|
Home-page: https://github.com/igrek51/nuclear
|
|
6
6
|
Author: igrek51
|
|
@@ -136,13 +136,13 @@ with the following **modifiers**:
|
|
|
136
136
|
- `.nodocs` to hide documentation for functions and classes
|
|
137
137
|
- `.all` to include all available information
|
|
138
138
|
|
|
139
|
-
You can chain modifiers, e.g. `wat.long.dunder / object`.
|
|
139
|
+
You can chain modifiers, e.g. `wat.long.dunder.nodocs / object`.
|
|
140
140
|
|
|
141
141
|
Call `wat()` to inspect `locals()` variables.
|
|
142
142
|
|
|
143
143
|
Type `wat` in the interpreter to learn more about this object itself.
|
|
144
144
|
|
|
145
|
-
## Use
|
|
145
|
+
## Use Cases Examples
|
|
146
146
|
|
|
147
147
|
### Determine type
|
|
148
148
|
In a dynamic typing language like Python, it's often hard to determine the type of an object. WAT Inspector can help you with that by showing the name of the type with the module it comes from.
|
|
@@ -162,12 +162,14 @@ type: django.contrib.auth.models.User
|
|
|
162
162
|
parents: django.contrib.auth.models.AbstractUser, django.contrib.auth.base_user.AbstractBaseUser, django.contrib.auth.models.PermissionsMixin, django.db.models.base.Model, django.db.models.utils.AltersData
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
Now that you've identified the actual type, you can put the type annotations in your code to reduce the confusion.
|
|
166
|
+
|
|
165
167
|
### Look up methods
|
|
166
168
|
Listing methods, functions and looking up their signature is extremely beneficial to see how to use them.
|
|
167
169
|
Plus, you can read their docstrings.
|
|
168
170
|
|
|
169
171
|
```python
|
|
170
|
-
wat
|
|
172
|
+
wat / 'stringy'
|
|
171
173
|
```
|
|
172
174
|
|
|
173
175
|

|
|
@@ -176,13 +178,13 @@ wat('stringy')
|
|
|
176
178
|
See the docstrings and the signature of a function or a method to see how to use it.
|
|
177
179
|
|
|
178
180
|
```python
|
|
179
|
-
wat
|
|
181
|
+
wat / str.split
|
|
180
182
|
```
|
|
181
183
|
|
|
182
184
|

|
|
183
185
|
|
|
184
|
-
### Look up
|
|
185
|
-
|
|
186
|
+
### Look up attributes
|
|
187
|
+
List the attribues and their types to see what's really inside the inspected object.
|
|
186
188
|
```python
|
|
187
189
|
wat / re.match('(\d)_(.*)', '1_title')
|
|
188
190
|
```
|
|
@@ -244,6 +246,13 @@ wat / __builtins__
|
|
|
244
246
|
### Look up local variables
|
|
245
247
|
```python
|
|
246
248
|
wat()
|
|
249
|
+
# or
|
|
250
|
+
wat.locals
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Look up global variables
|
|
254
|
+
```python
|
|
255
|
+
wat.globals
|
|
247
256
|
```
|
|
248
257
|
|
|
249
258
|
|
nuclear-2.2.0/nuclear/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.0"
|
|
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
|
|
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
|
|
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
|