forked from pylint-dev/pylint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
useless_super_delegation_py35.py
46 lines (30 loc) · 1.19 KB
/
useless_super_delegation_py35.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
# pylint: disable=missing-docstring,too-few-public-methods,no-member,unused-argument, useless-object-inheritance
class NotUselessSuper(object):
def not_passing_all_params(self, first, *args, second=None, **kwargs):
return super().not_passing_all_params(*args, second, **kwargs)
class UselessSuper(object):
def useless(self, first, *, second=None, **kwargs): # [useless-super-delegation]
return super().useless(first, second=second, **kwargs)
# pylint: disable=wrong-import-position
import random
from typing import Any
class ReturnTypeAny:
choices = ['a', 1, (2, 3)]
def draw(self) -> Any:
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: # [useless-super-delegation]
return super().draw()
class ReturnTypeSame(ReturnTypeAny):
choices = ['a', 'b']
def draw(self) -> Any: # [useless-super-delegation]
return super().draw()