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

Resolve locales warning for providers that end with the locale name #702

Merged

Conversation

pvk-developer
Copy link
Member

Resolves #701
Resolves sdv-dev/SDV#1480

@pvk-developer pvk-developer requested a review from a team as a code owner September 1, 2023 10:22
@pvk-developer pvk-developer requested review from frances-h and removed request for a team September 1, 2023 10:22
@codecov-commenter
Copy link

codecov-commenter commented Sep 1, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (5d7f8b7) 100.00% compared to head (7486dbc) 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #702   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines         1799      1802    +3     
=========================================
+ Hits          1799      1802    +3     
Files Changed Coverage Δ
rdt/transformers/pii/anonymizer.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@frances-h frances-h left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@@ -81,7 +81,7 @@ def _check_locales(self):
missed_locales = []
for locale in locales:
spec = importlib.util.find_spec(f'faker.providers.{self.provider_name}.{locale}')
if spec is None:
if spec is None and not self.provider_name.endswith(locale):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to assume that if the provider name ends with the locale, then it exists? Is it possible it's just a bad provider name that ends with a locale

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that you are right, we can improve this by adding .. to the locale when looking for.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant more that I think we should make sure the provider exists still. Like if the locale is already present, extract it and runs it through importlib.util.find_spec(f'faker.providers....

@pvk-developer pvk-developer force-pushed the issue-701-resolve-locales-warning-for-specific-locale branch from 1630a12 to b09f5a9 Compare September 6, 2023 08:51
Copy link
Contributor

@amontanez24 amontanez24 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing!

@pvk-developer pvk-developer merged commit 4f75aae into master Sep 7, 2023
46 checks passed
@pvk-developer pvk-developer deleted the issue-701-resolve-locales-warning-for-specific-locale branch September 7, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants