blob: 3a668ab21cde68b83762afc41213839903d81d95 (
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
|
# pylint: disable=R0921, print-statement
"""check assignment to function call where the function doesn't return
'E1111': ('Assigning to function call which doesn\'t return',
'Used when an assignment is done on a function call but the \
infered function doesn\'t return anything.'),
'W1111': ('Assigning to function call which only returns None',
'Used when an assignment is done on a function call but the \
infered function returns nothing but None.'),
"""
from __future__ import generators
__revision__ = None
def func_no_return():
"""function without return"""
print 'dougloup'
A = func_no_return()
def func_return_none():
"""function returning none"""
print 'dougloup'
return None
A = func_return_none()
def func_implicit_return_none():
"""Function returning None from bare return statement."""
return
A = func_implicit_return_none()
def func_return_none_and_smth():
"""function returning none and something else"""
print 'dougloup'
if __revision__:
return None
return 3
A = func_return_none_and_smth()
def generator():
"""no problemo"""
yield __revision__
A = generator()
class Abstract(object):
"""bla bla"""
def abstract_method(self):
"""use to return something in concrete implementation"""
raise NotImplementedError
def use_abstract(self):
"""should not issue E1111"""
var = self.abstract_method()
print var
|