fb-tools 3.1.0__tar.gz → 3.2.0__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.
- {fb_tools-3.1.0 → fb_tools-3.2.0}/PKG-INFO +1 -1
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/__init__.py +1 -1
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/socket_obj/__init__.py +36 -1
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/socket_obj/tcp.py +27 -4
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/socket_obj/unix.py +10 -1
- {fb_tools-3.1.0 → fb_tools-3.2.0}/LICENSE +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/README.md +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/data/share/locale/de/LC_MESSAGES/fb_tools.mo +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/data/share/locale/en/LC_MESSAGES/fb_tools.mo +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/pyproject.toml +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/any_config.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/app.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/application/__init__.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/application/cfg_converter.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/application/get_file_rm.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/application/show_spinner.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/argparse_actions.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_app.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_options/__init__.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_options/dump.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_options/hjson.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_options/inifile.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_options/json.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_options/toml.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/cfg_options/yaml.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/colcts.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/collections.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/common.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/config.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/errors.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/handler/__init__.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/handler/lock.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/handling_obj.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/mailaddress.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/merge.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/multi_config/__init__.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/multi_config/files.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/multi_config/inits.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/obj.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/pidfile.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/spinner.py +0 -0
- {fb_tools-3.1.0 → fb_tools-3.2.0}/src/fb_tools/xlate.py +0 -0
|
@@ -34,7 +34,7 @@ from ..errors import GenericSocketError
|
|
|
34
34
|
from ..handling_obj import HandlingObject
|
|
35
35
|
from ..xlate import XLATOR
|
|
36
36
|
|
|
37
|
-
__version__ = "0.
|
|
37
|
+
__version__ = "0.8.0"
|
|
38
38
|
|
|
39
39
|
LOG = logging.getLogger(__name__)
|
|
40
40
|
|
|
@@ -71,6 +71,7 @@ class GenericSocket(HandlingObject):
|
|
|
71
71
|
* initialized (bool - rw) (inherited from FbBaseObject)
|
|
72
72
|
* interrupted (bool - rw) (inherited from HandlingObject)
|
|
73
73
|
* is_venv (bool - ro) (inherited from HandlingObject)
|
|
74
|
+
* name (str - ro)
|
|
74
75
|
* polling_interval (float - rw)
|
|
75
76
|
* prompt_timeout (int - rw) (inherited from HandlingObject)
|
|
76
77
|
* quiet (bool - rw) (inherited from HandlingObject)
|
|
@@ -365,6 +366,12 @@ class GenericSocket(HandlingObject):
|
|
|
365
366
|
|
|
366
367
|
self._polling_interval = v
|
|
367
368
|
|
|
369
|
+
# -----------------------------------------------------------
|
|
370
|
+
@property
|
|
371
|
+
def name(self):
|
|
372
|
+
"""Return a descriptive name of this socket."""
|
|
373
|
+
return self._name()
|
|
374
|
+
|
|
368
375
|
# -------------------------------------------------------------------------
|
|
369
376
|
@abstractmethod
|
|
370
377
|
def connect(self):
|
|
@@ -377,6 +384,17 @@ class GenericSocket(HandlingObject):
|
|
|
377
384
|
"""Create the socket and listen on it."""
|
|
378
385
|
raise FunctionNotImplementedError("bind", self.__class__.__name__)
|
|
379
386
|
|
|
387
|
+
# -------------------------------------------------------------------------
|
|
388
|
+
@abstractmethod
|
|
389
|
+
def _name(self):
|
|
390
|
+
"""
|
|
391
|
+
Return a descriptive name of this socket.
|
|
392
|
+
|
|
393
|
+
It might be unique on the system as possible.
|
|
394
|
+
This methos ha to be overridden in descendent classes.
|
|
395
|
+
"""
|
|
396
|
+
raise FunctionNotImplementedError("_name", self.__class__.__name__)
|
|
397
|
+
|
|
380
398
|
# -------------------------------------------------------------------------
|
|
381
399
|
def as_dict(self, short=False):
|
|
382
400
|
"""
|
|
@@ -395,6 +413,7 @@ class GenericSocket(HandlingObject):
|
|
|
395
413
|
res["connected"] = self.connected
|
|
396
414
|
res["encoding"] = self.encoding
|
|
397
415
|
res["fileno"] = self.fileno
|
|
416
|
+
res["name"] = self.name
|
|
398
417
|
res["polling_interval"] = self.polling_interval
|
|
399
418
|
res["request_queue_size"] = self.request_queue_size
|
|
400
419
|
res["timeout"] = self.timeout
|
|
@@ -666,6 +685,22 @@ class GenericSocket(HandlingObject):
|
|
|
666
685
|
|
|
667
686
|
return result
|
|
668
687
|
|
|
688
|
+
# -------------------------------------------------------------------------
|
|
689
|
+
def __enter__(self):
|
|
690
|
+
"""Execute this action, when this socket will be opened by the with-block."""
|
|
691
|
+
LOG.debug(
|
|
692
|
+
_("Opened the {cls} {name!r} ...").format(cls=self.__class__.__name__, name=self.name)
|
|
693
|
+
)
|
|
694
|
+
|
|
695
|
+
# -------------------------------------------------------------------------
|
|
696
|
+
def __exit__(self, exc_type, exc_val, exc_traceback):
|
|
697
|
+
"""Exit action at the end of the with-block - closing socket."""
|
|
698
|
+
LOG.debug(
|
|
699
|
+
_("Closing the {cls} {name!r} ...").format(cls=self.__class__.__name__, name=self.name)
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
self.close()
|
|
703
|
+
|
|
669
704
|
|
|
670
705
|
# =============================================================================
|
|
671
706
|
|
|
@@ -24,7 +24,7 @@ from ..common import pp
|
|
|
24
24
|
from ..errors import GenericSocketError
|
|
25
25
|
from ..xlate import XLATOR
|
|
26
26
|
|
|
27
|
-
__version__ = "0.
|
|
27
|
+
__version__ = "0.5.0"
|
|
28
28
|
|
|
29
29
|
LOG = logging.getLogger(__name__)
|
|
30
30
|
|
|
@@ -67,6 +67,7 @@ class TcpSocket(GenericSocket):
|
|
|
67
67
|
* initialized (bool - rw) (inherited from FbBaseObject)
|
|
68
68
|
* interrupted (bool - rw) (inherited from HandlingObject)
|
|
69
69
|
* is_venv (bool - ro) (inherited from HandlingObject)
|
|
70
|
+
* name (str - ro) (inherited from GenericSocket)
|
|
70
71
|
* own_address (ipaddress - ro)
|
|
71
72
|
* polling_interval (float - rw) (inherited from GenericSocket)
|
|
72
73
|
* port (int - rw)
|
|
@@ -111,10 +112,11 @@ class TcpSocket(GenericSocket):
|
|
|
111
112
|
@raise TcpSocketError: on a uncoverable error.
|
|
112
113
|
|
|
113
114
|
@param address: the hostname or IP address, where to connect to or on which listening to.
|
|
114
|
-
If it can be converted to a
|
|
115
|
+
If it can be converted to a ipaddress._BaseAddress object,
|
|
116
|
+
an IP address is assumed.
|
|
115
117
|
If None is given, then the socket will listen on all local IP addresses -
|
|
116
118
|
not usable for client sockets. Else a hostname is assumed.
|
|
117
|
-
@type address: str or
|
|
119
|
+
@type address: str or ipaddress.IPv4Address or ipaddress.IPv6Address or None
|
|
118
120
|
@param port: the TCP port number, where to connect to or on which should be listened.
|
|
119
121
|
@type port: int
|
|
120
122
|
@param address_family: the IP address family, may be socket.AF_INET or socket.AF_INET6 or
|
|
@@ -177,7 +179,7 @@ class TcpSocket(GenericSocket):
|
|
|
177
179
|
"""
|
|
178
180
|
@ivar: The resolved IP address, where to connect to or on which listening to.
|
|
179
181
|
If self.address is '*', the self.resolved_address stays to None.
|
|
180
|
-
@type:
|
|
182
|
+
@type: ipaddress.IPv4Address or ipaddress.IPv6Address or None
|
|
181
183
|
"""
|
|
182
184
|
|
|
183
185
|
self.port = port
|
|
@@ -401,6 +403,8 @@ class TcpSocket(GenericSocket):
|
|
|
401
403
|
self._resolved_address = ip_addr
|
|
402
404
|
self._own_address = self.sock.getsockname()
|
|
403
405
|
|
|
406
|
+
return self
|
|
407
|
+
|
|
404
408
|
# -------------------------------------------------------------------------
|
|
405
409
|
def bind(self):
|
|
406
410
|
"""Create a TCP socket and listen on it."""
|
|
@@ -500,6 +504,25 @@ class TcpSocket(GenericSocket):
|
|
|
500
504
|
self._resolved_address = socketaddr[0]
|
|
501
505
|
self._own_address = self.sock.getsockname()
|
|
502
506
|
|
|
507
|
+
return self
|
|
508
|
+
|
|
509
|
+
# -------------------------------------------------------------------------
|
|
510
|
+
def _name(self):
|
|
511
|
+
"""Return a descriptive name of this socket."""
|
|
512
|
+
if self.address is None:
|
|
513
|
+
return f"*:{self.port}"
|
|
514
|
+
|
|
515
|
+
addr = str(self.address)
|
|
516
|
+
try:
|
|
517
|
+
ip_addr = ipaddress.ip_address(self.address)
|
|
518
|
+
except ValueError:
|
|
519
|
+
return f"{addr}:{self.port}"
|
|
520
|
+
|
|
521
|
+
if ip_addr.version == 4:
|
|
522
|
+
return f"{ip_addr}:{self.port}"
|
|
523
|
+
|
|
524
|
+
return f"[{ip_addr}]:{self.port}"
|
|
525
|
+
|
|
503
526
|
|
|
504
527
|
# =============================================================================
|
|
505
528
|
|
|
@@ -29,7 +29,7 @@ from . import GenericSocket
|
|
|
29
29
|
from ..errors import GenericSocketError
|
|
30
30
|
from ..xlate import XLATOR
|
|
31
31
|
|
|
32
|
-
__version__ = "0.
|
|
32
|
+
__version__ = "0.6.0"
|
|
33
33
|
|
|
34
34
|
LOG = logging.getLogger(__name__)
|
|
35
35
|
|
|
@@ -468,6 +468,8 @@ class UnixSocket(GenericSocket):
|
|
|
468
468
|
self._connected = True
|
|
469
469
|
self.fileno = self.sock.fileno()
|
|
470
470
|
|
|
471
|
+
return self
|
|
472
|
+
|
|
471
473
|
# -------------------------------------------------------------------------
|
|
472
474
|
def _set_socket_permissions(self):
|
|
473
475
|
"""Set file mode, owner and group to the socket file."""
|
|
@@ -540,6 +542,13 @@ class UnixSocket(GenericSocket):
|
|
|
540
542
|
)
|
|
541
543
|
self.sock.listen(self.request_queue_size)
|
|
542
544
|
|
|
545
|
+
return self
|
|
546
|
+
|
|
547
|
+
# -------------------------------------------------------------------------
|
|
548
|
+
def _name(self):
|
|
549
|
+
"""Return a descriptive name of this socket."""
|
|
550
|
+
return str(self.filename)
|
|
551
|
+
|
|
543
552
|
|
|
544
553
|
# =============================================================================
|
|
545
554
|
|
|
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
|