crashdb_impl: add type annotations to memory backend - #636
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #636 +/- ##
=======================================
Coverage 84.48% 84.49%
=======================================
Files 106 106
Lines 21018 21019 +1
Branches 3195 3195
=======================================
+ Hits 17758 17760 +2
Misses 2785 2785
+ Partials 475 474 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bdrung
left a comment
There was a problem hiding this comment.
Thanks for your contribution.
Can you rebase your change and squash the fixup commits into the relevant commit?
| This class does not support bug patterns and authentication. | ||
| """ | ||
| apport.crashdb.CrashDatabase.__init__(self, auth_file, options) | ||
| super().__init__(auth_file, options) |
There was a problem hiding this comment.
Can you put this change into a separate commit since that is unrelated to type hints?
| self.add_sample_data() | ||
|
|
||
| def upload(self, report, progress_callback=None, user_message_callback=None): | ||
| def upload( |
There was a problem hiding this comment.
Adding a type hint here, a type hint should be added to the base class (and probably all other subclasses) as well to match.
| return crash_id | ||
|
|
||
| def get_comment_url(self, report, handle): | ||
| def get_comment_url(self, report: apport.report.Report, handle: int | str) -> str: |
There was a problem hiding this comment.
This function can take a ProblemReport object as well.
Adding a type hint here, a type hint should be added to the base class (and probably all other subclasses) as well to match.
| return f"http://bugs.example.com/{handle}" | ||
|
|
||
| def get_id_url(self, report, crash_id): | ||
| def get_id_url(self, report: apport.report.Report, crash_id: int) -> str | None: |
There was a problem hiding this comment.
This function can take a ProblemReport object as well.
Adding a type hint here, a type hint should be added to the base class (and probably all other subclasses) as well to match.
| return self.get_comment_url(report, crash_id) | ||
|
|
||
| def download(self, crash_id): | ||
| def download(self, crash_id: int) -> apport.report.Report: |
There was a problem hiding this comment.
This function can take a ProblemReport object as well.
Adding a type hint here, a type hint should be added to the base class (and probably all other subclasses) as well to match.
| @@ -115,13 +121,13 @@ def can_update(self, crash_id: int) -> bool: | |||
| # pylint: disable-next=too-many-arguments,too-many-positional-arguments | |||
| def update( | |||
There was a problem hiding this comment.
This function can take a ProblemReport object as well.
Adding a type hint here, a type hint should be added to the base class (and probably all other subclasses) as well to match.
| return self.reports[crash_id]["dup_of"] | ||
|
|
||
| def close_duplicate(self, report, crash_id, master_id): | ||
| def close_duplicate( |
There was a problem hiding this comment.
This function can take a ProblemReport object as well.
Adding a type hint here, a type hint should be added to the base class (and probably all other subclasses) as well to match.
| self.reports[crash_id]["comment"] = f"regression, already fixed in #{master}" | ||
|
|
||
| def _mark_dup_checked(self, crash_id, report): | ||
| def _mark_dup_checked(self, crash_id: int, report: apport.report.Report) -> None: |
There was a problem hiding this comment.
This function can take a ProblemReport object as well.
Adding a type hint here, a type hint should be added to the base class (and probably all other subclasses) as well to match.
Summary
This pull request adds type annotations to
apport/crashdb_impl/memory.py.Changes
super().Verification
I verified the changes with:
python -m py_compile apport/crashdb_impl/memory.pyruff check apport/crashdb_impl/memory.pyblack --check apport/crashdb_impl/memory.pymypy apport/crashdb_impl/memory.py