[blivet:master 04/14] Move lines beneath __main__ into a main method
Vratislav Podzimek
vpodzime at redhat.com
Mon Mar 31 09:12:08 UTC 2014
On Fri, 2014-03-28 at 18:50 -0400, mulhern wrote:
> So that the variables now defined in main do not have global scope.
>
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
> blivet/tsort.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/blivet/tsort.py b/blivet/tsort.py
> index fb3af3a..7d120a2 100644
> --- a/blivet/tsort.py
> +++ b/blivet/tsort.py
> @@ -90,9 +90,7 @@ def create_graph(items, edges):
>
> return graph
>
> -
> -if __name__ == "__main__":
> -
> +def main():
> items = [5, 2, 3, 4, 1]
> edges = [(1, 2), (2, 4), (4, 5), (3, 2)]
>
> @@ -102,3 +100,5 @@ if __name__ == "__main__":
> graph = create_graph(items, edges)
> print tsort(graph)
>
> +if __name__ == "__main__":
> + main()
I believe the proper change here is to move this code into unittests.
Something for a follow-up patch, I guess.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list