-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[internal] Simplify import resolvers #1746
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1746 +/- ##
==========================================
- Coverage 89.66% 89.64% -0.02%
==========================================
Files 93 93
Lines 11405 11377 -28
Branches 2005 2005
==========================================
- Hits 10226 10199 -27
+ Misses 794 793 -1
Partials 385 385 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify even further.
@@ -277,21 +277,9 @@ def _fail(code: str, message: str) -> MaybeDependency: | |||
|
|||
class BaseImportResolver(abc.ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant: we no longer need BaseImportResolver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's necessary to avoid circular imports (same as BaseNotebookResolver)
@@ -111,13 +112,11 @@ def __repr__(self): | |||
|
|||
class LocalFileResolver(BaseImportResolver, BaseFileResolver): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class LocalFileResolver(BaseImportResolver, BaseFileResolver): | |
class ImportResolver(BaseFileResolver): |
and get rid of BaseImportResolver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to ImportFileResolver
return WhitelistResolver(self._whitelist, resolver) | ||
|
||
def resolve_import(self, path_lookup: PathLookup, name: str) -> MaybeDependency: | ||
def resolve_import(self, name: str) -> MaybeDependency | None: | ||
# TODO attach compatibility to dependency, see https://github.com/databrickslabs/ucx/issues/1382 | ||
compatibility = self._whitelist.compatibility(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the body of this method as private method to ImportResolver
class and get rid of WhitelistResolver
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Changes
Remove chain of import resolvers in favor of a single resolver.
Supersedes #1709
Resolves #1707