Pretify code
This commit is contained in:
parent
b72db1ca32
commit
07f827104e
@ -100,11 +100,7 @@ class Resource(object):
|
|||||||
self.db_obj.save()
|
self.db_obj.save()
|
||||||
|
|
||||||
# Load
|
# Load
|
||||||
<<<<<<< HEAD:solar/core/resource/resource.py
|
@dispatch(object) # noqa
|
||||||
@dispatch(DBResource) # NOQA
|
|
||||||
=======
|
|
||||||
@dispatch(object)
|
|
||||||
>>>>>>> 3f53526... Initial idea of new cache:solar/solar/core/resource/resource.py
|
|
||||||
def __init__(self, resource_db):
|
def __init__(self, resource_db):
|
||||||
self.db_obj = resource_db
|
self.db_obj = resource_db
|
||||||
self.name = resource_db.name
|
self.name = resource_db.name
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
from functools import total_ordering
|
from functools import total_ordering
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
import uuid
|
|
||||||
import time
|
import time
|
||||||
|
import uuid
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
@ -45,7 +45,6 @@ class DBLayerNoRiakObj(DBLayerException):
|
|||||||
|
|
||||||
class NONE(object):
|
class NONE(object):
|
||||||
"""A None like type"""
|
"""A None like type"""
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class SingleIndexCache(object):
|
class SingleIndexCache(object):
|
||||||
@ -93,7 +92,10 @@ class SingleClassCache(object):
|
|||||||
__slots__ = ['obj_cache', 'db_ch_state',
|
__slots__ = ['obj_cache', 'db_ch_state',
|
||||||
'lazy_save', 'origin_class',
|
'lazy_save', 'origin_class',
|
||||||
'refs']
|
'refs']
|
||||||
|
<<<<<<< HEAD
|
||||||
>>>>>>> 3f53526... Initial idea of new cache:solar/solar/dblayer/model.py
|
>>>>>>> 3f53526... Initial idea of new cache:solar/solar/dblayer/model.py
|
||||||
|
=======
|
||||||
|
>>>>>>> f8f2630... Pretify code
|
||||||
|
|
||||||
def __init__(self, origin_class):
|
def __init__(self, origin_class):
|
||||||
self.obj_cache = LFUCache(origin_class, 200)
|
self.obj_cache = LFUCache(origin_class, 200)
|
||||||
@ -823,7 +825,6 @@ class Model(object):
|
|||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash(self.key)
|
return hash(self.key)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def new(cls, key, data):
|
def new(cls, key, data):
|
||||||
return cls.from_dict(key, data)
|
return cls.from_dict(key, data)
|
||||||
@ -859,7 +860,8 @@ class Model(object):
|
|||||||
# shouldn't be needed, but may cover some weird usecase
|
# shouldn't be needed, but may cover some weird usecase
|
||||||
# when inproperly using from_dict, because it then leads to conflicts
|
# when inproperly using from_dict, because it then leads to conflicts
|
||||||
if key in cls._c.obj_cache:
|
if key in cls._c.obj_cache:
|
||||||
raise DBLayerException("Object already exists in cache, cannot create second")
|
raise DBLayerException("Object already exists in cache"
|
||||||
|
" cannot create second")
|
||||||
data['key'] = key
|
data['key'] = key
|
||||||
riak_obj = cls.bucket.new(key, data={})
|
riak_obj = cls.bucket.new(key, data={})
|
||||||
obj = cls.from_riakobj(riak_obj)
|
obj = cls.from_riakobj(riak_obj)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user