[PATCH] examples: network-scan: get rid of global variables

Aleksander Morgado aleksander at aleksander.es
Wed Feb 24 14:01:03 UTC 2021


On 24/2/21 10:10, yegorslists at googlemail.com wrote:
> From: Yegor Yefremov <yegorslists at googlemail.com>
> 
> Move the code into the main() routine.
> ---

Merged, thanks

>  examples/network-scan-python/network-scan-python | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/network-scan-python/network-scan-python b/examples/network-scan-python/network-scan-python
> index 12ee02f7..21dd89f4 100755
> --- a/examples/network-scan-python/network-scan-python
> +++ b/examples/network-scan-python/network-scan-python
> @@ -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 -*-
>  #
>  # 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
>  
>  
> -if __name__ == "__main__":
> +def main():
> +    """Main routine."""
>  
>      # Process input arguments
>      if len(sys.argv) != 1:
> @@ -67,3 +68,7 @@ if __name__ == "__main__":
>                          network.get_availability())))
>          else:
>              print('no networks found')
> +
> +
> +if __name__ == "__main__":
> +    main()
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list