sferriol-python 0.6.0__tar.gz → 0.7.3__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.
- {sferriol_python-0.6.0/sferriol_python.egg-info → sferriol_python-0.7.3}/PKG-INFO +1 -1
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol/python/__init__.py +9 -2
- sferriol_python-0.6.0/sferriol/python/_asyncio.py → sferriol_python-0.7.3/sferriol/python/asyncio.py +3 -3
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol/python/net.py +7 -5
- {sferriol_python-0.6.0 → sferriol_python-0.7.3/sferriol_python.egg-info}/PKG-INFO +1 -1
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol_python.egg-info/SOURCES.txt +1 -1
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/LICENSE +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/README.md +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/pyproject.toml +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/setup.cfg +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/setup.py +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol/python/dictionary/__init__.py +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol/python/env.py +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol/python/json.py +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol/python/object.py +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol/python/os.py +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol_python.egg-info/dependency_links.txt +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol_python.egg-info/requires.txt +0 -0
- {sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol_python.egg-info/top_level.txt +0 -0
|
@@ -4,8 +4,6 @@ import time
|
|
|
4
4
|
import types
|
|
5
5
|
from typing import Any, Callable
|
|
6
6
|
|
|
7
|
-
import _asyncio as asyncio
|
|
8
|
-
|
|
9
7
|
|
|
10
8
|
def load_module_from_file(fpath):
|
|
11
9
|
"""
|
|
@@ -58,3 +56,12 @@ def module_name_from_file(fpath):
|
|
|
58
56
|
Return The module name of the associated python file.
|
|
59
57
|
"""
|
|
60
58
|
return pathlib.Path(fpath).stem
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def update_methods(obj, functions):
|
|
62
|
+
"""
|
|
63
|
+
Update object methods by bounding new functions to instance obj
|
|
64
|
+
"""
|
|
65
|
+
for func in functions:
|
|
66
|
+
name = func.__name__
|
|
67
|
+
setattr(obj, name, types.MethodType(func, obj))
|
sferriol_python-0.6.0/sferriol/python/_asyncio.py → sferriol_python-0.7.3/sferriol/python/asyncio.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import asyncio
|
|
1
|
+
import asyncio as _asyncio
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
async def run_shell_cmd(cmd: str) -> (int, str, str):
|
|
@@ -7,7 +7,7 @@ async def run_shell_cmd(cmd: str) -> (int, str, str):
|
|
|
7
7
|
Returns:
|
|
8
8
|
Tuple (returned code, stdout, stderr)
|
|
9
9
|
"""
|
|
10
|
-
proc = await
|
|
11
|
-
cmd, stdout=
|
|
10
|
+
proc = await _asyncio.create_subprocess_shell(
|
|
11
|
+
cmd, stdout=_asyncio.subprocess.PIPE, stderr=_asyncio.subprocess.PIPE)
|
|
12
12
|
stdout, stderr = await proc.communicate()
|
|
13
13
|
return proc.returncode, stdout.decode().strip(), stderr.decode().strip()
|
|
@@ -34,11 +34,13 @@ def get_interface_ip_address(if_str: str) -> str:
|
|
|
34
34
|
if_name = get_interface_name(if_str) if is_ipv4_address(if_str) else if_str
|
|
35
35
|
if if_name in list_interfaces():
|
|
36
36
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
try:
|
|
38
|
+
return socket.inet_ntoa(
|
|
39
|
+
fcntl.ioctl(s.fileno(), 0x8915,
|
|
40
|
+
struct.pack('256s', bytes(if_name[:15],
|
|
41
|
+
'utf-8')))[20:24])
|
|
42
|
+
except OSError:
|
|
43
|
+
pass
|
|
42
44
|
|
|
43
45
|
def get_interface_name(ip_addr: str) -> str:
|
|
44
46
|
"""Returns the interface name
|
|
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
|
{sferriol_python-0.6.0 → sferriol_python-0.7.3}/sferriol_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|