@@ -75,11 +75,13 @@ class arguments(commonloc):
75
75
Function definition arguments, e.g. in ``def f(x, y=1, *z, **t)``.
76
76
77
77
:ivar args: (list of assignable node) regular formal arguments
78
- :ivar vararg: (node ) splat formal argument (if any), e.g. in ``*x``
79
- :ivar kwarg: (node ) keyword splat formal argument (if any), e.g. in ``**x``
80
- :ivar defaults: (node) values of default arguments
78
+ :ivar vararg: (string ) splat formal argument (if any), e.g. in ``*x``
79
+ :ivar kwarg: (string ) keyword splat formal argument (if any), e.g. in ``**x``
80
+ :ivar defaults: (list of node) values of default arguments
81
81
:ivar star_loc: location of ``*``, if any
82
+ :ivar vararg_loc: location of splat formal argument, if any
82
83
:ivar dstar_loc: location of ``**``, if any
84
+ :ivar kwarg_loc: location of keyword splat formal argument, if any
83
85
:ivar default_equals_locs: locations of ``=``
84
86
"""
85
87
@@ -132,13 +134,14 @@ class ExceptHandler(excepthandler, ast.ExceptHandler):
132
134
"""
133
135
An exception handler, e.g. ``except x as y:· z``.
134
136
135
- :ivar type: (node) type of handled exception
137
+ :ivar type: (node) type of handled exception, if any
136
138
:ivar name: (assignable node) variable bound to exception, if any
137
139
:ivar body: (list of node) code to execute when exception is caught
138
140
:ivar except_loc: location of ``except``
139
141
:ivar as_loc: location of ``as``, if any
142
+ :ivar colon_loc: location of ``:``
140
143
"""
141
- _locs = excepthandler ._locs + ('except_loc' , 'as_loc' )
144
+ _locs = excepthandler ._locs + ('except_loc' , 'as_loc' , 'colon_loc' )
142
145
143
146
class expr (commonloc ):
144
147
"""Base class for expression nodes."""
@@ -328,7 +331,6 @@ class keyword(commonloc, ast.keyword):
328
331
329
332
class mod (commonloc ):
330
333
"""Base class for modules (groups of statements)."""
331
- _locs = commonloc ._locs + ('body' ,)
332
334
class Expression (mod , ast .Expression ):
333
335
"""A group of statements parsed as if for :func:`eval`."""
334
336
class Interactive (mod , ast .Interactive ):
@@ -435,8 +437,9 @@ class ClassDef(keywordloc, stmt, ast.ClassDef):
435
437
:ivar name_loc: location of name
436
438
:ivar lparen_loc: location of ``(``, if any
437
439
:ivar rparen_loc: location of ``)``, if any
440
+ :ivar at_locs: locations of decorator ``@``
438
441
"""
439
- _locs = keywordloc ._locs + ('name_loc' , 'lparen_loc' , 'rparen_loc' )
442
+ _locs = keywordloc ._locs + ('name_loc' , 'lparen_loc' , 'rparen_loc' , 'at_loc' )
440
443
class Continue (keywordloc , stmt , ast .Continue ):
441
444
"""The ``continue`` statement."""
442
445
class Delete (keywordloc , stmt , ast .Delete ):
@@ -488,8 +491,9 @@ class FunctionDef(keywordloc, stmt, ast.FunctionDef):
488
491
:ivar decorator_list: (list of node) decorators
489
492
:ivar name_loc: location of name
490
493
:ivar colon_loc: location of ``:``, if any
494
+ :ivar at_locs: locations of decorator ``@``
491
495
"""
492
- _locs = keywordloc ._locs + ('keyword_loc' 'name_loc' , 'colon_loc' )
496
+ _locs = keywordloc ._locs + ('keyword_loc' 'name_loc' , 'colon_loc' , 'at_loc' )
493
497
class Global (keywordloc , stmt , ast .Global ):
494
498
"""
495
499
The ``global x, y`` statement.
@@ -516,17 +520,17 @@ class Import(keywordloc, stmt, ast.Import):
516
520
"""
517
521
class ImportFrom (keywordloc , stmt , ast .Import ):
518
522
"""
519
- The ``from ...x import y, z`` statement.
523
+ The ``from ...x import y, z`` or ``from x import *`` statement.
520
524
521
525
:ivar names: (list of :class:`alias`) names
522
- :ivar module: (string) module name
526
+ :ivar module: (string) module name, if any
523
527
:ivar level: (integer) amount of dots before module name
524
528
:ivar keyword_loc: location of ``from``
525
- :ivar dots_loc: location of dots
526
- :ivar module_loc: location of module name
529
+ :ivar dots_loc: location of dots, if any
530
+ :ivar module_loc: location of module name, if any
527
531
:ivar import_loc: location of ``import``
528
532
"""
529
- _locs = keywordloc ._locs + ('dots_loc' , ' module_loc' , 'import_loc' )
533
+ _locs = keywordloc ._locs + ('module_loc' , 'import_loc' )
530
534
class Pass (keywordloc , stmt , ast .Pass ):
531
535
"""The ``pass`` statement."""
532
536
class Print (keywordloc , stmt , ast .Print ):
@@ -554,7 +558,7 @@ class TryExcept(keywordloc, stmt, ast.TryExcept):
554
558
The ``try:· x·except y:· z·else:· t`` statement.
555
559
556
560
:ivar body: (list of node) code to try
557
- :ivar handlers:
561
+ :ivar handlers: (list of :class:`ExceptHandler`) exception handlers
558
562
:ivar orelse: (list of node) code if no exception
559
563
:ivar keyword_loc: location of ``try``
560
564
:ivar try_colon_loc: location of ``:`` after ``try``
0 commit comments