sferriol-python 0.7.1__tar.gz → 0.8.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.
Files changed (23) hide show
  1. {sferriol_python-0.7.1/sferriol_python.egg-info → sferriol_python-0.8.1}/PKG-INFO +3 -2
  2. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol/python/__init__.py +1 -1
  3. sferriol_python-0.7.1/sferriol/python/_asyncio.py → sferriol_python-0.8.1/sferriol/python/asyncio.py +3 -3
  4. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol/python/net.py +7 -5
  5. sferriol_python-0.8.1/sferriol/python/pkg.py +17 -0
  6. sferriol_python-0.8.1/sferriol/python/test/pkg/__init__.py +4 -0
  7. sferriol_python-0.8.1/sferriol/python/test/pkg/toto.py +1 -0
  8. sferriol_python-0.8.1/sferriol/python/test/pkg/tutu.py +1 -0
  9. {sferriol_python-0.7.1 → sferriol_python-0.8.1/sferriol_python.egg-info}/PKG-INFO +3 -2
  10. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol_python.egg-info/SOURCES.txt +6 -2
  11. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/LICENSE +0 -0
  12. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/README.md +0 -0
  13. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/pyproject.toml +0 -0
  14. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/setup.cfg +0 -0
  15. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/setup.py +0 -0
  16. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol/python/dictionary/__init__.py +0 -0
  17. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol/python/env.py +0 -0
  18. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol/python/json.py +0 -0
  19. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol/python/object.py +0 -0
  20. /sferriol_python-0.7.1/sferriol/python/os.py → /sferriol_python-0.8.1/sferriol/python/os_.py +0 -0
  21. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol_python.egg-info/dependency_links.txt +0 -0
  22. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol_python.egg-info/requires.txt +0 -0
  23. {sferriol_python-0.7.1 → sferriol_python-0.8.1}/sferriol_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: sferriol-python
3
- Version: 0.7.1
3
+ Version: 0.8.1
4
4
  Summary: python utilities
5
5
  Home-page: https://gitlab.in2p3.fr/sferriol-ip2i/sferriol-python
6
6
  Author: Sylvain Ferriol
@@ -13,6 +13,7 @@ License-File: LICENSE
13
13
  Provides-Extra: dev
14
14
  Requires-Dist: click; extra == "dev"
15
15
  Requires-Dist: yapf; extra == "dev"
16
+ Dynamic: license-file
16
17
 
17
18
  # sferriol-python
18
19
 
@@ -4,7 +4,7 @@ import time
4
4
  import types
5
5
  from typing import Any, Callable
6
6
 
7
- import _asyncio as asyncio
7
+ import sferriol.python.os_ as os
8
8
 
9
9
 
10
10
  def load_module_from_file(fpath):
@@ -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 asyncio.create_subprocess_shell(
11
- cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
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
- return socket.inet_ntoa(
38
- fcntl.ioctl(s.fileno(), 0x8915,
39
- struct.pack('256s', bytes(if_name[:15],
40
- 'utf-8')))[20:24])
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
@@ -0,0 +1,17 @@
1
+ import importlib
2
+ import pkgutil
3
+ import sys
4
+
5
+ from sferriol.python import module_name_from_file
6
+
7
+
8
+ def reload(pkg):
9
+ "Reload package and its sub modules"
10
+ pkg_name = pkg.__name__
11
+ pkg_path = pkg.__path__
12
+ if pkg_name in sys.modules:
13
+ importlib.reload(sys.modules[pkg_name])
14
+ for _, module_name, _ in pkgutil.iter_modules(pkg_path):
15
+ module = f"{pkg_name}.{module_name}"
16
+ if module in sys.modules:
17
+ importlib.reload(sys.modules[module])
@@ -0,0 +1,4 @@
1
+ from .toto import *
2
+ from .tutu import *
3
+
4
+ hello3 = 'world3'
@@ -0,0 +1 @@
1
+ hello = 'world'
@@ -0,0 +1 @@
1
+ hello2 = 'world2'
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: sferriol-python
3
- Version: 0.7.1
3
+ Version: 0.8.1
4
4
  Summary: python utilities
5
5
  Home-page: https://gitlab.in2p3.fr/sferriol-ip2i/sferriol-python
6
6
  Author: Sylvain Ferriol
@@ -13,6 +13,7 @@ License-File: LICENSE
13
13
  Provides-Extra: dev
14
14
  Requires-Dist: click; extra == "dev"
15
15
  Requires-Dist: yapf; extra == "dev"
16
+ Dynamic: license-file
16
17
 
17
18
  # sferriol-python
18
19
 
@@ -4,13 +4,17 @@ pyproject.toml
4
4
  setup.cfg
5
5
  setup.py
6
6
  sferriol/python/__init__.py
7
- sferriol/python/_asyncio.py
7
+ sferriol/python/asyncio.py
8
8
  sferriol/python/env.py
9
9
  sferriol/python/json.py
10
10
  sferriol/python/net.py
11
11
  sferriol/python/object.py
12
- sferriol/python/os.py
12
+ sferriol/python/os_.py
13
+ sferriol/python/pkg.py
13
14
  sferriol/python/dictionary/__init__.py
15
+ sferriol/python/test/pkg/__init__.py
16
+ sferriol/python/test/pkg/toto.py
17
+ sferriol/python/test/pkg/tutu.py
14
18
  sferriol_python.egg-info/PKG-INFO
15
19
  sferriol_python.egg-info/SOURCES.txt
16
20
  sferriol_python.egg-info/dependency_links.txt
File without changes