-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent cached callables being invoked multiple times when multithrea…
…ding
- Loading branch information
Showing
11 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import warnings | ||
|
||
from . import Cache | ||
|
||
warnings.warn( | ||
"cachetools.cache is deprecated, please use cachetools.Cache", DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import warnings | ||
|
||
from . import FIFOCache | ||
|
||
warnings.warn( | ||
"cachetools.fifo is deprecated, please use cachetools.FIFOCache", DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import warnings | ||
|
||
from . import LFUCache | ||
|
||
warnings.warn( | ||
"cachetools.lfu is deprecated, please use cachetools.LFUCache", DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import warnings | ||
|
||
from . import LRUCache | ||
|
||
warnings.warn( | ||
"cachetools.lru is deprecated, please use cachetools.LRUCache", DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import warnings | ||
|
||
from . import MRUCache | ||
|
||
warnings.warn( | ||
"cachetools.mru is deprecated, please use cachetools.MRUCache", DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import warnings | ||
|
||
from . import RRCache | ||
|
||
warnings.warn( | ||
"cachetools.rr is deprecated, please use cachetools.RRCache", DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import warnings | ||
|
||
from . import TTLCache | ||
|
||
warnings.warn( | ||
"cachetools.ttl is deprecated, please use cachetools.TTLCache", DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import unittest | ||
import warnings | ||
|
||
|
||
class DeprecatedTest(unittest.TestCase): | ||
def test_cache(self): | ||
with warnings.catch_warnings(record=True) as w: | ||
warnings.simplefilter("always") | ||
from cachetools.cache import Cache | ||
|
||
assert len(w) == 1 | ||
assert issubclass(w[-1].category, DeprecationWarning) | ||
assert "cachetools.cache" in str(w[-1].message) | ||
|
||
def test_fifo(self): | ||
with warnings.catch_warnings(record=True) as w: | ||
warnings.simplefilter("always") | ||
from cachetools.fifo import FIFOCache | ||
|
||
assert len(w) == 1 | ||
assert issubclass(w[-1].category, DeprecationWarning) | ||
assert "cachetools.fifo" in str(w[-1].message) | ||
|
||
def test_lfu(self): | ||
with warnings.catch_warnings(record=True) as w: | ||
warnings.simplefilter("always") | ||
from cachetools.lfu import LFUCache | ||
|
||
assert len(w) == 1 | ||
assert issubclass(w[-1].category, DeprecationWarning) | ||
assert "cachetools.lfu" in str(w[-1].message) | ||
|
||
def test_lru(self): | ||
with warnings.catch_warnings(record=True) as w: | ||
warnings.simplefilter("always") | ||
from cachetools.lru import LRUCache | ||
|
||
assert len(w) == 1 | ||
assert issubclass(w[-1].category, DeprecationWarning) | ||
assert "cachetools.lru" in str(w[-1].message) | ||
|
||
def test_mru(self): | ||
with warnings.catch_warnings(record=True) as w: | ||
warnings.simplefilter("always") | ||
from cachetools.mru import MRUCache | ||
|
||
assert len(w) == 1 | ||
assert issubclass(w[-1].category, DeprecationWarning) | ||
assert "cachetools.mru" in str(w[-1].message) | ||
|
||
def test_rr(self): | ||
with warnings.catch_warnings(record=True) as w: | ||
warnings.simplefilter("always") | ||
from cachetools.rr import RRCache | ||
|
||
assert len(w) == 1 | ||
assert issubclass(w[-1].category, DeprecationWarning) | ||
assert "cachetools.rr" in str(w[-1].message) | ||
|
||
def test_ttl(self): | ||
with warnings.catch_warnings(record=True) as w: | ||
warnings.simplefilter("always") | ||
from cachetools.ttl import TTLCache | ||
|
||
assert len(w) == 1 | ||
assert issubclass(w[-1].category, DeprecationWarning) | ||
assert "cachetools.ttl" in str(w[-1].message) |