pytorch/torch/package
joncrall 4c9eae331b Use standard mechanism for stdlib names (#81520)
I noticed that in #81261 all of the stdlib module names were explicitly listed, however as of Python 3.10 the stdlib now has a mechanism for this. https://github.com/python/cpython/issues/87121

I figured it was better to use `sys.stdlib_module_names` going forward for 3.10+ instead of having to maintain this file for every new Python release. For docs see:
https://docs.python.org/3/library/sys.html#sys.stdlib_module_names

I did a symmetric difference to determine what the effective change would be. I verified that everything listed in this file ins included in sys.stdlib_module_names. However, there are files in sys.stdlib_module_names that are not included in the previous hard coded definition. Namely these are:

```
frozenset({'__future__',
           '_abc',
           '_aix_support',
           '_asyncio',
           '_bisect',
           '_blake2',
           '_bootsubprocess',
           '_bz2',
           '_codecs',
           '_codecs_cn',
           '_codecs_hk',
           '_codecs_iso2022',
           '_codecs_jp',
           '_codecs_kr',
           '_codecs_tw',
           '_collections',
           '_collections_abc',
           '_compat_pickle',
           '_compression',
           '_contextvars',
           '_crypt',
           '_csv',
           '_ctypes',
           '_curses',
           '_curses_panel',
           '_datetime',
           '_dbm',
           '_decimal',
           '_elementtree',
           '_frozen_importlib',
           '_frozen_importlib_external',
           '_functools',
           '_gdbm',
           '_hashlib',
           '_heapq',
           '_imp',
           '_io',
           '_json',
           '_locale',
           '_lsprof',
           '_lzma',
           '_markupbase',
           '_md5',
           '_msi',
           '_multibytecodec',
           '_multiprocessing',
           '_opcode',
           '_operator',
           '_osx_support',
           '_overlapped',
           '_pickle',
           '_posixshmem',
           '_posixsubprocess',
           '_py_abc',
           '_pydecimal',
           '_pyio',
           '_queue',
           '_random',
           '_scproxy',
           '_sha1',
           '_sha256',
           '_sha3',
           '_sha512',
           '_signal',
           '_sitebuiltins',
           '_socket',
           '_sqlite3',
           '_sre',
           '_ssl',
           '_stat',
           '_statistics',
           '_string',
           '_strptime',
           '_struct',
           '_symtable',
           '_threading_local',
           '_tkinter',
           '_tracemalloc',
           '_uuid',
           '_warnings',
           '_weakref',
           '_weakrefset',
           '_winapi',
           '_zoneinfo',
           'antigravity',
           'genericpath',
           'idlelib',
           'nt',
           'nturl2path',
           'opcode',
           'pydoc_data',
           'pyexpat',
           'this'})
```

I'm not sure if excluding these matters. I wouldn't think it would, but if it does and it is better to explicitly update this file each time, then feel free to close this.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81520
Approved by: https://github.com/malfet
2022-07-15 23:11:23 +00:00
..
analyze Add __all__ to torch.distributed, futures, fx, nn, package, benchmark submodules (#80520) 2022-07-08 14:31:24 +00:00
__init__.py
_digraph.py
_directory_reader.py
_importlib.py
_mangling.py
_mock.py
_package_pickler.py
_package_unpickler.py
_stdlib.py Use standard mechanism for stdlib names (#81520) 2022-07-15 23:11:23 +00:00
file_structure_representation.py
find_file_dependencies.py
glob_group.py
importer.py
mangling.md
package_exporter.py Remove unused dtype assignment (#81503) 2022-07-15 03:43:32 +00:00
package_importer.py Allow torch._C to be recognized a module in torch.package (#80917) 2022-07-12 18:10:22 +00:00