Skip to content

Commit 3bc26f2

Browse files
[PATCH] Fixups for deepsource antics and GHA CI config (- WIP #94 & PR #118 -)
Changes in file .github/workflows/Tests.yml: - cleaning up some regressions (- PR #118 -) Changes in file multicast/hear.py: - more workarounds for deepsource defective config Changes in file multicast/recv.py: - more workarounds for deepsource defective config Changes in file multicast/send.py: - more workarounds for deepsource defective config Changes in file tests/MulticastUDPClient.py: - more workarounds for deepsource defective config
1 parent 22d09aa commit 3bc26f2

File tree

5 files changed

+41
-20
lines changed

5 files changed

+41
-20
lines changed

.github/workflows/Tests.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ jobs:
245245
if: ${{ runner.os }} == "Linux"
246246
shell: bash
247247
run: |
248-
if [ "$OS" == "ubuntu-latest" ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ; fi ;
248+
./cc-test-reporter after-build --exit-code 0 || true ;
249249
- name: deepsource for ${{ matrix.python-version }}
250250
if: ${{ runner.os }} == "Linux"
251251
shell: bash
252252
run: |
253-
if [ "$OS" == "ubuntu-latest" ] ; then ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; else echo "SKIP deepsource" ; fi ;
253+
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ;
254254
- name: Post-Clean
255255
id: post
256256
run: make -j1 -f Makefile clean || true ;
@@ -329,12 +329,12 @@ jobs:
329329
if: ${{ runner.os }} == "Linux"
330330
shell: bash
331331
run: |
332-
./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ;
332+
./cc-test-reporter after-build --exit-code 0 || true ;
333333
- name: deepsource for ${{ matrix.python-version }} on ${{ matrix.os }}
334334
if: ${{ runner.os }} == "Linux"
335335
shell: bash
336336
run: |
337-
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; else echo "SKIP deepsource"
337+
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ;
338338
- name: Post-Clean
339339
id: post
340340
run: make -j1 -f Makefile clean || true ;
@@ -411,13 +411,19 @@ jobs:
411411
pip install --upgrade -r ./requirements.txt ;
412412
pip install --upgrade -r ./tests/requirements.txt || true ;
413413
pip install --upgrade -r ./docs/requirements.txt || true ;
414-
- name: Install code-climate tools for ${{ matrix.python-version }}
414+
- name: Install Darwin code-climate tools for ${{ matrix.python-version }}
415415
if: ${{ runner.os }} != "Linux"
416416
run: |
417417
if [ "$OS" == "macos-latest" ] ; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter || true ; fi ;
418418
if [ "$OS" == "macos-latest" ] ; then chmod +x ./cc-test-reporter 2>/dev/null || true ; fi
419419
if [ "$OS" == "macos-latest" ] ; then ./cc-test-reporter before-build || true ; fi
420420
shell: bash
421+
- name: Install Linux code-climate tools for ${{ matrix.python-version }}
422+
if: ${{ runner.os }} == "Linux"
423+
run: |
424+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter || curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-arm64 > ./cc-test-reporter || true ;
425+
chmod +x ./cc-test-reporter 2>/dev/null || true ;
426+
./cc-test-reporter before-build || true ;
421427
- name: Pre-Clean
422428
id: clean-prep
423429
run: make -j1 -f Makefile clean ;
@@ -457,6 +463,11 @@ jobs:
457463
if: ${{ runner.os }} != "Linux"
458464
run: |
459465
if [ "$OS" == "macos-latest" ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "::warning file=.github/workflows/Tests.yml,line=459,endLine=459,title=SKIPPED::SKIP Code-Climate" ; fi ;
466+
if: ${{ !cancelled() }}
467+
- name: code-climate for ${{ matrix.python-version }}
468+
if: ${{ runner.os }} == "Linux"
469+
run: |
470+
./cc-test-reporter after-build --exit-code 0 || true ;
460471
- name: Upload Python ${{ matrix.python-version }} integration test results to Codecov
461472
if: ${{ !cancelled() }}
462473
uses: codecov/test-results-action@v1

multicast/hear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def setupArgs(cls, parser):
410410
pass # skipcq - Optional abstract method
411411

412412
def doStep(self, *args, **kwargs):
413-
HOST = kwargs.get("group", multicast._MCAST_DEFAULT_GROUP)
414-
PORT = kwargs.get("port", multicast._MCAST_DEFAULT_PORT)
413+
HOST = kwargs.get("group", multicast._MCAST_DEFAULT_GROUP) # skipcq: PYL-W0212 - module ok
414+
PORT = kwargs.get("port", multicast._MCAST_DEFAULT_PORT) # skipcq: PYL-W0212 - module ok
415415
with McastServer((HOST, PORT), HearUDPHandler) as server:
416416
server.serve_forever()

multicast/recv.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ def setupArgs(cls, parser):
444444
445445
"""
446446
if parser is not None:
447-
parser.add_argument("""--port""", type=int, default=multicast._MCAST_DEFAULT_PORT)
447+
parser.add_argument(
448+
"""--port""",
449+
type=int, default=multicast._MCAST_DEFAULT_PORT # skipcq: PYL-W0212 - module ok
450+
)
448451
__tmp_help = """local interface to use for listening to multicast data; """
449452
__tmp_help += """if unspecified, any one interface may be chosen."""
450453
parser.add_argument(
@@ -458,7 +461,8 @@ def setupArgs(cls, parser):
458461
__tmp_help += """If unspecified, bind to 224.0.0.1 """
459462
__tmp_help += """(all addresses (all multicast addresses) of that interface)"""
460463
parser.add_argument(
461-
"""--group""", default=multicast._MCAST_DEFAULT_GROUP,
464+
"""--group""",
465+
default=multicast._MCAST_DEFAULT_GROUP, # skipcq: PYL-W0212 - module ok
462466
help=str(__tmp_help)
463467
)
464468
parser.add_argument(
@@ -519,16 +523,16 @@ def _hearstep(groups, port, iface=None, bind_group=None):
519523

520524
def doStep(self, *args, **kwargs):
521525
response = self._hearstep(
522-
kwargs.get("groups", [multicast._MCAST_DEFAULT_GROUP]),
523-
kwargs.get("port", multicast._MCAST_DEFAULT_PORT),
524-
kwargs.get("iface", None),
525-
kwargs.get("group", multicast._MCAST_DEFAULT_GROUP),
526+
kwargs.get("groups", [multicast._MCAST_DEFAULT_GROUP]), # skipcq: PYL-W0212 - module ok
527+
kwargs.get("port", multicast._MCAST_DEFAULT_PORT), # skipcq: PYL-W0212 - module ok
528+
kwargs.get("iface", None), # skipcq: PTC-W0039 - ensure None by default
529+
kwargs.get("group", multicast._MCAST_DEFAULT_GROUP), # skipcq: PYL-W0212 - module ok
526530
)
527531
_is_std = kwargs.get("is_std", False)
528532
if (sys.stdout.isatty() or _is_std) and (len(response) > 0): # pragma: no cover
529-
print(multicast._BLANK)
533+
print(multicast._BLANK) # skipcq: PYL-W0212 - module ok
530534
print(str(response))
531-
print(multicast._BLANK)
535+
print(multicast._BLANK) # skipcq: PYL-W0212 - module ok
532536
_result = (len(response) > 0) is True
533537
return tuple((_result, None if not _result else response)) # skipcq: PTC-W0020 - intended
534538

multicast/send.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,14 @@ def setupArgs(cls, parser):
282282
283283
"""
284284
if parser is not None: # pragma: no branch
285-
parser.add_argument("""--port""", type=int, default=multicast._MCAST_DEFAULT_PORT)
286-
parser.add_argument("""--group""", default=multicast._MCAST_DEFAULT_GROUP)
285+
parser.add_argument(
286+
"""--port""", type=int,
287+
default=multicast._MCAST_DEFAULT_PORT # skipcq: PYL-W0212 - module ok
288+
)
289+
parser.add_argument(
290+
"""--group""",
291+
default=multicast._MCAST_DEFAULT_GROUP # skipcq: PYL-W0212 - module ok
292+
)
287293
parser.add_argument(
288294
"""-m""", """--message""", nargs='+', dest="""data""",
289295
default=str("""PING from {name}: group: {group}, port: {port}""")
@@ -307,8 +313,8 @@ def _sayStep(group, port, data):
307313

308314
def doStep(self, *args, **kwargs):
309315
return self._sayStep(
310-
kwargs.get("group", [multicast._MCAST_DEFAULT_GROUP]),
311-
kwargs.get("port", multicast._MCAST_DEFAULT_PORT),
316+
kwargs.get("group", [multicast._MCAST_DEFAULT_GROUP]), # skipcq: PYL-W0212 - module ok
317+
kwargs.get("port", multicast._MCAST_DEFAULT_PORT), # skipcq: PYL-W0212 - module ok
312318
None if "data" not in kwargs else str(kwargs["data"]),
313319
)
314320

tests/MulticastUDPClient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def __init__(self, *args, **kwargs):
191191
192192
"""
193193
if str("""grp_addr""") in kwargs:
194-
self._group_addr = kwargs.get("""grp_addr""", None)
194+
self._group_addr = kwargs.get("""grp_addr""", None) # skipcq: PTC-W0039 - ensure None
195195
if str("""src_port""") in kwargs:
196196
self._source_port = kwargs.get("""src_port""", 0)
197197
else:

0 commit comments

Comments
 (0)