Skip to content

Casted type from typing.cast() is ignored (no-member) #4534

Open
@postlund

Description

@postlund

Steps to reproduce

Given a file a.py:

import wave
from typing import cast

with wave.open("dummy.wav", "wb") as handle:
    writer = cast(wave.Wave_write, handle)
    writer.setnchannels(2)
    writer.setsampwidth(2)
    writer.setframerate(44100)

Current behavior

Result of pylint a.py:

a.py:7:4: E1101: Instance of 'Wave_read' has no 'setnchannels' member; maybe 'getnchannels'? (no-member)
a.py:8:4: E1101: Instance of 'Wave_read' has no 'setsampwidth' member; maybe 'getsampwidth'? (no-member)
a.py:9:4: E1101: Instance of 'Wave_read' has no 'setframerate' member; maybe 'getframerate'? (no-member)

Expected behavior

No warnings expected. mypy does not give any errors.

pylint --version output

Result of pylint --version output:

pylint 3.0.0a3
astroid 2.5.7
Python 3.8.1 (default, Jan  8 2020, 13:13:59) 
[GCC 4.9.2]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement ✨Improvement to a componentHigh effort 🏋Difficult solution or problem to solveNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationNeeds astroid Brain 🧠Needs a brain tip in astroid (then an astroid upgrade)typing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions