Merge "Update the rest of the code to satisfy flake8 in a py34 env"
This commit is contained in:
commit
d78c6a6e90
@ -100,7 +100,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
provision_log = os.path.join(VAR_PATH, 'provision-finished')
|
provision_log = os.path.join(VAR_PATH, 'provision-finished')
|
||||||
# touch the file so it is timestamped with when finished
|
# touch the file so it is timestamped with when finished
|
||||||
pl = file(provision_log, 'a')
|
pl = open(provision_log, 'a')
|
||||||
try:
|
try:
|
||||||
os.utime(provision_log, None)
|
os.utime(provision_log, None)
|
||||||
finally:
|
finally:
|
||||||
|
@ -76,7 +76,7 @@ def _import_module(importer, module_name, package):
|
|||||||
# Make this accessible through the parent package for static imports
|
# Make this accessible through the parent package for static imports
|
||||||
local_name = module_name.partition(package.__name__ + '.')[2]
|
local_name = module_name.partition(package.__name__ + '.')[2]
|
||||||
module_components = local_name.split('.')
|
module_components = local_name.split('.')
|
||||||
parent = reduce(getattr, module_components[:-1], package)
|
parent = six.moves.reduce(getattr, module_components[:-1], package)
|
||||||
setattr(parent, module_components[-1], module)
|
setattr(parent, module_components[-1], module)
|
||||||
|
|
||||||
return module
|
return module
|
||||||
|
@ -198,6 +198,6 @@ def select_from_attribute(attribute_value, path):
|
|||||||
return collection[key]
|
return collection[key]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return reduce(get_path_component, path, attribute_value)
|
return six.moves.reduce(get_path_component, path, attribute_value)
|
||||||
except (KeyError, IndexError, TypeError):
|
except (KeyError, IndexError, TypeError):
|
||||||
return None
|
return None
|
||||||
|
@ -449,7 +449,7 @@ class Replace(function.Function):
|
|||||||
|
|
||||||
return string.replace(placeholder, six.text_type(value))
|
return string.replace(placeholder, six.text_type(value))
|
||||||
|
|
||||||
return reduce(replace, six.iteritems(mapping), template)
|
return six.moves.reduce(replace, six.iteritems(mapping), template)
|
||||||
|
|
||||||
|
|
||||||
class Base64(function.Function):
|
class Base64(function.Function):
|
||||||
|
@ -83,7 +83,8 @@ class GetParam(function.Function):
|
|||||||
return collection[key]
|
return collection[key]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return reduce(get_path_component, path_components, parameter)
|
return six.moves.reduce(get_path_component, path_components,
|
||||||
|
parameter)
|
||||||
except (KeyError, IndexError, TypeError):
|
except (KeyError, IndexError, TypeError):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -412,6 +412,6 @@ def _hash_data(data):
|
|||||||
|
|
||||||
if isinstance(data, collections.Mapping):
|
if isinstance(data, collections.Mapping):
|
||||||
item_hashes = (hash(k) ^ _hash_data(v) for k, v in data.items())
|
item_hashes = (hash(k) ^ _hash_data(v) for k, v in data.items())
|
||||||
return reduce(operator.xor, item_hashes, 0L)
|
return six.moves.reduce(operator.xor, item_hashes, 0)
|
||||||
|
|
||||||
return hash(data)
|
return hash(data)
|
||||||
|
@ -89,10 +89,28 @@ class Timeout(BaseException):
|
|||||||
generator.close()
|
generator.close()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __cmp__(self, other):
|
def __eq__(self, other):
|
||||||
|
return not self < other and not other < self
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return not self.__eq__(other)
|
||||||
|
|
||||||
|
def __gt__(self, other):
|
||||||
|
return other < self
|
||||||
|
|
||||||
|
def __ge__(self, other):
|
||||||
|
return not self < other
|
||||||
|
|
||||||
|
def __le__(self, other):
|
||||||
|
return not other < self
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
if not isinstance(other, Timeout):
|
if not isinstance(other, Timeout):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return cmp(self._endtime, other._endtime)
|
return self._endtime < other._endtime
|
||||||
|
|
||||||
|
def __cmp__(self, other):
|
||||||
|
return self < other
|
||||||
|
|
||||||
|
|
||||||
class TimedCancel(Timeout):
|
class TimedCancel(Timeout):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user