Skip to content

Commit 1a17f08

Browse files
committed
-
1 parent 8903b51 commit 1a17f08

40 files changed

+666
-477
lines changed

source_py2/python_toolbox/caching/cached_property.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ def __init__(self, getter_or_value, doc=None, name=None,
5353
self.__doc__ = doc or getattr(self.getter, '__doc__', None)
5454

5555

56-
def __get__(self, obj, our_type=None):
56+
def __get__(self, thing, our_type=None):
5757

58-
if obj is None:
58+
if thing is None:
5959
# We're being accessed from the class itself, not from an object
6060
return self
6161

62-
value = self.getter(obj)
62+
value = self.getter(thing)
6363

64-
setattr(obj, self.get_our_name(obj, our_type=our_type), value)
64+
setattr(thing, self.get_our_name(thing, our_type=our_type), value)
6565

6666
return value
6767

source_py2/python_toolbox/caching/decorators.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010

1111
import datetime as datetime_module
1212

13+
from python_toolbox import misc_tools
1314
from python_toolbox import binary_search
1415
from python_toolbox import decorator_tools
1516
from python_toolbox.sleek_reffing import SleekCallArgs
1617

1718
infinity = float('inf')
1819

1920

20-
class CLEAR_ENTIRE_CACHE(object):
21-
'''Sentinel object for clearing the entire cache'''
21+
class CLEAR_ENTIRE_CACHE(misc_tools.NonInstantiable):
22+
'''Sentinel object for clearing the entire cache.'''
2223

2324

2425
def _get_now():
@@ -68,8 +69,6 @@ def f(a, b=2):
6869
# completely argumentless function. so do one for those.
6970

7071
from python_toolbox.nifty_collections import OrderedDict
71-
from python_toolbox import misc_tools
72-
7372

7473
if time_to_keep is not None:
7574
if max_size != infinity:

source_py2/python_toolbox/change_tracker.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# Copyright 2009-2015 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4-
'''
5-
This module defines the `ChangeTracker` class.
6-
7-
See its documentation for more information.
8-
'''
9-
10-
import cPickle
4+
import pickle
115

126
from python_toolbox.nifty_collections import WeakKeyIdentityDict
137

source_py2/python_toolbox/combi/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
import math
55

6+
from python_toolbox import misc_tools
67
from python_toolbox import math_tools
78
from python_toolbox import cute_iter_tools
8-
from python_toolbox import misc_tools
99

1010
infinity = float('inf')
1111

1212

13-
class MISSING_ELEMENT(object):
13+
class MISSING_ELEMENT(misc_tools.NonInstantiable):
1414
'''A placeholder for a missing element used in internal calculations.'''
1515

1616

source_py2/python_toolbox/context_management/blank_context_manager.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Copyright 2009-2015 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4-
'''
5-
This module defines the `BlankContextManager` class.
6-
7-
See its documentation for more information.
8-
'''
9-
104
from .context_manager import ContextManager
115

126

source_py2/python_toolbox/context_management/context_manager.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Copyright 2009-2015 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4-
'''
5-
This module defines the `ContextManager` class.
6-
7-
See its documentation for more information.
8-
'''
9-
104
import sys
115
import types
126
import abc

source_py2/python_toolbox/context_management/context_manager_type.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Copyright 2009-2015 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4-
'''
5-
This module defines the `ContextManagerType` class.
6-
7-
See its documentation for more information.
8-
'''
9-
104
import abc
115

126
from .context_manager_type_type import ContextManagerTypeType

source_py2/python_toolbox/context_management/context_manager_type_type.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Copyright 2009-2015 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4-
'''
5-
This module defines the `ContextManagerTypeType` metaclass.
6-
7-
See its documentation for more information.
8-
'''
9-
104

115
class ContextManagerTypeType(type):
126
'''

source_py2/python_toolbox/context_management/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This program is distributed under the MIT license.
33

44
'''
5-
This module defines various functions.
5+
This module defines various functions related to context managers.
66
77
See their documentation for more information.
88
'''

source_py2/python_toolbox/context_management/self_hook.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Copyright 2009-2015 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4-
'''
5-
This module defines the `SelfHook` class.
6-
7-
See its documentation for more information.
8-
'''
9-
104
class SelfHook(object):
115
'''
126
Hook that a context manager can yield in order to yield itself.

0 commit comments

Comments
 (0)