Skip to content

Commit

Permalink
Fix bug in typeshed:get_pytd_paths and delete internal dataclasses stub.
Browse files Browse the repository at this point in the history
I noticed this while grepping for stray Python 2.7 references. The incorrect
paths here were why the opensource tests were complaining about dataclasses. We
should actually be able to delete dataclasses.pytd, since dataclasses is in the
stdlib in 3.7.

I still don't know why test_dataclasses passes in 3.6, but it was passing
before we opensourced dataclasses.pytd a few days ago and is still passing now
that I've deleted dataclasses.pytd, so ¯\_(ツ)_/¯

PiperOrigin-RevId: 392537915
  • Loading branch information
rchen152 committed Aug 23, 2021
1 parent de7b868 commit 8378eeb
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 78 deletions.
2 changes: 1 addition & 1 deletion pytype/pytd/typeshed.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def get_typeshed_paths(self):
def get_pytd_paths(self):
"""Gets the paths to pytype's version-specific pytd files."""
return [pytype_source_utils.get_full_path(d)
for d in ("stubs/builtins/3", "stubs/stdlib/3")]
for d in ("stubs/builtins", "stubs/stdlib")]

def _list_modules(self, path, python_version):
"""Lists modules for _get_module_names_in_path."""
Expand Down
2 changes: 1 addition & 1 deletion pytype/pytd/typeshed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_get_pytd_paths(self):
# reads from TYPESHED_HOME.

paths = {p.rsplit("pytype/", 1)[-1] for p in self.ts.get_pytd_paths()}
self.assertSetEqual(paths, {"stubs/builtins/3", "stubs/stdlib/3"})
self.assertSetEqual(paths, {"stubs/builtins", "stubs/stdlib"})
finally:
os.environ = old_env

Expand Down
1 change: 0 additions & 1 deletion pytype/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ filegroup(
builtins/attr/setters.pytd
builtins/attr/validators.pytd
builtins/builtins.pytd
builtins/dataclasses.pytd
builtins/mypy_extensions.pytd
builtins/numpy/__init__.pytd
builtins/protocols.pytd
Expand Down
75 changes: 0 additions & 75 deletions pytype/stubs/builtins/dataclasses.pytd

This file was deleted.

0 comments on commit 8378eeb

Please sign in to comment.