diff --git a/jargonaut/transformations/layout/randomize_attributes.py b/jargonaut/transformations/layout/randomize_attributes.py index 01551a3..58baf3d 100644 --- a/jargonaut/transformations/layout/randomize_attributes.py +++ b/jargonaut/transformations/layout/randomize_attributes.py @@ -54,7 +54,7 @@ def dummyFunc(): # Avoid messing with the lambda strings which use # __code__ as well dummyFunc.__code__ - ] + ] for t in types_to_inspect: self.avoid_names.extend(method for method in dir(t)) @@ -91,7 +91,10 @@ def leave_Attribute( original_node: cst.Attribute, updated_node: cst.Attribute ) -> Optional[bool]: - scope = self.get_metadata(ScopeProvider, original_node) + try: + scope = self.get_metadata(ScopeProvider, original_node) + except KeyError: + return updated_node qualified_names = list(scope.get_qualified_names_for(original_node)) qualified_name = qualified_names[0] # print(f"scope: {scope} qualified_name: {qualified_name}")