From 063e1229bc540a8aeef87925e90261fb88614204 Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Fri, 5 Mar 2021 11:10:12 -0700 Subject: [PATCH] pep8 --- capa/main.py | 7 ++++++- scripts/show-capabilities-by-function.py | 10 +++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/capa/main.py b/capa/main.py index d5fd4b24..3d16d856 100644 --- a/capa/main.py +++ b/capa/main.py @@ -525,7 +525,11 @@ def install_common_args(parser, wanted=None): ] format_help = ", ".join(["%s: %s" % (f[0], f[1]) for f in formats]) parser.add_argument( - "-f", "--format", choices=[f[0] for f in formats], default="auto", help="select sample format, %s" % format_help + "-f", + "--format", + choices=[f[0] for f in formats], + default="auto", + help="select sample format, %s" % format_help, ) if "backend" in wanted and sys.version_info >= (3, 0): @@ -577,6 +581,7 @@ def handle_common_args(args): # because cp65001 is utf-8, we just map that codepage to the utf-8 codec. # see #380 and: https://stackoverflow.com/a/3259271/87207 import codecs + codecs.register(lambda name: codecs.lookup("utf-8") if name == "cp65001" else None) if args.color == "always": diff --git a/scripts/show-capabilities-by-function.py b/scripts/show-capabilities-by-function.py index ae429061..569e7534 100644 --- a/scripts/show-capabilities-by-function.py +++ b/scripts/show-capabilities-by-function.py @@ -161,9 +161,7 @@ def main(argv=None): logger.error( " capa currently only supports analyzing PE files (or shellcode, when using --format sc32|sc64)." ) - logger.error( - " If you don't know the input file type, you can try using the `file` utility to guess it." - ) + logger.error(" If you don't know the input file type, you can try using the `file` utility to guess it.") logger.error("-" * 80) return -1 except capa.main.UnsupportedRuntimeError: @@ -173,9 +171,7 @@ def main(argv=None): logger.error(" capa supports running under Python 2.7 using Vivisect for binary analysis.") logger.error(" It can also run within IDA Pro, using either Python 2.7 or 3.5+.") logger.error(" ") - logger.error( - " If you're seeing this message on the command line, please ensure you're running Python 2.7." - ) + logger.error(" If you're seeing this message on the command line, please ensure you're running Python 2.7.") logger.error("-" * 80) return -1 @@ -204,4 +200,4 @@ def main(argv=None): if __name__ == "__main__": - sys.exit(main()) \ No newline at end of file + sys.exit(main())