Remove unused common util functions

This commit is contained in:
Roberto Rosario
2014-11-02 21:23:31 -04:00
parent 9f2692d36a
commit ef213001e1

View File

@@ -169,22 +169,6 @@ def get_object_name(obj, display_object_type=True):
return u'%s' % (label)
def return_diff(old_obj, new_obj, attrib_list=None):
diff_dict = {}
if not attrib_list:
attrib_list = old_obj.__dict__.keys()
for attrib in attrib_list:
old_val = getattr(old_obj, attrib)
new_val = getattr(new_obj, attrib)
if old_val != new_val:
diff_dict[attrib] = {
'old_value': old_val,
'new_value': new_val
}
return diff_dict
def validate_path(path):
if not os.path.exists(path):
# If doesn't exist try to create it
@@ -211,10 +195,6 @@ def encapsulate(function):
return lambda: function
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
def get_descriptor(file_input, read=True):
try:
# Is it a file like object?
@@ -250,16 +230,6 @@ def copyfile(source, destination, buffer_size=1024 * 1024):
destination_descriptor.close()
def _lazy_load(fn):
_cached = []
def _decorated():
if not _cached:
_cached.append(fn())
return _cached[0]
return _decorated
def load_backend(backend_string):
logger.debug('loading: %s', backend_string)
module_name, klass = backend_string.rsplit('.', 1)