-
Notifications
You must be signed in to change notification settings - Fork 81
Eliminate Path(__file__) to locate resource files
#2210
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
Open
asnare
wants to merge
23
commits into
main
Choose a base branch
from
no-more-file-manip
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3ca7ce2
Use path traversal instead of string interpolation/parsing.
asnare 24926ba
Type hint.
asnare 081afb6
Use class-method directly.
asnare 8f8698d
Tidy up path manipulation to load version file.
asnare 39654af
Type hints.
asnare 8b57115
Introduce a test fixture that provides the location of resources need…
asnare d0b547d
Refactor existing tests that use `Path(__file__)` to locate test reso…
asnare d58b0ab
Drop unused global.
asnare b6af977
Eliminate more Path(__file__) manipulation.
asnare f50ec68
Use pathlib instead of string interpolation.
asnare 00261c9
Add missing import.
asnare 2c48403
Set defaults directly instead of during __post_init__().
asnare 2007cc3
Make PipelineConfig immutable.
asnare 4e0f733
Update the test LSP server to not use Path(__file__) manipulation.
asnare 2b4a8a2
Consolidate Presto functional tests, and eliminate Path(__file__) man…
asnare 234e6f5
Update Oracle functional tests to eliminate Path(__file__) manipulation.
asnare 6bd340c
Consolidate Snowflake functional tests, and eliminate Path(__file__) …
asnare b7e81ce
Update Morpheus integration tests to not use Path(__file__) manipulat…
asnare d991934
Update tests that run our stub LSP server to not use Path(__file__) m…
asnare 04e22c5
Remove unused code.
asnare b6b85a4
TODO marker for future work.
asnare 32a8519
Update assessment pipeline to avoid Path(__file__) manipulation.
asnare a9faad1
Fix formatting.
asnare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 11 additions & 12 deletions
23
src/databricks/labs/lakebridge/assessments/profiler_config.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,29 @@ | ||
| import dataclasses | ||
| from dataclasses import dataclass, field | ||
|
|
||
|
|
||
| @dataclass | ||
| @dataclass(frozen=True) | ||
| class Step: | ||
| name: str | ||
| type: str | None | ||
| extract_source: str | ||
| mode: str | None | ||
| frequency: str | None | ||
| flag: str | None | ||
| mode: str = "append" | ||
| frequency: str = "once" | ||
| flag: str = "active" | ||
| dependencies: list[str] = field(default_factory=list) | ||
| comment: str | None = None | ||
|
|
||
| def __post_init__(self): | ||
| if self.frequency is None: | ||
| self.frequency = "once" | ||
| if self.flag is None: | ||
| self.flag = "active" | ||
| if self.mode is None: | ||
| self.mode = "append" | ||
| def copy(self, /, **changes) -> "Step": | ||
| return dataclasses.replace(self, **changes) | ||
|
|
||
|
|
||
| @dataclass | ||
| @dataclass(frozen=True) | ||
| class PipelineConfig: | ||
| name: str | ||
| version: str | ||
| extract_folder: str | ||
| comment: str | None = None | ||
| steps: list[Step] = field(default_factory=list) | ||
|
|
||
| def copy(self, /, **changes) -> "PipelineConfig": | ||
| return dataclasses.replace(self, **changes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't think this worked prior to this PR (or after): this is a pure refactoring.
But it does raise an interesting point: how is this tested?
@sundarshankar89: How can I check this?