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

Provide annotations for kombu/utils/encoding.py #2208

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Harry-Lees
Copy link

Linked Issue: #1511

For this PR, I aimed to annotate the existing implementation of the encoding functions, regardless of what I thought the function's intention is.

There are some functions e.g. str_to_bytes, bytes_to_str, or safe_str which I think may have potentially misleading implementations. I'm not sure whether this is under the scope of this PR, input on this would be appreciated :).

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.52%. Comparing base (a9a67c9) to head (2a911cd).

Files with missing lines Patch % Lines
kombu/utils/encoding.py 81.81% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2208      +/-   ##
==========================================
- Coverage   81.54%   81.52%   -0.03%     
==========================================
  Files          77       77              
  Lines        9517     9527      +10     
  Branches     1154     1158       +4     
==========================================
+ Hits         7761     7767       +6     
  Misses       1564     1564              
- Partials      192      196       +4     

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

@auvipy auvipy self-requested a review December 22, 2024 09:56
Harry-Lees and others added 4 commits February 19, 2025 23:34
The initial annotations provided aim to annotate the current implementation opposed
to potentially refactoring to narrow down the original intention of the provided
implementations.
@Nusnus Nusnus force-pushed the annotate-utils-encoding branch from 4f51694 to 2a911cd Compare February 19, 2025 21:34
def _safe_str(
s: object,
errors: str = 'replace',
file: Any = None
Copy link
Member

Choose a reason for hiding this comment

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

Some places say Any and some object.
Is there any specific reason for not using the same annotation all over?

Copy link
Member

@Nusnus Nusnus left a comment

Choose a reason for hiding this comment

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

See comments

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.

2 participants