summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-09-14 03:20:29 +0200
committerTim Graham <timograham@gmail.com>2017-09-13 21:20:29 -0400
commit0ec0e5029ca5c499eac93787c3073c3e716b5951 (patch)
tree26995b1c9679736cd17132b3478d5dfbf2185cb0
parentee4043f7355f077583ca4c1749db7d5211f0855e (diff)
Removed unnecessary parens in various code.
-rw-r--r--django/conf/__init__.py2
-rw-r--r--django/contrib/admin/options.py2
-rw-r--r--django/contrib/contenttypes/management/__init__.py2
-rw-r--r--django/core/files/locks.py4
-rw-r--r--django/core/files/temp.py2
-rw-r--r--django/core/management/commands/dumpdata.py2
-rw-r--r--django/forms/models.py2
-rw-r--r--django/utils/cache.py4
8 files changed, 10 insertions, 10 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index 795f563085..9e4b0a4b1e 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -189,7 +189,7 @@ class UserSettingsHolder:
deleted = (setting in self._deleted)
set_locally = (setting in self.__dict__)
set_on_default = getattr(self.default_settings, 'is_overridden', lambda s: False)(setting)
- return (deleted or set_locally or set_on_default)
+ return deleted or set_locally or set_on_default
def __repr__(self):
return '<%(cls)s>' % {
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 32b30a7e8b..a1c469c91e 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -240,7 +240,7 @@ class BaseModelAdmin(metaclass=forms.MediaDefiningClass):
if db_field.name in self.raw_id_fields:
kwargs['widget'] = widgets.ManyToManyRawIdWidget(db_field.remote_field, self.admin_site, using=db)
- elif db_field.name in (list(self.filter_vertical) + list(self.filter_horizontal)):
+ elif db_field.name in list(self.filter_vertical) + list(self.filter_horizontal):
kwargs['widget'] = widgets.FilteredSelectMultiple(
db_field.verbose_name,
db_field.name in self.filter_vertical
diff --git a/django/contrib/contenttypes/management/__init__.py b/django/contrib/contenttypes/management/__init__.py
index 6bdbe39f5a..2b5f688136 100644
--- a/django/contrib/contenttypes/management/__init__.py
+++ b/django/contrib/contenttypes/management/__init__.py
@@ -61,7 +61,7 @@ def inject_rename_contenttypes_operations(plan=None, apps=global_apps, using=DEF
available = True
for migration, backward in plan:
- if ((migration.app_label, migration.name) == ('contenttypes', '0001_initial')):
+ if (migration.app_label, migration.name) == ('contenttypes', '0001_initial'):
# There's no point in going forward if the initial contenttypes
# migration is unapplied as the ContentType model will be
# unavailable from this point.
diff --git a/django/core/files/locks.py b/django/core/files/locks.py
index 8f7cef0a3e..63c7fda9bb 100644
--- a/django/core/files/locks.py
+++ b/django/core/files/locks.py
@@ -106,8 +106,8 @@ else:
else:
def lock(f, flags):
ret = fcntl.flock(_fd(f), flags)
- return (ret == 0)
+ return ret == 0
def unlock(f):
ret = fcntl.flock(_fd(f), fcntl.LOCK_UN)
- return (ret == 0)
+ return ret == 0
diff --git a/django/core/files/temp.py b/django/core/files/temp.py
index d5c56a0ad0..5fbb91b9ee 100644
--- a/django/core/files/temp.py
+++ b/django/core/files/temp.py
@@ -54,7 +54,7 @@ if os.name == 'nt':
pass
try:
self.unlink(self.name)
- except (OSError):
+ except OSError:
pass
def __del__(self):
diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py
index b246cee238..d32b191b5a 100644
--- a/django/core/management/commands/dumpdata.py
+++ b/django/core/management/commands/dumpdata.py
@@ -173,7 +173,7 @@ class Command(BaseCommand):
progress_output = None
object_count = 0
# If dumpdata is outputting to stdout, there is no way to display progress
- if (output and self.stdout.isatty() and options['verbosity'] > 0):
+ if output and self.stdout.isatty() and options['verbosity'] > 0:
progress_output = self.stdout
object_count = sum(get_objects(count_only=True))
stream = open(output, 'w') if output else None
diff --git a/django/forms/models.py b/django/forms/models.py
index ef934201a9..84a0c97de7 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1141,7 +1141,7 @@ class ModelChoiceIterator:
yield self.choice(obj)
def __len__(self):
- return (len(self.queryset) + (1 if self.field.empty_label is not None else 0))
+ return len(self.queryset) + (1 if self.field.empty_label is not None else 0)
def choice(self, obj):
return (self.field.prepare_value(obj), self.field.label_from_instance(obj))
diff --git a/django/utils/cache.py b/django/utils/cache.py
index e8576b539f..b1abbf0648 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -153,7 +153,7 @@ def get_conditional_response(request, etag=None, last_modified=None, response=No
if_modified_since = parse_http_date_safe(if_modified_since)
# Step 1 of section 6 of RFC 7232: Test the If-Match precondition.
- if (if_match_etags and not _if_match_passes(etag, if_match_etags)):
+ if if_match_etags and not _if_match_passes(etag, if_match_etags):
return _precondition_failed(request)
# Step 2: Test the If-Unmodified-Since precondition.
@@ -162,7 +162,7 @@ def get_conditional_response(request, etag=None, last_modified=None, response=No
return _precondition_failed(request)
# Step 3: Test the If-None-Match precondition.
- if (if_none_match_etags and not _if_none_match_passes(etag, if_none_match_etags)):
+ if if_none_match_etags and not _if_none_match_passes(etag, if_none_match_etags):
if request.method in ('GET', 'HEAD'):
return _not_modified(request, response)
else: