Skip to content

Commit

Permalink
Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Apr 4, 2022
1 parent 6fdba83 commit d213482
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doc/data/messages/f/functools-cache-decorating-method/bad.py
@@ -0,0 +1,7 @@
import functools


class MyClassWithMethods:
@functools.cache # [functools-cache-decorating-method]
def my_func(self, param):
return param + 1
3 changes: 3 additions & 0 deletions doc/data/messages/f/functools-cache-decorating-method/good.py
@@ -0,0 +1,3 @@
class MyClassWithMethods:
def my_func(self, param):
return param + 1
5 changes: 4 additions & 1 deletion pylint/checkers/stdlib.py
Expand Up @@ -569,7 +569,10 @@ def visit_boolop(self, node: nodes.BoolOp) -> None:
for value in node.values:
self._check_datetime(value)

@utils.check_messages("lru-cache-decorating-method")
@utils.check_messages(
"lru-cache-decorating-method",
"functools-cache-decorating-method",
)
def visit_functiondef(self, node: nodes.FunctionDef) -> None:
if node.decorators and isinstance(node.parent, nodes.ClassDef):
self._check_lru_cache_decorators(node.decorators)
Expand Down

0 comments on commit d213482

Please sign in to comment.