-
-
Notifications
You must be signed in to change notification settings - Fork 297
refactor(BaseConfig): update docstring, extract factory method and re… #1601
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
base: master
Are you sure you want to change the base?
refactor(BaseConfig): update docstring, extract factory method and re… #1601
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1601 +/- ##
==========================================
+ Coverage 97.33% 98.18% +0.84%
==========================================
Files 42 58 +16
Lines 2104 2696 +592
==========================================
+ Hits 2048 2647 +599
+ Misses 56 49 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -22,7 +22,6 @@ | |||
class JsonConfig(BaseConfig): | |||
def __init__(self, *, data: bytes | str, path: Path | str) -> None: |
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 think we can remove the str
of the parameter path
in the future? I'm not sure if that will be a breaking change
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 think it's fine to remove the str
, at most, it would generate a mypy
error
…move unnecessary variable assignment
bf6fef4
to
94b34ee
Compare
self._settings: Settings = DEFAULT_SETTINGS.copy() | ||
self.encoding = self.settings["encoding"] |
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'm not sure why this member variable exists. It will be stale if self._settings
is updated somewhere.
@@ -17,8 +17,8 @@ | |||
|
|||
class BaseConfig: |
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.
Should this be an abstract class?
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.
Ideally, a Protocol
, but it doesn't hurt like this
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. I found it odd that we can create BaseConfig
objects and it's sometimes confusing. I attempted to refactor it on another branch (not published yet) but many tests would be affected.
…move unnecessary variable assignment
Description
Checklist
Code Changes
poetry all
locally to ensure this change passes linter check and testsDocumentation Changes
poetry doc
locally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
Additional Context