[blivet:master 04/14] Move lines beneath __main__ into a main method

mulhern amulhern at redhat.com
Fri Mar 28 22:50:29 UTC 2014


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()
-- 
1.8.3.1



More information about the anaconda-patches mailing list