zubin71 avatar zubin71 committed 4a7fa64

test_unrepr cleared. ast.diff applied.

Comments (0)

Files changed (1)

         return m(o)
 
     def build_List(self, o):
-        return list(map(self.build, o.getChildren()))
+        return map(self.build, o.elts)
+    
+    def build_Num(self, o):
+        return o.n
 
-    def build_Const(self, o):
-        return o.value
+    def build_Str(str, o):
+        return o.s
 
     def build_Dict(self, o):
         d = {}
-        i = iter(map(self.build, o.getChildren()))
-        for el in i:
-            d[el] = next(i)
+        items = zip(o.keys, o.values)
+        for key, value in items:
+            key = self.build(key)
+            value = self.build(value)
+            d[key] = value
         return d
 
     def build_Tuple(self, o):
         return tuple(self.build_List(o))
 
     def build_Name(self, o):
-        if o.name == 'None':
+        value = o.id
+        if value == 'None':
             return None
-        if o.name == 'True':
+        if value == 'True':
             return True
-        if o.name == 'False':
+        if value == 'False':
             return False
 
         # An undefined Name
         raise UnknownType('Undefined Name')
 
-    def build_Add(self, o):
-        real, imag = list(map(self.build_Const, o.getChildren()))
-        try:
-            real = float(real)
-        except TypeError:
-            raise UnknownType('Add')
-        if not isinstance(imag, complex) or imag.real != 0.0:
-            raise UnknownType('Add')
-        return real+imag
-
-    def build_Getattr(self, o):
-        parent = self.build(o.expr)
-        return getattr(parent, o.attrname)
-
-    def build_UnarySub(self, o):
-        return -self.build_Const(o.getChildren()[0])
-
-    def build_UnaryAdd(self, o):
-        return self.build_Const(o.getChildren()[0])
-
-
 _builder = Builder()
 
 def unrepr(s):
         Called by validate. Handles setting the configspec on subsections
         including sections to be validated by __many__
         """
-        print("inside _set_configspec")
         configspec = section.configspec
         many = configspec.get('__many__')
         if isinstance(many, dict):
         results dictionary into a flattened list of failures - useful for
         displaying meaningful error messages.
         """
-        print("inside the validate function")
         if section is None:
             if self.configspec is None:
                 raise ValueError('No configspec supplied.')
         self._set_configspec(section, copy)
     
         def validate_entry(entry, spec, val, missing, ret_true, ret_false):
-            print("inside validate_entry")
             section.default_values.pop(entry, None)
 
             try:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.