Skip to content

Commit 66e7ff4

Browse files
[MERGE]
* From PR/MR #168 (feature-implement-from-std-in): [PATCH] Apply suggested changes from review (- WIP #168 -) [TESTING] Possible fix for low code coverage on new functions (- WIP #168 -) [FEATURE] implemented reading and sending from stdin for SAY operations (- WIP #150 -) * From PR/MR #169 (feature-implement-custom-exceptions-157): [STYLE] Minor style fixes from review (- WIP PR #169 -) [CI] Possible fix by suppression of PYL-E0603. [DOCUMENTATION] Add docstrings to global variables from multicast/exceptions.py (- WIP PR #169 -) [REGRESSION] Various fixes and debugging from review (- WIP PR #169 -) [STYLE] Refactor exceptions and exit-code utilities (- WIP #117 & #157 -) [PATCH] part 2 of implementation (- WIP #157 -) [TESTING] implementing use of new exception - part 1 of 2 (- WIP #157 -) [DOCUMENTATION] added docstrings for new CommandExecutionError (- WIP #157 -) [TESTING] new exceptions file in tests (- WIP #157 -). * From PR/MR #167 (testing-coverage): Update multicast/send.py [REGRESSION] Apply suggestions from code review (- WIP #167 -) [STYLE] Possible fix for style. (- WIP #53 -) [PATCH] Implementation for (- WIP #53 -) [TESTING] New test for TestRecvCleanup. (- WIP #53 -) [TESTING] New test for TestRecvDaemonMode. (- WIP #53 -) [TESTING] New test for TestRecvDataProcessing. (- WIP #53 -) [TESTING] New test for TestRecvExceptionHandling. (- WIP #53 -) [TESTING] New test for TestRecvInvalidSocket. (- WIP #53 -) [TESTING] New test for TestHearCleanup. (- WIP #53 -) [TESTING] New test for TestHearSocketErrors. (- WIP #53 -) [TESTING] New test for TestHearDaemonMode. (- WIP #53 -) [TESTING] New test for TestHearDataProcessing. (- WIP #53 -) [TESTING] New test for TestHearSocketException. (- WIP #53 -) [TESTING] New test for TestHearMissingParams. (- WIP #53 -) * multicast/__init__.py * added new exceptions handling functions * added new exit code mapping globals * minor change to documentation * multicast/hear.py * made warnings aware for socket re-use stability * slight stability improvement to handling data from transmissions * multicast/recv.py * changed how invalid and empty groups are handled when joining multicast groups. * fixed hearstep to close sockets before returning now. * multicast/send.py * Fixed issue where '--groups' was raising errors instead of being silently ignored. * New feature to allow reading from standard input when given a dash '-' instead of message data. * Improved testing of sending messages where the total size of the message requires packetization. * multicast/skt.py * Fixed socket cleanup and release logic to reduce possible underlying resource leaks. * added new test suites for: * to ensure listener activation logic is well tested * to verify sockets and the default listeners properly go away when done * to test stability with more kinds of data * other minor improvements related to changes * New file multicast/exceptions.py * New Feature -- see #117 and CEP-8
3 parents eff783a + d47e86d + 2501007 commit 66e7ff4

File tree

14 files changed

+904
-32
lines changed

14 files changed

+904
-32
lines changed

multicast/__init__.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@
2727
# skipcq
2828
__all__ = [
2929
"""__package__""", """__module__""", """__name__""", """__version__""", """__prologue__""",
30-
"""__doc__""", """skt""", """skt.__package__""", """skt.__module__""", """skt.__name__""",
30+
"""__doc__""", """exceptions""", """exceptions.CommandExecutionError""",
31+
"""exceptions.get_exit_code_from_exception""", """exceptions.exit_on_exception""",
32+
"""get_exit_code_from_exception""", """exit_on_exception""",
33+
"""skt""", """skt.__package__""", """skt.__module__""", """skt.__name__""",
3134
"""skt.__file__""", """skt.genSocket""", """skt.genSocket.__func__""", """genSocket""",
3235
"""skt.endSocket""", """skt.endSocket.__func__""", """endSocket""",
36+
"""EXIT_CODES""", """EXCEPTION_EXIT_CODES""",
3337
"""_BLANK""", """_MCAST_DEFAULT_PORT""", """_MCAST_DEFAULT_GROUP""",
3438
"""_MCAST_DEFAULT_TTL""", """mtool""", """recv""", """send""", """hear""",
3539
"""recv.McastRECV""", """send.McastSAY""", """hear.McastHEAR""",
@@ -352,6 +356,23 @@
352356
raise ModuleNotFoundError("FAIL: we could not import Abstract base class. ABORT.") from None
353357

354358

359+
if 'multicast.exceptions' not in sys.modules:
360+
# pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
361+
from . import exceptions # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
362+
else: # pragma: no branch
363+
exceptions = sys.modules["""multicast.exceptions"""]
364+
365+
EXIT_CODES = exceptions.EXIT_CODES
366+
367+
EXCEPTION_EXIT_CODES = exceptions.EXCEPTION_EXIT_CODES
368+
369+
CommandExecutionError = exceptions.CommandExecutionError
370+
371+
get_exit_code_from_exception = exceptions.get_exit_code_from_exception
372+
373+
exit_on_exception = exceptions.exit_on_exception
374+
375+
355376
class mtool(abc.ABC):
356377
"""
357378
Class for Multicast tools.
@@ -602,9 +623,11 @@ def doStep(self, *args): # pragma: no cover
602623

603624

604625
genSocket = skt.genSocket
626+
"""See multicast.skt.genSocket."""
605627

606628

607629
endSocket = skt.endSocket
630+
"""See multicast.skt.endSocket."""
608631

609632

610633
if 'multicast.recv' not in sys.modules:

0 commit comments

Comments
 (0)