diff options
| author | coagulant <baryshev@gmail.com> | 2013-11-03 01:02:56 +0400 |
|---|---|---|
| committer | Jason Myers <jason@jasonamyers.com> | 2013-11-02 23:50:33 -0500 |
| commit | 8eec2d93b6e93b8a1107fb3de2acd68d6994d6ec (patch) | |
| tree | dee448f4b73c925b10871f4fbe7d601f5feb576b /django | |
| parent | c3791463a5a9674f8e0148fbab57eae23c138896 (diff) | |
Fixed all E261 warnings
Diffstat (limited to 'django')
112 files changed, 427 insertions, 427 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 7a915f1486..5245ff9e25 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -36,7 +36,7 @@ class LazySettings(LazyObject): """ try: settings_module = os.environ[ENVIRONMENT_VARIABLE] - if not settings_module: # If it's set but is an empty string. + if not settings_module: # If it's set but is an empty string. raise KeyError except KeyError: desc = ("setting %s" % name) if name else "settings" diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 377c010b32..19d70eeb3e 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -302,7 +302,7 @@ FILE_UPLOAD_HANDLERS = ( # Maximum size, in bytes, of a request before it will be streamed to the # file system instead of into memory. -FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB +FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB # Directory in which upload streamed files will be temporarily saved. A value of # `None` will make Django use the operating system's default temporary directory @@ -360,11 +360,11 @@ SHORT_DATETIME_FORMAT = 'm/d/Y P' # http://docs.python.org/library/datetime.html#strftime-behavior # * Note that these format strings are different from the ones to display dates DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' - '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' - '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' - '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' - '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006' + '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' + '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' + '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' + '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' + '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006' ) # Default formats to be used when parsing times from input boxes, in order diff --git a/django/conf/locale/bg/formats.py b/django/conf/locale/bg/formats.py index 4472600398..e1a8a820e3 100644 --- a/django/conf/locale/bg/formats.py +++ b/django/conf/locale/bg/formats.py @@ -20,5 +20,5 @@ SHORT_DATE_FORMAT = 'd.m.Y' # TIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS = DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = ' ' # Non-breaking space +THOUSAND_SEPARATOR = ' ' # Non-breaking space # NUMBER_GROUPING = diff --git a/django/conf/locale/ca/formats.py b/django/conf/locale/ca/formats.py index 9ccddbb24d..392eb48c1c 100644 --- a/django/conf/locale/ca/formats.py +++ b/django/conf/locale/ca/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = r'F \d\e\l Y' MONTH_DAY_FORMAT = r'j \d\e F' SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATETIME_FORMAT = 'd/m/Y G:i' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior diff --git a/django/conf/locale/cs/formats.py b/django/conf/locale/cs/formats.py index 42ca212392..fd445fac6a 100644 --- a/django/conf/locale/cs/formats.py +++ b/django/conf/locale/cs/formats.py @@ -12,34 +12,34 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = ( '%d.%m.%Y', '%d.%m.%y', # '05.01.2006', '05.01.06' - '%d. %m. %Y', '%d. %m. %y', # '5. 1. 2006', '5. 1. 06' + '%d. %m. %Y', '%d. %m. %y', # '5. 1. 2006', '5. 1. 06' # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' ) # Kept ISO formats as one is in first position TIME_INPUT_FORMATS = ( - '%H:%M:%S', # '04:30:59' + '%H:%M:%S', # '04:30:59' '%H.%M', # '04.30' '%H:%M', # '04:30' ) DATETIME_INPUT_FORMATS = ( '%d.%m.%Y %H:%M:%S', # '05.01.2006 04:30:59' - '%d.%m.%Y %H:%M:%S.%f', # '05.01.2006 04:30:59.000200' + '%d.%m.%Y %H:%M:%S.%f', # '05.01.2006 04:30:59.000200' '%d.%m.%Y %H.%M', # '05.01.2006 04.30' '%d.%m.%Y %H:%M', # '05.01.2006 04:30' '%d.%m.%Y', # '05.01.2006' '%d. %m. %Y %H:%M:%S', # '05. 01. 2006 04:30:59' - '%d. %m. %Y %H:%M:%S.%f', # '05. 01. 2006 04:30:59.000200' + '%d. %m. %Y %H:%M:%S.%f', # '05. 01. 2006 04:30:59.000200' '%d. %m. %Y %H.%M', # '05. 01. 2006 04.30' '%d. %m. %Y %H:%M', # '05. 01. 2006 04:30' '%d. %m. %Y', # '05. 01. 2006' '%Y-%m-%d %H.%M', # '2006-01-05 04.30' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/de/formats.py b/django/conf/locale/de/formats.py index b3731a3617..b57f6213a5 100644 --- a/django/conf/locale/de/formats.py +++ b/django/conf/locale/de/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior @@ -22,7 +22,7 @@ DATE_INPUT_FORMATS = ( ) DATETIME_INPUT_FORMATS = ( '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' - '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' + '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y', # '25.10.2006' ) diff --git a/django/conf/locale/de_CH/formats.py b/django/conf/locale/de_CH/formats.py index bf8a5ce372..4b1678cffd 100644 --- a/django/conf/locale/de_CH/formats.py +++ b/django/conf/locale/de_CH/formats.py @@ -13,7 +13,7 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior @@ -23,7 +23,7 @@ DATE_INPUT_FORMATS = ( ) DATETIME_INPUT_FORMATS = ( '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' - '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' + '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y', # '25.10.2006' ) @@ -34,5 +34,5 @@ DATETIME_INPUT_FORMATS = ( # For details, please refer to http://www.bk.admin.ch/dokumentation/sprachen/04915/05016/index.html?lang=de # (in German) and the documentation DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/en/formats.py b/django/conf/locale/en/formats.py index 5accf9e3d2..279cd3c518 100644 --- a/django/conf/locale/en/formats.py +++ b/django/conf/locale/en/formats.py @@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'F j' SHORT_DATE_FORMAT = 'm/d/Y' SHORT_DATETIME_FORMAT = 'm/d/Y P' -FIRST_DAY_OF_WEEK = 0 # Sunday +FIRST_DAY_OF_WEEK = 0 # Sunday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' + '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' # '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' # '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' # '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' diff --git a/django/conf/locale/es/formats.py b/django/conf/locale/es/formats.py index 08029a876e..dee0a889f6 100644 --- a/django/conf/locale/es/formats.py +++ b/django/conf/locale/es/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y' MONTH_DAY_FORMAT = r'j \d\e F' SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATETIME_FORMAT = 'd/m/Y H:i' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior diff --git a/django/conf/locale/es_AR/formats.py b/django/conf/locale/es_AR/formats.py index 41c732f7b8..37faa80b8a 100644 --- a/django/conf/locale/es_AR/formats.py +++ b/django/conf/locale/es_AR/formats.py @@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = r'F Y' MONTH_DAY_FORMAT = r'j \d\e F' SHORT_DATE_FORMAT = r'd/m/Y' SHORT_DATETIME_FORMAT = r'd/m/Y H:i' -FIRST_DAY_OF_WEEK = 0 # 0: Sunday, 1: Monday +FIRST_DAY_OF_WEEK = 0 # 0: Sunday, 1: Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = ( - '%d/%m/%Y', # '31/12/2009' - '%d/%m/%y', # '31/12/09' + '%d/%m/%Y', # '31/12/2009' + '%d/%m/%y', # '31/12/09' ) DATETIME_INPUT_FORMATS = ( '%d/%m/%Y %H:%M:%S', diff --git a/django/conf/locale/es_MX/formats.py b/django/conf/locale/es_MX/formats.py index e3ac674ab0..729eee5370 100644 --- a/django/conf/locale/es_MX/formats.py +++ b/django/conf/locale/es_MX/formats.py @@ -24,5 +24,5 @@ DATETIME_INPUT_FORMATS = ( '%d/%m/%y %H:%M', ) DECIMAL_SEPARATOR = '.' # ',' is also official (less common): NOM-008-SCFI-2002 -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/es_NI/formats.py b/django/conf/locale/es_NI/formats.py index 4bdf24e491..2f8d403d85 100644 --- a/django/conf/locale/es_NI/formats.py +++ b/django/conf/locale/es_NI/formats.py @@ -10,7 +10,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y' MONTH_DAY_FORMAT = r'j \d\e F' SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATETIME_FORMAT = 'd/m/Y H:i' -FIRST_DAY_OF_WEEK = 1 # Monday: ISO 8601 +FIRST_DAY_OF_WEEK = 1 # Monday: ISO 8601 DATE_INPUT_FORMATS = ( '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' '%Y%m%d', # '20061025' diff --git a/django/conf/locale/es_PR/formats.py b/django/conf/locale/es_PR/formats.py index 1d4e76c55b..8f5a25ea53 100644 --- a/django/conf/locale/es_PR/formats.py +++ b/django/conf/locale/es_PR/formats.py @@ -10,7 +10,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y' MONTH_DAY_FORMAT = r'j \d\e F' SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATETIME_FORMAT = 'd/m/Y H:i' -FIRST_DAY_OF_WEEK = 0 # Sunday +FIRST_DAY_OF_WEEK = 0 # Sunday DATE_INPUT_FORMATS = ( # '31/12/2009', '31/12/09' diff --git a/django/conf/locale/et/formats.py b/django/conf/locale/et/formats.py index 1de3948a2b..5be8131ed6 100644 --- a/django/conf/locale/et/formats.py +++ b/django/conf/locale/et/formats.py @@ -20,5 +20,5 @@ SHORT_DATE_FORMAT = 'd.m.Y' # TIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS = DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = ' ' # Non-breaking space +THOUSAND_SEPARATOR = ' ' # Non-breaking space # NUMBER_GROUPING = diff --git a/django/conf/locale/fi/formats.py b/django/conf/locale/fi/formats.py index da1f003411..b1900a3b7c 100644 --- a/django/conf/locale/fi/formats.py +++ b/django/conf/locale/fi/formats.py @@ -20,5 +20,5 @@ SHORT_DATE_FORMAT = 'j.n.Y' # TIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS = DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = ' ' # Non-breaking space +THOUSAND_SEPARATOR = ' ' # Non-breaking space # NUMBER_GROUPING = diff --git a/django/conf/locale/fr/formats.py b/django/conf/locale/fr/formats.py index f6c8f40648..7b85807404 100644 --- a/django/conf/locale/fr/formats.py +++ b/django/conf/locale/fr/formats.py @@ -12,25 +12,25 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'j N Y' SHORT_DATETIME_FORMAT = 'j N Y H:i:s' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = ( - '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' - '%d.%m.%Y', '%d.%m.%y', # Swiss (fr_CH), '25.10.2006', '25.10.06' + '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' + '%d.%m.%Y', '%d.%m.%y', # Swiss (fr_CH), '25.10.2006', '25.10.06' # '%d %B %Y', '%d %b %Y', # '25 octobre 2006', '25 oct. 2006' ) DATETIME_INPUT_FORMATS = ( - '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' - '%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200' - '%d/%m/%Y %H:%M', # '25/10/2006 14:30' - '%d/%m/%Y', # '25/10/2006' - '%d.%m.%Y %H:%M:%S', # Swiss (fr_CH), '25.10.2006 14:30:59' - '%d.%m.%Y %H:%M:%S.%f', # Swiss (fr_CH), '25.10.2006 14:30:59.000200' - '%d.%m.%Y %H:%M', # Swiss (fr_CH), '25.10.2006 14:30' - '%d.%m.%Y', # Swiss (fr_CH), '25.10.2006' + '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' + '%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200' + '%d/%m/%Y %H:%M', # '25/10/2006 14:30' + '%d/%m/%Y', # '25/10/2006' + '%d.%m.%Y %H:%M:%S', # Swiss (fr_CH), '25.10.2006 14:30:59' + '%d.%m.%Y %H:%M:%S.%f', # Swiss (fr_CH), '25.10.2006 14:30:59.000200' + '%d.%m.%Y %H:%M', # Swiss (fr_CH), '25.10.2006 14:30' + '%d.%m.%Y', # Swiss (fr_CH), '25.10.2006' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/gl/formats.py b/django/conf/locale/gl/formats.py index de592240f0..0facf691a9 100644 --- a/django/conf/locale/gl/formats.py +++ b/django/conf/locale/gl/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y' MONTH_DAY_FORMAT = r'j \d\e F' SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATETIME_FORMAT = 'd-m-Y, H:i' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior diff --git a/django/conf/locale/hr/formats.py b/django/conf/locale/hr/formats.py index 96a724b2b8..a38457a435 100644 --- a/django/conf/locale/hr/formats.py +++ b/django/conf/locale/hr/formats.py @@ -23,26 +23,26 @@ DATE_INPUT_FORMATS = ( '%d. %m. %Y.', '%d. %m. %y.', # '25. 10. 2006.', '25. 10. 06.' ) DATETIME_INPUT_FORMATS = ( - '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' - '%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200' - '%Y-%m-%d %H:%M', # '2006-10-25 14:30' - '%Y-%m-%d', # '2006-10-25' - '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' - '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' - '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' - '%d.%m.%Y.', # '25.10.2006.' - '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' - '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' - '%d.%m.%y. %H:%M', # '25.10.06. 14:30' - '%d.%m.%y.', # '25.10.06.' - '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' - '%d. %m. %Y. %H:%M:%S.%f',# '25. 10. 2006. 14:30:59.000200' - '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' - '%d. %m. %Y.', # '25. 10. 2006.' - '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' - '%d. %m. %y. %H:%M:%S.%f',# '25. 10. 06. 14:30:59.000200' - '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' - '%d. %m. %y.', # '25. 10. 06.' + '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' + '%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200' + '%Y-%m-%d %H:%M', # '2006-10-25 14:30' + '%Y-%m-%d', # '2006-10-25' + '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' + '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' + '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' + '%d.%m.%Y.', # '25.10.2006.' + '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' + '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' + '%d.%m.%y. %H:%M', # '25.10.06. 14:30' + '%d.%m.%y.', # '25.10.06.' + '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' + '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' + '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' + '%d. %m. %Y.', # '25. 10. 2006.' + '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' + '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' + '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' + '%d. %m. %y.', # '25. 10. 06.' ) DECIMAL_SEPARATOR = ',' diff --git a/django/conf/locale/hu/formats.py b/django/conf/locale/hu/formats.py index 9b6630d775..7e499da4ee 100644 --- a/django/conf/locale/hu/formats.py +++ b/django/conf/locale/hu/formats.py @@ -12,23 +12,23 @@ YEAR_MONTH_FORMAT = 'Y. F' MONTH_DAY_FORMAT = 'F j.' SHORT_DATE_FORMAT = 'Y.m.d.' SHORT_DATETIME_FORMAT = 'Y.m.d. G.i.s' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = ( - '%Y.%m.%d.', # '2006.10.25.' + '%Y.%m.%d.', # '2006.10.25.' ) TIME_INPUT_FORMATS = ( - '%H.%M.%S', # '14.30.59' + '%H.%M.%S', # '14.30.59' '%H.%M', # '14.30' ) DATETIME_INPUT_FORMATS = ( '%Y.%m.%d. %H.%M.%S', # '2006.10.25. 14.30.59' - '%Y.%m.%d. %H.%M.%S.%f', # '2006.10.25. 14.30.59.000200' + '%Y.%m.%d. %H.%M.%S.%f', # '2006.10.25. 14.30.59.000200' '%Y.%m.%d. %H.%M', # '2006.10.25. 14.30' '%Y.%m.%d.', # '2006.10.25.' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = ' ' # Non-breaking space +THOUSAND_SEPARATOR = ' ' # Non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/it/formats.py b/django/conf/locale/it/formats.py index b12e478ccb..368535d293 100644 --- a/django/conf/locale/it/formats.py +++ b/django/conf/locale/it/formats.py @@ -5,14 +5,14 @@ from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date -DATE_FORMAT = 'd F Y' # 25 Ottobre 2006 -TIME_FORMAT = 'H:i:s' # 14:30:59 -DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59 -YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006 -MONTH_DAY_FORMAT = 'j/F' # 10/2006 -SHORT_DATE_FORMAT = 'd/m/Y' # 25/12/2009 -SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s' # 25/10/2009 14:30:59 -FIRST_DAY_OF_WEEK = 1 # Lunedì +DATE_FORMAT = 'd F Y' # 25 Ottobre 2006 +TIME_FORMAT = 'H:i:s' # 14:30:59 +DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59 +YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006 +MONTH_DAY_FORMAT = 'j/F' # 10/2006 +SHORT_DATE_FORMAT = 'd/m/Y' # 25/12/2009 +SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s' # 25/10/2009 14:30:59 +FIRST_DAY_OF_WEEK = 1 # Lunedì # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior diff --git a/django/conf/locale/ka/formats.py b/django/conf/locale/ka/formats.py index bb26bec6be..1d2eb5f9cb 100644 --- a/django/conf/locale/ka/formats.py +++ b/django/conf/locale/ka/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F, Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'j.M.Y' SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s' -FIRST_DAY_OF_WEEK = 1 # (Monday) +FIRST_DAY_OF_WEEK = 1 # (Monday) # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior diff --git a/django/conf/locale/ko/formats.py b/django/conf/locale/ko/formats.py index 28b4d06ca2..29e57f136c 100644 --- a/django/conf/locale/ko/formats.py +++ b/django/conf/locale/ko/formats.py @@ -18,7 +18,7 @@ SHORT_DATETIME_FORMAT = 'Y-n-j H:i' # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' + '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' # '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' # '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' # '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' diff --git a/django/conf/locale/lt/formats.py b/django/conf/locale/lt/formats.py index 1bff4d9861..41dab5f53b 100644 --- a/django/conf/locale/lt/formats.py +++ b/django/conf/locale/lt/formats.py @@ -17,7 +17,7 @@ FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' + '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' ) TIME_INPUT_FORMATS = ( '%H:%M:%S', # '14:30:59' diff --git a/django/conf/locale/lv/formats.py b/django/conf/locale/lv/formats.py index c2c9f9da37..2b281d810f 100644 --- a/django/conf/locale/lv/formats.py +++ b/django/conf/locale/lv/formats.py @@ -18,7 +18,7 @@ FIRST_DAY_OF_WEEK = 1 # Monday # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' + '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' ) TIME_INPUT_FORMATS = ( '%H:%M:%S', # '14:30:59' @@ -45,5 +45,5 @@ DATETIME_INPUT_FORMATS = ( '%d.%m.%y', # '25.10.06' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = ' ' # Non-breaking space +THOUSAND_SEPARATOR = ' ' # Non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/mk/formats.py b/django/conf/locale/mk/formats.py index 2a0df6c43f..fe33070786 100644 --- a/django/conf/locale/mk/formats.py +++ b/django/conf/locale/mk/formats.py @@ -22,22 +22,22 @@ DATE_INPUT_FORMATS = ( ) DATETIME_INPUT_FORMATS = ( - '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' - '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' - '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' - '%d.%m.%Y.', # '25.10.2006.' - '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' - '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' - '%d.%m.%y. %H:%M', # '25.10.06. 14:30' - '%d.%m.%y.', # '25.10.06.' - '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' - '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' - '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' - '%d. %m. %Y.', # '25. 10. 2006.' - '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' - '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' - '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' - '%d. %m. %y.', # '25. 10. 06.' + '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' + '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' + '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' + '%d.%m.%Y.', # '25.10.2006.' + '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' + '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' + '%d.%m.%y. %H:%M', # '25.10.06. 14:30' + '%d.%m.%y.', # '25.10.06.' + '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' + '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' + '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' + '%d. %m. %Y.', # '25. 10. 2006.' + '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' + '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' + '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' + '%d. %m. %y.', # '25. 10. 06.' ) DECIMAL_SEPARATOR = ',' diff --git a/django/conf/locale/ml/formats.py b/django/conf/locale/ml/formats.py index 5accf9e3d2..279cd3c518 100644 --- a/django/conf/locale/ml/formats.py +++ b/django/conf/locale/ml/formats.py @@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'F j' SHORT_DATE_FORMAT = 'm/d/Y' SHORT_DATETIME_FORMAT = 'm/d/Y P' -FIRST_DAY_OF_WEEK = 0 # Sunday +FIRST_DAY_OF_WEEK = 0 # Sunday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' + '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' # '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' # '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' # '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' diff --git a/django/conf/locale/nb/formats.py b/django/conf/locale/nb/formats.py index 8f976d7045..5bf43af0d4 100644 --- a/django/conf/locale/nb/formats.py +++ b/django/conf/locale/nb/formats.py @@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y H:i' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' + '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' # '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006' # '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006' # '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006' @@ -38,5 +38,5 @@ DATETIME_INPUT_FORMATS = ( '%d.%m.%y', # '25.10.06' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/nn/formats.py b/django/conf/locale/nn/formats.py index 528ae30107..ca7d2e294c 100644 --- a/django/conf/locale/nn/formats.py +++ b/django/conf/locale/nn/formats.py @@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y H:i' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' + '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' # '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006' # '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006' # '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006' @@ -39,5 +39,5 @@ DATETIME_INPUT_FORMATS = ( '%d.%m.%y', # '25.10.06' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/pl/formats.py b/django/conf/locale/pl/formats.py index 25cfc793cf..5997839477 100644 --- a/django/conf/locale/pl/formats.py +++ b/django/conf/locale/pl/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j F' SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATETIME_FORMAT = 'd-m-Y H:i:s' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior @@ -22,10 +22,10 @@ DATE_INPUT_FORMATS = ( # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' ) DATETIME_INPUT_FORMATS = ( - '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' - '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' - '%d.%m.%Y %H:%M', # '25.10.2006 14:30' - '%d.%m.%Y', # '25.10.2006' + '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' + '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' + '%d.%m.%Y %H:%M', # '25.10.2006 14:30' + '%d.%m.%Y', # '25.10.2006' ) DECIMAL_SEPARATOR = ',' THOUSAND_SEPARATOR = ' ' diff --git a/django/conf/locale/pt/formats.py b/django/conf/locale/pt/formats.py index 9452428dd9..6141176760 100644 --- a/django/conf/locale/pt/formats.py +++ b/django/conf/locale/pt/formats.py @@ -18,7 +18,7 @@ FIRST_DAY_OF_WEEK = 0 # Sunday # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # Kept ISO formats as they are in first position DATE_INPUT_FORMATS = ( - '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06' + '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06' # '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006' # '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006' ) diff --git a/django/conf/locale/pt_BR/formats.py b/django/conf/locale/pt_BR/formats.py index a5ec333d50..6057a21056 100644 --- a/django/conf/locale/pt_BR/formats.py +++ b/django/conf/locale/pt_BR/formats.py @@ -17,7 +17,7 @@ FIRST_DAY_OF_WEEK = 0 # Sunday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior DATE_INPUT_FORMATS = ( - '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' + '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' # '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006' # '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006' ) diff --git a/django/conf/locale/ru/formats.py b/django/conf/locale/ru/formats.py index 413ce2788b..2cc5001c6a 100644 --- a/django/conf/locale/ru/formats.py +++ b/django/conf/locale/ru/formats.py @@ -21,15 +21,15 @@ DATE_INPUT_FORMATS = ( '%d.%m.%y', # '25.10.06' ) DATETIME_INPUT_FORMATS = ( - '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' - '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' - '%d.%m.%Y %H:%M', # '25.10.2006 14:30' - '%d.%m.%Y', # '25.10.2006' - '%d.%m.%y %H:%M:%S', # '25.10.06 14:30:59' - '%d.%m.%y %H:%M:%S.%f', # '25.10.06 14:30:59.000200' - '%d.%m.%y %H:%M', # '25.10.06 14:30' - '%d.%m.%y', # '25.10.06' + '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' + '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' + '%d.%m.%Y %H:%M', # '25.10.2006 14:30' + '%d.%m.%Y', # '25.10.2006' + '%d.%m.%y %H:%M:%S', # '25.10.06 14:30:59' + '%d.%m.%y %H:%M:%S.%f', # '25.10.06 14:30:59.000200' + '%d.%m.%y %H:%M', # '25.10.06 14:30' + '%d.%m.%y', # '25.10.06' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/sk/formats.py b/django/conf/locale/sk/formats.py index 6ff8ca791b..dfbd1a681f 100644 --- a/django/conf/locale/sk/formats.py +++ b/django/conf/locale/sk/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s' -FIRST_DAY_OF_WEEK = 1 # Monday +FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior @@ -22,11 +22,11 @@ DATE_INPUT_FORMATS = ( # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' ) DATETIME_INPUT_FORMATS = ( - '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' - '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' - '%d.%m.%Y %H:%M', # '25.10.2006 14:30' - '%d.%m.%Y', # '25.10.2006' + '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' + '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' + '%d.%m.%Y %H:%M', # '25.10.2006 14:30' + '%d.%m.%Y', # '25.10.2006' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/sr/formats.py b/django/conf/locale/sr/formats.py index 8e9e9a487e..86d63e42f1 100644 --- a/django/conf/locale/sr/formats.py +++ b/django/conf/locale/sr/formats.py @@ -24,22 +24,22 @@ DATE_INPUT_FORMATS = ( # '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.' ) DATETIME_INPUT_FORMATS = ( - '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' - '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' - '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' - '%d.%m.%Y.', # '25.10.2006.' - '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' - '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' - '%d.%m.%y. %H:%M', # '25.10.06. 14:30' - '%d.%m.%y.', # '25.10.06.' - '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' - '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' - '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' - '%d. %m. %Y.', # '25. 10. 2006.' - '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' - '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' - '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' - '%d. %m. %y.', # '25. 10. 06.' + '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' + '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' + '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' + '%d.%m.%Y.', # '25.10.2006.' + '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' + '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' + '%d.%m.%y. %H:%M', # '25.10.06. 14:30' + '%d.%m.%y.', # '25.10.06.' + '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' + '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' + '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' + '%d. %m. %Y.', # '25. 10. 2006.' + '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' + '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' + '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' + '%d. %m. %y.', # '25. 10. 06.' ) DECIMAL_SEPARATOR = ',' THOUSAND_SEPARATOR = '.' diff --git a/django/conf/locale/sr_Latn/formats.py b/django/conf/locale/sr_Latn/formats.py index 8e9e9a487e..86d63e42f1 100644 --- a/django/conf/locale/sr_Latn/formats.py +++ b/django/conf/locale/sr_Latn/formats.py @@ -24,22 +24,22 @@ DATE_INPUT_FORMATS = ( # '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.' ) DATETIME_INPUT_FORMATS = ( - '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' - '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' - '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' - '%d.%m.%Y.', # '25.10.2006.' - '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' - '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' - '%d.%m.%y. %H:%M', # '25.10.06. 14:30' - '%d.%m.%y.', # '25.10.06.' - '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' - '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' - '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' - '%d. %m. %Y.', # '25. 10. 2006.' - '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' - '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' - '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' - '%d. %m. %y.', # '25. 10. 06.' + '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' + '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' + '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' + '%d.%m.%Y.', # '25.10.2006.' + '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' + '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' + '%d.%m.%y. %H:%M', # '25.10.06. 14:30' + '%d.%m.%y.', # '25.10.06.' + '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' + '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' + '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' + '%d. %m. %Y.', # '25. 10. 2006.' + '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' + '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' + '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' + '%d. %m. %y.', # '25. 10. 06.' ) DECIMAL_SEPARATOR = ',' THOUSAND_SEPARATOR = '.' diff --git a/django/conf/locale/sv/formats.py b/django/conf/locale/sv/formats.py index 8874da7519..7673d472a1 100644 --- a/django/conf/locale/sv/formats.py +++ b/django/conf/locale/sv/formats.py @@ -37,5 +37,5 @@ DATETIME_INPUT_FORMATS = ( '%m/%d/%y', # '10/25/06' ) DECIMAL_SEPARATOR = ',' -THOUSAND_SEPARATOR = '\xa0' # non-breaking space +THOUSAND_SEPARATOR = '\xa0' # non-breaking space NUMBER_GROUPING = 3 diff --git a/django/conf/locale/tr/formats.py b/django/conf/locale/tr/formats.py index 395fca9114..175def1956 100644 --- a/django/conf/locale/tr/formats.py +++ b/django/conf/locale/tr/formats.py @@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'd F' SHORT_DATE_FORMAT = 'd M Y' SHORT_DATETIME_FORMAT = 'd M Y H:i:s' -FIRST_DAY_OF_WEEK = 1 # Pazartesi +FIRST_DAY_OF_WEEK = 1 # Pazartesi # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior @@ -22,10 +22,10 @@ DATE_INPUT_FORMATS = ( # '%d %B %Y', '%d %b. %Y', # '25 Ekim 2006', '25 Eki. 2006' ) DATETIME_INPUT_FORMATS = ( - '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' - '%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200' - '%d/%m/%Y %H:%M', # '25/10/2006 14:30' - '%d/%m/%Y', # '25/10/2006' + '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' + '%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200' + '%d/%m/%Y %H:%M', # '25/10/2006 14:30' + '%d/%m/%Y', # '25/10/2006' ) DECIMAL_SEPARATOR = ',' THOUSAND_SEPARATOR = '.' diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index ee38fdf1d5..012a14ef64 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -83,7 +83,7 @@ class Fieldset(object): class Fieldline(object): def __init__(self, form, field, readonly_fields=None, model_admin=None): - self.form = form # A django.forms.Form instance + self.form = form # A django.forms.Form instance if not hasattr(field, "__iter__") or isinstance(field, six.text_type): self.fields = [field] else: @@ -110,8 +110,8 @@ class Fieldline(object): class AdminField(object): def __init__(self, form, field, is_first): - self.field = form[field] # A django.forms.BoundField instance - self.is_first = is_first # Whether this field is first on the line + self.field = form[field] # A django.forms.BoundField instance + self.is_first = is_first # Whether this field is first on the line self.is_checkbox = isinstance(self.field.field.widget, forms.CheckboxInput) def label_tag(self): diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index e3514dd82a..6ab842dd61 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1033,7 +1033,7 @@ class ModelAdmin(BaseModelAdmin): attr = obj._meta.pk.attname value = obj.serializable_value(attr) return SimpleTemplateResponse('admin/popup_response.html', { - 'pk_value': escape(pk_value), # for possible backwards-compatibility + 'pk_value': escape(pk_value), # for possible backwards-compatibility 'value': escape(value), 'obj': escapejs(obj) }) diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 0b48cb0851..e75f1a2a60 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -136,13 +136,13 @@ def result_headers(cl): new_order_type = {'asc': 'desc', 'desc': 'asc'}[order_type] # build new ordering param - o_list_primary = [] # URL for making this field the primary sort - o_list_remove = [] # URL for removing this field from sort - o_list_toggle = [] # URL for toggling order type for this field + o_list_primary = [] # URL for making this field the primary sort + o_list_remove = [] # URL for removing this field from sort + o_list_toggle = [] # URL for toggling order type for this field make_qs_param = lambda t, n: ('-' if t == 'desc' else '') + str(n) for j, ot in ordering_field_columns.items(): - if j == i: # Same column + if j == i: # Same column param = make_qs_param(new_order_type, j) # We want clicking on this header to bring the ordering to the # front diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py index 7665176228..c4ce53fec0 100644 --- a/django/contrib/admin/templatetags/admin_modify.py +++ b/django/contrib/admin/templatetags/admin_modify.py @@ -49,7 +49,7 @@ def submit_row(context): @register.filter def cell_count(inline_admin_form): """Returns the number of cells used in a tabular inline""" - count = 1 # Hidden cell with hidden 'id' field + count = 1 # Hidden cell with hidden 'id' field for fieldset in inline_admin_form: # Loop through all the fields (one per cell) for line in fieldset: diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py index 2242f7de58..ed3668907a 100644 --- a/django/contrib/admin/utils.py +++ b/django/contrib/admin/utils.py @@ -154,7 +154,7 @@ def get_deleted_objects(objs, opts, user, admin_site, using): class NestedObjects(Collector): def __init__(self, *args, **kwargs): super(NestedObjects, self).__init__(*args, **kwargs) - self.edges = {} # {from_instance: [to_instances]} + self.edges = {} # {from_instance: [to_instances]} self.protected = set() def add_edge(self, source, target): @@ -391,7 +391,7 @@ class NotRelationField(Exception): def get_model_from_relation(field): if isinstance(field, models.related.RelatedObject): return field.model - elif getattr(field, 'rel'): # or isinstance? + elif getattr(field, 'rel'): # or isinstance? return field.rel.to else: raise NotRelationField @@ -412,7 +412,7 @@ def reverse_field_path(model, path): for piece in pieces: field, model, direct, m2m = parent._meta.get_field_by_name(piece) # skip trailing data field if extant: - if len(reversed_path) == len(pieces)-1: # final iteration + if len(reversed_path) == len(pieces)-1: # final iteration try: get_model_from_relation(field) except NotRelationField: @@ -469,8 +469,8 @@ def get_limit_choices_to_from_path(model, path): fields and hasattr(fields[-1], 'rel') and getattr(fields[-1].rel, 'limit_choices_to', None)) if not limit_choices_to: - return models.Q() # empty Q + return models.Q() # empty Q elif isinstance(limit_choices_to, models.Q): - return limit_choices_to # already a Q + return limit_choices_to # already a Q else: - return models.Q(**limit_choices_to) # convert dict to Q + return models.Q(**limit_choices_to) # convert dict to Q diff --git a/django/contrib/admin/validation.py b/django/contrib/admin/validation.py index 12b3bdb211..b2cb0b4181 100644 --- a/django/contrib/admin/validation.py +++ b/django/contrib/admin/validation.py @@ -70,7 +70,7 @@ class BaseValidator(object): def validate_fields(self, cls, model): " Validate that fields only refer to existing fields, doesn't contain duplicates. " # fields - if cls.fields: # default value is None + if cls.fields: # default value is None check_isseq(cls, 'fields', cls.fields) self.check_field_spec(cls, model, cls.fields, 'fields') if cls.fieldsets: @@ -81,7 +81,7 @@ class BaseValidator(object): def validate_fieldsets(self, cls, model): " Validate that fieldsets is properly formatted and doesn't contain duplicates. " from django.contrib.admin.options import flatten_fieldsets - if cls.fieldsets: # default value is None + if cls.fieldsets: # default value is None check_isseq(cls, 'fieldsets', cls.fieldsets) for idx, fieldset in enumerate(cls.fieldsets): check_isseq(cls, 'fieldsets[%d]' % idx, fieldset) @@ -100,7 +100,7 @@ class BaseValidator(object): def validate_exclude(self, cls, model): " Validate that exclude is a sequence without duplicates. " - if cls.exclude: # default value is None + if cls.exclude: # default value is None check_isseq(cls, 'exclude', cls.exclude) if len(cls.exclude) > len(set(cls.exclude)): raise ImproperlyConfigured('There are duplicate field(s) in %s.exclude' % cls.__name__) @@ -384,7 +384,7 @@ class ModelAdminValidator(BaseValidator): class InlineValidator(BaseValidator): def validate_fk_name(self, cls, model): " Validate that fk_name refers to a ForeignKey. " - if cls.fk_name: # default value is None + if cls.fk_name: # default value is None f = get_field(cls, model, 'fk_name', cls.fk_name) if not isinstance(f, models.ForeignKey): raise ImproperlyConfigured("'%s.fk_name is not an instance of " diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 04977eeef8..a0ffef90f4 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -130,7 +130,7 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): """ if not params: params = self.params - lookup_params = params.copy() # a dictionary of the query string + lookup_params = params.copy() # a dictionary of the query string # Remove all the parameters that are globally and systematically # ignored. for ignored in IGNORED_PARAMS: @@ -299,10 +299,10 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): field_name = self.list_display[int(idx)] order_field = self.get_ordering_field(field_name) if not order_field: - continue # No 'admin_order_field', skip it + continue # No 'admin_order_field', skip it ordering.append(pfx + order_field) except (IndexError, ValueError): - continue # Invalid ordering specified, skip it. + continue # Invalid ordering specified, skip it. # Add the given query's ordering fields, if any. ordering.extend(queryset.query.order_by) @@ -347,7 +347,7 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): try: idx = int(idx) except ValueError: - continue # skip it + continue # skip it ordering_fields[idx] = 'desc' if pfx == '-' else 'asc' return ordering_fields diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index 0066f86b52..a17f875f40 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -164,7 +164,7 @@ class ForeignKeyRawIdWidget(forms.TextInput): else: url = '' if "class" not in attrs: - attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook. + attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook. # TODO: "lookup_id_" is hard-coded here. This should instead use # the correct API to determine the ID dynamically. extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py index 10d3f7d4a5..26af7f0d3f 100644 --- a/django/contrib/contenttypes/generic.py +++ b/django/contrib/contenttypes/generic.py @@ -461,7 +461,7 @@ def generic_inlineformset_factory(model, form=ModelForm, ct_field = opts.get_field(ct_field) if not isinstance(ct_field, models.ForeignKey) or ct_field.rel.to != ContentType: raise Exception("fk_name '%s' is not a ForeignKey to ContentType" % ct_field) - fk_field = opts.get_field(fk_field) # let the exception propagate + fk_field = opts.get_field(fk_field) # let the exception propagate if exclude is not None: exclude = list(exclude) exclude.extend([ct_field.name, fk_field.name]) diff --git a/django/contrib/flatpages/middleware.py b/django/contrib/flatpages/middleware.py index 2f494064f3..9fe595d0cf 100644 --- a/django/contrib/flatpages/middleware.py +++ b/django/contrib/flatpages/middleware.py @@ -6,7 +6,7 @@ from django.conf import settings class FlatpageFallbackMiddleware(object): def process_response(self, request, response): if response.status_code != 404: - return response # No need to check for a flatpage for non-404 responses. + return response # No need to check for a flatpage for non-404 responses. try: return flatpage(request, request.path_info) # Return the original response if any errors happened. Because this diff --git a/django/contrib/formtools/preview.py b/django/contrib/formtools/preview.py index e7de911a8d..02e6f27547 100644 --- a/django/contrib/formtools/preview.py +++ b/django/contrib/formtools/preview.py @@ -8,7 +8,7 @@ from django.template.context import RequestContext from django.utils.crypto import constant_time_compare from django.contrib.formtools.utils import form_hmac -AUTO_ID = 'formtools_%s' # Each form here uses this as its auto_id parameter. +AUTO_ID = 'formtools_%s' # Each form here uses this as its auto_id parameter. class FormPreview(object): @@ -42,7 +42,7 @@ class FormPreview(object): try: self.form.base_fields[name] except KeyError: - break # This field name isn't being used by the form. + break # This field name isn't being used by the form. name += '_' return name @@ -75,7 +75,7 @@ class FormPreview(object): if f.is_valid(): if not self._check_security_hash(request.POST.get(self.unused_name('hash'), ''), request, f): - return self.failed_hash(request) # Security hash failed. + return self.failed_hash(request) # Security hash failed. return self.done(request, f.cleaned_data) else: return render_to_response(self.form_template, diff --git a/django/contrib/gis/db/backends/mysql/operations.py b/django/contrib/gis/db/backends/mysql/operations.py index 26cec743a9..81aa1e2fb6 100644 --- a/django/contrib/gis/db/backends/mysql/operations.py +++ b/django/contrib/gis/db/backends/mysql/operations.py @@ -14,11 +14,11 @@ class MySQLOperations(DatabaseOperations, BaseSpatialOperations): from_text = 'GeomFromText' Adapter = WKTAdapter - Adaptor = Adapter # Backwards-compatibility alias. + Adaptor = Adapter # Backwards-compatibility alias. geometry_functions = { - 'bbcontains': 'MBRContains', # For consistency w/PostGIS API - 'bboverlaps': 'MBROverlaps', # .. .. + 'bbcontains': 'MBRContains', # For consistency w/PostGIS API + 'bboverlaps': 'MBROverlaps', # .. .. 'contained': 'MBRWithin', # .. .. 'contains': 'MBRContains', 'disjoint': 'MBRDisjoint', diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index 14df0ff1d3..8212938f01 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -86,7 +86,7 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations): valid_aggregates = {'Union', 'Extent'} Adapter = OracleSpatialAdapter - Adaptor = Adapter # Backwards-compatibility alias. + Adaptor = Adapter # Backwards-compatibility alias. area = 'SDO_GEOM.SDO_AREA' gml = 'SDO_UTIL.TO_GMLGEOMETRY' @@ -126,12 +126,12 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations): 'coveredby': SDOOperation('SDO_COVEREDBY'), 'covers': SDOOperation('SDO_COVERS'), 'disjoint': SDOGeomRelate('DISJOINT'), - 'intersects': SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()? + 'intersects': SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()? 'equals': SDOOperation('SDO_EQUAL'), 'exact': SDOOperation('SDO_EQUAL'), 'overlaps': SDOOperation('SDO_OVERLAPS'), 'same_as': SDOOperation('SDO_EQUAL'), - 'relate': (SDORelate, six.string_types), # Oracle uses a different syntax, e.g., 'mask=inside+touch' + 'relate': (SDORelate, six.string_types), # Oracle uses a different syntax, e.g., 'mask=inside+touch' 'touches': SDOOperation('SDO_TOUCH'), 'within': SDOOperation('SDO_INSIDE'), } diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index eae08479df..1a71be681c 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -79,7 +79,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations): valid_aggregates = {'Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'} Adapter = PostGISAdapter - Adaptor = Adapter # Backwards-compatibility alias. + Adaptor = Adapter # Backwards-compatibility alias. def __init__(self, connection): super(PostGISOperations, self).__init__(connection) diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py index 827c5217a5..5149b541a2 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -68,7 +68,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): valid_aggregates = {'Extent', 'Union'} Adapter = SpatiaLiteAdapter - Adaptor = Adapter # Backwards-compatibility alias. + Adaptor = Adapter # Backwards-compatibility alias. area = 'Area' centroid = 'Centroid' @@ -77,7 +77,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): distance = 'Distance' envelope = 'Envelope' intersection = 'Intersection' - length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword + length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword num_geom = 'NumGeometries' num_points = 'NumPoints' point_on_surface = 'PointOnSurface' @@ -86,7 +86,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): sym_difference = 'SymDifference' transform = 'Transform' translate = 'ShiftCoords' - union = 'GUnion' # OpenGis defines Union, but this conflicts with an SQLite reserved keyword + union = 'GUnion' # OpenGis defines Union, but this conflicts with an SQLite reserved keyword unionagg = 'GUnion' from_text = 'GeomFromText' diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py index 662b20ae79..6dc2ee23b9 100644 --- a/django/contrib/gis/db/models/fields.py +++ b/django/contrib/gis/db/models/fields.py @@ -188,7 +188,7 @@ class GeometryField(Field): the SRID set for the field. For example, if the input geometry has no SRID, then that of the field will be returned. """ - gsrid = geom.srid # SRID of given geometry. + gsrid = geom.srid # SRID of given geometry. if gsrid is None or self.srid == -1 or (gsrid == -1 and self.srid != -1): return self.srid else: diff --git a/django/contrib/gis/db/models/query.py b/django/contrib/gis/db/models/query.py index 5f1d4623ab..cdff5396cc 100644 --- a/django/contrib/gis/db/models/query.py +++ b/django/contrib/gis/db/models/query.py @@ -50,7 +50,7 @@ class GeoQuerySet(QuerySet): if backend.oracle: s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s' s['procedure_args']['tolerance'] = tolerance - s['select_field'] = AreaField('sq_m') # Oracle returns area in units of meters. + s['select_field'] = AreaField('sq_m') # Oracle returns area in units of meters. elif backend.postgis or backend.spatialite: if backend.geography: # Geography fields support area calculation, returns square meters. @@ -420,7 +420,7 @@ class GeoQuerySet(QuerySet): custom_sel = '%s(%s, %s)' % (connections[self.db].ops.transform, geo_col, srid) # TODO: Should we have this as an alias? # custom_sel = '(%s(%s, %s)) AS %s' % (SpatialBackend.transform, geo_col, srid, qn(geo_field.name)) - self.query.transformed_srid = srid # So other GeoQuerySet methods + self.query.transformed_srid = srid # So other GeoQuerySet methods self.query.custom_select[geo_field] = custom_sel return self._clone() diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index a331053eeb..753baff9ac 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -339,9 +339,9 @@ class OGRGeometry(GDALBase): def wkb(self): "Returns the WKB representation of the Geometry." if sys.byteorder == 'little': - byteorder = 1 # wkbNDR (from ogr_core.h) + byteorder = 1 # wkbNDR (from ogr_core.h) else: - byteorder = 0 # wkbXDR + byteorder = 0 # wkbXDR sz = self.wkb_size # Creating the unsigned character buffer, and passing it in by reference. buf = (c_ubyte * sz)() @@ -635,7 +635,7 @@ class Polygon(OGRGeometry): @property def shell(self): "Returns the shell of this Polygon." - return self[0] # First ring is the shell + return self[0] # First ring is the shell exterior_ring = shell @property diff --git a/django/contrib/gis/gdal/prototypes/ds.py b/django/contrib/gis/gdal/prototypes/ds.py index 11d3b2452f..374a0f424e 100644 --- a/django/contrib/gis/gdal/prototypes/ds.py +++ b/django/contrib/gis/gdal/prototypes/ds.py @@ -9,7 +9,7 @@ from django.contrib.gis.gdal.libgdal import lgdal from django.contrib.gis.gdal.prototypes.generation import (const_string_output, double_output, geom_output, int_output, srs_output, void_output, voidptr_output) -c_int_p = POINTER(c_int) # shortcut type +c_int_p = POINTER(c_int) # shortcut type ### Driver Routines ### register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False) diff --git a/django/contrib/gis/gdal/prototypes/geom.py b/django/contrib/gis/gdal/prototypes/geom.py index f5dc7e10e9..4e4fb633c7 100644 --- a/django/contrib/gis/gdal/prototypes/geom.py +++ b/django/contrib/gis/gdal/prototypes/geom.py @@ -59,7 +59,7 @@ import_wkt = void_output(lgdal.OGR_G_ImportFromWkt, [c_void_p, POINTER(c_char_p) destroy_geom = void_output(lgdal.OGR_G_DestroyGeometry, [c_void_p], errcheck=False) # Geometry export routines. -to_wkb = void_output(lgdal.OGR_G_ExportToWkb, None, errcheck=True) # special handling for WKB. +to_wkb = void_output(lgdal.OGR_G_ExportToWkb, None, errcheck=True) # special handling for WKB. to_wkt = string_output(lgdal.OGR_G_ExportToWkt, [c_void_p, POINTER(c_char_p)], decoding='ascii') to_gml = string_output(lgdal.OGR_G_ExportToGML, [c_void_p], str_result=True, decoding='ascii') get_wkbsize = int_output(lgdal.OGR_G_WkbSize, [c_void_p]) diff --git a/django/contrib/gis/gdal/tests/test_ds.py b/django/contrib/gis/gdal/tests/test_ds.py index a2c0e9e133..5cfdb4a8ea 100644 --- a/django/contrib/gis/gdal/tests/test_ds.py +++ b/django/contrib/gis/gdal/tests/test_ds.py @@ -13,19 +13,19 @@ if HAS_GDAL: ds_list = ( TestDS('test_point', nfeat=5, nfld=3, geom='POINT', gtype=1, driver='ESRI Shapefile', fields={'dbl': OFTReal, 'int': OFTInteger, 'str': OFTString}, - extent=(-1.35011, 0.166623, -0.524093, 0.824508), # Got extent from QGIS + extent=(-1.35011, 0.166623, -0.524093, 0.824508), # Got extent from QGIS srs_wkt='GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]', field_values={'dbl': [float(i) for i in range(1, 6)], 'int': list(range(1, 6)), 'str': [str(i) for i in range(1, 6)]}, fids=range(5)), TestDS('test_vrt', ext='vrt', nfeat=3, nfld=3, geom='POINT', gtype='Point25D', driver='VRT', - fields={'POINT_X': OFTString, 'POINT_Y': OFTString, 'NUM': OFTString}, # VRT uses CSV, which all types are OFTString. - extent=(1.0, 2.0, 100.0, 523.5), # Min/Max from CSV + fields={'POINT_X': OFTString, 'POINT_Y': OFTString, 'NUM': OFTString}, # VRT uses CSV, which all types are OFTString. + extent=(1.0, 2.0, 100.0, 523.5), # Min/Max from CSV field_values={'POINT_X': ['1.0', '5.0', '100.0'], 'POINT_Y': ['2.0', '23.0', '523.5'], 'NUM': ['5', '17', '23']}, fids=range(1, 4)), TestDS('test_poly', nfeat=3, nfld=3, geom='POLYGON', gtype=3, driver='ESRI Shapefile', fields={'float': OFTReal, 'int': OFTInteger, 'str': OFTString}, - extent=(-1.01513, -0.558245, 0.161876, 0.839637), # Got extent from QGIS + extent=(-1.01513, -0.558245, 0.161876, 0.839637), # Got extent from QGIS srs_wkt='GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]'), ) diff --git a/django/contrib/gis/gdal/tests/test_envelope.py b/django/contrib/gis/gdal/tests/test_envelope.py index 4644fbc533..555ca69531 100644 --- a/django/contrib/gis/gdal/tests/test_envelope.py +++ b/django/contrib/gis/gdal/tests/test_envelope.py @@ -23,7 +23,7 @@ class EnvelopeTest(unittest.TestCase): "Testing Envelope initilization." e1 = Envelope((0, 0, 5, 5)) Envelope(0, 0, 5, 5) - Envelope(0, '0', '5', 5) # Thanks to ww for this + Envelope(0, '0', '5', 5) # Thanks to ww for this Envelope(e1._envelope) self.assertRaises(OGRException, Envelope, (5, 5, 0, 0)) self.assertRaises(OGRException, Envelope, 5, 5, 0, 0) diff --git a/django/contrib/gis/gdal/tests/test_geom.py b/django/contrib/gis/gdal/tests/test_geom.py index 65d78a1735..ed6bb2ad9c 100644 --- a/django/contrib/gis/gdal/tests/test_geom.py +++ b/django/contrib/gis/gdal/tests/test_geom.py @@ -130,7 +130,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): OGRGeometry('POINT(0 0)') for p in self.geometries.points: - if not hasattr(p, 'z'): # No 3D + if not hasattr(p, 'z'): # No 3D pnt = OGRGeometry(p.wkt) self.assertEqual(1, pnt.geom_type) self.assertEqual('POINT', pnt.geom_name) @@ -141,15 +141,15 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): def test03_multipoints(self): "Testing MultiPoint objects." for mp in self.geometries.multipoints: - mgeom1 = OGRGeometry(mp.wkt) # First one from WKT + mgeom1 = OGRGeometry(mp.wkt) # First one from WKT self.assertEqual(4, mgeom1.geom_type) self.assertEqual('MULTIPOINT', mgeom1.geom_name) - mgeom2 = OGRGeometry('MULTIPOINT') # Creating empty multipoint + mgeom2 = OGRGeometry('MULTIPOINT') # Creating empty multipoint mgeom3 = OGRGeometry('MULTIPOINT') for g in mgeom1: - mgeom2.add(g) # adding each point from the multipoints - mgeom3.add(g.wkt) # should take WKT as well - self.assertEqual(mgeom1, mgeom2) # they should equal + mgeom2.add(g) # adding each point from the multipoints + mgeom3.add(g.wkt) # should take WKT as well + self.assertEqual(mgeom1, mgeom2) # they should equal self.assertEqual(mgeom1, mgeom3) self.assertEqual(mp.coords, mgeom2.coords) self.assertEqual(mp.n_p, mgeom2.point_count) @@ -247,7 +247,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): poly.centroid poly.close_rings() - self.assertEqual(10, poly.point_count) # Two closing points should've been added + self.assertEqual(10, poly.point_count) # Two closing points should've been added self.assertEqual(OGRGeometry('POINT(2.5 2.5)'), poly.centroid) def test08_multipolygons(self): @@ -309,7 +309,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): # Changing each ring in the polygon self.assertEqual(32140, ring.srs.srid) self.assertEqual('NAD83 / Texas South Central', ring.srs.name) - ring.srs = str(SpatialReference(4326)) # back to WGS84 + ring.srs = str(SpatialReference(4326)) # back to WGS84 self.assertEqual(4326, ring.srs.srid) # Using the `srid` property. @@ -361,8 +361,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): d1 = OGRGeometry(self.geometries.diff_geoms[i].wkt) d2 = a.difference(b) self.assertEqual(d1, d2) - self.assertEqual(d1, a - b) # __sub__ is difference operator - a -= b # testing __isub__ + self.assertEqual(d1, a - b) # __sub__ is difference operator + a -= b # testing __isub__ self.assertEqual(d1, a) def test11_intersection(self): @@ -374,8 +374,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): self.assertTrue(a.intersects(b)) i2 = a.intersection(b) self.assertEqual(i1, i2) - self.assertEqual(i1, a & b) # __and__ is intersection operator - a &= b # testing __iand__ + self.assertEqual(i1, a & b) # __and__ is intersection operator + a &= b # testing __iand__ self.assertEqual(i1, a) def test12_symdifference(self): @@ -386,8 +386,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): d1 = OGRGeometry(self.geometries.sdiff_geoms[i].wkt) d2 = a.sym_difference(b) self.assertEqual(d1, d2) - self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator - a ^= b # testing __ixor__ + self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator + a ^= b # testing __ixor__ self.assertEqual(d1, a) def test13_union(self): @@ -398,8 +398,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): u1 = OGRGeometry(self.geometries.union_geoms[i].wkt) u2 = a.union(b) self.assertEqual(u1, u2) - self.assertEqual(u1, a | b) # __or__ is union operator - a |= b # testing __ior__ + self.assertEqual(u1, a | b) # __or__ is union operator + a |= b # testing __ior__ self.assertEqual(u1, a) def test14_add(self): @@ -418,9 +418,9 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): mp3 = OGRGeometry('MultiPolygon') for poly in mpoly: - mp1.add(poly) # Adding a geometry at a time - mp2.add(poly.wkt) # Adding WKT - mp3.add(mpoly) # Adding a MultiPolygon's entire contents at once. + mp1.add(poly) # Adding a geometry at a time + mp2.add(poly.wkt) # Adding WKT + mp3.add(mpoly) # Adding a MultiPolygon's entire contents at once. for tmp in (mp1, mp2, mp3): self.assertEqual(mpoly, tmp) diff --git a/django/contrib/gis/gdal/tests/test_srs.py b/django/contrib/gis/gdal/tests/test_srs.py index 39cccf8440..372232755d 100644 --- a/django/contrib/gis/gdal/tests/test_srs.py +++ b/django/contrib/gis/gdal/tests/test_srs.py @@ -127,8 +127,8 @@ class SpatialRefTest(unittest.TestCase): for s in srlist: srs = SpatialReference(s.wkt) for tup in s.attr: - att = tup[0] # Attribute to test - exp = tup[1] # Expected result + att = tup[0] # Attribute to test + exp = tup[1] # Expected result self.assertEqual(exp, srs[att]) def test11_wellknown(self): diff --git a/django/contrib/gis/geoip/tests.py b/django/contrib/gis/geoip/tests.py index 4e7a990d50..f771608e1d 100644 --- a/django/contrib/gis/geoip/tests.py +++ b/django/contrib/gis/geoip/tests.py @@ -30,10 +30,10 @@ class GeoIPTest(unittest.TestCase): def test01_init(self): "Testing GeoIP initialization." - g1 = GeoIP() # Everything inferred from GeoIP path + g1 = GeoIP() # Everything inferred from GeoIP path path = settings.GEOIP_PATH - g2 = GeoIP(path, 0) # Passing in data path explicitly. - g3 = GeoIP.open(path, 0) # MaxMind Python API syntax. + g2 = GeoIP(path, 0) # Passing in data path explicitly. + g3 = GeoIP.open(path, 0) # MaxMind Python API syntax. for g in (g1, g2, g3): self.assertEqual(True, bool(g._country)) diff --git a/django/contrib/gis/geos/linestring.py b/django/contrib/gis/geos/linestring.py index 7a03712600..72f766310e 100644 --- a/django/contrib/gis/geos/linestring.py +++ b/django/contrib/gis/geos/linestring.py @@ -47,7 +47,7 @@ class LineString(GEOSGeometry): raise TypeError('Dimension mismatch.') numpy_coords = False elif numpy and isinstance(coords, numpy.ndarray): - shape = coords.shape # Using numpy's shape. + shape = coords.shape # Using numpy's shape. if len(shape) != 2: raise TypeError('Too many dimensions.') self._checkdim(shape[1]) @@ -91,8 +91,8 @@ class LineString(GEOSGeometry): _get_single_internal = _get_single_external def _set_list(self, length, items): - ndim = self._cs.dims # - hasz = self._cs.hasz # I don't understand why these are different + ndim = self._cs.dims + hasz = self._cs.hasz # I don't understand why these are different # create a new coordinate sequence and populate accordingly cs = GEOSCoordSeq(capi.create_cs(length, ndim), z=hasz) @@ -130,7 +130,7 @@ class LineString(GEOSGeometry): """ lst = [func(i) for i in xrange(len(self))] if numpy: - return numpy.array(lst) # ARRRR! + return numpy.array(lst) # ARRRR! else: return lst diff --git a/django/contrib/gis/geos/prototypes/errcheck.py b/django/contrib/gis/geos/prototypes/errcheck.py index bd99047604..a3682ffd91 100644 --- a/django/contrib/gis/geos/prototypes/errcheck.py +++ b/django/contrib/gis/geos/prototypes/errcheck.py @@ -58,7 +58,7 @@ def check_minus_one(result, func, cargs): def check_predicate(result, func, cargs): "Error checking for unary/binary predicate functions." - val = ord(result) # getting the ordinal from the character + val = ord(result) # getting the ordinal from the character if val == 1: return True elif val == 0: diff --git a/django/contrib/gis/geos/prototypes/misc.py b/django/contrib/gis/geos/prototypes/misc.py index 55381bf7fd..6b10396aba 100644 --- a/django/contrib/gis/geos/prototypes/misc.py +++ b/django/contrib/gis/geos/prototypes/misc.py @@ -21,7 +21,7 @@ def dbl_from_geom(func, num_geom=1): argtypes = [GEOM_PTR for i in xrange(num_geom)] argtypes += [POINTER(c_double)] func.argtypes = argtypes - func.restype = c_int # Status code returned + func.restype = c_int # Status code returned func.errcheck = check_dbl return func diff --git a/django/contrib/gis/geos/tests/test_geos.py b/django/contrib/gis/geos/tests/test_geos.py index 9c24f614df..59cd9a32cc 100644 --- a/django/contrib/gis/geos/tests/test_geos.py +++ b/django/contrib/gis/geos/tests/test_geos.py @@ -198,7 +198,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): poly = fromstr(ewkt) self.assertEqual(srid, poly.srid) self.assertEqual(srid, poly.shell.srid) - self.assertEqual(srid, fromstr(poly.ewkt).srid) # Checking export + self.assertEqual(srid, fromstr(poly.ewkt).srid) # Checking export @skipUnless(HAS_GDAL, "GDAL is required.") def test_json(self): @@ -279,7 +279,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): # Now testing the different constructors pnt2 = Point(tup_args) # e.g., Point((1, 2)) - pnt3 = Point(*tup_args) # e.g., Point(1, 2) + pnt3 = Point(*tup_args) # e.g., Point(1, 2) self.assertEqual(True, pnt == pnt2) self.assertEqual(True, pnt == pnt3) @@ -295,7 +295,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): pnt.coords = set_tup2 self.assertEqual(set_tup2, pnt.coords) - prev = pnt # setting the previous geometry + prev = pnt # setting the previous geometry def test_multipoints(self): "Testing MultiPoint objects." @@ -337,11 +337,11 @@ class GEOSTest(unittest.TestCase, TestDataMixin): # Creating a LineString from a tuple, list, and numpy array self.assertEqual(ls, LineString(ls.tuple)) # tuple - self.assertEqual(ls, LineString(*ls.tuple)) # as individual arguments - self.assertEqual(ls, LineString([list(tup) for tup in ls.tuple])) # as list - self.assertEqual(ls.wkt, LineString(*tuple(Point(tup) for tup in ls.tuple)).wkt) # Point individual arguments + self.assertEqual(ls, LineString(*ls.tuple)) # as individual arguments + self.assertEqual(ls, LineString([list(tup) for tup in ls.tuple])) # as list + self.assertEqual(ls.wkt, LineString(*tuple(Point(tup) for tup in ls.tuple)).wkt) # Point individual arguments if numpy: - self.assertEqual(ls, LineString(numpy.array(ls.tuple))) # as numpy array + self.assertEqual(ls, LineString(numpy.array(ls.tuple))) # as numpy array def test_multilinestring(self): "Testing MultiLineString objects." @@ -409,7 +409,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(poly.empty, False) self.assertEqual(poly.ring, False) self.assertEqual(p.n_i, poly.num_interior_rings) - self.assertEqual(p.n_i + 1, len(poly)) # Testing __len__ + self.assertEqual(p.n_i + 1, len(poly)) # Testing __len__ self.assertEqual(p.n_p, poly.num_points) # Area & Centroid @@ -419,7 +419,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): # Testing the geometry equivalence self.assertEqual(True, poly == fromstr(p.wkt)) - self.assertEqual(False, poly == prev) # Should not be equal to previous geometry + self.assertEqual(False, poly == prev) # Should not be equal to previous geometry self.assertEqual(True, poly != prev) # Testing the exterior ring @@ -428,7 +428,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(ring.geom_typeid, 2) if p.ext_ring_cs: self.assertEqual(p.ext_ring_cs, ring.tuple) - self.assertEqual(p.ext_ring_cs, poly[0].tuple) # Testing __getitem__ + self.assertEqual(p.ext_ring_cs, poly[0].tuple) # Testing __getitem__ # Testing __getitem__ and __setitem__ on invalid indices self.assertRaises(GEOSIndexError, poly.__getitem__, len(poly)) @@ -522,13 +522,13 @@ class GEOSTest(unittest.TestCase, TestDataMixin): poly = fromstr(p.wkt) cs = poly.exterior_ring.coord_seq - self.assertEqual(p.ext_ring_cs, cs.tuple) # done in the Polygon test too. - self.assertEqual(len(p.ext_ring_cs), len(cs)) # Making sure __len__ works + self.assertEqual(p.ext_ring_cs, cs.tuple) # done in the Polygon test too. + self.assertEqual(len(p.ext_ring_cs), len(cs)) # Making sure __len__ works # Checks __getitem__ and __setitem__ for i in xrange(len(p.ext_ring_cs)): - c1 = p.ext_ring_cs[i] # Expected value - c2 = cs[i] # Value from coordseq + c1 = p.ext_ring_cs[i] # Expected value + c2 = cs[i] # Value from coordseq self.assertEqual(c1, c2) # Constructing the test value to set the coordinate sequence with @@ -562,8 +562,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(True, a.intersects(b)) i2 = a.intersection(b) self.assertEqual(i1, i2) - self.assertEqual(i1, a & b) # __and__ is intersection operator - a &= b # testing __iand__ + self.assertEqual(i1, a & b) # __and__ is intersection operator + a &= b # testing __iand__ self.assertEqual(i1, a) def test_union(self): @@ -574,8 +574,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin): u1 = fromstr(self.geometries.union_geoms[i].wkt) u2 = a.union(b) self.assertEqual(u1, u2) - self.assertEqual(u1, a | b) # __or__ is union operator - a |= b # testing __ior__ + self.assertEqual(u1, a | b) # __or__ is union operator + a |= b # testing __ior__ self.assertEqual(u1, a) def test_difference(self): @@ -586,8 +586,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin): d1 = fromstr(self.geometries.diff_geoms[i].wkt) d2 = a.difference(b) self.assertEqual(d1, d2) - self.assertEqual(d1, a - b) # __sub__ is difference operator - a -= b # testing __isub__ + self.assertEqual(d1, a - b) # __sub__ is difference operator + a -= b # testing __isub__ self.assertEqual(d1, a) def test_symdifference(self): @@ -598,8 +598,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin): d1 = fromstr(self.geometries.sdiff_geoms[i].wkt) d2 = a.sym_difference(b) self.assertEqual(d1, d2) - self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator - a ^= b # testing __ixor__ + self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator + a ^= b # testing __ixor__ self.assertEqual(d1, a) def test_buffer(self): @@ -667,7 +667,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): p2 = fromstr(p1.hex) self.assertEqual(exp_srid, p2.srid) - p3 = fromstr(p1.hex, srid=-1) # -1 is intended. + p3 = fromstr(p1.hex, srid=-1) # -1 is intended. self.assertEqual(-1, p3.srid) @skipUnless(HAS_GDAL, "GDAL is required.") @@ -705,7 +705,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): # Assigning polygon's exterior ring w/the new shell poly.exterior_ring = new_shell - str(new_shell) # new shell is still accessible + str(new_shell) # new shell is still accessible self.assertEqual(poly.exterior_ring, new_shell) self.assertEqual(poly[0], new_shell) @@ -718,7 +718,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): new = Point(random.randint(21, 100), random.randint(21, 100)) # Testing the assignment mp[i] = new - str(new) # what was used for the assignment is still accessible + str(new) # what was used for the assignment is still accessible self.assertEqual(mp[i], new) self.assertEqual(mp[i].wkt, new.wkt) self.assertNotEqual(pnt, mp[i]) @@ -740,7 +740,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertNotEqual(mpoly[i], poly) # Testing the assignment mpoly[i] = poly - str(poly) # Still accessible + str(poly) # Still accessible self.assertEqual(mpoly[i], poly) self.assertNotEqual(mpoly[i], old_poly) @@ -821,7 +821,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): # Testing len() and num_geom. if isinstance(g, Polygon): - self.assertEqual(1, len(g)) # Has one empty linear ring + self.assertEqual(1, len(g)) # Has one empty linear ring self.assertEqual(1, g.num_geom) self.assertEqual(0, len(g[0])) elif isinstance(g, (Point, LineString)): @@ -1039,7 +1039,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): # A set of test points. pnts = [Point(5, 5), Point(7.5, 7.5), Point(2.5, 7.5)] - covers = [True, True, False] # No `covers` op for regular GEOS geoms. + covers = [True, True, False] # No `covers` op for regular GEOS geoms. for pnt, c in zip(pnts, covers): # Results should be the same (but faster) self.assertEqual(mpoly.contains(pnt), prep.contains(pnt)) diff --git a/django/contrib/gis/geos/tests/test_mutable_list.py b/django/contrib/gis/geos/tests/test_mutable_list.py index fc3b247f1f..5340dac99d 100644 --- a/django/contrib/gis/geos/tests/test_mutable_list.py +++ b/django/contrib/gis/geos/tests/test_mutable_list.py @@ -223,9 +223,9 @@ class ListMixinTest(unittest.TestCase): del x[i] pl, ul = self.lists_of_len() for i in (-1 - self.limit, self.limit): - self.assertRaises(IndexError, setfcn, ul, i) # 'set index %d' % i) - self.assertRaises(IndexError, getfcn, ul, i) # 'get index %d' % i) - self.assertRaises(IndexError, delfcn, ul, i) # 'del index %d' % i) + self.assertRaises(IndexError, setfcn, ul, i) # 'set index %d' % i) + self.assertRaises(IndexError, getfcn, ul, i) # 'get index %d' % i) + self.assertRaises(IndexError, delfcn, ul, i) # 'del index %d' % i) def test06_list_methods(self): 'List methods' diff --git a/django/contrib/gis/maps/google/gmap.py b/django/contrib/gis/maps/google/gmap.py index ee820fc3c6..b61c95913d 100644 --- a/django/contrib/gis/maps/google/gmap.py +++ b/django/contrib/gis/maps/google/gmap.py @@ -20,9 +20,9 @@ class GoogleMap(object): "A class for generating Google Maps JavaScript." # String constants - onunload = mark_safe('onunload="GUnload()"') # Cleans up after Google Maps - vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML - xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML). + onunload = mark_safe('onunload="GUnload()"') # Cleans up after Google Maps + vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML + xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML). def __init__(self, key=None, api_url=None, version=None, center=None, zoom=None, dom_id='map', diff --git a/django/contrib/gis/maps/google/zoom.py b/django/contrib/gis/maps/google/zoom.py index 6bbadcdf16..22b3ceac1d 100644 --- a/django/contrib/gis/maps/google/zoom.py +++ b/django/contrib/gis/maps/google/zoom.py @@ -33,18 +33,18 @@ class GoogleZoom(object): # Initializing arrays to hold the parameters for each one of the # zoom levels. - self._degpp = [] # Degrees per pixel - self._radpp = [] # Radians per pixel - self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level + self._degpp = [] # Degrees per pixel + self._radpp = [] # Radians per pixel + self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level # Incrementing through the zoom levels and populating the parameter arrays. - z = tilesize # The number of pixels per zoom level. + z = tilesize # The number of pixels per zoom level. for i in xrange(num_zoom): # Getting the degrees and radians per pixel, and the 1/2 the number of # for every zoom level. - self._degpp.append(z / 360.) # degrees per pixel - self._radpp.append(z / (2 * pi)) # radians per pixel - self._npix.append(z / 2) # number of pixels to center of tile + self._degpp.append(z / 360.) # degrees per pixel + self._radpp.append(z / (2 * pi)) # radians per pixel + self._npix.append(z / 2) # number of pixels to center of tile # Multiplying `z` by 2 for the next iteration. z *= 2 diff --git a/django/contrib/gis/tests/distapp/tests.py b/django/contrib/gis/tests/distapp/tests.py index 8db977e025..6b7c734066 100644 --- a/django/contrib/gis/tests/distapp/tests.py +++ b/django/contrib/gis/tests/distapp/tests.py @@ -5,7 +5,7 @@ from unittest import skipUnless from django.db import connection from django.db.models import Q from django.contrib.gis.geos import HAS_GEOS -from django.contrib.gis.measure import D # alias for Distance +from django.contrib.gis.measure import D # alias for Distance from django.contrib.gis.tests.utils import ( HAS_SPATIAL_DB, mysql, oracle, postgis, spatialite, no_oracle, no_spatialite ) @@ -123,7 +123,7 @@ class DistanceTest(TestCase): if spatialite or oracle: dist_qs = [dist1, dist2] else: - dist3 = SouthTexasCityFt.objects.distance(lagrange.ewkt) # Using EWKT string parameter. + dist3 = SouthTexasCityFt.objects.distance(lagrange.ewkt) # Using EWKT string parameter. dist4 = SouthTexasCityFt.objects.distance(lagrange) dist_qs = [dist1, dist2, dist3, dist4] @@ -199,7 +199,7 @@ class DistanceTest(TestCase): for i, c in enumerate(qs): self.assertAlmostEqual(sphere_distances[i], c.distance.m, tol) - @no_oracle # Oracle already handles geographic distance calculation. + @no_oracle # Oracle already handles geographic distance calculation. def test_distance_transform(self): """ Test the `distance` GeoQuerySet method used with `transform` on a geographic field. @@ -307,7 +307,7 @@ class DistanceTest(TestCase): # Cities that are either really close or really far from Wollongong -- # and using different units of distance. wollongong = AustraliaCity.objects.get(name='Wollongong') - d1, d2 = D(yd=19500), D(nm=400) # Yards (~17km) & Nautical miles. + d1, d2 = D(yd=19500), D(nm=400) # Yards (~17km) & Nautical miles. # Normal geodetic distance lookup (uses `distance_sphere` on PostGIS. gq1 = Q(point__distance_lte=(wollongong.point, d1)) diff --git a/django/contrib/gis/tests/geoapp/models.py b/django/contrib/gis/tests/geoapp/models.py index 251173e432..8234bc8d9b 100644 --- a/django/contrib/gis/tests/geoapp/models.py +++ b/django/contrib/gis/tests/geoapp/models.py @@ -9,7 +9,7 @@ null_flag = not mysql @python_2_unicode_compatible class Country(models.Model): name = models.CharField(max_length=30) - mpoly = models.MultiPolygonField() # SRID, by default, is 4326 + mpoly = models.MultiPolygonField() # SRID, by default, is 4326 objects = models.GeoManager() def __str__(self): @@ -30,13 +30,13 @@ class City(models.Model): class PennsylvaniaCity(City): county = models.CharField(max_length=30) founded = models.DateTimeField(null=True) - objects = models.GeoManager() # TODO: This should be implicitly inherited. + objects = models.GeoManager() # TODO: This should be implicitly inherited. @python_2_unicode_compatible class State(models.Model): name = models.CharField(max_length=30) - poly = models.PolygonField(null=null_flag) # Allowing NULL geometries here. + poly = models.PolygonField(null=null_flag) # Allowing NULL geometries here. objects = models.GeoManager() def __str__(self): @@ -68,5 +68,5 @@ if not spatialite: return self.name class MinusOneSRID(models.Model): - geom = models.PointField(srid=-1) # Minus one SRID. + geom = models.PointField(srid=-1) # Minus one SRID. objects = models.GeoManager() diff --git a/django/contrib/gis/tests/geoapp/test_feeds.py b/django/contrib/gis/tests/geoapp/test_feeds.py index 9ae06d76e0..7b8fc159b4 100644 --- a/django/contrib/gis/tests/geoapp/test_feeds.py +++ b/django/contrib/gis/tests/geoapp/test_feeds.py @@ -92,5 +92,5 @@ class GeoFeedTest(TestCase): self.assertChildNodes(item, ['title', 'link', 'description', 'guid', 'geo:lat', 'geo:lon']) # Boxes and Polygons aren't allowed in W3C Geo feeds. - self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo2/') # Box in <channel> - self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo3/') # Polygons in <entry> + self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo2/') # Box in <channel> + self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo3/') # Polygons in <entry> diff --git a/django/contrib/gis/tests/geoapp/test_sitemaps.py b/django/contrib/gis/tests/geoapp/test_sitemaps.py index 92d70e1fd5..d9ede80c57 100644 --- a/django/contrib/gis/tests/geoapp/test_sitemaps.py +++ b/django/contrib/gis/tests/geoapp/test_sitemaps.py @@ -59,7 +59,7 @@ class GeoSitemapTest(TestCase): self.assertEqual(urlset.getAttribute('xmlns:geo'), 'http://www.google.com/geo/schemas/sitemap/1.0') urls = urlset.getElementsByTagName('url') - self.assertEqual(2, len(urls)) # Should only be 2 sitemaps. + self.assertEqual(2, len(urls)) # Should only be 2 sitemaps. for url in urls: self.assertChildNodes(url, ['loc', 'geo:geo']) # Making sure the 'geo:format' element was properly set. diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index 4b20c4b2c8..f1b2f1adbe 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -84,7 +84,7 @@ class GeoModelTest(TestCase): # Creating a State object using a built Polygon ply = Polygon(shell, inner) nullstate = State(name='NullState', poly=ply) - self.assertEqual(4326, nullstate.poly.srid) # SRID auto-set from None + self.assertEqual(4326, nullstate.poly.srid) # SRID auto-set from None nullstate.save() ns = State.objects.get(name='NullState') @@ -111,7 +111,7 @@ class GeoModelTest(TestCase): "Testing automatic transform for lookups and inserts." # San Antonio in 'WGS84' (SRID 4326) sa_4326 = 'POINT (-98.493183 29.424170)' - wgs_pnt = fromstr(sa_4326, srid=4326) # Our reference point in WGS84 + wgs_pnt = fromstr(sa_4326, srid=4326) # Our reference point in WGS84 # Oracle doesn't have SRID 3084, using 41157. if oracle: @@ -122,7 +122,7 @@ class GeoModelTest(TestCase): nad_srid = 41157 else: # San Antonio in 'NAD83(HARN) / Texas Centric Lambert Conformal' (SRID 3084) - nad_wkt = 'POINT (1645978.362408288754523 6276356.025927528738976)' # Used ogr.py in gdal 1.4.1 for this transform + nad_wkt = 'POINT (1645978.362408288754523 6276356.025927528738976)' # Used ogr.py in gdal 1.4.1 for this transform nad_srid = 3084 # Constructing & querying with a point from a different SRID. Oracle @@ -156,7 +156,7 @@ class GeoModelTest(TestCase): c = City() self.assertEqual(c.point, None) - @no_spatialite # SpatiaLite does not support abstract geometry columns + @no_spatialite # SpatiaLite does not support abstract geometry columns def test_geometryfield(self): "Testing the general GeometryField." Feature(name='Point', geom=Point(1, 1)).save() @@ -242,8 +242,8 @@ class GeoLookupTest(TestCase): # Now testing contains on the countries using the points for # Houston and Wellington. - tx = Country.objects.get(mpoly__contains=houston.point) # Query w/GEOSGeometry - nz = Country.objects.get(mpoly__contains=wellington.point.hex) # Query w/EWKBHEX + tx = Country.objects.get(mpoly__contains=houston.point) # Query w/GEOSGeometry + nz = Country.objects.get(mpoly__contains=wellington.point.hex) # Query w/EWKBHEX self.assertEqual('Texas', tx.name) self.assertEqual('New Zealand', nz.name) @@ -254,9 +254,9 @@ class GeoLookupTest(TestCase): # Pueblo and Oklahoma City (even though OK City is within the bounding box of Texas) # are not contained in Texas or New Zealand. - self.assertEqual(0, len(Country.objects.filter(mpoly__contains=pueblo.point))) # Query w/GEOSGeometry object + self.assertEqual(0, len(Country.objects.filter(mpoly__contains=pueblo.point))) # Query w/GEOSGeometry object self.assertEqual((mysql and 1) or 0, - len(Country.objects.filter(mpoly__contains=okcity.point.wkt))) # Qeury w/WKT + len(Country.objects.filter(mpoly__contains=okcity.point.wkt))) # Qeury w/WKT # OK City is contained w/in bounding box of Texas. if not oracle: @@ -446,7 +446,7 @@ class GeoQuerySetTest(TestCase): self.assertIsInstance(country.envelope, Polygon) @no_mysql - @no_spatialite # SpatiaLite does not have an Extent function + @no_spatialite # SpatiaLite does not have an Extent function def test_extent(self): "Testing the `extent` GeoQuerySet method." # Reference query: @@ -618,7 +618,7 @@ class GeoQuerySetTest(TestCase): self.assertEqual(1, c.num_geom) @no_mysql - @no_spatialite # SpatiaLite can only count vertices in LineStrings + @no_spatialite # SpatiaLite can only count vertices in LineStrings def test_num_points(self): "Testing the `num_points` GeoQuerySet method." for c in Country.objects.num_points(): @@ -671,7 +671,7 @@ class GeoQuerySetTest(TestCase): def test_scale(self): "Testing the `scale` GeoQuerySet method." xfac, yfac = 2, 3 - tol = 5 # XXX The low precision tolerance is for SpatiaLite + tol = 5 # XXX The low precision tolerance is for SpatiaLite qs = Country.objects.scale(xfac, yfac, model_att='scaled') for c in qs: for p1, p2 in zip(c.mpoly, c.scaled): @@ -740,7 +740,7 @@ class GeoQuerySetTest(TestCase): # Pre-transformed points for Houston and Pueblo. htown = fromstr('POINT(1947516.83115183 6322297.06040572)', srid=3084) ptown = fromstr('POINT(992363.390841912 481455.395105533)', srid=2774) - prec = 3 # Precision is low due to version variations in PROJ and GDAL. + prec = 3 # Precision is low due to version variations in PROJ and GDAL. # Asserting the result of the transform operation with the values in # the pre-transformed points. Oracle does not have the 3084 SRID. diff --git a/django/contrib/gis/tests/geogapp/tests.py b/django/contrib/gis/tests/geogapp/tests.py index 83c73dfd4d..615c142324 100644 --- a/django/contrib/gis/tests/geogapp/tests.py +++ b/django/contrib/gis/tests/geogapp/tests.py @@ -48,7 +48,7 @@ class GeographyTest(TestCase): "Ensuring exceptions are raised for operators & functions invalid on geography fields." # Only a subset of the geometry functions & operator are available # to PostGIS geography types. For more information, visit: - # http://postgis.refractions.net/documentation/manual-1.5/ch08.html#PostGIS_GeographyFunctions + # http://postgis.refractions.net/documentation/manual-1.5/ch08.html#PostGIS_GeographyFunctions z = Zipcode.objects.get(code='77002') # ST_Within not available. self.assertRaises(ValueError, City.objects.filter(point__within=z.poly).count) @@ -76,7 +76,7 @@ class GeographyTest(TestCase): # Reference county names, number of polygons, and state names. names = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo'] - num_polys = [1, 2, 1, 19, 1] # Number of polygons for each. + num_polys = [1, 2, 1, 19, 1] # Number of polygons for each. st_names = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado'] lm = LayerMapping(County, co_shp, co_mapping, source_srs=4269, unique='name') diff --git a/django/contrib/gis/tests/layermap/models.py b/django/contrib/gis/tests/layermap/models.py index 5e8b0879ed..1b66c6d94c 100644 --- a/django/contrib/gis/tests/layermap/models.py +++ b/django/contrib/gis/tests/layermap/models.py @@ -9,7 +9,7 @@ class State(models.Model): class County(models.Model): name = models.CharField(max_length=25) state = models.ForeignKey(State) - mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in NAD83 + mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in NAD83 objects = models.GeoManager() @@ -58,8 +58,8 @@ class Invalid(models.Model): # Mapping dictionaries for the models above. co_mapping = {'name': 'Name', - 'state': {'name': 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case). - 'mpoly': 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS. + 'state': {'name': 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case). + 'mpoly': 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS. } cofeat_mapping = {'name': 'Name', diff --git a/django/contrib/gis/tests/layermap/tests.py b/django/contrib/gis/tests/layermap/tests.py index d42fe1d6ee..df6f22c38a 100644 --- a/django/contrib/gis/tests/layermap/tests.py +++ b/django/contrib/gis/tests/layermap/tests.py @@ -32,7 +32,7 @@ invalid_shp = os.path.join(shp_path, 'invalid', 'emptypoints.shp') # Dictionaries to hold what's expected in the county shapefile. NAMES = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo'] -NUMS = [1, 2, 1, 19, 1] # Number of polygons for each. +NUMS = [1, 2, 1, 19, 1] # Number of polygons for each. STATES = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado'] @@ -129,7 +129,7 @@ class LayerMapTest(TestCase): # Should only be one record b/c of `unique` keyword. c = County.objects.get(name=name) self.assertEqual(n, len(c.mpoly)) - self.assertEqual(st, c.state.name) # Checking ForeignKey mapping. + self.assertEqual(st, c.state.name) # Checking ForeignKey mapping. # Multiple records because `unique` was not set. if county_feat: @@ -224,7 +224,7 @@ class LayerMapTest(TestCase): self.assertRaises(TypeError, lm.save, fid_range=bad) # Step keyword should not be allowed w/`fid_range`. - fr = (3, 5) # layer[3:5] + fr = (3, 5) # layer[3:5] self.assertRaises(LayerMapError, lm.save, fid_range=fr, step=10) lm.save(fid_range=fr) @@ -237,8 +237,8 @@ class LayerMapTest(TestCase): # Features IDs 5 and beyond for Honolulu County, Hawaii, and # FID 0 is for Pueblo County, Colorado. clear_counties() - lm.save(fid_range=slice(5, None), silent=True, strict=True) # layer[5:] - lm.save(fid_range=slice(None, 1), silent=True, strict=True) # layer[:1] + lm.save(fid_range=slice(5, None), silent=True, strict=True) # layer[5:] + lm.save(fid_range=slice(None, 1), silent=True, strict=True) # layer[:1] # Only Pueblo & Honolulu counties should be present because of # the `unique` keyword. Have to set `order_by` on this QuerySet diff --git a/django/contrib/gis/tests/test_spatialrefsys.py b/django/contrib/gis/tests/test_spatialrefsys.py index 8bc9177fb4..194578d1e0 100644 --- a/django/contrib/gis/tests/test_spatialrefsys.py +++ b/django/contrib/gis/tests/test_spatialrefsys.py @@ -15,7 +15,7 @@ test_srs = ({'srid': 4326, 'proj4_re': r'\+proj=longlat (\+ellps=WGS84 )?\+datum=WGS84 \+no_defs ', 'spheroid': 'WGS 84', 'name': 'WGS 84', 'geographic': True, 'projected': False, 'spatialite': True, - 'ellipsoid': (6378137.0, 6356752.3, 298.257223563), # From proj's "cs2cs -le" and Wikipedia (semi-minor only) + 'ellipsoid': (6378137.0, 6356752.3, 298.257223563), # From proj's "cs2cs -le" and Wikipedia (semi-minor only) 'eprec': (1, 1, 9), }, {'srid': 32140, @@ -27,7 +27,7 @@ test_srs = ({'srid': 4326, r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ', 'spheroid': 'GRS 1980', 'name': 'NAD83 / Texas South Central', 'geographic': False, 'projected': True, 'spatialite': False, - 'ellipsoid': (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only) + 'ellipsoid': (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only) 'eprec': (1, 5, 10), }, ) diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py index 9d70026dbb..5f57bc1749 100644 --- a/django/contrib/gis/utils/layermapping.py +++ b/django/contrib/gis/utils/layermapping.py @@ -129,7 +129,7 @@ class LayerMapping(object): if unique: self.check_unique(unique) - transaction_mode = 'autocommit' # Has to be set to autocommit. + transaction_mode = 'autocommit' # Has to be set to autocommit. self.unique = unique else: self.unique = None @@ -286,7 +286,7 @@ class LayerMapping(object): else: raise TypeError('Unique keyword argument must be set with a tuple, list, or string.') - #### Keyword argument retrieval routines #### + # Keyword argument retrieval routines #### def feature_kwargs(self, feat): """ Given an OGR Feature, this will return a dictionary of keyword arguments @@ -359,7 +359,7 @@ class LayerMapping(object): # Getting the decimal value as a tuple. dtup = d.as_tuple() digits = dtup[1] - d_idx = dtup[2] # index where the decimal is + d_idx = dtup[2] # index where the decimal is # Maximum amount of precision, or digits to the left of the decimal. max_prec = model_field.max_digits - model_field.decimal_places diff --git a/django/contrib/messages/storage/cookie.py b/django/contrib/messages/storage/cookie.py index 2ec3fe484b..d0d09dee48 100644 --- a/django/contrib/messages/storage/cookie.py +++ b/django/contrib/messages/storage/cookie.py @@ -101,7 +101,7 @@ class CookieStorage(BaseStorage): if self.max_cookie_size: # data is going to be stored eventually by SimpleCookie, which # adds it's own overhead, which we must account for. - cookie = SimpleCookie() # create outside the loop + cookie = SimpleCookie() # create outside the loop def stored_length(val): return len(cookie.value_encode(val)[1]) diff --git a/django/contrib/messages/tests/test_cookie.py b/django/contrib/messages/tests/test_cookie.py index c4e2b0abfb..028f01382b 100644 --- a/django/contrib/messages/tests/test_cookie.py +++ b/django/contrib/messages/tests/test_cookie.py @@ -77,7 +77,7 @@ class CookieTest(BaseTests, TestCase): response = self.get_response() storage.add(constants.INFO, 'test') for m in storage: - pass # Iterate through the storage to simulate consumption of messages. + pass # Iterate through the storage to simulate consumption of messages. storage.update(response) self.assertEqual(response.cookies['messages'].value, '') self.assertEqual(response.cookies['messages']['domain'], '.example.com') diff --git a/django/contrib/sessions/models.py b/django/contrib/sessions/models.py index 3a6e31152f..1ab42c03e1 100644 --- a/django/contrib/sessions/models.py +++ b/django/contrib/sessions/models.py @@ -14,7 +14,7 @@ class SessionManager(models.Manager): if session_dict: s.save() else: - s.delete() # Clear sessions with no data. + s.delete() # Clear sessions with no data. return s diff --git a/django/contrib/sessions/tests.py b/django/contrib/sessions/tests.py index 275eba5713..862bdfb69b 100644 --- a/django/contrib/sessions/tests.py +++ b/django/contrib/sessions/tests.py @@ -388,7 +388,7 @@ class CacheDBSessionTests(SessionTestsMixin, TestCase): @override_settings(SESSION_CACHE_ALIAS='sessions') def test_non_default_cache(self): - #21000 - CacheDB backend should respect SESSION_CACHE_ALIAS. + # 21000 - CacheDB backend should respect SESSION_CACHE_ALIAS. self.assertRaises(InvalidCacheBackendError, self.backend) diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py index 9b2c5e8bd1..c49c20e59b 100644 --- a/django/core/cache/backends/memcached.py +++ b/django/core/cache/backends/memcached.py @@ -60,7 +60,7 @@ class BaseMemcachedCache(six.with_metaclass(BaseMemcachedCacheMethods, BaseCache # in memcache backends, a negative timeout must be passed. timeout = -1 - if timeout > 2592000: # 60*60*24*30, 30 days + if timeout > 2592000: # 60*60*24*30, 30 days # See http://code.google.com/p/memcached/wiki/FAQ # "You can set expire times up to 30 days in the future. After that # memcached interprets it as a date, and will expire the item after diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py index 3bd6993771..4b23d48fb4 100644 --- a/django/core/files/uploadhandler.py +++ b/django/core/files/uploadhandler.py @@ -64,7 +64,7 @@ class FileUploadHandler(object): """ Base class for streaming upload handlers. """ - chunk_size = 64 * 2 ** 10 #: The default chunk size is 64 KB. + chunk_size = 64 * 2 ** 10 # : The default chunk size is 64 KB. def __init__(self, request=None): self.file_name = None diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py index 577cb2176b..bf65687d5c 100644 --- a/django/core/handlers/base.py +++ b/django/core/handlers/base.py @@ -189,7 +189,7 @@ class BaseHandler(object): # Allow sys.exit() to actually exit. See tickets #1023 and #4701 raise - except: # Handle everything else. + except: # Handle everything else. # Get the exception info now, in case another exception is thrown later. signals.got_request_exception.send(sender=self.__class__, request=request) response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) @@ -199,7 +199,7 @@ class BaseHandler(object): for middleware_method in self._response_middleware: response = middleware_method(request, response) response = self.apply_response_fixes(request, response) - except: # Any exception should be gathered and handled + except: # Any exception should be gathered and handled signals.got_request_exception.send(sender=self.__class__, request=request) response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py index 4c54b3e39d..21cadf48b8 100644 --- a/django/core/handlers/wsgi.py +++ b/django/core/handlers/wsgi.py @@ -52,7 +52,7 @@ class LimitedStream(object): elif size < len(self.buffer): result = self.buffer[:size] self.buffer = self.buffer[size:] - else: # size >= len(self.buffer) + else: # size >= len(self.buffer) result = self.buffer + self._read_limited(size - len(self.buffer)) self.buffer = b'' return result diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 3516ac330b..de49f5e241 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -121,7 +121,7 @@ def get_commands(): _commands.update(dict((name, app_name) for name in find_commands(path))) except ImportError: - pass # No management module - ignore this app + pass # No management module - ignore this app return _commands @@ -379,12 +379,12 @@ class ManagementUtility(object): options, args = parser.parse_args(self.argv) handle_default_options(options) except: # Needed because parser.parse_args can raise SystemExit - pass # Ignore any option errors at this point. + pass # Ignore any option errors at this point. try: subcommand = self.argv[1] except IndexError: - subcommand = 'help' # Display help if no arguments were given. + subcommand = 'help' # Display help if no arguments were given. if subcommand == 'help': if len(args) <= 2: diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py index 89549dc3c1..a24ae2b51e 100644 --- a/django/core/management/commands/inspectdb.py +++ b/django/core/management/commands/inspectdb.py @@ -66,9 +66,9 @@ class Command(NoArgsCommand): indexes = connection.introspection.get_indexes(cursor, table_name) except NotImplementedError: indexes = {} - used_column_names = [] # Holds column names used in the table so far + used_column_names = [] # Holds column names used in the table so far for i, row in enumerate(connection.introspection.get_table_description(cursor, table_name)): - comment_notes = [] # Holds Field notes, to be displayed in a Python comment. + comment_notes = [] # Holds Field notes, to be displayed in a Python comment. extra_params = OrderedDict() # Holds Field parameters such as 'db_column'. column_name = row[0] is_relation = i in relations @@ -112,7 +112,7 @@ class Command(NoArgsCommand): # Add 'null' and 'blank', if the 'null_ok' flag was present in the # table description. - if row[6]: # If it's NULL... + if row[6]: # If it's NULL... if field_type == 'BooleanField(': field_type = 'NullBooleanField(' else: diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index 723fe626be..76b50916e0 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -24,9 +24,9 @@ from django.utils import six from django.utils.translation import get_language -_resolver_cache = {} # Maps URLconf modules to RegexURLResolver instances. -_ns_resolver_cache = {} # Maps namespaces to RegexURLResolver instances. -_callable_cache = {} # Maps view and url pattern names to their view functions. +_resolver_cache = {} # Maps URLconf modules to RegexURLResolver instances. +_ns_resolver_cache = {} # Maps namespaces to RegexURLResolver instances. +_callable_cache = {} # Maps view and url pattern names to their view functions. # SCRIPT_NAME prefixes for each thread are stored here. If there's no entry for # the current thread (which is the only one we ever access), it is assumed to diff --git a/django/core/validators.py b/django/core/validators.py index cf5ec7aa77..695dda258b 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -86,7 +86,7 @@ class EmailValidator(object): code = 'invalid' user_regex = re.compile( r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$" # dot-atom - r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string + r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string re.IGNORECASE) domain_regex = re.compile( r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,})$' # domain 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 diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py index 664a817f37..28c0195a48 100644 --- a/django/http/multipartparser.py +++ b/django/http/multipartparser.py @@ -127,7 +127,7 @@ class MultiPartParser(object): self._content_length, self._boundary, encoding) - #Check to see if it was handled + # Check to see if it was handled if result is not None: return result[0], result[1] @@ -483,7 +483,7 @@ class BoundaryIter(six.Iterator): else: # make sure we dont treat a partial boundary (and # its separators) as data - if not chunk[:-rollback]:# and len(chunk) >= (len(self._boundary) + 6): + if not chunk[:-rollback]: # and len(chunk) >= (len(self._boundary) + 6): # There's nothing left, we should just return and mark as done. self._done = True return chunk diff --git a/django/http/request.py b/django/http/request.py index 07ab6cb27d..4d11fb21e0 100644 --- a/django/http/request.py +++ b/django/http/request.py @@ -249,13 +249,13 @@ class HttpRequest(object): else: self._post, self._files = QueryDict('', encoding=self._encoding), MultiValueDict() - ## File-like and iterator interface. - ## - ## Expects self._stream to be set to an appropriate source of bytes by - ## a corresponding request subclass (e.g. WSGIRequest). - ## Also when request data has already been read by request.POST or - ## request.body, self._stream points to a BytesIO instance - ## containing that data. + # File-like and iterator interface. + # + # Expects self._stream to be set to an appropriate source of bytes by + # a corresponding request subclass (e.g. WSGIRequest). + # Also when request data has already been read by request.POST or + # request.body, self._stream points to a BytesIO instance + # containing that data. def read(self, *args, **kwargs): self._read_started = True diff --git a/django/middleware/cache.py b/django/middleware/cache.py index 96c6b24034..361e46f5e5 100644 --- a/django/middleware/cache.py +++ b/django/middleware/cache.py @@ -134,13 +134,13 @@ class FetchFromCacheMiddleware(object): """ if not request.method in ('GET', 'HEAD'): request._cache_update_cache = False - return None # Don't bother checking the cache. + return None # Don't bother checking the cache. # try and get the cached GET response cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache) if cache_key is None: request._cache_update_cache = True - return None # No cache information available, need to rebuild. + return None # No cache information available, need to rebuild. response = self.cache.get(cache_key, None) # if it wasn't found and we are looking for a HEAD, try looking just for that if response is None and request.method == 'HEAD': @@ -149,7 +149,7 @@ class FetchFromCacheMiddleware(object): if response is None: request._cache_update_cache = True - return None # No cache information available, need to rebuild. + return None # No cache information available, need to rebuild. # hit, return cached response request._cache_update_cache = False diff --git a/django/templatetags/cache.py b/django/templatetags/cache.py index 0de00210fe..1ef97d7cf0 100644 --- a/django/templatetags/cache.py +++ b/django/templatetags/cache.py @@ -87,7 +87,7 @@ def do_cache(parser, token): cache_name = None return CacheNode(nodelist, parser.compile_filter(tokens[1]), - tokens[2], # fragment_name can't be a variable. + tokens[2], # fragment_name can't be a variable. [parser.compile_filter(t) for t in tokens[3:]], cache_name, ) diff --git a/django/test/_doctest.py b/django/test/_doctest.py index 2b90f1dc2e..048d886720 100644 --- a/django/test/_doctest.py +++ b/django/test/_doctest.py @@ -898,7 +898,7 @@ class DocTestFinder: elif hasattr(object, '__module__'): return module.__name__ == object.__module__ elif isinstance(object, property): - return True # [XX] no way not be sure. + return True # [XX] no way not be sure. else: raise ValueError("object must be a class or function") @@ -1221,7 +1221,7 @@ class DocTestRunner: # to modify them). original_optionflags = self.optionflags - SUCCESS, FAILURE, BOOM = range(3) # `outcome` state + SUCCESS, FAILURE, BOOM = range(3) # `outcome` state check = self._checker.check_output @@ -1274,7 +1274,7 @@ class DocTestRunner: # Strip b"" and u"" prefixes from the repr and expected output # TODO: better way of stripping the prefixes? expected = example.want - expected = expected.strip() # be wary of newlines + expected = expected.strip() # be wary of newlines s = s.replace("u", "") s = s.replace("b", "") expected = expected.replace("u", "") @@ -1288,7 +1288,7 @@ class DocTestRunner: lines.append(s) # let them match - if s == expected: # be wary of false positives here + if s == expected: # be wary of false positives here # they should be the same, print expected value sys.stdout.write("%s\n" % example.want.strip()) @@ -1314,13 +1314,13 @@ class DocTestRunner: # Don't blink! This is where the user's code gets run. six.exec_(compile(example.source, filename, "single", compileflags, 1), test.globs) - self.debugger.set_continue() # ==== Example Finished ==== + self.debugger.set_continue() # ==== Example Finished ==== exception = None except KeyboardInterrupt: raise except: exception = sys.exc_info() - self.debugger.set_continue() # ==== Example Finished ==== + self.debugger.set_continue() # ==== Example Finished ==== finally: # restore the original displayhook sys.displayhook = original_displayhook @@ -1647,11 +1647,11 @@ class OutputChecker: # Use difflib to find their differences. if optionflags & REPORT_UDIFF: diff = difflib.unified_diff(want_lines, got_lines, n=2) - diff = list(diff)[2:] # strip the diff header + diff = list(diff)[2:] # strip the diff header kind = 'unified diff with -expected +actual' elif optionflags & REPORT_CDIFF: diff = difflib.context_diff(want_lines, got_lines, n=2) - diff = list(diff)[2:] # strip the diff header + diff = list(diff)[2:] # strip the diff header kind = 'context diff with expected followed by actual' elif optionflags & REPORT_NDIFF: engine = difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK) diff --git a/django/test/simple.py b/django/test/simple.py index b2ab1269b5..05a7329fae 100644 --- a/django/test/simple.py +++ b/django/test/simple.py @@ -191,7 +191,7 @@ def build_test(label): try: if issubclass(TestClass, (unittest.TestCase, real_unittest.TestCase)): - if len(parts) == 2: # label is app.TestClass + if len(parts) == 2: # label is app.TestClass try: return unittest.TestLoader().loadTestsFromTestCase( TestClass) @@ -199,7 +199,7 @@ def build_test(label): raise ValueError( "Test label '%s' does not refer to a test class" % label) - else: # label is app.TestClass.test_method + else: # label is app.TestClass.test_method return TestClass(parts[2]) except TypeError: # TestClass isn't a TestClass - it must be a method or normal class diff --git a/django/utils/dictconfig.py b/django/utils/dictconfig.py index d01b785001..773b703497 100644 --- a/django/utils/dictconfig.py +++ b/django/utils/dictconfig.py @@ -71,7 +71,7 @@ class ConvertingDict(dict): def __getitem__(self, key): value = dict.__getitem__(self, key) result = self.configurator.convert(value) - #If the converted value is different, save for next time + # If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, @@ -83,7 +83,7 @@ class ConvertingDict(dict): def get(self, key, default=None): value = dict.get(self, key, default) result = self.configurator.convert(value) - #If the converted value is different, save for next time + # If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, @@ -107,7 +107,7 @@ class ConvertingList(list): def __getitem__(self, key): value = list.__getitem__(self, key) result = self.configurator.convert(value) - #If the converted value is different, save for next time + # If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, @@ -197,7 +197,7 @@ class BaseConfigurator(object): else: rest = rest[m.end():] d = self.config[m.groups()[0]] - #print d, rest + # print d, rest while rest: m = self.DOT_PATTERN.match(rest) if m: @@ -219,7 +219,7 @@ class BaseConfigurator(object): else: raise ValueError('Unable to convert ' '%r at %r' % (value, rest)) - #rest should be empty + # rest should be empty return d def convert(self, value): @@ -359,25 +359,25 @@ class DictConfigurator(BaseConfigurator): '%r: %s' % (name, e)) # Next, do loggers - they refer to handlers and filters - #we don't want to lose the existing loggers, - #since other threads may have pointers to them. - #existing is set to contain all existing loggers, - #and as we go through the new configuration we - #remove any which are configured. At the end, - #what's left in existing is the set of loggers - #which were in the previous configuration but - #which are not in the new configuration. + # we don't want to lose the existing loggers, + # since other threads may have pointers to them. + # existing is set to contain all existing loggers, + # and as we go through the new configuration we + # remove any which are configured. At the end, + # what's left in existing is the set of loggers + # which were in the previous configuration but + # which are not in the new configuration. root = logging.root existing = list(root.manager.loggerDict) - #The list needs to be sorted so that we can - #avoid disabling child loggers of explicitly - #named loggers. With a sorted list it is easier - #to find the child loggers. + # The list needs to be sorted so that we can + # avoid disabling child loggers of explicitly + # named loggers. With a sorted list it is easier + # to find the child loggers. existing.sort() - #We'll keep the list of existing loggers - #which are children of named loggers here... + # We'll keep the list of existing loggers + # which are children of named loggers here... child_loggers = [] - #now set up the new ones... + # now set up the new ones... loggers = config.get('loggers', EMPTY_DICT) for name in loggers: if name in existing: @@ -397,11 +397,11 @@ class DictConfigurator(BaseConfigurator): raise ValueError('Unable to configure logger ' '%r: %s' % (name, e)) - #Disable any old loggers. There's no point deleting - #them as other threads may continue to hold references - #and by disabling them, you stop them doing any logging. - #However, don't disable children of named loggers, as that's - #probably not what was intended by the user. + # Disable any old loggers. There's no point deleting + # them as other threads may continue to hold references + # and by disabling them, you stop them doing any logging. + # However, don't disable children of named loggers, as that's + # probably not what was intended by the user. for log in existing: logger = root.manager.loggerDict[log] if log in child_loggers: @@ -431,9 +431,9 @@ class DictConfigurator(BaseConfigurator): except TypeError as te: if "'format'" not in str(te): raise - #Name of parameter changed from fmt to format. - #Retry with old name. - #This is so that code can be used with older Python versions + # Name of parameter changed from fmt to format. + # Retry with old name. + # This is so that code can be used with older Python versions #(e.g. by Django) config['fmt'] = config.pop('format') config['()'] = factory @@ -479,7 +479,7 @@ class DictConfigurator(BaseConfigurator): factory = c else: klass = self.resolve(config.pop('class')) - #Special case for handler which refers to another handler + # Special case for handler which refers to another handler if issubclass(klass, logging.handlers.MemoryHandler) and\ 'target' in config: try: @@ -500,9 +500,9 @@ class DictConfigurator(BaseConfigurator): except TypeError as te: if "'stream'" not in str(te): raise - #The argument name changed from strm to stream - #Retry with old name. - #This is so that code can be used with older Python versions + # The argument name changed from strm to stream + # Retry with old name. + # This is so that code can be used with older Python versions #(e.g. by Django) kwargs['strm'] = kwargs.pop('stream') result = factory(**kwargs) @@ -530,7 +530,7 @@ class DictConfigurator(BaseConfigurator): if level is not None: logger.setLevel(_checkLevel(level)) if not incremental: - #Remove any existing handlers + # Remove any existing handlers for h in logger.handlers[:]: logger.removeHandler(h) handlers = config.get('handlers', None) diff --git a/django/views/debug.py b/django/views/debug.py index 96d3e65189..2829ca1443 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -483,7 +483,7 @@ def technical_404_response(request, exception): c = Context({ 'urlconf': urlconf, 'root_urlconf': settings.ROOT_URLCONF, - 'request_path': request.path_info[1:], # Trim leading slash + 'request_path': request.path_info[1:], # Trim leading slash 'urlpatterns': tried, 'reason': force_bytes(exception, errors='replace'), 'request': request, |
