Skip to content
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

Update WorkspaceClient to support globbing #125

Merged
merged 5 commits into from
Jul 12, 2024

Conversation

asnare
Copy link
Contributor

@asnare asnare commented Jul 12, 2024

This PR is stacked on top of #122 and updates WorkspaceClient to support:

  • .glob()
  • .rglob()
  • .iterdir()

@asnare asnare added the enhancement New feature or request label Jul 12, 2024
@asnare asnare self-assigned this Jul 12, 2024
@asnare asnare requested a review from nfx as a code owner July 12, 2024 15:57
Copy link

❌ 17/18 passed, 1 failed, 2 skipped, 32s total

❌ test_mkdirs: TypeError: can only concatenate list (not "method") to list (4ms)
TypeError: can only concatenate list (not "method") to list
15:58 DEBUG [databricks.sdk] Loaded from environment
15:58 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
15:58 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
15:58 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
15:58 INFO [databricks.sdk] Using Databricks Metadata Service authentication
[gw5] linux -- Python 3.10.14 /home/runner/work/blueprint/blueprint/.venv/bin/python
15:58 DEBUG [databricks.sdk] Loaded from environment
15:58 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
15:58 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
15:58 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
15:58 INFO [databricks.sdk] Using Databricks Metadata Service authentication
15:58 DEBUG [databricks.sdk] Loaded from environment
15:58 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
15:58 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
15:58 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
15:58 INFO [databricks.sdk] Using Databricks Metadata Service authentication
[gw5] linux -- Python 3.10.14 /home/runner/work/blueprint/blueprint/.venv/bin/python

Running from acceptance #175

Copy link
Contributor

@nfx nfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

src/databricks/labs/blueprint/paths.py Show resolved Hide resolved

def glob(self, pattern, *, case_sensitive=None):
pattern_parts = self._prepare_pattern(pattern)
selector = _Selector.parse(pattern_parts, case_sensitive=case_sensitive if case_sensitive is not None else True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
selector = _Selector.parse(pattern_parts, case_sensitive=case_sensitive if case_sensitive is not None else True)
case_sensitive = case_sensitive if case_sensitive is not None else True
selector = _Selector.parse(pattern_parts, case_sensitive=case_sensitive)

src/databricks/labs/blueprint/paths.py Show resolved Hide resolved

def rglob(self, pattern, *, case_sensitive=None):
pattern_parts = ("**", *self._prepare_pattern(pattern))
selector = _Selector.parse(pattern_parts, case_sensitive=case_sensitive if case_sensitive is not None else True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
selector = _Selector.parse(pattern_parts, case_sensitive=case_sensitive if case_sensitive is not None else True)
case_sensitive = case_sensitive if case_sensitive is not None else True
selector = _Selector.parse(pattern_parts, case_sensitive=case_sensitive)

@nfx nfx merged commit 4c17714 into feature/python-312-wspath Jul 12, 2024
7 of 9 checks passed
@nfx nfx deleted the feature/python-312-wspath-globbing branch July 12, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants