Coverage for /usr/local/lib/python3.7/site-packages/py/_std.py : 60%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import sys
2import warnings
5class PyStdIsDeprecatedWarning(DeprecationWarning):
6 pass
9class Std(object):
10 """ makes top-level python modules available as an attribute,
11 importing them on first access.
12 """
14 def __init__(self):
15 self.__dict__ = sys.modules
17 def __getattr__(self, name):
18 warnings.warn("py.std is deprecated, plase import %s directly" % name,
19 category=PyStdIsDeprecatedWarning)
20 try:
21 m = __import__(name)
22 except ImportError:
23 raise AttributeError("py.std: could not import %s" % name)
24 return m
26std = Std()