• Home
  • Raw
  • Download

Lines Matching +full:visitor +full:- +full:keys

16     using the built-in `compile()` function.
44 major, minor = feature_version # Should be a 2-tuple.
48 feature_version = -1
82 return - operand
97 if len(node.keys) != len(node.values):
99 return dict(zip(map(_convert, node.keys),
108 return left - right
121 include_attributes can be set to true. If indent is a non-negative
122 integer or string, then the tree will be pretty-printed with that indent
349 If *padded* is `True`, the first line of a multi-line statement will
355 lineno = node.lineno - 1
356 end_lineno = node.end_lineno - 1
396 A node visitor base class that walks the abstract syntax tree and calls a
397 visitor function for every node found. This function may return a value
400 This class is meant to be subclassed, with the subclass adding visitor
403 Per default the visitor functions for the nodes are ``'visit_'`` +
406 the `visit` method. If no visitor function exists for a node
407 (return value `None`) the `generic_visit` visitor is used instead.
410 traversing. For this a special visitor exists (`NodeTransformer`) that
417 visitor = getattr(self, method, self.generic_visit)
418 return visitor(node)
421 """Called if no explicit visitor function exists for a node."""
441 visitor = getattr(self, method)
448 return visitor(node)
458 visitor methods to replace or remove the old node. If the return value of
459 the visitor method is ``None``, the node will be removed from its location,
480 statement nodes), the visitor may also return a list of nodes rather than
654 TEST = auto() # 'if'-'else', 'lambda'
665 ARITH = auto() # '+', '-'
667 FACTOR = auto() # unary '+', '-', '~'
755 self._indent -= 1
842 self.write(" -> ")
1047 self.write(" -> ")
1118 # \n and \t are non-printable, but we only escape them if
1122 # Always escape backslashes and other non-printable characters
1138 return string[1:-1], [quote]
1141 possible_quotes.sort(key=lambda q: q[0] == escaped_string[-1])
1144 if possible_quotes[0][0] == escaped_string[-1]:
1146 escaped_string = escaped_string[:-1] + "\\" + escaped_string[-1]
1167 # Constant parts of the f-string, and allow escapes accordingly.
1192 # for both the f-string itself, and format_spec
1213 "Unable to avoid backslash in f-string expression part"
1219 if node.conversion != -1:
1237 # and inf - inf for NaNs.
1241 .replace("nan", f"({_INFSTR}-{_INFSTR})")
1342 lambda: self.write(", "), write_item, zip(node.keys, node.values)
1353 unop = {"Invert": "~", "Not": "not", "UAdd": "+", "USub": "-"}
1358 "-": _Precedence.FACTOR,
1366 # factor prefixes (+, -, ~) shouldn't be separated
1375 "Sub": "-",
1391 "-": _Precedence.ARITH,
1541 defaults = [None] * (len(all_args) - len(node.defaults)) + node.defaults
1555 # varargs, or bare '*' if no varargs but keyword-only arguments present
1568 # keyword-only arguments
1653 keys = node.keys
1657 zip(keys, node.patterns, strict=True),
1661 if keys:
1714 parser = argparse.ArgumentParser(prog='python -m ast')
1716 default='-',
1718 parser.add_argument('-m', '--mode', default='exec',
1721 parser.add_argument('--no-type-comments', default=True, action='store_false',
1723 parser.add_argument('-a', '--include-attributes', action='store_true',
1726 parser.add_argument('-i', '--indent', type=int, default=3,