Skip to content

Commit e8fcbc7

Browse files
hsheth2sleeperdeep
authored andcommitted
chore(ingest): start using explicit exports (datahub-project#11899)
1 parent 995fbcf commit e8fcbc7

File tree

69 files changed

+206
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+206
-189
lines changed

metadata-ingestion/scripts/avro_codegen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def generate(
769769
import importlib
770770
from typing import TYPE_CHECKING
771771
772-
from datahub._codegen.aspect import _Aspect
772+
from datahub._codegen.aspect import _Aspect as _Aspect
773773
from datahub.utilities.docs_build import IS_SPHINX_BUILD
774774
from datahub.utilities._custom_package_loader import get_custom_models_package
775775
@@ -802,7 +802,7 @@ def generate(
802802
803803
from datahub.utilities.docs_build import IS_SPHINX_BUILD
804804
from datahub.utilities._custom_package_loader import get_custom_urns_package
805-
from datahub.utilities.urns._urn_base import Urn # noqa: F401
805+
from datahub.utilities.urns._urn_base import Urn as Urn # noqa: F401
806806
807807
_custom_package_path = get_custom_urns_package()
808808

metadata-ingestion/setup.cfg

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ exclude =
3131
__pycache__
3232
per-file-ignores =
3333
# imported but unused
34-
__init__.py: F401
34+
__init__.py: F401, I250
3535
ban-relative-imports = true
3636

3737
[mypy]
@@ -53,6 +53,14 @@ disallow_untyped_defs = no
5353
# try to be a bit more strict in certain areas of the codebase
5454
[mypy-datahub.*]
5555
ignore_missing_imports = no
56+
implicit_reexport = no
57+
[mypy-datahub.metadata.*]
58+
# TODO: Remove this once all the code has been updated.
59+
implicit_reexport = yes
60+
[mypy-datahub.ingestion.*]
61+
# TODO: Remove this once all the code has been updated.
62+
implicit_reexport = yes
63+
5664
[mypy-datahub_provider.*]
5765
ignore_missing_imports = no
5866
[mypy-tests.*]

metadata-ingestion/src/datahub/api/circuit_breaker/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@
1212
)
1313

1414
requests_logger.setLevel(logging.WARNING)
15+
16+
__all__ = [
17+
"AssertionCircuitBreaker",
18+
"AssertionCircuitBreakerConfig",
19+
"OperationCircuitBreaker",
20+
"OperationCircuitBreakerConfig",
21+
]

metadata-ingestion/src/datahub/api/circuit_breaker/circuit_breaker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from gql.transport.requests import RequestsHTTPTransport
77
from pydantic import Field
88

9-
from datahub.configuration import ConfigModel
9+
from datahub.configuration.common import ConfigModel
1010

1111
logger = logging.getLogger(__name__)
1212

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
from datahub.api.entities.datajob.dataflow import DataFlow
22
from datahub.api.entities.datajob.datajob import DataJob
3+
4+
# TODO: Remove this and start importing directly from the inner files.
5+
__all__ = ["DataFlow", "DataJob"]

metadata-ingestion/src/datahub/api/entities/datajob/dataflow.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Callable, Dict, Iterable, List, Optional, Set, cast
44

55
import datahub.emitter.mce_builder as builder
6-
from datahub.configuration.source_common import ALL_ENV_TYPES
76
from datahub.emitter.generic_emitter import Emitter
87
from datahub.emitter.mcp import MetadataChangeProposalWrapper
98
from datahub.metadata.schema_classes import (
@@ -114,7 +113,7 @@ def generate_tags_aspect(self) -> List[GlobalTagsClass]:
114113

115114
def _get_env(self) -> Optional[str]:
116115
env: Optional[str] = None
117-
if self.env and self.env.upper() in ALL_ENV_TYPES:
116+
if self.env and self.env.upper() in builder.ALL_ENV_TYPES:
118117
env = self.env.upper()
119118
else:
120119
logger.debug(

metadata-ingestion/src/datahub/api/entities/datajob/datajob.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Callable, Dict, Iterable, List, Optional, Set
44

55
import datahub.emitter.mce_builder as builder
6-
from datahub.configuration.source_common import ALL_ENV_TYPES
76
from datahub.emitter.generic_emitter import Emitter
87
from datahub.emitter.mcp import MetadataChangeProposalWrapper
98
from datahub.metadata.schema_classes import (
@@ -109,7 +108,7 @@ def generate_mcp(
109108
self, materialize_iolets: bool = True
110109
) -> Iterable[MetadataChangeProposalWrapper]:
111110
env: Optional[str] = None
112-
if self.flow_urn.cluster.upper() in ALL_ENV_TYPES:
111+
if self.flow_urn.cluster.upper() in builder.ALL_ENV_TYPES:
113112
env = self.flow_urn.cluster.upper()
114113
else:
115114
logger.debug(
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
from datahub.api.graphql.assertion import Assertion
22
from datahub.api.graphql.operation import Operation
3+
4+
__all__ = ["Assertion", "Operation"]

metadata-ingestion/src/datahub/cli/put_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
from datahub.cli.cli_utils import post_entity
88
from datahub.configuration.config_loader import load_config_file
9-
from datahub.emitter.mcp import MetadataChangeProposalWrapper, SystemMetadataClass
9+
from datahub.emitter.mcp import MetadataChangeProposalWrapper
1010
from datahub.ingestion.graph.client import get_default_graph
1111
from datahub.metadata.schema_classes import (
1212
DataPlatformInfoClass as DataPlatformInfo,
1313
PlatformTypeClass,
14+
SystemMetadataClass,
1415
)
1516
from datahub.telemetry import telemetry
1617
from datahub.upgrade import upgrade
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from datahub.configuration.common import (
2-
ConfigModel,
3-
ConfigurationMechanism,
4-
DynamicTypedConfig,
2+
ConfigModel as ConfigModel,
3+
DynamicTypedConfig as DynamicTypedConfig,
54
)

0 commit comments

Comments
 (0)