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:
T. Joseph Carter 2017-07-19 08:47:17 -07:00
parent 0d17a525ac
commit 48f65d6f55
1 changed files with 10 additions and 2 deletions

12
cppo
View File

@ -53,10 +53,17 @@ import blocksfree.logging as logging
LOG = logging.LOG
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__)
sys.exit(exitcode)
#pylint: disable=too-many-branches,too-many-statements
def main() -> None:
"""provide the legacy cppo CLI interface"""
# Setup logging
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter('{message}', style='{')
@ -64,10 +71,10 @@ def main() -> None:
LOG.logger.addHandler(handler)
LOG.setLevel(logging.DEBUG)
g = blocksfree.legacy.g
g = blocksfree.legacy.g #pylint: disable=invalid-name
args = sys.argv
while True: # breaks when there are no more arguments starting with dash
while True:
if len(args) == 1:
usage()
@ -151,6 +158,7 @@ def main() -> None:
sys.exit(2)
blocksfree.legacy.run_cppo()
#pylint: enable=too-many-branches,too-many-statements
if __name__ == '__main__':
main()