forked from pylint-dev/pylint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
useless_super_delegation_py3.py
70 lines (44 loc) · 1.69 KB
/
useless_super_delegation_py3.py
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
# pylint: disable=missing-docstring, no-member, unused-argument, invalid-name,unused-variable
# pylint: disable=too-few-public-methods,wrong-import-position, useless-object-inheritance
class NotUselessSuper(object):
def not_passing_keyword_only(self, first, *, second):
return super().not_passing_keyword_only(first)
def passing_keyword_only_with_modifications(self, first, *, second):
return super().passing_keyword_only_with_modifications(
first, second + 1)
class AlsoNotUselessSuper(NotUselessSuper):
def not_passing_keyword_only(self, first, *, second="second"):
return super().not_passing_keyword_only(first, second=second)
class UselessSuper(object):
def useless(self, *, first): # [useless-super-delegation]
super().useless(first=first)
class Egg():
def __init__(self, thing: object) -> None:
pass
class Spam(Egg):
def __init__(self, thing: int) -> None:
super().__init__(thing)
class Ham(Egg):
def __init__(self, thing: object) -> None: # [useless-super-delegation]
super().__init__(thing)
from typing import List
class Test:
def __init__(self, _arg: List[int]) -> None:
super().__init__()
import random
class ReturnTypeAny:
choices = ['a', 1, (2, 3)]
def draw(self) -> None:
return random.choice(self.choices)
class ReturnTypeNarrowed(ReturnTypeAny):
choices = [1, 2, 3]
def draw(self) -> int:
return super().draw()
class NoReturnType:
choices = ['a', 1, (2, 3)]
def draw(self):
return random.choice(self.choices)
class ReturnTypeSpecified(NoReturnType):
choices = ['a', 'b']
def draw(self) -> str:
return super().draw()