nano-dev-utils 0.3.3__tar.gz → 0.3.5__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.
Potentially problematic release.
This version of nano-dev-utils might be problematic. Click here for more details.
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/workspace.xml +31 -4
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/PKG-INFO +8 -8
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/README.md +7 -7
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/pyproject.toml +1 -1
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/src/nano_dev_utils/dynamic_importer.py +4 -2
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.gitignore +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/.gitignore +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/misc.xml +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/modules.xml +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/nano_dev_utils.iml +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/vcs.xml +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/LICENSE.md +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/src/nano_dev_utils/__init__.py +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/src/nano_dev_utils/release_ports.py +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/src/nano_dev_utils/timers.py +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/tests/__init__.py +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/tests/testing_dynamic_importer.py +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/tests/testing_release_ports.py +0 -0
- {nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/tests/testing_timer.py +0 -0
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="96bbbefe-efb6-42c4-93da-e069ac3e654f" name="Changes" comment="
|
|
7
|
+
<list default="true" id="96bbbefe-efb6-42c4-93da-e069ac3e654f" name="Changes" comment="minor update">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
|
9
|
+
</list>
|
|
8
10
|
<option name="SHOW_DIALOG" value="false" />
|
|
9
11
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
12
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
"Python tests.Python tests in tests.executor": "Run",
|
|
35
37
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
36
38
|
"git-widget-placeholder": "master",
|
|
39
|
+
"ignore.virus.scanning.warn.message": "true",
|
|
37
40
|
"last_opened_file_path": "C:/GitHubWS/nano_dev_utils",
|
|
38
41
|
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
|
|
39
42
|
}
|
|
@@ -213,7 +216,31 @@
|
|
|
213
216
|
<option name="project" value="LOCAL" />
|
|
214
217
|
<updated>1745713915283</updated>
|
|
215
218
|
</task>
|
|
216
|
-
<
|
|
219
|
+
<task id="LOCAL-00014" summary="minor update">
|
|
220
|
+
<option name="closed" value="true" />
|
|
221
|
+
<created>1745714123280</created>
|
|
222
|
+
<option name="number" value="00014" />
|
|
223
|
+
<option name="presentableId" value="LOCAL-00014" />
|
|
224
|
+
<option name="project" value="LOCAL" />
|
|
225
|
+
<updated>1745714123280</updated>
|
|
226
|
+
</task>
|
|
227
|
+
<task id="LOCAL-00015" summary="minor update">
|
|
228
|
+
<option name="closed" value="true" />
|
|
229
|
+
<created>1745715895476</created>
|
|
230
|
+
<option name="number" value="00015" />
|
|
231
|
+
<option name="presentableId" value="LOCAL-00015" />
|
|
232
|
+
<option name="project" value="LOCAL" />
|
|
233
|
+
<updated>1745715895476</updated>
|
|
234
|
+
</task>
|
|
235
|
+
<task id="LOCAL-00016" summary="minor update">
|
|
236
|
+
<option name="closed" value="true" />
|
|
237
|
+
<created>1745715934159</created>
|
|
238
|
+
<option name="number" value="00016" />
|
|
239
|
+
<option name="presentableId" value="LOCAL-00016" />
|
|
240
|
+
<option name="project" value="LOCAL" />
|
|
241
|
+
<updated>1745715934159</updated>
|
|
242
|
+
</task>
|
|
243
|
+
<option name="localTasksCounter" value="17" />
|
|
217
244
|
<servers />
|
|
218
245
|
</component>
|
|
219
246
|
<component name="Vcs.Log.Tabs.Properties">
|
|
@@ -238,9 +265,9 @@
|
|
|
238
265
|
<MESSAGE value="Optional: modernized style for py>=3.10" />
|
|
239
266
|
<MESSAGE value="essential field updates" />
|
|
240
267
|
<MESSAGE value="dunder init update" />
|
|
241
|
-
<MESSAGE value="minor update" />
|
|
242
268
|
<MESSAGE value="fixed authors and url for pip show" />
|
|
243
269
|
<MESSAGE value="version update" />
|
|
244
|
-
<
|
|
270
|
+
<MESSAGE value="minor update" />
|
|
271
|
+
<option name="LAST_COMMIT_MESSAGE" value="minor update" />
|
|
245
272
|
</component>
|
|
246
273
|
</project>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nano_dev_utils
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: A collection of small Python utilities for developers.
|
|
5
5
|
Project-URL: Homepage, https://github.com/yaronday/nano_utils
|
|
6
6
|
Project-URL: Issues, https://github.com/yaronday/nano_utils/issues
|
|
@@ -26,13 +26,13 @@ This module provides a `Timer` class for measuring the execution time of code bl
|
|
|
26
26
|
|
|
27
27
|
* **`__init__(self, precision=4, verbose=False)`**: Initializes a `Timer` instance.
|
|
28
28
|
* `precision` (int, optional): The number of decimal places to record and
|
|
29
|
-
|
|
30
|
-
* `verbose` (bool, optional): If `True`, the function's arguments and keyword
|
|
31
|
-
|
|
29
|
+
display time durations. Defaults to 4.
|
|
30
|
+
* `verbose` (bool, optional): If `True`, the function's arguments (args) and keyword arguments (kwargs)
|
|
31
|
+
will be included in the printed timing output. Defaults to `False`.
|
|
32
32
|
|
|
33
33
|
* **`timeit(self, func)`**: A decorator that measures the execution time of the decorated function.
|
|
34
34
|
* When the decorated function is called, this decorator records the start and end times,
|
|
35
|
-
* calculates the total execution time, prints the function name and execution time
|
|
35
|
+
* calculates the total execution time, prints the function name and execution time.
|
|
36
36
|
* (optionally including arguments if `verbose` is `True`), and returns the result of the original function.
|
|
37
37
|
|
|
38
38
|
#### Example Usage:
|
|
@@ -101,16 +101,16 @@ listening on specified TCP ports. It supports Windows, Linux, and macOS.
|
|
|
101
101
|
|
|
102
102
|
* **`get_pid_by_port(port: int) -> Optional[int]`**: A static method that attempts to
|
|
103
103
|
* find the process ID (PID) listening on the given `port`. It uses platform-specific
|
|
104
|
-
|
|
104
|
+
commands (`netstat`, `ss`, `lsof`). Returns the PID if found, otherwise `None`.
|
|
105
105
|
|
|
106
106
|
* **`kill_process(pid: int) -> bool`**: A static method that attempts to kill the process
|
|
107
|
-
|
|
107
|
+
with the given `pid`. It uses platform-specific commands (`taskkill`, `kill -9`).
|
|
108
108
|
* Returns `True` if the process was successfully killed, `False` otherwise.
|
|
109
109
|
|
|
110
110
|
* **`release_all(self, ports: Optional[list[int]] = None) -> None`**: Releases all processes
|
|
111
111
|
* listening on the specified `ports`.
|
|
112
112
|
* `ports` (`list[int]`, *optional*): A list of ports to release. If `None`, it uses the
|
|
113
|
-
|
|
113
|
+
`default_ports` defined during initialization.
|
|
114
114
|
* For each port, it first tries to get the PID and then attempts to kill the process.
|
|
115
115
|
* It logs the actions and any errors encountered. Invalid port numbers in the provided list are skipped.
|
|
116
116
|
|
|
@@ -12,13 +12,13 @@ This module provides a `Timer` class for measuring the execution time of code bl
|
|
|
12
12
|
|
|
13
13
|
* **`__init__(self, precision=4, verbose=False)`**: Initializes a `Timer` instance.
|
|
14
14
|
* `precision` (int, optional): The number of decimal places to record and
|
|
15
|
-
|
|
16
|
-
* `verbose` (bool, optional): If `True`, the function's arguments and keyword
|
|
17
|
-
|
|
15
|
+
display time durations. Defaults to 4.
|
|
16
|
+
* `verbose` (bool, optional): If `True`, the function's arguments (args) and keyword arguments (kwargs)
|
|
17
|
+
will be included in the printed timing output. Defaults to `False`.
|
|
18
18
|
|
|
19
19
|
* **`timeit(self, func)`**: A decorator that measures the execution time of the decorated function.
|
|
20
20
|
* When the decorated function is called, this decorator records the start and end times,
|
|
21
|
-
* calculates the total execution time, prints the function name and execution time
|
|
21
|
+
* calculates the total execution time, prints the function name and execution time.
|
|
22
22
|
* (optionally including arguments if `verbose` is `True`), and returns the result of the original function.
|
|
23
23
|
|
|
24
24
|
#### Example Usage:
|
|
@@ -87,16 +87,16 @@ listening on specified TCP ports. It supports Windows, Linux, and macOS.
|
|
|
87
87
|
|
|
88
88
|
* **`get_pid_by_port(port: int) -> Optional[int]`**: A static method that attempts to
|
|
89
89
|
* find the process ID (PID) listening on the given `port`. It uses platform-specific
|
|
90
|
-
|
|
90
|
+
commands (`netstat`, `ss`, `lsof`). Returns the PID if found, otherwise `None`.
|
|
91
91
|
|
|
92
92
|
* **`kill_process(pid: int) -> bool`**: A static method that attempts to kill the process
|
|
93
|
-
|
|
93
|
+
with the given `pid`. It uses platform-specific commands (`taskkill`, `kill -9`).
|
|
94
94
|
* Returns `True` if the process was successfully killed, `False` otherwise.
|
|
95
95
|
|
|
96
96
|
* **`release_all(self, ports: Optional[list[int]] = None) -> None`**: Releases all processes
|
|
97
97
|
* listening on the specified `ports`.
|
|
98
98
|
* `ports` (`list[int]`, *optional*): A list of ports to release. If `None`, it uses the
|
|
99
|
-
|
|
99
|
+
`default_ports` defined during initialization.
|
|
100
100
|
* For each port, it first tries to get the PID and then attempts to kill the process.
|
|
101
101
|
* It logs the actions and any errors encountered. Invalid port numbers in the provided list are skipped.
|
|
102
102
|
|
|
@@ -17,12 +17,14 @@ class Importer:
|
|
|
17
17
|
if module_name in self.imported_modules:
|
|
18
18
|
return self.imported_modules[module_name]
|
|
19
19
|
|
|
20
|
+
lib_mod = f'{library}.{module_name}'
|
|
21
|
+
|
|
20
22
|
try:
|
|
21
|
-
module = importlib.import_module(
|
|
23
|
+
module = importlib.import_module(lib_mod)
|
|
22
24
|
self.imported_modules[module_name] = module
|
|
23
25
|
return module
|
|
24
26
|
except ModuleNotFoundError as e:
|
|
25
|
-
raise ImportError(f
|
|
27
|
+
raise ImportError(f'Could not import {lib_mod}') from e
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
|
|
File without changes
|
|
File without changes
|
{nano_dev_utils-0.3.3 → nano_dev_utils-0.3.5}/.idea/inspectionProfiles/profiles_settings.xml
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
|