diff options
| author | coagulant <baryshev@gmail.com> | 2013-11-03 01:02:56 +0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-11-02 18:20:39 -0400 |
| commit | 3bc0d46a840f17dce561daca8a6b8690b2cf5d0a (patch) | |
| tree | c25954abbde0c4c06af7f862effcd351047cddf9 /django/db | |
| parent | 2a03a9a9a1c4517be75e72899e545b0bc9dd0688 (diff) | |
Fixed all E261 warnings
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/backends/mysql/base.py | 6 | ||||
| -rw-r--r-- | django/db/backends/oracle/creation.py | 2 | ||||
| -rw-r--r-- | django/db/backends/oracle/introspection.py | 4 | ||||
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/introspection.py | 2 | ||||
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/operations.py | 4 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/base.py | 2 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/introspection.py | 2 | ||||
| -rw-r--r-- | django/db/backends/utils.py | 10 | ||||
| -rw-r--r-- | django/db/models/__init__.py | 2 | ||||
| -rw-r--r-- | django/db/models/base.py | 2 | ||||
| -rw-r--r-- | django/db/models/fields/__init__.py | 2 | ||||
| -rw-r--r-- | django/db/models/query.py | 8 | ||||
| -rw-r--r-- | django/db/models/sql/query.py | 2 |
13 files changed, 24 insertions, 24 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 84bbf1569f..b38d00c84a 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -226,7 +226,7 @@ class DatabaseOperations(BaseDatabaseOperations): def date_trunc_sql(self, lookup_type, field_name): fields = ['year', 'month', 'day', 'hour', 'minute', 'second'] - format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape. + format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape. format_def = ('0000-', '01', '-01', ' 00:', '00', ':00') try: i = fields.index(lookup_type) + 1 @@ -259,7 +259,7 @@ class DatabaseOperations(BaseDatabaseOperations): else: params = [] fields = ['year', 'month', 'day', 'hour', 'minute', 'second'] - format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape. + format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape. format_def = ('0000-', '01', '-01', ' 00:', '00', ':00') try: i = fields.index(lookup_type) + 1 @@ -300,7 +300,7 @@ class DatabaseOperations(BaseDatabaseOperations): def quote_name(self, name): if name.startswith("`") and name.endswith("`"): - return name # Quoting once is enough. + return name # Quoting once is enough. return "`%s`" % name def quote_parameter(self, value): diff --git a/django/db/backends/oracle/creation.py b/django/db/backends/oracle/creation.py index fc9a0d034f..6cb2f1467e 100644 --- a/django/db/backends/oracle/creation.py +++ b/django/db/backends/oracle/creation.py @@ -147,7 +147,7 @@ class DatabaseCreation(BaseDatabaseCreation): } cursor = self.connection.cursor() - time.sleep(1) # To avoid "database is being accessed by other users" errors. + time.sleep(1) # To avoid "database is being accessed by other users" errors. if self._test_user_create(): if verbosity >= 1: print('Destroying test user...') diff --git a/django/db/backends/oracle/introspection.py b/django/db/backends/oracle/introspection.py index 9e6e29d5e3..43f61faf0a 100644 --- a/django/db/backends/oracle/introspection.py +++ b/django/db/backends/oracle/introspection.py @@ -52,8 +52,8 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name)) description = [] for desc in cursor.description: - name = force_text(desc[0]) # cx_Oracle always returns a 'str' on both Python 2 and 3 - name = name % {} # cx_Oracle, for some reason, doubles percent signs. + name = force_text(desc[0]) # cx_Oracle always returns a 'str' on both Python 2 and 3 + name = name % {} # cx_Oracle, for some reason, doubles percent signs. description.append(FieldInfo(*(name.lower(),) + desc[1:])) return description diff --git a/django/db/backends/postgresql_psycopg2/introspection.py b/django/db/backends/postgresql_psycopg2/introspection.py index 046af9af55..aef0bf08aa 100644 --- a/django/db/backends/postgresql_psycopg2/introspection.py +++ b/django/db/backends/postgresql_psycopg2/introspection.py @@ -16,7 +16,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): 700: 'FloatField', 701: 'FloatField', 869: 'GenericIPAddressField', - 1042: 'CharField', # blank-padded + 1042: 'CharField', # blank-padded 1043: 'CharField', 1082: 'DateField', 1083: 'TimeField', diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py index 723453c9c5..b9496868b0 100644 --- a/django/db/backends/postgresql_psycopg2/operations.py +++ b/django/db/backends/postgresql_psycopg2/operations.py @@ -95,7 +95,7 @@ class DatabaseOperations(BaseDatabaseOperations): def quote_name(self, name): if name.startswith('"') and name.endswith('"'): - return name # Quoting once is enough. + return name # Quoting once is enough. return '"%s"' % name def quote_parameter(self, value): @@ -175,7 +175,7 @@ class DatabaseOperations(BaseDatabaseOperations): style.SQL_KEYWORD('IS NOT'), style.SQL_KEYWORD('FROM'), style.SQL_TABLE(qn(model._meta.db_table)))) - break # Only one AutoField is allowed per model, so don't bother continuing. + break # Only one AutoField is allowed per model, so don't bother continuing. for f in model._meta.many_to_many: if not f.rel.through: output.append("%s setval(pg_get_serial_sequence('%s','%s'), coalesce(max(%s), 1), max(%s) %s null) %s %s;" % diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 5d07f68f73..6c9728889f 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -212,7 +212,7 @@ class DatabaseOperations(BaseDatabaseOperations): def quote_name(self, name): if name.startswith('"') and name.endswith('"'): - return name # Quoting once is enough. + return name # Quoting once is enough. return '"%s"' % name def quote_parameter(self, value): diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index 6ebc572e0c..da8629ace6 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -157,7 +157,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): # Skip indexes across multiple fields if len(info) != 1: continue - name = info[0][2] # seqno, cid, name + name = info[0][2] # seqno, cid, name indexes[name] = {'primary_key': indexes.get(name, {}).get("primary_key", False), 'unique': unique} return indexes diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py index 095cb4efe4..8bed6415c3 100644 --- a/django/db/backends/utils.py +++ b/django/db/backends/utils.py @@ -112,21 +112,21 @@ class CursorDebugWrapper(CursorWrapper): ############################################### def typecast_date(s): - return datetime.date(*map(int, s.split('-'))) if s else None # returns None if s is null + return datetime.date(*map(int, s.split('-'))) if s else None # returns None if s is null -def typecast_time(s): # does NOT store time zone information +def typecast_time(s): # does NOT store time zone information if not s: return None hour, minutes, seconds = s.split(':') - if '.' in seconds: # check whether seconds have a fractional part + if '.' in seconds: # check whether seconds have a fractional part seconds, microseconds = seconds.split('.') else: microseconds = '0' return datetime.time(int(hour), int(minutes), int(seconds), int(float('.' + microseconds) * 1000000)) -def typecast_timestamp(s): # does NOT store time zone information +def typecast_timestamp(s): # does NOT store time zone information # "2005-07-29 15:48:00.590358-05" # "2005-07-29 09:56:00-05" if not s: @@ -147,7 +147,7 @@ def typecast_timestamp(s): # does NOT store time zone information dates = d.split('-') times = t.split(':') seconds = times[2] - if '.' in seconds: # check whether seconds have a fractional part + if '.' in seconds: # check whether seconds have a fractional part seconds, microseconds = seconds.split('.') else: microseconds = '0' diff --git a/django/db/models/__init__.py b/django/db/models/__init__.py index cf219d39aa..13785ed17a 100644 --- a/django/db/models/__init__.py +++ b/django/db/models/__init__.py @@ -11,7 +11,7 @@ from django.db.models.base import Model # NOQA from django.db.models.aggregates import * # NOQA from django.db.models.fields import * # NOQA from django.db.models.fields.subclassing import SubfieldBase # NOQA -from django.db.models.fields.files import FileField, ImageField # NOQA +from django.db.models.fields.files import FileField, ImageField # NOQA from django.db.models.fields.related import ( # NOQA ForeignKey, ForeignObject, OneToOneField, ManyToManyField, ManyToOneRel, ManyToManyRel, OneToOneRel) diff --git a/django/db/models/base.py b/django/db/models/base.py index 73df8633ca..ce3f095055 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -280,7 +280,7 @@ class ModelBase(type): def copy_managers(cls, base_managers): # This is in-place sorting of an Options attribute, but that's fine. base_managers.sort() - for _, mgr_name, manager in base_managers: # NOQA (redefinition of _) + for _, mgr_name, manager in base_managers: # NOQA (redefinition of _) val = getattr(cls, mgr_name, None) if not val or val is manager: new_manager = manager._copy_to_model(cls) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 022de52134..dec2e2dd9e 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -93,7 +93,7 @@ class Field(object): # creates, creation_counter is used for all user-specified fields. creation_counter = 0 auto_creation_counter = -1 - default_validators = [] # Default set of validators + default_validators = [] # Default set of validators default_error_messages = { 'invalid_choice': _('Value %(value)r is not a valid choice.'), 'null': _('This field cannot be null.'), diff --git a/django/db/models/query.py b/django/db/models/query.py index ca49f67712..5bfa68b071 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -1627,16 +1627,16 @@ def prefetch_related_objects(result_cache, related_lookups): from a QuerySet """ if len(result_cache) == 0: - return # nothing to do + return # nothing to do # We need to be able to dynamically add to the list of prefetch_related # lookups that we look up (see below). So we need some book keeping to # ensure we don't do duplicate work. - done_lookups = set() # list of lookups like foo__bar__baz + done_lookups = set() # list of lookups like foo__bar__baz done_queries = {} # dictionary of things like 'foo__bar': [results] - auto_lookups = [] # we add to this as we go through. - followed_descriptors = set() # recursion protection + auto_lookups = [] # we add to this as we go through. + followed_descriptors = set() # recursion protection all_lookups = itertools.chain(related_lookups, auto_lookups) for lookup in all_lookups: diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 46a308f5ce..988b8bc644 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -146,7 +146,7 @@ class Query(object): # The _aggregates will be an OrderedDict when used. Due to the cost # of creating OrderedDict this attribute is created lazily (in # self.aggregates property). - self._aggregates = None # Maps alias -> SQL aggregate function + self._aggregates = None # Maps alias -> SQL aggregate function self.aggregate_select_mask = None self._aggregate_select_cache = None |
