kr.motd.maven.sphinx.dist.libfuturize.fixes.fix_metaclass$py.class Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sphinx-maven-plugin Show documentation
Show all versions of sphinx-maven-plugin Show documentation
Maven plugin that creates the site with Sphinx
???? 1? f$0 R(Lorg/python/core/PyFrame;Lorg/python/core/ThreadState;)Lorg/python/core/PyObject; __doc__ ?Fixer for __metaclass__ = X -> (future.utils.with_metaclass(X)) methods.
The various forms of classef (inherits nothing, inherits once, inherints
many) don't parse the same in the CST so we look at ALL classes for
a __metaclass__ and if we find one normalize the inherits to all be
an arglist.
For one-liner classes ('class X: pass') there is no indent/dedent so
we normalize those into having a suite.
Moving the __metaclass__ into the classdef can also cause the class
body to be empty so there is some special casing for that as well.
This fixer also tries very hard to keep original indenting and spacing
in all those corner cases.
org/python/core/PyString fromInterned .(Ljava/lang/String;)Lorg/python/core/PyString;
org/python/core/PyFrame
setglobal /(Ljava/lang/String;Lorg/python/core/PyObject;)V
setline (I)V
lib2to3 java/lang/String
fixer_base org/python/core/imp
importFrom \(Ljava/lang/String;[Ljava/lang/String;Lorg/python/core/PyFrame;I)[Lorg/python/core/PyObject;
! setlocal #
$ lib2to3.pygram & token ( lib2to3.fixer_util * Name , syms . Node 0 Leaf 2 touch_import 4 Call 6 String 8 Comma : parenthesize < org/python/core/Py > EmptyObjects [Lorg/python/core/PyObject; @ A ? B org/python/core/PyFunction D f_globals Lorg/python/core/PyObject; F G H has_metaclass$1 ? we have to check the cls_node without changing it.
There are two possiblities:
1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
2) clsdef => simple_stmt => expr_stmt => Leaf('__meta')
K getlocal (I)Lorg/python/core/PyObject; M N
O children Q org/python/core/PyObject S __getattr__ .(Ljava/lang/String;)Lorg/python/core/PyObject; U V
T W __iter__ ()Lorg/python/core/PyObject; Y Z
T [ (ILorg/python/core/PyObject;)V # ]
^ type ` getglobal b V
c suite e _eq 6(Lorg/python/core/PyObject;)Lorg/python/core/PyObject; g h
T i __nonzero__ ()Z k l
T m
has_metaclass o __call__ S(Lorg/python/core/ThreadState;Lorg/python/core/PyObject;)Lorg/python/core/PyObject; q r
T s f_lasti I u v w simple_stmt y
newInteger (I)Lorg/python/core/PyInteger; { |
? } __getitem__ h
T ? expr_stmt ?
isinstance ? m(Lorg/python/core/ThreadState;Lorg/python/core/PyObject;Lorg/python/core/PyObject;)Lorg/python/core/PyObject; q ?
T ? value ?
__metaclass__ ? True ? __iternext__ ? Z
T ? False ? "libfuturize/fixes/fix_metaclass$py ? Lorg/python/core/PyCode; J ? ? ? j(Lorg/python/core/PyObject;[Lorg/python/core/PyObject;Lorg/python/core/PyCode;Lorg/python/core/PyObject;)V ? ?
E ? fixup_parse_tree$2 f one-line classes don't get a suite in the parse tree so we add
one to normalize the tree
? None ? G ? ? enumerate ? unpackSequence 8(Lorg/python/core/PyObject;I)[Lorg/python/core/PyObject; ? ?
? ? COLON ?
ValueError ? No class suite and no ':'! ?
makeException 9(Lorg/python/core/PyObject;)Lorg/python/core/PyException; ? ?
? ? org/python/core/PyList ? ([Lorg/python/core/PyObject;)V ? ?
? ? _add ? h
T ? append_child ? clone ? 9(Lorg/python/core/ThreadState;)Lorg/python/core/PyObject; q ?
T ? remove ? __getslice__ j(Lorg/python/core/PyObject;Lorg/python/core/PyObject;Lorg/python/core/PyObject;)Lorg/python/core/PyObject; ? ?
T ? ? ? ? ? fixup_parse_tree ? fixup_simple_stmt$3 ? if there is a semi-colon all the parts count as part of the same
simple_stmt. We just want the __metaclass__ part so we move
everything efter the semi-colon into its own simple_stmt node
? SEMI ? insert_child ? prefix ? __setattr__ ?
T ? ? ? ? ? fixup_simple_stmt ? remove_trailing_newline$4 NEWLINE ? ? ? ? ? remove_trailing_newline ? find_metas$5 No class suite! ? list ? org/python/core/PyUnicode ? /(Ljava/lang/String;)Lorg/python/core/PyUnicode; ?
? ? ?(Lorg/python/core/ThreadState;Lorg/python/core/PyObject;Lorg/python/core/PyObject;Lorg/python/core/PyObject;)Lorg/python/core/PyObject; q ?
T ? org/python/core/PyTuple ?
? ? java/util/Arrays ? fill (([Ljava/lang/Object;Ljava/lang/Object;)V ? ?
? ? java/lang/Object ?
f_savedlocals [Ljava/lang/Object; ? ? ? getGeneratorInput ()Ljava/lang/Object; ?
org/python/core/PyException java/lang/Throwable ? ? ?
find_metas fixup_indent$6 ? If an INDENT is followed by a thing with a prefix then nuke the prefix
Otherwise we get in trouble when removing __metaclass__ at suite start
pop INDENT DEDENT _ne h
T extend ? ? fixup_indent getname V
BaseFix" FixMetaclass$ FixMetaclass$7
__module__' __name__)
BM_compatible+
classdef
- PATTERN/ transform$8 __not__2 Z
T3 ? len6 arglist8 set_child: RPAR< )> LPAR@ (B Unexpected class definitionD metaclassF future.utilsH with_metaclassJ L 'NewBase'N atomP LBRACER {T RBRACEV }X g(Lorg/python/core/ThreadState;[Lorg/python/core/PyObject;[Ljava/lang/String;)Lorg/python/core/PyObject; qZ
T[ replace] pass_
a _gtc h
Td1 ? ?f transformh getf_localsj Z
k&