summaryrefslogtreecommitdiff
path: root/tests/functional/m/missing/missing_kwoa_py3.py
blob: b4dc604cd32ee815d7c7f9aa0cbd22ea6f7717ab (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# pylint: disable=missing-docstring,unused-argument,too-few-public-methods
import typing


def target(pos, *, keyword):
    return pos + keyword


def forwarding_kwds(pos, **kwds):
    target(pos, **kwds)


def forwarding_args(*args, keyword):
    target(*args, keyword=keyword)

def forwarding_conversion(*args, **kwargs):
    target(*args, **dict(kwargs))


def not_forwarding_kwargs(*args, **kwargs):
    target(*args) # [missing-kwoa]


target(1, keyword=2)

PARAM = 1
target(2, PARAM) # [too-many-function-args, missing-kwoa]


def some_function(*, param):
    return param + 2


def other_function(**kwargs):
    return some_function(**kwargs)  # Does not trigger missing-kwoa


other_function(param=2)


class Parent:

    @typing.overload
    def __init__( self, *, first, second, third):
        pass

    @typing.overload
    def __init__(self, *, first, second):
        pass

    @typing.overload
    def __init__(self, *, first):
        pass

    def __init__(
            self,
            *,
            first,
            second: typing.Optional[str] = None,
            third: typing.Optional[str] = None):
        self._first = first
        self._second = second
        self._third = third


class Child(Parent):
    def __init__(
            self,
            *,
            first,
            second):
        super().__init__(first=first, second=second)
        self._first = first + second