summaryrefslogtreecommitdiff
path: root/tests/functional/r/regression_02/regression_5479.py
blob: adc20f26ca4f627e384226931d7b4bb7c54cf116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Test for a regression on slots and annotated assignments.
Reported in https://github.com/PyCQA/pylint/issues/5479
"""
# pylint: disable=too-few-public-methods, unused-private-member, missing-class-docstring, missing-function-docstring

from __future__ import annotations

import asyncio


class Connector:
    __slots__ = ("_Connector__reader", "_Connector__writer")

    __reader: asyncio.StreamReader
    __writer: asyncio.StreamWriter

    def __init__(self) -> None:
        raise TypeError("Use connect() instead")

    @classmethod
    async def connect(cls, socket: str) -> Connector:
        self = cls.__new__(cls)
        self.__reader, self.__writer = await asyncio.open_unix_connection(socket)
        return self


async def main():
    conn = await Connector.connect("/tmp/mysocket")  # [unused-variable]


asyncio.run(main())