Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
andbag committed Apr 5, 2018
1 parent 9a8ea41 commit a6a7581
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Products/PluginIndexes/util.py
Expand Up @@ -21,9 +21,15 @@

def safe_callable(ob):
# Works with ExtensionClasses and Acquisition.
if hasattr(ob, '__class__'):
return hasattr(ob, '__call__') or isinstance(ob, six.class_types)
else:
try:
ob.__class__

try:
return bool(ob.__call__)
except AttributeError:
return isinstance(ob, six.class_types)

except AttributeError:
return callable(ob)


Expand All @@ -40,13 +46,13 @@ def datetime_to_minutes(value, precision=1,

# flatten to precision
if precision > 1:
value = value - (value % precision)
value = value - (value % precision) # noqa: S001

value = int(value)

if value > max_value or value < min_value:
# value must be integer fitting in the range (default 32bit)
raise OverflowError(
'%s is not within the range of dates allowed.' % value)
'{0} is not within the range of dates allowed.'.format(value))

return value

0 comments on commit a6a7581

Please sign in to comment.