Skip to content

Commit

Permalink
[REGRESSION] improved style as per linters
Browse files Browse the repository at this point in the history
  • Loading branch information
reactive-firewall committed Jan 25, 2022
1 parent ed05374 commit a2abf29
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 27 deletions.
24 changes: 20 additions & 4 deletions multicast/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__all__ = ["""__module__""", """__prog__""", """__prolog__""", """__epilog__""", """__doc__""", "NoOp", """SendMCast""", """joinMCast""", """dumpUsage""", """TASK_OPTIONS""", """__checkToolArgs""", """buildArgs""", """main""", """parseArgs""", """useTool"""]
__all__ = [
"""__module__""", """__prog__""", """__prolog__""", """__epilog__""",
"""__doc__""", "NoOp", """SendMCast""", """joinMCast""",
"""dumpUsage""", """TASK_OPTIONS""", """__checkToolArgs""",
"""buildArgs""", """main""", """parseArgs""", """useTool"""
]


__package__ = """multicast"""


__module__ = """multicast.__main__"""


__file__ = """multicast/__main__.py"""

__prog__ = """multicast"""

__name__ = """multicast.__main__"""


__proc__ = """multicast"""


__prolog__ = """The Main Entrypoint"""


__epilog__ = """Add an epilog here."""


__doc__ = __prolog__ + """
Minimal Acceptance Testing:
Expand Down Expand Up @@ -59,6 +74,7 @@
"""


try:
import sys
import argparse
Expand Down Expand Up @@ -276,7 +292,7 @@ def main(*argv):
if __name__ in u'__main__':
__EXIT_CODE = 2
if (sys.argv is not None) and (len(sys.argv) > 1):
__EXIT_CODE = main(sys.argv[1:])
__EXIT_CODE = main(argv=sys.argv)
else:
__EXIT_CODE = main(argv=["""--help"""])
__EXIT_CODE = main(argv=[__proc__, """--help"""])
exit(__EXIT_CODE)
19 changes: 11 additions & 8 deletions multicast/recv.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
# ..........................................
# NO ASSOCIATION

__all__ = ["""genSocket""", """endSocket""", """parseArgs""", """hearstep""", """main""", """__module__""", """__name__""", """__proc__""", """__prolog__""", """__epilog__""", """__doc__"""]
__all__ = [
"""genSocket""", """endSocket""", """parseArgs""", """hearstep""", """main""",
"""__module__""", """__name__""", """__proc__""", """__prolog__""",
"""__epilog__""", """__doc__"""
]


__package__ = """multicast"""
Expand Down Expand Up @@ -90,7 +94,7 @@

def genSocket():
"""Generates an unbound socket.socket object ready to receive network traffic.
Minimal Acceptance Testing:
First setup test fixtures by importing multicast.
Expand Down Expand Up @@ -270,8 +274,7 @@ def hearstep(groups, port, iface=None, bind_group=None):
if chunk is not None:
msgbuffer += str(chunk, encoding='utf8')
chunk = None
msgbuffer += unicodedata.lookup("""SOFT HYPHEN""")
#print(sock.recv(1316))
# msgbuffer += unicodedata.lookup("""SOFT HYPHEN""")
# about 969 bytes in base64 encoded as chars
except KeyboardInterrupt:
print("""""")
Expand All @@ -280,16 +283,16 @@ def hearstep(groups, port, iface=None, bind_group=None):
print(str(""""""))
finally:
sock = endSocket(sock)
print(str(""""""))
print(str(msgbuffer))
#return msgbuffer
# print(str(""""""))
# print(str(msgbuffer))
return msgbuffer


def main(*argv):
"""The Main Event. This does two things:
1: calls parseArgs() and passes the given arguments, handling any errors if needed.
2: calls run with the parsed args if able and handles any errors regardles
2: calls hearstep with the parsed args if able and handles any errors regardles
Regardles of errors the result as an 'exit code' (int) is returned.
(Note the __main__ handler just exits with this code as a true return code status.)
Expand Down
33 changes: 18 additions & 15 deletions multicast/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
# ..........................................
# NO ASSOCIATION

__all__ = ["""main""", """saystep""", """parseArgs""", """__module__""", """__name__""", """__doc__"""]
__all__ = [
"""main""", """saystep""", """parseArgs""",
"""__module__""", """__name__""", """__doc__"""
]


__package__ = """multicast"""
Expand All @@ -56,25 +59,25 @@
Testcase 0: Multicast should be importable.
>>> import multicast
>>>
>>> import multicast
>>>
>>> multicast.__doc__ is not None
True
>>>
>>> multicast.__doc__ is not None
True
>>>
Testcase 1: Recv should be automaticly imported.
A: Test that the __main__ component is initialized.
B: Test that the send component is initialized.
>>> import multicast
>>> import multicast.__main__
>>>
>>> multicast.__main__ is not None
True
>>> multicast.send is not None
True
>>>
>>> import multicast
>>> import multicast.__main__
>>>
>>> multicast.__main__ is not None
True
>>> multicast.send is not None
True
>>>
"""
Expand Down Expand Up @@ -113,7 +116,7 @@ def parseArgs(*arguments):
"""Parses the CLI arguments. See argparse.ArgumentParser for more.
param str - arguments - the array of arguments to parse. Usually sys.argv[1:]
returns argparse.Namespace - the Namespace parsed with the key-value pairs.
Minimal Acceptance Testing:
First setup test fixtures by importing multicast.
Expand Down

0 comments on commit a2abf29

Please sign in to comment.