diff options
| author | Tim Graham <timograham@gmail.com> | 2016-04-03 20:37:32 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-04-04 17:14:26 -0400 |
| commit | 2cd2d188516475ddf256e6267cd82c495fb5c430 (patch) | |
| tree | 1a7c3c167c1576923c7c4f5544495face5bd7327 /django/utils | |
| parent | d356bb653f4d90ae9809e5a051791ded39010c38 (diff) | |
Fixed W503 flake8 warnings.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/archive.py | 3 | ||||
| -rw-r--r-- | django/utils/timezone.py | 10 | ||||
| -rw-r--r-- | django/utils/translation/trans_real.py | 3 | ||||
| -rw-r--r-- | django/utils/tree.py | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/django/utils/archive.py b/django/utils/archive.py index 6a47b00502..3e47213455 100644 --- a/django/utils/archive.py +++ b/django/utils/archive.py @@ -101,8 +101,7 @@ class BaseArchive(object): def split_leading_dir(self, path): path = str(path) path = path.lstrip('/').lstrip('\\') - if '/' in path and (('\\' in path and path.find('/') < path.find('\\')) - or '\\' not in path): + if '/' in path and (('\\' in path and path.find('/') < path.find('\\')) or '\\' not in path): return path.split('/', 1) elif '\\' in path: return path.split('\\', 1) diff --git a/django/utils/timezone.py b/django/utils/timezone.py index 205cac44a9..20d59f5fed 100644 --- a/django/utils/timezone.py +++ b/django/utils/timezone.py @@ -288,10 +288,12 @@ def template_localtime(value, use_tz=None): This function is designed for use by the template engine. """ - should_convert = (isinstance(value, datetime) - and (settings.USE_TZ if use_tz is None else use_tz) - and not is_naive(value) - and getattr(value, 'convert_to_local_time', True)) + should_convert = ( + isinstance(value, datetime) and + (settings.USE_TZ if use_tz is None else use_tz) and + not is_naive(value) and + getattr(value, 'convert_to_local_time', True) + ) return localtime(value) if should_convert else value diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index baa39b445d..34dd7bc768 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -129,8 +129,7 @@ class DjangoTranslation(gettext_module.GNUTranslations): self._add_installed_apps_translations() self._add_local_translations() - if (self.__language == settings.LANGUAGE_CODE and self.domain == 'django' - and self._catalog is None): + if self.__language == settings.LANGUAGE_CODE and self.domain == 'django' and self._catalog is None: # default lang should have at least one translation file available. raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE) self._add_fallback(localedirs) diff --git a/django/utils/tree.py b/django/utils/tree.py index 50712bb866..3eb3529354 100644 --- a/django/utils/tree.py +++ b/django/utils/tree.py @@ -102,8 +102,8 @@ class Node(object): return data if self.connector == conn_type: # We can reuse self.children to append or squash the node other. - if (isinstance(data, Node) and not data.negated - and (data.connector == conn_type or len(data) == 1)): + if (isinstance(data, Node) and not data.negated and + (data.connector == conn_type or len(data) == 1)): # We can squash the other node's children directly into this # node. We are just doing (AB)(CD) == (ABCD) here, with the # addition that if the length of the other node is 1 the |
