MCPcopy Create free account
hub / github.com/python/mypy / adjust_public_exports

Method adjust_public_exports

mypy/semanal.py:888–899  ·  view source on GitHub ↗

Adjust the module visibility of globals due to __all__.

(self)

Source from the content-addressed store, hash-verified

886 del tree.names[name]
887
888 def adjust_public_exports(self) -> None:
889 """Adjust the module visibility of globals due to __all__."""
890 if "__all__" in self.globals:
891 for name, g in self.globals.items():
892 # Being included in __all__ explicitly exports and makes public.
893 if name in self.all_exports:
894 g.module_public = True
895 g.module_hidden = False
896 # But when __all__ is defined, and a symbol is not included in it,
897 # it cannot be public.
898 else:
899 g.module_public = False
900
901 @contextmanager
902 def file_context(

Callers 1

refresh_top_levelMethod · 0.95

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected