Skip to content

Commit

Permalink
Merge and release
Browse files Browse the repository at this point in the history
  • Loading branch information
Josverl committed Mar 5, 2024
2 parents 2a5a5b1 + 9173d82 commit 7814bde
Show file tree
Hide file tree
Showing 16 changed files with 196 additions and 188 deletions.
40 changes: 20 additions & 20 deletions mip/full.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs.py"
],
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem.py"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
]
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs.py"
],
"deps": [],
"version": "1.17.4"
}
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem.py"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
]
],
"deps": [],
"version": "1.17.5"
}
40 changes: 20 additions & 20 deletions mip/minified.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs_min.py"
],
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db_min.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem_min.py"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
]
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs_min.py"
],
"deps": [],
"version": "1.17.4"
}
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db_min.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem_min.py"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
]
],
"deps": [],
"version": "1.17.5"
}
40 changes: 20 additions & 20 deletions mip/mpy_v5.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"urls": [
[
"createstubs.mpy",
"github:josverl/micropython-stubber/mip/v5/createstubs_mpy.mpy"
],
[
"createstubs_db.mpy",
"github:Josverl/micropython-stubber/mip/v5/createstubs_db_mpy.mpy"
],
[
"createstubs_mem.mpy",
"github:Josverl/micropython-stubber/mip/v5/createstubs_mem_mpy.mpy"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/mip/v5/modulelist.txt"
]
"urls": [
[
"createstubs.mpy",
"github:josverl/micropython-stubber/mip/v5/createstubs_mpy.mpy"
],
"deps": [],
"version": "1.17.4"
}
[
"createstubs_db.mpy",
"github:Josverl/micropython-stubber/mip/v5/createstubs_db_mpy.mpy"
],
[
"createstubs_mem.mpy",
"github:Josverl/micropython-stubber/mip/v5/createstubs_mem_mpy.mpy"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/mip/v5/modulelist.txt"
]
],
"deps": [],
"version": "1.17.5"
}
40 changes: 20 additions & 20 deletions mip/mpy_v6.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"urls": [
[
"createstubs.mpy",
"github:josverl/micropython-stubber/mip/v6/createstubs_mpy.mpy"
],
[
"createstubs_mem.mpy",
"github:Josverl/micropython-stubber/mip/v6/createstubs_mem_mpy.mpy"
],
[
"createstubs_db.mpy",
"github:Josverl/micropython-stubber/mip/v6/createstubs_db_mpy.mpy"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/mip/v6/modulelist.txt"
]
"urls": [
[
"createstubs.mpy",
"github:josverl/micropython-stubber/mip/v6/createstubs_mpy.mpy"
],
"deps": [],
"version": "1.17.4"
}
[
"createstubs_mem.mpy",
"github:Josverl/micropython-stubber/mip/v6/createstubs_mem_mpy.mpy"
],
[
"createstubs_db.mpy",
"github:Josverl/micropython-stubber/mip/v6/createstubs_db_mpy.mpy"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/mip/v6/modulelist.txt"
]
],
"deps": [],
"version": "1.17.5"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
]
],
"deps": [],
"version": "1.17.4"
"version": "1.17.5"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repo-path = "./repos"

[tool.poetry]
name = "micropython-stubber"
version = "1.17.4"
version = "1.17.5"
description = "Tooling to create and maintain stubs for MicroPython"
authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
license = "MIT"
Expand Down
3 changes: 1 addition & 2 deletions src/stubber/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""get the version"""


__version__ = "1.17.4"
__version__ = "1.17.5"
4 changes: 3 additions & 1 deletion src/stubber/board/createstubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
except ImportError:
from ucollections import OrderedDict # type: ignore

__version__ = "v1.17.4"
__version__ = "v1.17.5"
ENOENT = 2
_MAX_CLASS_LEVEL = 2 # Max class nesting
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
Expand Down Expand Up @@ -363,6 +363,8 @@ def write_object_stub(self, fp, object_expr: object, obj_name: str, indent: str,
else:
# Requires Python 3.6 syntax, which is OK for the stubs/pyi
t = "Incomplete"
if " at " in item_repr:
item_repr = item_repr.split(" at ")[0] + " at ...>"
if " at " in item_repr:
item_repr = item_repr.split(" at ")[0] + " at ...>"
s = "{0}{1}: {2} ## {3} = {4}\n".format(indent, item_name, t, item_type_txt, item_repr)
Expand Down
6 changes: 4 additions & 2 deletions src/stubber/board/createstubs_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- cross compilation, using mpy-cross, to avoid the compilation step on the micropython device
This variant was generated from createstubs.py by micropython-stubber v1.17.4
This variant was generated from createstubs.py by micropython-stubber v1.17.5
"""

# Copyright (c) 2019-2023 Jos Verlinde
Expand All @@ -43,7 +43,7 @@
except ImportError:
from ucollections import OrderedDict # type: ignore

__version__ = "v1.17.4"
__version__ = "v1.17.5"
ENOENT = 2
_MAX_CLASS_LEVEL = 2 # Max class nesting
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
Expand Down Expand Up @@ -376,6 +376,8 @@ def write_object_stub(self, fp, object_expr: object, obj_name: str, indent: str,
else:
# Requires Python 3.6 syntax, which is OK for the stubs/pyi
t = "Incomplete"
if " at " in item_repr:
item_repr = item_repr.split(" at ")[0] + " at ...>"
if " at " in item_repr:
item_repr = item_repr.split(" at ")[0] + " at ...>"
s = "{0}{1}: {2} ## {3} = {4}\n".format(indent, item_name, t, item_type_txt, item_repr)
Expand Down
67 changes: 34 additions & 33 deletions src/stubber/board/createstubs_db_min.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
except O:pass
try:from collections import OrderedDict as k
except O:from ucollections import OrderedDict as k
__version__='v1.17.4'
__version__='v1.17.5'
A3=2
A4=2
A5=['lib','/lib','/sd/lib','/flash/lib',J]
Expand Down Expand Up @@ -131,40 +131,41 @@ def create_module_stub(K,module_name,file_name=E):
try:del N
except(D,q):A.warning('could not del new_module')
F.collect();return R
def write_object_stub(K,fp,object_expr,obj_name,indent,in_class=0):
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()
if L in K.problematic:A.warning('SKIPPING problematic module:{}'.format(L));return
Z,O=K.get_obj_attributes(L)
if O:A.error(O)
for(E,J,H,a,c)in Z:
if E in['classmethod','staticmethod','BaseException',M]:continue
def write_object_stub(L,fp,object_expr,obj_name,indent,in_class=0):
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()
if M in L.problematic:A.warning('SKIPPING problematic module:{}'.format(M));return
a,Q=L.get_obj_attributes(M)
if Q:A.error(Q)
for(E,H,I,b,g)in a:
if E in['classmethod','staticmethod','BaseException',N]:continue
if E[0].isdigit():A.warning('NameError: invalid name {}'.format(E));continue
if H=="<class 'type'>"and P(D)<=A4*4:
Q=B;R=E.endswith(M)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
if R:Q=M
C='\n{}class {}({}):\n'.format(D,E,Q)
if R:C+=D+' ...\n';I.write(C);continue
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)
elif any(A in H for A in[A0,z,'closure']):
S=U;T=B
if N>0:T='self, '
if V in H or V in J:C='{}@classmethod\n'.format(D)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(D,E,S)
else:C='{}def {}({}*args, **kwargs) -> {}:\n'.format(D,E,T,S)
C+=D+' ...\n\n';I.write(C)
elif H=="<class 'module'>":0
elif H.startswith("<class '"):
G=H[8:-2];C=B
if G in(x,v,w,y,'bytearray','bytes'):C=W.format(D,E,J,G)
elif G in(f,e,d):b={f:'{}',e:'[]',d:'()'};C=W.format(D,E,b[G],G)
elif G in('object','set','frozenset','Pin',X):
if G==X:G='Generator'
C='{0}{1}: {2} ## = {4}\n'.format(D,E,G,H,J)
if I=="<class 'type'>"and P(D)<=A4*4:
R=B;S=E.endswith(N)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
if S:R=N
C='\n{}class {}({}):\n'.format(D,E,R)
if S:C+=D+' ...\n';J.write(C);continue
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)
elif any(A in I for A in[A0,z,'closure']):
T=V;U=B
if O>0:U='self, '
if W in I or W in H:C='{}@classmethod\n'.format(D)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(D,E,T)
else:C='{}def {}({}*args, **kwargs) -> {}:\n'.format(D,E,U,T)
C+=D+' ...\n\n';J.write(C)
elif I=="<class 'module'>":0
elif I.startswith("<class '"):
G=I[8:-2];C=B
if G in(x,v,w,y,'bytearray','bytes'):C=X.format(D,E,H,G)
elif G in(f,e,d):c={f:'{}',e:'[]',d:'()'};C=X.format(D,E,c[G],G)
elif G in('object','set','frozenset','Pin',Y):
if G==Y:G='Generator'
C='{0}{1}: {2} ## = {4}\n'.format(D,E,G,I,H)
else:
G=U
if Y in J:J=J.split(Y)[0]+' at ...>'
C='{0}{1}: {2} ## {3} = {4}\n'.format(D,E,G,H,J)
I.write(C)
else:I.write("# all other, type = '{0}'\n".format(H));I.write(D+E+' # type: Incomplete\n')
G=V
if K in H:H=H.split(K)[0]+Z
if K in H:H=H.split(K)[0]+Z
C='{0}{1}: {2} ## {3} = {4}\n'.format(D,E,G,I,H)
J.write(C)
else:J.write("# all other, type = '{0}'\n".format(I));J.write(D+E+' # type: Incomplete\n')
@property
def flat_fwid(self):
A=self._fwid;B=' .()/\\:$'
Expand Down
Binary file modified src/stubber/board/createstubs_db_mpy.mpy
Binary file not shown.
6 changes: 4 additions & 2 deletions src/stubber/board/createstubs_mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- cross compilation, using mpy-cross,
to avoid the compilation step on the micropython device
This variant was generated from createstubs.py by micropython-stubber v1.17.4
This variant was generated from createstubs.py by micropython-stubber v1.17.5
"""

# Copyright (c) 2019-2023 Jos Verlinde
Expand All @@ -34,7 +34,7 @@
except ImportError:
from ucollections import OrderedDict # type: ignore

__version__ = "v1.17.4"
__version__ = "v1.17.5"
ENOENT = 2
_MAX_CLASS_LEVEL = 2 # Max class nesting
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
Expand Down Expand Up @@ -367,6 +367,8 @@ def write_object_stub(self, fp, object_expr: object, obj_name: str, indent: str,
else:
# Requires Python 3.6 syntax, which is OK for the stubs/pyi
t = "Incomplete"
if " at " in item_repr:
item_repr = item_repr.split(" at ")[0] + " at ...>"
if " at " in item_repr:
item_repr = item_repr.split(" at ")[0] + " at ...>"
s = "{0}{1}: {2} ## {3} = {4}\n".format(indent, item_name, t, item_type_txt, item_repr)
Expand Down
Loading

0 comments on commit 7814bde

Please sign in to comment.