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

Fix pylint warnings for bump to next-pylint #2713

Closed
l0lawrence opened this issue Jul 22, 2024 · 1 comment · Fixed by #2666
Closed

Fix pylint warnings for bump to next-pylint #2713

l0lawrence opened this issue Jul 22, 2024 · 1 comment · Fixed by #2666
Assignees

Comments

@l0lawrence
Copy link
Member

Resolve warnings shown in this PR in order to bump pylint to version 3.2.5

@msyyc if you have time could you take a look?

@msyyc msyyc self-assigned this Jul 23, 2024
@msyyc
Copy link
Member

msyyc commented Jul 23, 2024

lint errors are possibly-used-before-assignment,

  • one is about the following code:
    if response.status_code not in [200, 204]:
    try:
    await response.read() # Load the body in memory and close the socket
    except (StreamConsumedError, StreamClosedError):
    pass
    map_error(status_code=response.status_code, response=response, error_map=error_map)
    raise HttpResponseError(response=response, error_format=ARMErrorFormat)
    if response.status_code == 200:
    deserialized = response.iter_bytes()
    if response.status_code == 204:
    deserialized = response.iter_bytes()
    if cls:
    return cls(pipeline_response, cast(AsyncIterator[bytes], deserialized), {}) # type: ignore
    return cast(AsyncIterator[bytes], deserialized) # type: ignore

However, if we look into the logic, the variable deserialized must have value so the error is fake error. Although it is fake error, I think it is not good solution to disable it in pylint configuration file so let me think how to optimize the logic to avoid the fake error report

It is also fake report since readonly_props will not be accessed when exclude_readonly is False. We could assign readonly_props with initial value [] to avoid the pylint error.

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 a pull request may close this issue.

2 participants