Skip to content

Commit 7713b0b

Browse files
committed
python-stdlib: Update modules to allow for new typing modules.
`__future__`, `abc`, `collection` Signed-off-by: Jos Verlinde <[email protected]>
1 parent 769d565 commit 7713b0b

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
metadata(version="0.1.0")
1+
metadata(version="1.26.1")
22

3-
module("__future__.py")
3+
options.defaults(opt_level=3)
4+
5+
module("__future__.py", opt=options.opt_level)

python-stdlib/abc/abc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
def abstractmethod(f):
2-
return f
1+
def abstractmethod(arg):
2+
return arg
3+
4+
try:
5+
# add functionality if typing module is available
6+
from typing import __Ignore as ABC, __getattr__ as __getattr__
7+
8+
except: # naked except saves 4 bytes
9+
pass

python-stdlib/abc/manifest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
metadata(version="0.0.1")
1+
metadata(version="1.26.1")
22

3-
module("abc.py")
3+
options.defaults(opt_level=3)
4+
5+
module("abc.py", opt=options.opt_level)

python-stdlib/collections/collections/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
from .defaultdict import defaultdict
77
except ImportError:
88
pass
9+
# optional collections.abc typing dummy module
10+
try:
11+
# cannot use relative import here
12+
import collections.abc as abc
13+
import sys
14+
sys.modules['collections.abc'] = abc
15+
except ImportError:
16+
pass
917

1018

1119
class MutableMapping:

0 commit comments

Comments
 (0)