• Home
  • Raw
  • Download

Lines Matching refs:t

59             for t in tree:
60 self.dispatch(t)
89 def _Import(self, t): argument
91 interleave(lambda: self.write(", "), self.dispatch, t.names)
93 def _ImportFrom(self, t): argument
95 self.write("." * t.level)
96 if t.module:
97 self.write(t.module)
99 interleave(lambda: self.write(", "), self.dispatch, t.names)
101 def _Assign(self, t): argument
103 for target in t.targets:
106 self.dispatch(t.value)
108 def _AugAssign(self, t): argument
110 self.dispatch(t.target)
111 self.write(" "+self.binop[t.op.__class__.__name__]+"= ")
112 self.dispatch(t.value)
114 def _AnnAssign(self, t): argument
116 if not t.simple and isinstance(t.target, ast.Name):
118 self.dispatch(t.target)
119 if not t.simple and isinstance(t.target, ast.Name):
122 self.dispatch(t.annotation)
123 if t.value:
125 self.dispatch(t.value)
127 def _Return(self, t): argument
129 if t.value:
131 self.dispatch(t.value)
133 def _Pass(self, t): argument
136 def _Break(self, t): argument
139 def _Continue(self, t): argument
142 def _Delete(self, t): argument
144 interleave(lambda: self.write(", "), self.dispatch, t.targets)
146 def _Assert(self, t): argument
148 self.dispatch(t.test)
149 if t.msg:
151 self.dispatch(t.msg)
153 def _Global(self, t): argument
155 interleave(lambda: self.write(", "), self.write, t.names)
157 def _Nonlocal(self, t): argument
159 interleave(lambda: self.write(", "), self.write, t.names)
161 def _Await(self, t): argument
164 if t.value:
166 self.dispatch(t.value)
169 def _Yield(self, t): argument
172 if t.value:
174 self.dispatch(t.value)
177 def _YieldFrom(self, t): argument
180 if t.value:
182 self.dispatch(t.value)
185 def _Raise(self, t): argument
187 if not t.exc:
188 assert not t.cause
191 self.dispatch(t.exc)
192 if t.cause:
194 self.dispatch(t.cause)
196 def _Try(self, t): argument
199 self.dispatch(t.body)
201 for ex in t.handlers:
203 if t.orelse:
206 self.dispatch(t.orelse)
208 if t.finalbody:
211 self.dispatch(t.finalbody)
214 def _ExceptHandler(self, t): argument
216 if t.type:
218 self.dispatch(t.type)
219 if t.name:
221 self.write(t.name)
223 self.dispatch(t.body)
226 def _ClassDef(self, t): argument
228 for deco in t.decorator_list:
231 self.fill("class "+t.name)
234 for e in t.bases:
238 for e in t.keywords:
245 self.dispatch(t.body)
248 def _FunctionDef(self, t): argument
249 self.__FunctionDef_helper(t, "def")
251 def _AsyncFunctionDef(self, t): argument
252 self.__FunctionDef_helper(t, "async def")
254 def __FunctionDef_helper(self, t, fill_suffix): argument
256 for deco in t.decorator_list:
259 def_str = fill_suffix+" "+t.name + "("
261 self.dispatch(t.args)
263 if t.returns:
265 self.dispatch(t.returns)
267 self.dispatch(t.body)
270 def _For(self, t): argument
271 self.__For_helper("for ", t)
273 def _AsyncFor(self, t): argument
274 self.__For_helper("async for ", t)
276 def __For_helper(self, fill, t): argument
278 self.dispatch(t.target)
280 self.dispatch(t.iter)
282 self.dispatch(t.body)
284 if t.orelse:
287 self.dispatch(t.orelse)
290 def _If(self, t): argument
292 self.dispatch(t.test)
294 self.dispatch(t.body)
297 while (t.orelse and len(t.orelse) == 1 and
298 isinstance(t.orelse[0], ast.If)):
299 t = t.orelse[0]
301 self.dispatch(t.test)
303 self.dispatch(t.body)
306 if t.orelse:
309 self.dispatch(t.orelse)
312 def _While(self, t): argument
314 self.dispatch(t.test)
316 self.dispatch(t.body)
318 if t.orelse:
321 self.dispatch(t.orelse)
324 def _With(self, t): argument
326 interleave(lambda: self.write(", "), self.dispatch, t.items)
328 self.dispatch(t.body)
331 def _AsyncWith(self, t): argument
333 interleave(lambda: self.write(", "), self.dispatch, t.items)
335 self.dispatch(t.body)
339 def _JoinedStr(self, t): argument
342 self._fstring_JoinedStr(t, string.write)
345 def _FormattedValue(self, t): argument
348 self._fstring_FormattedValue(t, string.write)
351 def _fstring_JoinedStr(self, t, write): argument
352 for value in t.values:
356 def _fstring_Constant(self, t, write): argument
357 assert isinstance(t.value, str)
358 value = t.value.replace("{", "{{").replace("}", "}}")
361 def _fstring_FormattedValue(self, t, write): argument
364 Unparser(t.value, expr)
369 if t.conversion != -1:
370 conversion = chr(t.conversion)
373 if t.format_spec:
375 meth = getattr(self, "_fstring_" + type(t.format_spec).__name__)
376 meth(t.format_spec, write)
379 def _Name(self, t): argument
380 self.write(t.id)
389 def _Constant(self, t): argument
390 value = t.value
402 if t.kind == "u":
404 self._write_constant(t.value)
406 def _List(self, t): argument
408 interleave(lambda: self.write(", "), self.dispatch, t.elts)
411 def _ListComp(self, t): argument
413 self.dispatch(t.elt)
414 for gen in t.generators:
418 def _GeneratorExp(self, t): argument
420 self.dispatch(t.elt)
421 for gen in t.generators:
425 def _SetComp(self, t): argument
427 self.dispatch(t.elt)
428 for gen in t.generators:
432 def _DictComp(self, t): argument
434 self.dispatch(t.key)
436 self.dispatch(t.value)
437 for gen in t.generators:
441 def _comprehension(self, t): argument
442 if t.is_async:
446 self.dispatch(t.target)
448 self.dispatch(t.iter)
449 for if_clause in t.ifs:
453 def _IfExp(self, t): argument
455 self.dispatch(t.body)
457 self.dispatch(t.test)
459 self.dispatch(t.orelse)
462 def _Set(self, t): argument
463 assert(t.elts) # should be at least one element
465 interleave(lambda: self.write(", "), self.dispatch, t.elts)
468 def _Dict(self, t): argument
484 interleave(lambda: self.write(", "), write_item, zip(t.keys, t.values))
487 def _Tuple(self, t): argument
489 if len(t.elts) == 1:
490 elt = t.elts[0]
494 interleave(lambda: self.write(", "), self.dispatch, t.elts)
498 def _UnaryOp(self, t): argument
500 self.write(self.unop[t.op.__class__.__name__])
502 self.dispatch(t.operand)
508 def _BinOp(self, t): argument
510 self.dispatch(t.left)
511 self.write(" " + self.binop[t.op.__class__.__name__] + " ")
512 self.dispatch(t.right)
517 def _Compare(self, t): argument
519 self.dispatch(t.left)
520 for o, e in zip(t.ops, t.comparators):
526 def _BoolOp(self, t): argument
528 s = " %s " % self.boolops[t.op.__class__]
529 interleave(lambda: self.write(s), self.dispatch, t.values)
532 def _Attribute(self,t): argument
533 self.dispatch(t.value)
537 if isinstance(t.value, ast.Constant) and isinstance(t.value.value, int):
540 self.write(t.attr)
542 def _Call(self, t): argument
543 self.dispatch(t.func)
546 for e in t.args:
550 for e in t.keywords:
556 def _Subscript(self, t): argument
557 self.dispatch(t.value)
559 self.dispatch(t.slice)
562 def _Starred(self, t): argument
564 self.dispatch(t.value)
567 def _Ellipsis(self, t): argument
570 def _Index(self, t): argument
571 self.dispatch(t.value)
573 def _Slice(self, t): argument
574 if t.lower:
575 self.dispatch(t.lower)
577 if t.upper:
578 self.dispatch(t.upper)
579 if t.step:
581 self.dispatch(t.step)
583 def _ExtSlice(self, t): argument
584 interleave(lambda: self.write(', '), self.dispatch, t.dims)
587 def _arg(self, t): argument
588 self.write(t.arg)
589 if t.annotation:
591 self.dispatch(t.annotation)
594 def _arguments(self, t): argument
597 all_args = t.posonlyargs + t.args
598 defaults = [None] * (len(all_args) - len(t.defaults)) + t.defaults
607 if index == len(t.posonlyargs):
611 if t.vararg or t.kwonlyargs:
615 if t.vararg:
616 self.write(t.vararg.arg)
617 if t.vararg.annotation:
619 self.dispatch(t.vararg.annotation)
622 if t.kwonlyargs:
623 for a, d in zip(t.kwonlyargs, t.kw_defaults):
632 if t.kwarg:
635 self.write("**"+t.kwarg.arg)
636 if t.kwarg.annotation:
638 self.dispatch(t.kwarg.annotation)
640 def _keyword(self, t): argument
641 if t.arg is None:
644 self.write(t.arg)
646 self.dispatch(t.value)
648 def _Lambda(self, t): argument
651 self.dispatch(t.args)
653 self.dispatch(t.body)
656 def _alias(self, t): argument
657 self.write(t.name)
658 if t.asname:
659 self.write(" as "+t.asname)
661 def _withitem(self, t): argument
662 self.dispatch(t.context_expr)
663 if t.optional_vars:
665 self.dispatch(t.optional_vars)