2828# POSSIBILITY OF SUCH DAMAGE.
2929
3030# Authors: Stuart Glaser, William Woodall, Robert Haschke
31- # Maintainer: Morgan Quigley <[email protected] > 3231
3332import ast
3433import collections
@@ -200,12 +199,12 @@ def expose(*args, **kwargs):
200199
201200 deprecate_msg = 'Using {name}() directly is deprecated. Use {ns}.{name}() instead.'
202201 # This is the list of symbols we have exposed for years now. Continue exposing them directly
203- expose ('list' , 'dict' , 'map' , 'len' , 'str' , 'float' , 'int' , 'True' , 'False' , 'min' , 'max' , 'round' ,
202+ expose ('list' , 'dict' , 'map' , 'len' , 'str' , 'float' , 'int' , 'bool' , ' True' , 'False' , 'min' , 'max' , 'round' ,
204203 source = __builtins__ )
205- # These few were only recently added. The should move into python namespace, but (with a deprecation msg) stay global for now
204+ # These few were only recently added. They should move into the python namespace, but (with a deprecation msg) stay global for now
206205 expose ('sorted' , 'range' , source = __builtins__ , ns = 'python' , deprecate_msg = deprecate_msg )
207- # Expose all builtin symbols into the python namespace. Thus the stay accessible if the global symbol was overriden
208- expose ('list' , 'dict' , 'map' , 'len' , 'str' , 'float' , 'int' , 'True' , 'False' , 'min' , 'max' , 'round' ,
206+ # Expose all builtin symbols into the python namespace. Thus, they stay accessible if the global symbol is overridden
207+ expose ('list' , 'dict' , 'map' , 'len' , 'str' , 'float' , 'int' , 'bool' , ' True' , 'False' , 'min' , 'max' , 'round' ,
209208 'abs' , 'all' , 'any' , 'complex' , 'divmod' , 'enumerate' , 'filter' , 'frozenset' , 'hash' , 'isinstance' , 'issubclass' ,
210209 'ord' , 'repr' , 'reversed' , 'slice' , 'set' , 'sum' , 'tuple' , 'type' , 'vars' , 'zip' , source = __builtins__ , ns = 'python' )
211210
@@ -786,7 +785,7 @@ def handle_macro_call(node, macros, symbols):
786785
787786 name = node .tagName [6 :] # drop 'xacro:' prefix
788787 try :
789- macros , symbols , m = resolve_macro (name , macros , symbols )
788+ scoped_macros , scoped_symbols , m = resolve_macro (name , macros , symbols )
790789 body = m .body .cloneNode (deep = True )
791790
792791 except KeyError :
@@ -795,8 +794,8 @@ def handle_macro_call(node, macros, symbols):
795794 macrostack .append (m )
796795
797796 # Expand the macro
798- scoped_symbols = Table (symbols ) # new local name space for macro evaluation
799- scoped_macros = Table (macros )
797+ scoped_symbols = Table (scoped_symbols ) # new local name space for macro evaluation
798+ scoped_macros = Table (scoped_macros )
800799 params = m .params [:] # deep copy macro's params list
801800 for name , value in node .attributes .items ():
802801 if name not in params :
@@ -1115,7 +1114,8 @@ def process_file(input_file_name, **kwargs):
11151114 # add xacro auto-generated banner
11161115 banner = [xml .dom .minidom .Comment (c ) for c in
11171116 [" %s " % ('=' * 83 ),
1118- " | This document was autogenerated by xacro from %-30s | " % input_file_name ,
1117+ # replace consecutive dashes with a single one to yield a XML-compliant comment string
1118+ " | This document was autogenerated by xacro from %-30s | " % re .sub (r'-+' , '-' , input_file_name ),
11191119 " | EDITING THIS FILE BY HAND IS NOT RECOMMENDED %-30s | " % "" ,
11201120 " %s " % ('=' * 83 )]]
11211121 first = doc .firstChild
0 commit comments