mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Resolve variable name issues per PEP8
Move all logic under `if __name__ == "__main__"` to a `main(..)` function. The purpose of this is to not only address flake8/pylint reported issues with variable names, but also to enable testing of the function in isolation to ensure the logic acts as desired. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This commit is contained in:
parent
f30cc2b04b
commit
2c38d6b115
@ -1711,21 +1711,22 @@ class CommandLine:
|
|||||||
entry.PrintCode(impl_fp)
|
entry.PrintCode(impl_fp)
|
||||||
impl_fp.close()
|
impl_fp.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
try:
|
|
||||||
CommandLine(sys.argv).run()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
def main(argv=None):
|
||||||
|
try:
|
||||||
|
CommandLine(argv).run()
|
||||||
|
return 0
|
||||||
except RpcGenError as e:
|
except RpcGenError as e:
|
||||||
sys.stderr.write(e)
|
sys.stderr.write(e)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
except EnvironmentError as e:
|
except EnvironmentError as e:
|
||||||
if e.filename and e.strerror:
|
if e.filename and e.strerror:
|
||||||
sys.stderr.write("%s: %s" % (e.filename, e.strerror))
|
sys.stderr.write("%s: %s" % (e.filename, e.strerror))
|
||||||
sys.exit(1)
|
|
||||||
elif e.strerror:
|
elif e.strerror:
|
||||||
sys.stderr.write(e.strerror)
|
sys.stderr.write(e.strerror)
|
||||||
sys.exit(1)
|
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main(argv=sys.argv))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user