Skip to content

Commit 6542364

Browse files
[STYLE] Mass Refactoring of tripple double quotes (- WIP #171 -)
* Project-wide simplification of triple double quotes to single double quotes and related work.
1 parent 344208a commit 6542364

29 files changed

+400
-400
lines changed

docs/FAQ.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ import random # for random port
7979

8080
# set up some stuff
8181
_fixture_PORT_arg = int(random.SystemRandom().randint(49152, 65535))
82-
_fixture_mcast_GRP_arg = """224.0.0.1""" # only use dotted notation for multicast group addresses
83-
_fixture_host_BIND_arg = """224.0.0.1"""
82+
_fixture_mcast_GRP_arg = "224.0.0.1" # only use dotted notation for multicast group addresses
83+
_fixture_host_BIND_arg = "224.0.0.1"
8484

8585
# spawn a listening proc
8686

@@ -107,15 +107,15 @@ inputHandler()
107107
from multiprocessing import Process as Process
108108

109109
_fixture_HEAR_kwargs = {
110-
"""is_daemon""": True,
111-
"""port""": _fixture_PORT_arg,
112-
"""group""": _fixture_host_BIND_arg
110+
"is_daemon": True,
111+
"port": _fixture_PORT_arg,
112+
"group": _fixture_host_BIND_arg
113113
}
114114
p = Process(
115115
target=multicast.hear.McastHEAR().doStep,
116116
name="HEAR", kwargs=_fixture_HEAR_kwargs
117117
)
118-
p.daemon = _fixture_HEAR_kwargs["""is_daemon"""]
118+
p.daemon = _fixture_HEAR_kwargs["is_daemon"]
119119
p.start()
120120

121121
# ... use CTL+C (or signal 2) to shutdown the server 'p'
@@ -128,9 +128,9 @@ _and elsewhere (like another function or even module) for the sender:_
128128
# assuming already did 'import multicast as multicast'
129129

130130
_fixture_SAY_args = [
131-
"""--port""", _fixture_PORT_arg,
132-
"""--group""", _fixture_mcast_GRP_arg,
133-
"""--message""", """'test message'"""
131+
"--port", _fixture_PORT_arg,
132+
"--group", _fixture_mcast_GRP_arg,
133+
"--message", "'test message'"
134134
]
135135
try:
136136
multicast.__main__.McastDispatch().doStep(["SAY", _fixture_SAY_args])

docs/USAGE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ from multiprocessing import Process
1313
# set up some stuff
1414
_fixture_PORT_arg = int(59595)
1515
# Valid multicast addresses range from 224.0.0.0 to 239.255.255.255
16-
_fixture_mcast_GRP_arg = """224.0.0.1""" # only use dotted notation for multicast group addresses
17-
_fixture_host_BIND_arg = """224.0.0.1""" # only use dotted notation for multicast group addresses
16+
_fixture_mcast_GRP_arg = "224.0.0.1" # only use dotted notation for multicast group addresses
17+
_fixture_host_BIND_arg = "224.0.0.1" # only use dotted notation for multicast group addresses
1818
_fixture_host_IFACE_arg = None # Initial value representing no specific interface
1919
_fixture_HEAR_args = [
2020
"--port", _fixture_PORT_arg,
@@ -38,7 +38,7 @@ def print_loop_stub(func, iterations=5):
3838
@print_loop_stub
3939
def inputHandle():
4040
test_RCEV = multicast.recv.McastRECV()
41-
buffer_string = str("""""")
41+
buffer_string = str()
4242
(didWork, result) = test_RCEV.doStep(
4343
groups=[_fixture_mcast_GRP_arg],
4444
port=_fixture_PORT_arg,
@@ -69,9 +69,9 @@ _and elsewhere (like another function or even module) for the sender:_
6969
# assuming already did 'import multicast'
7070

7171
_fixture_SAY_args = [
72-
"""--port""", _fixture_PORT_arg,
73-
"""--group""", _fixture_mcast_GRP_arg,
74-
"""--message""", """'test message'"""
72+
"--port", _fixture_PORT_arg,
73+
"--group", _fixture_mcast_GRP_arg,
74+
"--message", "'test message'"
7575
]
7676
try:
7777
multicast.__main__.McastDispatch().doStep("SAY", _fixture_SAY_args)

docs/conf.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# If extensions (or modules to document with autodoc) are in another directory,
4444
# add these directories to sys.path here. If the directory is relative to the
4545
# documentation root, use os.path.abspath to make it absolute, like shown here.
46-
sys.path.insert(0, os.path.abspath(""".."""))
46+
sys.path.insert(0, os.path.abspath(".."))
4747
from docs.utils import _validate_git_ref # noqa
4848
from docs.utils import slugify_header # noqa
4949

@@ -58,8 +58,8 @@
5858
variable is not set.
5959
"""
6060

61-
sys.path.insert(1, os.path.abspath("""multicast"""))
62-
sys.path.insert(1, os.path.abspath("""tests"""))
61+
sys.path.insert(1, os.path.abspath("multicast"))
62+
sys.path.insert(1, os.path.abspath("tests"))
6363

6464
# -- General configuration -----------------------------------------------------
6565

@@ -71,18 +71,18 @@
7171
# for md us 'autodoc2' (pip install sphinx-autodoc2)
7272
# for rst use 'sphinx.ext.autodoc'
7373
extensions = [
74-
"""sphinx.ext.napoleon""",
75-
"""autodoc2""",
76-
"""sphinx.ext.autosectionlabel""",
77-
"""sphinx.ext.githubpages""",
78-
"""myst_parser""",
79-
"""sphinx_design""",
80-
"""sphinx.ext.autosummary""",
81-
"""sphinx.ext.doctest""",
82-
"""sphinx.ext.todo""",
83-
"""sphinx.ext.linkcode""",
84-
"""sphinx.ext.viewcode""",
85-
"""sphinx.ext.intersphinx""",
74+
"sphinx.ext.napoleon",
75+
"autodoc2",
76+
"sphinx.ext.autosectionlabel",
77+
"sphinx.ext.githubpages",
78+
"myst_parser",
79+
"sphinx_design",
80+
"sphinx.ext.autosummary",
81+
"sphinx.ext.doctest",
82+
"sphinx.ext.todo",
83+
"sphinx.ext.linkcode",
84+
"sphinx.ext.viewcode",
85+
"sphinx.ext.intersphinx",
8686
]
8787

8888
# for md auto-docs
@@ -179,15 +179,15 @@
179179
pygments_style_dark = "github-dark"
180180

181181
pygments_options = {
182-
"""tabsize""": 4,
183-
"""stripall""": False,
184-
"""encoding""": "utf-8",
182+
"tabsize": 4,
183+
"stripall": False,
184+
"encoding": "utf-8",
185185
}
186186

187187
pygments_yaml_options = {
188-
"""tabsize""": 2,
189-
"""stripall""": True,
190-
"""encoding""": "utf-8",
188+
"tabsize": 2,
189+
"stripall": True,
190+
"encoding": "utf-8",
191191
}
192192

193193
highlight_options = {
@@ -421,19 +421,19 @@
421421

422422
linkcode_url_prefix: str = f"https://github.com/reactive-firewall/{project}"
423423

424-
suffix = """/issues/%s"""
424+
suffix = "/issues/%s"
425425

426426
extlinks = {
427-
"""issue""": (
427+
"issue": (
428428
f"{linkcode_url_prefix}/{suffix}",
429-
"""issue #%s"""
429+
"issue #%s"
430430
)
431431
}
432432

433433
# try to link with official python3 documentation.
434434
# see https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html for more
435435
intersphinx_mapping = {
436-
"""python""": ("""https://docs.python.org/3""", (None, """python-inv.txt"""))
436+
"python": ("https://docs.python.org/3", (None, "python-inv.txt"))
437437
}
438438

439439

multicast/__init__.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"""hear.McastHEAR""",
6565
]
6666

67-
__package__ = """multicast""" # skipcq: PYL-W0622
67+
__package__ = "multicast" # skipcq: PYL-W0622
6868
"""The package of this program.
6969
7070
Minimal Acceptance Testing:
@@ -80,7 +80,7 @@
8080
8181
"""
8282

83-
__module__ = """multicast"""
83+
__module__ = "multicast"
8484
"""The module of this program.
8585
8686
Minimal Acceptance Testing:
@@ -96,7 +96,7 @@
9696
9797
"""
9898

99-
__name__ = """multicast""" # skipcq: PYL-W0622
99+
__name__ = "multicast" # skipcq: PYL-W0622
100100
"""The name of this program.
101101
102102
Minimal Acceptance Testing:
@@ -114,7 +114,7 @@
114114

115115
global __version__ # skipcq: PYL-W0604
116116

117-
__version__ = """2.0.4"""
117+
__version__ = "2.0.4"
118118
"""The version of this program.
119119
120120
Minimal Acceptance Testing:
@@ -265,7 +265,7 @@
265265

266266
global _MCAST_DEFAULT_GROUP # skipcq: PYL-W0604
267267

268-
_MCAST_DEFAULT_GROUP = """224.0.0.1"""
268+
_MCAST_DEFAULT_GROUP = "224.0.0.1"
269269
"""Arbitrary group to use by default, though any mcst grp would work.
270270
271271
The Value of "224.0.0.1" is chosen as a default multicast group as per RFC-5771
@@ -378,7 +378,7 @@
378378
from . import exceptions # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
379379
else: # pragma: no branch
380380
global exceptions # skipcq: PYL-W0604
381-
exceptions = sys.modules["""multicast.exceptions"""]
381+
exceptions = sys.modules["multicast.exceptions"]
382382

383383
EXIT_CODES = exceptions.EXIT_CODES
384384
"""See multicast.exceptions.EXIT_CODES."""
@@ -395,12 +395,12 @@
395395
exit_on_exception = exceptions.exit_on_exception
396396
"""See multicast.exceptions.exit_on_exception function."""
397397

398-
if 'multicast.env' not in sys.modules:
398+
if "multicast.env" not in sys.modules:
399399
# pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
400400
from . import env # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
401401
else: # pragma: no branch
402402
global env # skipcq: PYL-W0604
403-
env = sys.modules["""multicast.env"""]
403+
env = sys.modules["multicast.env"]
404404

405405
_config = env.load_config()
406406

@@ -439,13 +439,13 @@ class mtool(abc.ABC):
439439
440440
"""
441441

442-
__module__ = """multicast"""
442+
__module__ = "multicast"
443443

444444
__proc__ = None
445445

446-
__prologue__ = """Add a prologue here."""
446+
__prologue__ = "Add a prologue here."
447447

448-
__epilogue__ = """Add an epilogue here."""
448+
__epilogue__ = "Add an epilogue here."
449449

450450
@classmethod
451451
def buildArgs(cls, calling_parser_group):
@@ -498,21 +498,21 @@ def buildArgs(cls, calling_parser_group):
498498
add_help=False
499499
)
500500
group = calling_parser_group.add_mutually_exclusive_group(required=False)
501-
group.add_argument('-h', '--help', action='help')
501+
group.add_argument("-h", "--help", action="help")
502502
group.add_argument(
503503
"-v",
504504
"--version",
505505
action="version",
506506
version=str("%(prog)s {version}").format(version=str(__version__))
507507
)
508508
calling_parser_group.add_argument(
509-
"""--use-std""", dest='is_std', default=False, action='store_true'
509+
"--use-std", dest="is_std", default=False, action="store_true"
510510
)
511511
calling_parser_group.add_argument(
512-
"""--daemon""", dest='is_daemon', default=False, action='store_true'
512+
"--daemon", dest="is_daemon", default=False, action="store_true"
513513
)
514514
subparsers = calling_parser_group.add_subparsers(
515-
title="Tools", dest="cmd_tool", help=str("""Sub-Commands."""), metavar="CMD"
515+
title="Tools", dest="cmd_tool", help=str("Sub-Commands."), metavar="CMD"
516516
)
517517
if mtool.__class__.__subclasscheck__(mtool, cls): # pragma: no branch
518518
cls.setupArgs(subparsers)
@@ -662,44 +662,44 @@ def doStep(self, *args, **kwargs): # pragma: no cover
662662
raise NotImplementedError("Subclasses must implement this method.")
663663

664664

665-
if 'multicast.skt' not in sys.modules:
665+
if "multicast.skt" not in sys.modules:
666666
from . import skt as skt # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
667667
else: # pragma: no branch
668668
global skt # skipcq: PYL-W0604
669-
skt = sys.modules["""multicast.skt"""]
669+
skt = sys.modules["multicast.skt"]
670670

671671
genSocket = skt.genSocket
672672
"""See multicast.skt.genSocket."""
673673

674674
endSocket = skt.endSocket
675675
"""See multicast.skt.endSocket."""
676676

677-
if 'multicast.recv' not in sys.modules:
677+
if "multicast.recv" not in sys.modules:
678678
from . import recv as recv # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
679679
else: # pragma: no branch
680680
global recv # skipcq: PYL-W0604
681-
recv = sys.modules["""multicast.recv"""]
681+
recv = sys.modules["multicast.recv"]
682682

683-
if 'multicast.send' not in sys.modules:
683+
if "multicast.send" not in sys.modules:
684684
from . import send as send # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
685685
else: # pragma: no branch
686686
global send # skipcq: PYL-W0604
687-
send = sys.modules["""multicast.send"""]
687+
send = sys.modules["multicast.send"]
688688

689-
if 'multicast.hear' not in sys.modules:
689+
if "multicast.hear" not in sys.modules:
690690
from . import hear as hear # pylint: disable=cyclic-import - skipcq: PYL-R0401, PYL-C0414
691691
else: # pragma: no branch
692692
global hear # skipcq: PYL-W0604
693-
hear = sys.modules["""multicast.hear"""]
693+
hear = sys.modules["multicast.hear"]
694694

695695
try:
696-
if """multicast.__main__""" in sys.modules: # pragma: no cover
696+
if "multicast.__main__" in sys.modules: # pragma: no cover
697697
global __main__ # skipcq: PYL-W0604
698-
__main__ = sys.modules["""multicast.__main__"""]
698+
__main__ = sys.modules["multicast.__main__"]
699699
except Exception:
700700
import multicast.__main__ as __main__ # pylint: disable=cyclic-import - skipcq: PYL-R0401
701701

702-
if __name__ in u'__main__':
702+
if __name__ in u"__main__":
703703
__EXIT_CODE = 2
704704
if __main__.main is not None:
705705
__EXIT_CODE = __main__.main(sys.argv[1:])

0 commit comments

Comments
 (0)