cleanup
This commit is contained in:
@ -33,7 +33,8 @@ class Log:
|
||||
self.show_debug = show_debug
|
||||
self.show_verbose = show_verbose
|
||||
|
||||
def error(self, txt):
|
||||
@staticmethod
|
||||
def error(txt):
|
||||
if colorama:
|
||||
print(colorama.Fore.RED + colorama.Style.BRIGHT + "! " + txt + colorama.Style.RESET_ALL, file=sys.stderr)
|
||||
else:
|
||||
@ -227,7 +228,6 @@ class CachedProperty(object):
|
||||
self.__doc__ = getattr(func, '__doc__')
|
||||
self.func = func
|
||||
|
||||
|
||||
def __get__(self, obj, cls):
|
||||
if obj is None:
|
||||
return self
|
||||
@ -245,6 +245,7 @@ class CachedProperty(object):
|
||||
|
||||
|
||||
def invalidate_cache(obj):
|
||||
if hasattr(obj, '_cached_properties'):
|
||||
obj._cached_properties = {}
|
||||
|
||||
|
||||
@ -540,7 +541,6 @@ class ZfsDataset:
|
||||
self.name = name # full name
|
||||
self.force_exists = force_exists
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return "{}: {}".format(self.zfs_node, self.name)
|
||||
|
||||
@ -564,7 +564,6 @@ class ZfsDataset:
|
||||
|
||||
def invalidate(self):
|
||||
"""clear cache"""
|
||||
# TODO: nicer?
|
||||
invalidate_cache(self)
|
||||
self.force_exists = None
|
||||
|
||||
@ -777,7 +776,6 @@ class ZfsDataset:
|
||||
"""add to self.snapshots as soon as it is created"""
|
||||
pass
|
||||
|
||||
|
||||
@CachedProperty
|
||||
def snapshots(self):
|
||||
"""get all snapshots of this dataset"""
|
||||
@ -1649,7 +1647,7 @@ class ZfsAutobackup:
|
||||
if args.resume:
|
||||
self.verbose("NOTE: The --resume option isn't needed anymore (its autodetected now)")
|
||||
|
||||
if args.target_path!=None and args.target_path[0] == "/":
|
||||
if args.target_path is not None and args.target_path[0] == "/":
|
||||
self.log.error("Target should not start with a /")
|
||||
sys.exit(255)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user