|
51 | 51 | except O:pass |
52 | 52 | try:from collections import OrderedDict as k |
53 | 53 | except O:from ucollections import OrderedDict as k |
54 | | -__version__='v1.17.4' |
| 54 | +__version__='v1.17.5' |
55 | 55 | A3=2 |
56 | 56 | A4=2 |
57 | 57 | A5=['lib','/lib','/sd/lib','/flash/lib',J] |
@@ -131,40 +131,41 @@ def create_module_stub(K,module_name,file_name=E): |
131 | 131 | try:del N |
132 | 132 | except(D,q):A.warning('could not del new_module') |
133 | 133 | F.collect();return R |
134 | | - def write_object_stub(K,fp,object_expr,obj_name,indent,in_class=0): |
135 | | - Y=' at ';X='generator';W='{0}{1}: {3} = {2}\n';V='bound_method';U='Incomplete';N=in_class;M='Exception';L=object_expr;I=fp;D=indent;F.collect() |
136 | | - if L in K.problematic:A.warning('SKIPPING problematic module:{}'.format(L));return |
137 | | - Z,O=K.get_obj_attributes(L) |
138 | | - if O:A.error(O) |
139 | | - for(E,J,H,a,c)in Z: |
140 | | - if E in['classmethod','staticmethod','BaseException',M]:continue |
| 134 | + def write_object_stub(L,fp,object_expr,obj_name,indent,in_class=0): |
| 135 | + Z=' at ...>';Y='generator';X='{0}{1}: {3} = {2}\n';W='bound_method';V='Incomplete';O=in_class;N='Exception';M=object_expr;K=' at ';J=fp;D=indent;F.collect() |
| 136 | + if M in L.problematic:A.warning('SKIPPING problematic module:{}'.format(M));return |
| 137 | + a,Q=L.get_obj_attributes(M) |
| 138 | + if Q:A.error(Q) |
| 139 | + for(E,H,I,b,g)in a: |
| 140 | + if E in['classmethod','staticmethod','BaseException',N]:continue |
141 | 141 | if E[0].isdigit():A.warning('NameError: invalid name {}'.format(E));continue |
142 | | - if H=="<class 'type'>"and P(D)<=A4*4: |
143 | | - Q=B;R=E.endswith(M)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit'] |
144 | | - if R:Q=M |
145 | | - C='\n{}class {}({}):\n'.format(D,E,Q) |
146 | | - if R:C+=D+' ...\n';I.write(C);continue |
147 | | - I.write(C);K.write_object_stub(I,a,'{0}.{1}'.format(obj_name,E),D+' ',N+1);C=D+' def __init__(self, *argv, **kwargs) -> None:\n';C+=D+' ...\n\n';I.write(C) |
148 | | - elif any(A in H for A in[A0,z,'closure']): |
149 | | - S=U;T=B |
150 | | - if N>0:T='self, ' |
151 | | - if V in H or V in J:C='{}@classmethod\n'.format(D)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(D,E,S) |
152 | | - else:C='{}def {}({}*args, **kwargs) -> {}:\n'.format(D,E,T,S) |
153 | | - C+=D+' ...\n\n';I.write(C) |
154 | | - elif H=="<class 'module'>":0 |
155 | | - elif H.startswith("<class '"): |
156 | | - G=H[8:-2];C=B |
157 | | - if G in(x,v,w,y,'bytearray','bytes'):C=W.format(D,E,J,G) |
158 | | - elif G in(f,e,d):b={f:'{}',e:'[]',d:'()'};C=W.format(D,E,b[G],G) |
159 | | - elif G in('object','set','frozenset','Pin',X): |
160 | | - if G==X:G='Generator' |
161 | | - C='{0}{1}: {2} ## = {4}\n'.format(D,E,G,H,J) |
| 142 | + if I=="<class 'type'>"and P(D)<=A4*4: |
| 143 | + R=B;S=E.endswith(N)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit'] |
| 144 | + if S:R=N |
| 145 | + C='\n{}class {}({}):\n'.format(D,E,R) |
| 146 | + if S:C+=D+' ...\n';J.write(C);continue |
| 147 | + J.write(C);L.write_object_stub(J,b,'{0}.{1}'.format(obj_name,E),D+' ',O+1);C=D+' def __init__(self, *argv, **kwargs) -> None:\n';C+=D+' ...\n\n';J.write(C) |
| 148 | + elif any(A in I for A in[A0,z,'closure']): |
| 149 | + T=V;U=B |
| 150 | + if O>0:U='self, ' |
| 151 | + if W in I or W in H:C='{}@classmethod\n'.format(D)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(D,E,T) |
| 152 | + else:C='{}def {}({}*args, **kwargs) -> {}:\n'.format(D,E,U,T) |
| 153 | + C+=D+' ...\n\n';J.write(C) |
| 154 | + elif I=="<class 'module'>":0 |
| 155 | + elif I.startswith("<class '"): |
| 156 | + G=I[8:-2];C=B |
| 157 | + if G in(x,v,w,y,'bytearray','bytes'):C=X.format(D,E,H,G) |
| 158 | + elif G in(f,e,d):c={f:'{}',e:'[]',d:'()'};C=X.format(D,E,c[G],G) |
| 159 | + elif G in('object','set','frozenset','Pin',Y): |
| 160 | + if G==Y:G='Generator' |
| 161 | + C='{0}{1}: {2} ## = {4}\n'.format(D,E,G,I,H) |
162 | 162 | else: |
163 | | - G=U |
164 | | - if Y in J:J=J.split(Y)[0]+' at ...>' |
165 | | - C='{0}{1}: {2} ## {3} = {4}\n'.format(D,E,G,H,J) |
166 | | - I.write(C) |
167 | | - else:I.write("# all other, type = '{0}'\n".format(H));I.write(D+E+' # type: Incomplete\n') |
| 163 | + G=V |
| 164 | + if K in H:H=H.split(K)[0]+Z |
| 165 | + if K in H:H=H.split(K)[0]+Z |
| 166 | + C='{0}{1}: {2} ## {3} = {4}\n'.format(D,E,G,I,H) |
| 167 | + J.write(C) |
| 168 | + else:J.write("# all other, type = '{0}'\n".format(I));J.write(D+E+' # type: Incomplete\n') |
168 | 169 | @property |
169 | 170 | def flat_fwid(self): |
170 | 171 | A=self._fwid;B=' .()/\\:$' |
|
0 commit comments