Commits

Gary Bernhardt  committed 03db582

Added compute_code_complexity function to avoid test churn

  • Participants
  • Parent commits 0addcbf

Comments (0)

Files changed (2)

File complexity.py

 from compiler.visitor import ASTVisitor
 
 
+def compute_code_complexity(code):
+    return Complexity(code)
+
+
 class Complexity(ASTVisitor):
     def __init__(self, code_or_node):
         ASTVisitor.__init__(self)
 
 def compute_stats_for(filename):
     code = open(filename).read()
-    stats = Complexity(code).stats.ordered_by_line()
+    stats = compute_code_complexity(code).stats.ordered_by_line()
     return stats
 
 

File tests/utils.py

 from textwrap import dedent
 
-from complexity import Complexity
+from complexity import compute_code_complexity
 
 
 def complexity(code):
-    return Complexity(dedent(code))
+    return compute_code_complexity(dedent(code))