examples: network-scan: get rid of global variables
Move the code into the main() routine.
This commit is contained in:

committed by
Aleksander Morgado

parent
6250603496
commit
cc07d21410
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it under
|
# This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -26,7 +26,8 @@ gi.require_version('ModemManager', '1.0')
|
|||||||
from gi.repository import Gio, GLib, GObject, ModemManager
|
from gi.repository import Gio, GLib, GObject, ModemManager
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
|
"""Main routine."""
|
||||||
|
|
||||||
# Process input arguments
|
# Process input arguments
|
||||||
if len(sys.argv) != 1:
|
if len(sys.argv) != 1:
|
||||||
@@ -67,3 +68,7 @@ if __name__ == "__main__":
|
|||||||
network.get_availability())))
|
network.get_availability())))
|
||||||
else:
|
else:
|
||||||
print('no networks found')
|
print('no networks found')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
Reference in New Issue
Block a user