diff options
| author | Claude Paroz <claude@2xlibre.net> | 2015-03-13 20:08:04 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-03-13 21:58:28 +0100 |
| commit | a52cd407b86a51e1badf6771e590361e24fd7155 (patch) | |
| tree | 0849a494da214a1c258f39cd5a7faaf334e57fa1 /django | |
| parent | b9d9ab23bdcc404708aada664e718a9d56415ca3 (diff) | |
Fed tuples to startswith when appropriate
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/compilemessages.py | 5 | ||||
| -rw-r--r-- | django/shortcuts.py | 2 | ||||
| -rw-r--r-- | django/template/base.py | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/django/core/management/commands/compilemessages.py b/django/core/management/commands/compilemessages.py index dbadac0c7d..f4b45d72ff 100644 --- a/django/core/management/commands/compilemessages.py +++ b/django/core/management/commands/compilemessages.py @@ -12,9 +12,8 @@ from django.utils._os import npath, upath def has_bom(fn): with open(fn, 'rb') as f: sample = f.read(4) - return sample[:3] == b'\xef\xbb\xbf' or \ - sample.startswith(codecs.BOM_UTF16_LE) or \ - sample.startswith(codecs.BOM_UTF16_BE) + return (sample[:3] == b'\xef\xbb\xbf' or + sample.startswith((codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE))) def is_writable(path): diff --git a/django/shortcuts.py b/django/shortcuts.py index 415e51887e..5b1ec7d4ab 100644 --- a/django/shortcuts.py +++ b/django/shortcuts.py @@ -197,7 +197,7 @@ def resolve_url(to, *args, **kwargs): if isinstance(to, six.string_types): # Handle relative URLs - if any(to.startswith(path) for path in ('./', '../')): + if to.startswith(('./', '../')): return to # Next try a reverse URL resolution. diff --git a/django/template/base.py b/django/template/base.py index 25a42531fd..686a18ef2d 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -232,7 +232,7 @@ class Token(object): bits = iter(smart_split(self.contents)) for bit in bits: # Handle translation-marked template pieces - if bit.startswith('_("') or bit.startswith("_('"): + if bit.startswith(('_("', "_('")): sentinal = bit[2] + ')' trans_bit = [bit] while not bit.endswith(sentinal): |
