133 @param node reference to the node to check |
133 @param node reference to the node to check |
134 @type ast.AST |
134 @type ast.AST |
135 @return flag indicating a bytes |
135 @return flag indicating a bytes |
136 @rtype bool |
136 @rtype bool |
137 """ |
137 """ |
138 return ( |
138 return isinstance(node, ast.Bytes) |
139 sys.version_info[0] >= 3 and |
|
140 isinstance(node, ast.Bytes) |
|
141 ) |
|
142 |
139 |
143 def isBaseString(node): |
140 def isBaseString(node): |
144 """ |
141 """ |
145 Function to check that a node is a bytes or string. |
142 Function to check that a node is a bytes or string. |
146 |
143 |
147 @param node reference to the node to check |
144 @param node reference to the node to check |
148 @type ast.AST |
145 @type ast.AST |
149 @return flag indicating a bytes or string |
146 @return flag indicating a bytes or string |
150 @rtype bool |
147 @rtype bool |
151 """ |
148 """ |
152 typ = (ast.Str,) |
149 return isinstance(node, (ast.Str, ast.Bytes)) |
153 if sys.version_info[0] > 2: |
|
154 typ += (ast.Bytes,) |
|
155 return isinstance(node, typ) |
|
156 |
150 |
157 def isNameConstant(node): |
151 def isNameConstant(node): |
158 """ |
152 """ |
159 Function to check that a node is a name constant. |
153 Function to check that a node is a name constant. |
160 |
154 |