-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
method_cache_max_size_none_py39.py
47 lines (36 loc) · 1.18 KB
/
method_cache_max_size_none_py39.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
"""Tests for method-cache-max-size-none"""
# pylint: disable=no-self-use, missing-function-docstring, reimported, too-few-public-methods
# pylint: disable=missing-class-docstring, function-redefined
import functools
import functools as aliased_functools
from functools import cache
from functools import cache as aliased_cache
@cache
def my_func(param):
return param + 1
class MyClassWithMethods:
@cache
@staticmethod
def my_func(param):
return param + 1
@cache
@classmethod
def my_func(cls, param):
return param + 1
@cache # [method-cache-max-size-none]
def my_func(self, param):
return param + 1
@functools.cache # [method-cache-max-size-none]
def my_func(self, param):
return param + 1
@aliased_functools.cache # [method-cache-max-size-none]
def my_func(self, param):
return param + 1
@aliased_cache # [method-cache-max-size-none]
def my_func(self, param):
return param + 1
# Check double decorating to check robustness of checker itself
@functools.lru_cache(maxsize=1)
@aliased_cache # [method-cache-max-size-none]
def my_func(self, param):
return param + 1