Skip to content

apport-unpack: fix mypy complaint in unpack_report_to_directory#605

Open
bdrung wants to merge 1 commit into
canonical:mainfrom
bdrung:apport-unpack-bytes
Open

apport-unpack: fix mypy complaint in unpack_report_to_directory#605
bdrung wants to merge 1 commit into
canonical:mainfrom
bdrung:apport-unpack-bytes

Conversation

@bdrung
Copy link
Copy Markdown
Member

@bdrung bdrung commented Apr 28, 2026

mypy will complain if ProblemReport will get type hints:

error: Argument 1 to "write" of "BufferedWriter" has incompatible type "bytes | CompressedFile | CompressedValue | tuple[Any, ...]"; expected "Buffer"  [arg-type]

The problem report is loaded with binary=True or binary=False. In both cases this should result in the values to be either str or bytes. So add an isinstance assertion for that.

@bdrung bdrung force-pushed the apport-unpack-bytes branch from 931fd77 to b71e0d6 Compare April 28, 2026 13:45
@bdrung bdrung changed the title wip: apport-unpack: support more value types apport-unpack: fix mypy complaint in unpack_report_to_directory Apr 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.54%. Comparing base (b24ed44) to head (f2bcbf2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #605   +/-   ##
=======================================
  Coverage   84.54%   84.54%           
=======================================
  Files         104      104           
  Lines       21028    21029    +1     
  Branches     3219     3219           
=======================================
+ Hits        17779    17780    +1     
  Misses       2809     2809           
  Partials      440      440           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mypy will complain if `ProblemReport` will get type hints:

```
error: Argument 1 to "write" of "BufferedWriter" has incompatible type "bytes | CompressedFile | CompressedValue | tuple[Any, ...]"; expected "Buffer"  [arg-type]
```

The problem report is loaded with `binary=True` or `binary=False`. In
both cases this should result in the values to be either `str` or
`bytes`. So add an `isinstance` assertion for that.
@bdrung bdrung force-pushed the apport-unpack-bytes branch from b71e0d6 to f2bcbf2 Compare April 29, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant