-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor parse_access_* functions into BaseBuilder class #181
Conversation
(and curse VSCode for not saving things automatically like my last IDE)
…including tests (some cleanup still required)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #181 +/- ##
=======================================
Coverage 96.96% 96.96%
=======================================
Files 9 9
Lines 626 626
=======================================
Hits 607 607
Misses 19 19 ☔ 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.
Thanks for this @marc-white!
I guess the main difference in having these as @classmethod
s, rather than just having source.utils.parse_access_ncfile
receive an additional input for the patterns (which are an attribute on each Builder class) is that it allows overriding the parse_access_ncfile
and/or parse_access_filename
. I'm not sure whether that will ever be needed, but I guess there's no reason not to add that additional flexibility.
@dougiesquire is there any other process we need to tick off before I merge this back in, or is the accepted review enough? |
An accepted review and the passing checks is sufficient. Please feel free to merge |
Fixes #67 (or at least improves).
This PR refactors the utils functions
parse_access_filename
andparse_access_ncfile
to be@classmethod
s of thebuilders.BaseBuilder
class. The idea behind doing this is:BaseBuilder.parse_access_filename
;@classmethod
(as opposed to@staticmethod
) gives access to the underlying class definition, so everyBuilder
now has a list of relevant patterns (PATTERNS
) that is used by default for this builder. This has the effect of causing eachBuilder
to have its own unique list of filename regex patterns, preventing cross-contamination when new builders/patterns are added. The patterns list used can be defined by kwarg to the functions if required instead;parse_access_*
for a particular Builder is now easier (although I'm not sure if that's something that will ever need to be done).Associated tests have also been updated.