Skip to content

Commit 3e07ccf

Browse files
committed
python-stdlib: Update modules to allow for new typing modules.
`__future__`, `abc`, `collection` Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
1 parent 40bcd66 commit 3e07ccf

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
# type: ignore
12
class ABC:
23
pass
34

45

5-
def abstractmethod(f):
6-
return f
6+
def abstractmethod(arg):
7+
return arg
8+
9+
try:
10+
# add functionality if typing module is available
11+
from typing import __getattr__ as __getattr__
12+
13+
except: # naked except saves 4 bytes
14+
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.1.0")
1+
metadata(version="0.2.0")
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)