mirror of
https://github.com/iKarith/cppo-ng.git
synced 2025-02-09 04:31:01 +00:00
Lint cppo: Docstrings, warning disables
This actually disables all pylint warnings we haven't fixed because, as of now, we don't intend to fix them. The arg parsing is suboptimal, but if you can make sure that existing scripts using cppo don't break by turning this into argparse code, be my guest. I didn't see an obvious way to do it any better than what we have now. When cppo is rewritten, we'll create a new runner with its own argparse-based command parser. Until then, I'm inclined to leave it be. This is just part of a larger rewrite I started working on, but ... it's not needed now.
This commit is contained in:
parent
0d17a525ac
commit
48f65d6f55
12
cppo
12
cppo
@ -53,10 +53,17 @@ import blocksfree.logging as logging
|
|||||||
LOG = logging.LOG
|
LOG = logging.LOG
|
||||||
|
|
||||||
def usage(exitcode=1):
|
def usage(exitcode=1):
|
||||||
|
"""Print script usage and exit "gracefully"
|
||||||
|
|
||||||
|
Args:
|
||||||
|
exitcode: The shell return value (1 is appropriate for errors)
|
||||||
|
"""
|
||||||
print(sys.modules[__name__].__doc__)
|
print(sys.modules[__name__].__doc__)
|
||||||
sys.exit(exitcode)
|
sys.exit(exitcode)
|
||||||
|
|
||||||
|
#pylint: disable=too-many-branches,too-many-statements
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
"""provide the legacy cppo CLI interface"""
|
||||||
# Setup logging
|
# Setup logging
|
||||||
handler = logging.StreamHandler(sys.stdout)
|
handler = logging.StreamHandler(sys.stdout)
|
||||||
formatter = logging.Formatter('{message}', style='{')
|
formatter = logging.Formatter('{message}', style='{')
|
||||||
@ -64,10 +71,10 @@ def main() -> None:
|
|||||||
LOG.logger.addHandler(handler)
|
LOG.logger.addHandler(handler)
|
||||||
LOG.setLevel(logging.DEBUG)
|
LOG.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
g = blocksfree.legacy.g
|
g = blocksfree.legacy.g #pylint: disable=invalid-name
|
||||||
|
|
||||||
args = sys.argv
|
args = sys.argv
|
||||||
while True: # breaks when there are no more arguments starting with dash
|
while True:
|
||||||
if len(args) == 1:
|
if len(args) == 1:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
@ -151,6 +158,7 @@ def main() -> None:
|
|||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
blocksfree.legacy.run_cppo()
|
blocksfree.legacy.run_cppo()
|
||||||
|
#pylint: enable=too-many-branches,too-many-statements
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user