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(' ' 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 - self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo3/') # Polygons in + self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo2/') # Box in + self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo3/') # Polygons in 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, diff --git a/docs/conf.py b/docs/conf.py index f8625e73d9..49e70fab84 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -117,7 +117,7 @@ intersphinx_mapping = { } # Python's docs don't change every week. -intersphinx_cache_limit = 90 # days +intersphinx_cache_limit = 90 # days # -- Options for HTML output --------------------------------------------------- diff --git a/setup.cfg b/setup.cfg index dd708a5d9a..aaca7b6dc0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh [flake8] exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py,./django/conf/app_template/* -ignore=E124,E125,E127,E128,E226,E251,E302,E501,E261,W601 +ignore=E124,E125,E127,E128,E226,E251,E302,E501,W601 [metadata] license-file = LICENSE diff --git a/tests/admin_changelist/admin.py b/tests/admin_changelist/admin.py index d0797581dc..42b8c959af 100644 --- a/tests/admin_changelist/admin.py +++ b/tests/admin_changelist/admin.py @@ -98,7 +98,7 @@ site.register(Parent, NoListDisplayLinksParentAdmin) class SwallowAdmin(admin.ModelAdmin): - actions = None # prevent ['action_checkbox'] + list(list_display) + actions = None # prevent ['action_checkbox'] + list(list_display) list_display = ('origin', 'load', 'speed') site.register(Swallow, SwallowAdmin) diff --git a/tests/admin_filters/models.py b/tests/admin_filters/models.py index e0b8bde2de..bd2e4e5e98 100644 --- a/tests/admin_filters/models.py +++ b/tests/admin_filters/models.py @@ -13,7 +13,7 @@ class Book(models.Model): contributors = models.ManyToManyField(User, verbose_name="Verbose Contributors", related_name='books_contributed', blank=True, null=True) is_best_seller = models.NullBooleanField(default=0) date_registered = models.DateField(null=True) - no = models.IntegerField(verbose_name='number', blank=True, null=True) # This field is intentionally 2 characters long. See #16080. + no = models.IntegerField(verbose_name='number', blank=True, null=True) # This field is intentionally 2 characters long. See #16080. def __str__(self): return self.title diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py index bdfacdc206..bbec124d4d 100644 --- a/tests/admin_filters/tests.py +++ b/tests/admin_filters/tests.py @@ -78,12 +78,12 @@ class DecadeListFilterWithQuerysetBasedLookups(DecadeListFilterWithTitleAndParam class DecadeListFilterParameterEndsWith__In(DecadeListFilter): title = 'publication decade' - parameter_name = 'decade__in' # Ends with '__in" + parameter_name = 'decade__in' # Ends with '__in" class DecadeListFilterParameterEndsWith__Isnull(DecadeListFilter): title = 'publication decade' - parameter_name = 'decade__isnull' # Ends with '__isnull" + parameter_name = 'decade__isnull' # Ends with '__isnull" class DepartmentListFilterLookupWithNonStringValue(SimpleListFilter): diff --git a/tests/admin_inlines/admin.py b/tests/admin_inlines/admin.py index 98c19befa4..da5ddc03b3 100644 --- a/tests/admin_inlines/admin.py +++ b/tests/admin_inlines/admin.py @@ -43,7 +43,7 @@ class AuthorAdmin(admin.ModelAdmin): class InnerInline(admin.StackedInline): model = Inner can_delete = False - readonly_fields = ('readonly',) # For bug #13174 tests. + readonly_fields = ('readonly',) # For bug #13174 tests. class HolderAdmin(admin.ModelAdmin): diff --git a/tests/admin_ordering/tests.py b/tests/admin_ordering/tests.py index 763e97bd72..0085b35586 100644 --- a/tests/admin_ordering/tests.py +++ b/tests/admin_ordering/tests.py @@ -51,7 +51,7 @@ class TestAdminOrdering(TestCase): it actually changes. """ class BandAdmin(ModelAdmin): - ordering = ('rank',) # default ordering is ('name',) + ordering = ('rank',) # default ordering is ('name',) ma = BandAdmin(Band, None) names = [b.name for b in ma.get_queryset(request)] self.assertEqual(['Radiohead', 'Van Halen', 'Aerosmith'], names) diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py index 36b35aeefe..2aa96fbafa 100644 --- a/tests/admin_views/admin.py +++ b/tests/admin_views/admin.py @@ -262,7 +262,7 @@ class Podcast(Media): release_date = models.DateField() class Meta: - ordering = ('release_date',) # overridden in PodcastAdmin + ordering = ('release_date',) # overridden in PodcastAdmin class PodcastAdmin(admin.ModelAdmin): @@ -444,7 +444,7 @@ class PostAdmin(admin.ModelAdmin): class CustomChangeList(ChangeList): def get_queryset(self, request): - return self.root_queryset.filter(pk=9999) # Does not exist + return self.root_queryset.filter(pk=9999) # Does not exist class GadgetAdmin(admin.ModelAdmin): @@ -527,7 +527,7 @@ class StoryForm(forms.ModelForm): class StoryAdmin(admin.ModelAdmin): list_display = ('id', 'title', 'content') - list_display_links = ('title',) # 'id' not in list_display_links + list_display_links = ('title',) # 'id' not in list_display_links list_editable = ('content', ) form = StoryForm ordering = ["-pk"] @@ -535,7 +535,7 @@ class StoryAdmin(admin.ModelAdmin): class OtherStoryAdmin(admin.ModelAdmin): list_display = ('id', 'title', 'content') - list_display_links = ('title', 'id') # 'id' in list_display_links + list_display_links = ('title', 'id') # 'id' in list_display_links list_editable = ('content', ) ordering = ["-pk"] diff --git a/tests/admin_views/customadmin.py b/tests/admin_views/customadmin.py index f964d6cffb..560b4409c2 100644 --- a/tests/admin_views/customadmin.py +++ b/tests/admin_views/customadmin.py @@ -17,7 +17,7 @@ class Admin2(admin.AdminSite): login_form = forms.CustomAdminAuthenticationForm login_template = 'custom_admin/login.html' logout_template = 'custom_admin/logout.html' - index_template = ['custom_admin/index.html'] # a list, to test fix for #18697 + index_template = ['custom_admin/index.html'] # a list, to test fix for #18697 password_change_template = 'custom_admin/password_change_form.html' password_change_done_template = 'custom_admin/password_change_done.html' @@ -42,7 +42,7 @@ class UserLimitedAdmin(UserAdmin): class CustomPwdTemplateUserAdmin(UserAdmin): - change_user_password_template = ['admin/auth/user/change_password.html'] # a list, to test fix for #18697 + change_user_password_template = ['admin/auth/user/change_password.html'] # a list, to test fix for #18697 site = Admin2(name="admin2") diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index 67f3b4216a..4dcca9a4cb 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -256,7 +256,7 @@ class Podcast(Media): release_date = models.DateField() class Meta: - ordering = ('release_date',) # overridden in PodcastAdmin + ordering = ('release_date',) # overridden in PodcastAdmin class Vodcast(Media): diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 0aa8e98933..4b36f8bd32 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -911,7 +911,7 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCas self.assertSelectOptions(to_box, [str(self.peter.id), str(self.jason.id)]) - input.send_keys([Keys.BACK_SPACE]) # Clear text box + input.send_keys([Keys.BACK_SPACE]) # Clear text box self.assertSelectOptions(from_box, [str(self.arthur.id), str(self.bob.id), str(self.cliff.id), str(self.jenny.id), @@ -922,7 +922,7 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCas # Save and check that everything is properly stored in the database --- self.selenium.find_element_by_xpath('//input[@value="Save"]').click() self.wait_page_loaded() - self.school = models.School.objects.get(id=self.school.id) # Reload from database + self.school = models.School.objects.get(id=self.school.id) # Reload from database self.assertEqual(list(self.school.students.all()), [self.jason, self.peter]) self.assertEqual(list(self.school.alumni.all()), diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 8e192bd082..be42a13181 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -70,7 +70,7 @@ class AggregationTests(TestCase): Regression test for #11916: Extra params + aggregation creates incorrect SQL. """ - #oracle doesn't support subqueries in group by clause + # oracle doesn't support subqueries in group by clause shortest_book_sql = """ SELECT name FROM aggregation_regress_book b diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 0c6ae91553..a79d4d9fac 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -1486,7 +1486,7 @@ class CacheI18nTest(TestCase): request = self._get_request() response = HttpResponse() with timezone.override(CustomTzName()): - CustomTzName.name = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string + CustomTzName.name = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string sanitized_name = 'Hora_estndar_de_Argentina' self.assertIn(sanitized_name, learn_cache_key(request, response), "Cache keys should include the time zone name when time zones are active") @@ -1645,9 +1645,9 @@ class CacheMiddlewareTest(IgnoreDeprecationWarningsMixin, TestCase): # First, test with "defaults": as_view_decorator = CacheMiddleware(cache_alias=None, key_prefix=None) - self.assertEqual(as_view_decorator.cache_timeout, 300) # Timeout value for 'default' cache, i.e. 300 + self.assertEqual(as_view_decorator.cache_timeout, 300) # Timeout value for 'default' cache, i.e. 300 self.assertEqual(as_view_decorator.key_prefix, '') - self.assertEqual(as_view_decorator.cache_alias, 'default') # Value of DEFAULT_CACHE_ALIAS from django.core.cache + self.assertEqual(as_view_decorator.cache_alias, 'default') # Value of DEFAULT_CACHE_ALIAS from django.core.cache self.assertEqual(as_view_decorator.cache_anonymous_only, False) # Next, test with custom values: diff --git a/tests/comment_tests/tests/test_moderation_views.py b/tests/comment_tests/tests/test_moderation_views.py index 62007e43fb..b70b01ed16 100644 --- a/tests/comment_tests/tests/test_moderation_views.py +++ b/tests/comment_tests/tests/test_moderation_views.py @@ -304,12 +304,12 @@ class AdminActionsTests(CommentTestCase): makeModerator("normaluser") self.client.login(username="normaluser", password="normaluser") with translation.override('en'): - #Test approving + # Test approving self.performActionAndCheckMessage('approve_comments', one_comment, '1 comment was successfully approved') self.performActionAndCheckMessage('approve_comments', many_comments, '3 comments were successfully approved') - #Test flagging + # Test flagging self.performActionAndCheckMessage('flag_comments', one_comment, '1 comment was successfully flagged') self.performActionAndCheckMessage('flag_comments', many_comments, '3 comments were successfully flagged') - #Test removing + # Test removing self.performActionAndCheckMessage('remove_comments', one_comment, '1 comment was successfully removed') self.performActionAndCheckMessage('remove_comments', many_comments, '3 comments were successfully removed') diff --git a/tests/datatypes/tests.py b/tests/datatypes/tests.py index 41e8a2d5d3..3cd954d3ad 100644 --- a/tests/datatypes/tests.py +++ b/tests/datatypes/tests.py @@ -37,7 +37,7 @@ class DataTypesTestCase(TestCase): self.assertEqual(d2.consumed_at, datetime.datetime(2007, 4, 20, 16, 19, 59)) def test_time_field(self): - #Test for ticket #12059: TimeField wrongly handling datetime.datetime object. + # Test for ticket #12059: TimeField wrongly handling datetime.datetime object. d = Donut(name='Apple Fritter') d.baked_time = datetime.datetime(year=2007, month=4, day=20, hour=16, minute=19, second=59) d.save() diff --git a/tests/file_uploads/uploadhandler.py b/tests/file_uploads/uploadhandler.py index b30ef136e9..2d4e52e4d5 100644 --- a/tests/file_uploads/uploadhandler.py +++ b/tests/file_uploads/uploadhandler.py @@ -11,7 +11,7 @@ class QuotaUploadHandler(FileUploadHandler): (5MB) is uploaded. """ - QUOTA = 5 * 2**20 # 5 MB + QUOTA = 5 * 2**20 # 5 MB def __init__(self, request=None): super(QuotaUploadHandler, self).__init__(request) diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index aecf8f32d5..b30742106b 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -938,7 +938,7 @@ class FormsTestCase(TestCase): class UserRegistration(Form): username = CharField(max_length=10) # uses TextInput by default password = CharField(max_length=10, widget=PasswordInput) - realname = CharField(max_length=10, widget=TextInput) # redundantly define widget, just to test + realname = CharField(max_length=10, widget=TextInput) # redundantly define widget, just to test address = CharField() # no max_length defined here p = UserRegistration(auto_id=False) diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index 784724bf41..cf721b5510 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -198,10 +198,10 @@ class FormsFormsetTestCase(TestCase): # number of forms to be completed. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': '', 'choices-0-votes': '', 'choices-1-choice': '', @@ -251,10 +251,10 @@ class FormsFormsetTestCase(TestCase): # We can just fill out one of the forms. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-1-choice': '', @@ -275,10 +275,10 @@ class FormsFormsetTestCase(TestCase): # value in the returned data is not checked) data = { - 'choices-TOTAL_FORMS': '2', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored + 'choices-TOTAL_FORMS': '2', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', @@ -297,10 +297,10 @@ class FormsFormsetTestCase(TestCase): # value in the returned data is not checked) data = { - 'choices-TOTAL_FORMS': '2', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms - should be ignored + 'choices-TOTAL_FORMS': '2', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms - should be ignored 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', @@ -316,14 +316,14 @@ class FormsFormsetTestCase(TestCase): # And once again, if we try to partially complete a form, validation will fail. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-1-choice': 'The Decemberists', - 'choices-1-votes': '', # missing value + 'choices-1-votes': '', # missing value 'choices-2-choice': '', 'choices-2-votes': '', } @@ -388,10 +388,10 @@ class FormsFormsetTestCase(TestCase): # 'on'. Let's go ahead and delete Fergie. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '2', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '2', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-DELETE': '', @@ -416,10 +416,10 @@ class FormsFormsetTestCase(TestCase): field = IntegerField(min_value=100) data = { - 'check-TOTAL_FORMS': '3', # the number of forms rendered - 'check-INITIAL_FORMS': '2', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'check-MAX_NUM_FORMS': '0', # max number of forms + 'check-TOTAL_FORMS': '3', # the number of forms rendered + 'check-INITIAL_FORMS': '2', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'check-MAX_NUM_FORMS': '0', # max number of forms 'check-0-field': '200', 'check-0-DELETE': '', 'check-1-field': '50', @@ -447,7 +447,7 @@ class FormsFormsetTestCase(TestCase): can_delete=True) p = PeopleForm( - {'form-0-name': '', 'form-0-DELETE': 'on', # no name! + {'form-0-name': '', 'form-0-DELETE': 'on', # no name! 'form-TOTAL_FORMS': 1, 'form-INITIAL_FORMS': 1, 'form-MIN_NUM_FORMS': 0, 'form-MAX_NUM_FORMS': 1}) @@ -484,10 +484,10 @@ class FormsFormsetTestCase(TestCase):
  • Order:
  • """) data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '2', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '2', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-ORDER': '1', @@ -517,10 +517,10 @@ class FormsFormsetTestCase(TestCase): # they will be sorted below everything else. data = { - 'choices-TOTAL_FORMS': '4', # the number of forms rendered - 'choices-INITIAL_FORMS': '3', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '4', # the number of forms rendered + 'choices-INITIAL_FORMS': '3', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-ORDER': '1', @@ -554,10 +554,10 @@ class FormsFormsetTestCase(TestCase): # Ordering should work with blank fieldsets. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms } ChoiceFormSet = formset_factory(Choice, can_order=True) @@ -607,10 +607,10 @@ class FormsFormsetTestCase(TestCase): # Let's delete Fergie, and put The Decemberists ahead of Calexico. data = { - 'choices-TOTAL_FORMS': '4', # the number of forms rendered - 'choices-INITIAL_FORMS': '3', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '4', # the number of forms rendered + 'choices-INITIAL_FORMS': '3', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-ORDER': '1', @@ -653,7 +653,7 @@ class FormsFormsetTestCase(TestCase): p = PeopleForm({ 'form-0-name': '', - 'form-0-DELETE': 'on', # no name! + 'form-0-DELETE': 'on', # no name! 'form-TOTAL_FORMS': 1, 'form-INITIAL_FORMS': 1, 'form-MIN_NUM_FORMS': 0, @@ -671,10 +671,10 @@ class FormsFormsetTestCase(TestCase): # We start out with a some duplicate data. data = { - 'drinks-TOTAL_FORMS': '2', # the number of forms rendered - 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data - 'drinks-MIN_NUM_FORMS': '0', # min number of forms - 'drinks-MAX_NUM_FORMS': '0', # max number of forms + 'drinks-TOTAL_FORMS': '2', # the number of forms rendered + 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data + 'drinks-MIN_NUM_FORMS': '0', # min number of forms + 'drinks-MAX_NUM_FORMS': '0', # max number of forms 'drinks-0-name': 'Gin and Tonic', 'drinks-1-name': 'Gin and Tonic', } @@ -691,10 +691,10 @@ class FormsFormsetTestCase(TestCase): # Make sure we didn't break the valid case. data = { - 'drinks-TOTAL_FORMS': '2', # the number of forms rendered - 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data - 'drinks-MIN_NUM_FORMS': '0', # min number of forms - 'drinks-MAX_NUM_FORMS': '0', # max number of forms + 'drinks-TOTAL_FORMS': '2', # the number of forms rendered + 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data + 'drinks-MIN_NUM_FORMS': '0', # min number of forms + 'drinks-MAX_NUM_FORMS': '0', # max number of forms 'drinks-0-name': 'Gin and Tonic', 'drinks-1-name': 'Bloody Mary', } @@ -859,10 +859,10 @@ class FormsFormsetTestCase(TestCase): # Regression test for #12878 ################################################# data = { - 'drinks-TOTAL_FORMS': '2', # the number of forms rendered - 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data - 'drinks-MIN_NUM_FORMS': '0', # min number of forms - 'drinks-MAX_NUM_FORMS': '0', # max number of forms + 'drinks-TOTAL_FORMS': '2', # the number of forms rendered + 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data + 'drinks-MIN_NUM_FORMS': '0', # min number of forms + 'drinks-MAX_NUM_FORMS': '0', # max number of forms 'drinks-0-name': 'Gin and Tonic', 'drinks-1-name': 'Gin and Tonic', } @@ -951,7 +951,7 @@ class FormsFormsetTestCase(TestCase): data = { 'choices-TOTAL_FORMS': '1', # number of forms rendered 'choices-INITIAL_FORMS': '0', # number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MIN_NUM_FORMS': '0', # min number of forms 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', @@ -972,7 +972,7 @@ class FormsFormsetTestCase(TestCase): { 'choices-TOTAL_FORMS': '4', 'choices-INITIAL_FORMS': '0', - 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MIN_NUM_FORMS': '0', # min number of forms 'choices-MAX_NUM_FORMS': '4', 'choices-0-choice': 'Zero', 'choices-0-votes': '0', @@ -1004,7 +1004,7 @@ class FormsFormsetTestCase(TestCase): { 'choices-TOTAL_FORMS': '4', 'choices-INITIAL_FORMS': '0', - 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MIN_NUM_FORMS': '0', # min number of forms 'choices-MAX_NUM_FORMS': '4', 'choices-0-choice': 'Zero', 'choices-0-votes': '0', @@ -1070,9 +1070,9 @@ class FormsFormsetTestCase(TestCase): def test_formset_total_error_count_with_non_form_errors(self): data = { - 'choices-TOTAL_FORMS': '2', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored + 'choices-TOTAL_FORMS': '2', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', @@ -1089,10 +1089,10 @@ class FormsFormsetTestCase(TestCase): data = { - 'choices-TOTAL_FORMS': '1', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '1', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', } @@ -1156,7 +1156,7 @@ class TestIsBoundBehavior(TestCase): 'form-0-title': 'Test', 'form-0-pub_date': '1904-06-16', 'form-1-title': 'Test', - 'form-1-pub_date': '', # <-- this date is missing but required + 'form-1-pub_date': '', # <-- this date is missing but required } formset = ArticleFormSet(data) self.assertFalse(formset.is_valid()) diff --git a/tests/forms_tests/tests/test_input_formats.py b/tests/forms_tests/tests/test_input_formats.py index 95308d4eeb..25b491a499 100644 --- a/tests/forms_tests/tests/test_input_formats.py +++ b/tests/forms_tests/tests/test_input_formats.py @@ -191,7 +191,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase): result = f.clean('13.30.05') self.assertEqual(result, time(13, 30, 5)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "01:30:05 PM") @@ -385,7 +385,7 @@ class LocalizedDateTests(SimpleTestCase): result = f.clean('12.21.2010') self.assertEqual(result, date(2010, 12, 21)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "21.12.2010") @@ -478,7 +478,7 @@ class CustomDateInputFormatsTests(SimpleTestCase): result = f.clean('12.21.2010') self.assertEqual(result, date(2010, 12, 21)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "21.12.2010") @@ -671,7 +671,7 @@ class LocalizedDateTimeTests(SimpleTestCase): result = f.clean('13.30.05 12.21.2010') self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "21.12.2010 13:30:05") @@ -764,7 +764,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase): result = f.clean('12.21.2010 13:30:05') self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "01:30:05 PM 21/12/2010") diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py index 1cf2f492a4..23f17f7b22 100644 --- a/tests/generic_inline_admin/tests.py +++ b/tests/generic_inline_admin/tests.py @@ -72,7 +72,7 @@ class GenericAdminViewTest(TestCase): "generic_inline_admin-media-content_type-object_id-MAX_NUM_FORMS": "0", } response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/add/', post_data) - self.assertEqual(response.status_code, 302) # redirect somewhere + self.assertEqual(response.status_code, 302) # redirect somewhere def testBasicEditPost(self): """ @@ -93,7 +93,7 @@ class GenericAdminViewTest(TestCase): } url = '/generic_inline_admin/admin/generic_inline_admin/episode/%d/' % self.episode_pk response = self.client.post(url, post_data) - self.assertEqual(response.status_code, 302) # redirect somewhere + self.assertEqual(response.status_code, 302) # redirect somewhere def testGenericInlineFormset(self): EpisodeMediaFormSet = generic_inlineformset_factory(Media, can_delete=False, exclude=['description', 'keywords'], extra=3) @@ -208,7 +208,7 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase): response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/contact/add/') self.assertEqual(response.status_code, 200) response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/contact/add/', post_data) - self.assertEqual(response.status_code, 302) # redirect somewhere + self.assertEqual(response.status_code, 302) # redirect somewhere class NoInlineDeletionTest(TestCase): urls = "generic_inline_admin.urls" diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 1e099d2bb4..820aecf1f7 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -315,11 +315,11 @@ class HttpResponseTests(unittest.TestCase): self.assertEqual(r.get('test'), None) def test_non_string_content(self): - #Bug 16494: HttpResponse should behave consistently with non-strings + # Bug 16494: HttpResponse should behave consistently with non-strings r = HttpResponse(12345) self.assertEqual(r.content, b'12345') - #test content via property + # test content via property r = HttpResponse() r.content = 12345 self.assertEqual(r.content, b'12345') @@ -328,7 +328,7 @@ class HttpResponseTests(unittest.TestCase): r = HttpResponse(['abc', 'def', 'ghi']) self.assertEqual(r.content, b'abcdefghi') - #test iter content via property + # test iter content via property r = HttpResponse() r.content = ['idan', 'alex', 'jacob'] self.assertEqual(r.content, b'idanalexjacob') @@ -337,13 +337,13 @@ class HttpResponseTests(unittest.TestCase): r.content = [1, 2, 3] self.assertEqual(r.content, b'123') - #test odd inputs + # test odd inputs r = HttpResponse() r.content = ['1', '2', 3, '\u079e'] #'\xde\x9e' == unichr(1950).encode('utf-8') self.assertEqual(r.content, b'123\xde\x9e') - #with Content-Encoding header + # with Content-Encoding header r = HttpResponse() r['Content-Encoding'] = 'winning' r.content = [b'abc', b'def'] @@ -573,8 +573,8 @@ class CookieTests(unittest.TestCase): """ c = SimpleCookie() c['test'] = "An,awkward;value" - self.assertTrue(";" not in c.output().rstrip(';')) # IE compat - self.assertTrue("," not in c.output().rstrip(';')) # Safari compat + self.assertTrue(";" not in c.output().rstrip(';')) # IE compat + self.assertTrue("," not in c.output().rstrip(';')) # Safari compat def test_decode(self): """ diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index 04bc0a8632..18088e5e16 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -423,7 +423,7 @@ class LocationCommentsTests(ExtractorTests): # #21208 -- Leaky paths in comments on Windows e.g. #: path\to\file.html.py:123 bad_suffix = '.py' - bad_string = 'templates%stest.html%s' % (os.sep, bad_suffix) # + bad_string = 'templates%stest.html%s' % (os.sep, bad_suffix) self.assertFalse(bad_string in po_contents, '"%s" shouldn\'t be in final .po file.' % bad_string) diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index e8b3ac7b7d..b1f3de0ef9 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -735,7 +735,7 @@ class FormattingTests(TransRealMixin, TestCase): with self.settings(FORMAT_MODULE_PATH='i18n.other.locale'): with translation.override('de', deactivate=True): old = str("%r") % get_format_modules(reverse=True) - new = str("%r") % get_format_modules(reverse=True) # second try + new = str("%r") % get_format_modules(reverse=True) # second try self.assertEqual(new, old, 'Value returned by get_formats_modules() must be preserved between calls.') def test_localize_templatetag_and_filter(self): diff --git a/tests/invalid_models/invalid_models/models.py b/tests/invalid_models/invalid_models/models.py index 8e04a4d328..0c991dcf13 100644 --- a/tests/invalid_models/invalid_models/models.py +++ b/tests/invalid_models/invalid_models/models.py @@ -1,4 +1,4 @@ -#encoding=utf-8 +# encoding=utf-8 """ 26. Invalid models diff --git a/tests/m2m_and_m2o/tests.py b/tests/m2m_and_m2o/tests.py index ee5d77919f..35443e32e4 100644 --- a/tests/m2m_and_m2o/tests.py +++ b/tests/m2m_and_m2o/tests.py @@ -82,6 +82,6 @@ class RelatedObjectUnicodeTests(TestCase): """ m1 = UnicodeReferenceModel.objects.create() m2 = UnicodeReferenceModel.objects.create() - m2.others.add(m1) # used to cause an error (see ticket #6045) + m2.others.add(m1) # used to cause an error (see ticket #6045) m2.save() - list(m2.others.all()) # Force retrieval. + list(m2.others.all()) # Force retrieval. diff --git a/tests/max_lengths/tests.py b/tests/max_lengths/tests.py index feb3351cf7..5dd33fc80f 100644 --- a/tests/max_lengths/tests.py +++ b/tests/max_lengths/tests.py @@ -34,6 +34,6 @@ class MaxLengthORMTests(unittest.TestCase): for field in ("email", "vcard", "homepage", "avatar"): new_args = args.copy() - new_args[field] = "X" * 250 # a value longer than any of the default fields could hold. + new_args[field] = "X" * 250 # a value longer than any of the default fields could hold. p = PersonWithCustomMaxLengths.objects.create(**new_args) self.assertEqual(getattr(p, field), ("X" * 250)) diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 2da852d11e..ddc7a4ceef 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -318,7 +318,7 @@ class ModelFormBaseTest(TestCase): class Meta: model = Category - fields = [] # url will still appear, since it is explicit above + fields = [] # url will still appear, since it is explicit above self.assertIsInstance(ReplaceField.base_fields['url'], forms.fields.BooleanField) @@ -348,7 +348,7 @@ class ModelFormBaseTest(TestCase): class CategoryForm(forms.ModelForm): class Meta: model = Category - fields = ('url') # note the missing comma + fields = ('url') # note the missing comma def test_exclude_fields(self): class ExcludeFields(forms.ModelForm): @@ -374,7 +374,7 @@ class ModelFormBaseTest(TestCase): class CategoryForm(forms.ModelForm): class Meta: model = Category - exclude = ('url') # note the missing comma + exclude = ('url') # note the missing comma def test_confused_form(self): class ConfusedForm(forms.ModelForm): @@ -415,7 +415,7 @@ class ModelFormBaseTest(TestCase): ) def test_bad_form(self): - #First class with a Meta class wins... + # First class with a Meta class wins... class BadForm(ArticleForm, BaseCategoryForm): pass @@ -818,10 +818,10 @@ class ModelToDictTests(TestCase): with self.assertNumQueries(1): d = model_to_dict(art) - #Ensure all many-to-many categories appear in model_to_dict + # Ensure all many-to-many categories appear in model_to_dict for c in categories: self.assertIn(c.pk, d['categories']) - #Ensure many-to-many relation appears as a list + # Ensure many-to-many relation appears as a list self.assertIsInstance(d['categories'], list) class OldFormForXTests(TestCase): diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py index 4c57e0f549..ac9d68132e 100644 --- a/tests/model_formsets/tests.py +++ b/tests/model_formsets/tests.py @@ -54,8 +54,8 @@ class DeletionTests(TestCase): 'form-0-id': six.text_type(poet.id), 'form-0-name': 'test', 'form-1-id': '', - 'form-1-name': 'x' * 1000, # Too long - 'form-1-id': six.text_type(poet.id), # Violate unique constraint + 'form-1-name': 'x' * 1000, # Too long + 'form-1-id': six.text_type(poet.id), # Violate unique constraint 'form-1-name': 'test2', } formset = PoetFormSet(data, queryset=Poet.objects.all()) @@ -145,9 +145,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'form-TOTAL_FORMS': '3', # the number of forms rendered - 'form-INITIAL_FORMS': '0', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '3', # the number of forms rendered + 'form-INITIAL_FORMS': '0', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-name': 'Charles Baudelaire', 'form-1-name': 'Arthur Rimbaud', 'form-2-name': '', @@ -183,9 +183,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'form-TOTAL_FORMS': '3', # the number of forms rendered - 'form-INITIAL_FORMS': '2', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '3', # the number of forms rendered + 'form-INITIAL_FORMS': '2', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(author2.id), 'form-0-name': 'Arthur Rimbaud', 'form-1-id': str(author1.id), @@ -227,9 +227,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'form-TOTAL_FORMS': '4', # the number of forms rendered - 'form-INITIAL_FORMS': '3', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '4', # the number of forms rendered + 'form-INITIAL_FORMS': '3', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(author2.id), 'form-0-name': 'Arthur Rimbaud', 'form-1-id': str(author1.id), @@ -253,9 +253,9 @@ class ModelFormsetTest(TestCase): # Let's edit a record to ensure save only returns that one record. data = { - 'form-TOTAL_FORMS': '4', # the number of forms rendered - 'form-INITIAL_FORMS': '3', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '4', # the number of forms rendered + 'form-INITIAL_FORMS': '3', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(author2.id), 'form-0-name': 'Walt Whitman', 'form-1-id': str(author1.id), @@ -291,9 +291,9 @@ class ModelFormsetTest(TestCase): AuthorMeetingFormSet = modelformset_factory(AuthorMeeting, fields="__all__", extra=1, can_delete=True) data = { - 'form-TOTAL_FORMS': '2', # the number of forms rendered - 'form-INITIAL_FORMS': '1', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '2', # the number of forms rendered + 'form-INITIAL_FORMS': '1', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(meeting.id), 'form-0-name': '2nd Tuesday of the Week Meeting', 'form-0-authors': [author2.id, author1.id, author3.id, author4.id], @@ -379,9 +379,9 @@ class ModelFormsetTest(TestCase): PoetFormSet = modelformset_factory(Poet, fields="__all__", form=PoetForm) data = { - 'form-TOTAL_FORMS': '3', # the number of forms rendered - 'form-INITIAL_FORMS': '0', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '3', # the number of forms rendered + 'form-INITIAL_FORMS': '0', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-name': 'Walt Whitman', 'form-1-name': 'Charles Baudelaire', 'form-2-name': '', @@ -445,9 +445,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'form-TOTAL_FORMS': '1', # the number of forms rendered - 'form-INITIAL_FORMS': '0', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '1', # the number of forms rendered + 'form-INITIAL_FORMS': '0', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-author_ptr': '', 'form-0-name': 'Ernest Hemingway', 'form-0-write_speed': '10', @@ -471,9 +471,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'form-TOTAL_FORMS': '2', # the number of forms rendered - 'form-INITIAL_FORMS': '1', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '2', # the number of forms rendered + 'form-INITIAL_FORMS': '1', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-author_ptr': hemingway_id, 'form-0-name': 'Ernest Hemingway', 'form-0-write_speed': '10', @@ -503,9 +503,9 @@ class ModelFormsetTest(TestCase): '

    ' % author.id) data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-title': 'Les Fleurs du Mal', 'book_set-1-title': '', 'book_set-2-title': '', @@ -537,9 +537,9 @@ class ModelFormsetTest(TestCase): '

    ' % author.id) data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': str(book1.id), 'book_set-0-title': 'Les Fleurs du Mal', 'book_set-1-title': 'Les Paradis Artificiels', @@ -568,9 +568,9 @@ class ModelFormsetTest(TestCase): Author.objects.create(name='Charles Baudelaire') data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '2', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '2', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': '1', 'book_set-0-title': 'Les Fleurs du Mal', 'book_set-1-id': '2', @@ -613,9 +613,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'bookwithcustompk_set-TOTAL_FORMS': '1', # the number of forms rendered - 'bookwithcustompk_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'bookwithcustompk_set-MAX_NUM_FORMS': '', # the max number of forms + 'bookwithcustompk_set-TOTAL_FORMS': '1', # the number of forms rendered + 'bookwithcustompk_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'bookwithcustompk_set-MAX_NUM_FORMS': '', # the max number of forms 'bookwithcustompk_set-0-my_pk': '77777', 'bookwithcustompk_set-0-title': 'Les Fleurs du Mal', } @@ -645,9 +645,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'alternatebook_set-TOTAL_FORMS': '1', # the number of forms rendered - 'alternatebook_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'alternatebook_set-MAX_NUM_FORMS': '', # the max number of forms + 'alternatebook_set-TOTAL_FORMS': '1', # the number of forms rendered + 'alternatebook_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'alternatebook_set-MAX_NUM_FORMS': '', # the max number of forms 'alternatebook_set-0-title': 'Flowers of Evil', 'alternatebook_set-0-notes': 'English translation of Les Fleurs du Mal' } @@ -670,9 +670,9 @@ class ModelFormsetTest(TestCase): author = Author.objects.create(pk=1, name='Charles Baudelaire') data = { - 'bookwithoptionalalteditor_set-TOTAL_FORMS': '2', # the number of forms rendered - 'bookwithoptionalalteditor_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'bookwithoptionalalteditor_set-MAX_NUM_FORMS': '', # the max number of forms + 'bookwithoptionalalteditor_set-TOTAL_FORMS': '2', # the number of forms rendered + 'bookwithoptionalalteditor_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'bookwithoptionalalteditor_set-MAX_NUM_FORMS': '', # the max number of forms 'bookwithoptionalalteditor_set-0-author': '1', 'bookwithoptionalalteditor_set-0-title': 'Les Fleurs du Mal', 'bookwithoptionalalteditor_set-1-author': '1', @@ -708,9 +708,9 @@ class ModelFormsetTest(TestCase): PoemFormSet = inlineformset_factory(Poet, Poem, form=PoemForm, fields="__all__") data = { - 'poem_set-TOTAL_FORMS': '3', # the number of forms rendered - 'poem_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'poem_set-MAX_NUM_FORMS': '', # the max number of forms + 'poem_set-TOTAL_FORMS': '3', # the number of forms rendered + 'poem_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'poem_set-MAX_NUM_FORMS': '', # the max number of forms 'poem_set-0-name': 'The Cloud in Trousers', 'poem_set-1-name': 'I', 'poem_set-2-name': '', @@ -743,9 +743,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'book_set-TOTAL_FORMS': '5', # the number of forms rendered - 'book_set-INITIAL_FORMS': '3', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '5', # the number of forms rendered + 'book_set-INITIAL_FORMS': '3', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': str(book1.id), 'book_set-0-title': 'Les Paradis Artificiels', 'book_set-1-id': str(book2.id), @@ -768,9 +768,9 @@ class ModelFormsetTest(TestCase): '

    ') data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': str(book3.id), 'book_set-0-title': 'Flowers of Evil', 'book_set-1-title': 'Revue des deux mondes', @@ -958,7 +958,7 @@ class ModelFormsetTest(TestCase): data = { 'form-TOTAL_FORMS': '2', 'form-INITIAL_FORMS': '0', - 'form-MAX_NUM_FORMS': '2', # should be ignored + 'form-MAX_NUM_FORMS': '2', # should be ignored 'form-0-price': '12.00', 'form-0-quantity': '1', 'form-1-price': '24.00', @@ -1064,7 +1064,7 @@ class ModelFormsetTest(TestCase): # default. This is required to ensure the value is tested for change correctly # when determine what extra forms have changed to save. - self.assertEqual(len(formset.forms), 1) # this formset only has one form + self.assertEqual(len(formset.forms), 1) # this formset only has one form form = formset.forms[0] now = form.fields['date_joined'].initial() result = form.as_p() diff --git a/tests/modeladmin/models.py b/tests/modeladmin/models.py index 4789e35a43..27f54821d6 100644 --- a/tests/modeladmin/models.py +++ b/tests/modeladmin/models.py @@ -35,7 +35,7 @@ class ValidationTestModel(models.Model): is_active = models.BooleanField(default=False) pub_date = models.DateTimeField() band = models.ForeignKey(Band) - no = models.IntegerField(verbose_name="Number", blank=True, null=True) # This field is intentionally 2 characters long. See #16080. + no = models.IntegerField(verbose_name="Number", blank=True, null=True) # This field is intentionally 2 characters long. See #16080. def decade_published_in(self): return self.pub_date.strftime('%Y')[:3] + "0's" diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index f7c5862167..679c7e33f5 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -1785,10 +1785,10 @@ class RouterAttributeErrorTestCase(TestCase): def test_attribute_error_read(self): "Check that the AttributeError from AttributeErrorRouter bubbles up" - router.routers = [] # Reset routers so we can save a Book instance + router.routers = [] # Reset routers so we can save a Book instance b = Book.objects.create(title="Pro Django", published=datetime.date(2008, 12, 16)) - router.routers = [AttributeErrorRouter()] # Install our router + router.routers = [AttributeErrorRouter()] # Install our router self.assertRaises(AttributeError, Book.objects.get, pk=b.pk) def test_attribute_error_save(self): @@ -1800,22 +1800,22 @@ class RouterAttributeErrorTestCase(TestCase): def test_attribute_error_delete(self): "Check that the AttributeError from AttributeErrorRouter bubbles up" - router.routers = [] # Reset routers so we can save our Book, Person instances + router.routers = [] # Reset routers so we can save our Book, Person instances b = Book.objects.create(title="Pro Django", published=datetime.date(2008, 12, 16)) p = Person.objects.create(name="Marty Alchin") b.authors = [p] b.editor = p - router.routers = [AttributeErrorRouter()] # Install our router + router.routers = [AttributeErrorRouter()] # Install our router self.assertRaises(AttributeError, b.delete) def test_attribute_error_m2m(self): "Check that the AttributeError from AttributeErrorRouter bubbles up" - router.routers = [] # Reset routers so we can save our Book, Person instances + router.routers = [] # Reset routers so we can save our Book, Person instances b = Book.objects.create(title="Pro Django", published=datetime.date(2008, 12, 16)) p = Person.objects.create(name="Marty Alchin") - router.routers = [AttributeErrorRouter()] # Install our router + router.routers = [AttributeErrorRouter()] # Install our router self.assertRaises(AttributeError, setattr, b, 'authors', [p]) class ModelMetaRouter(object): diff --git a/tests/null_fk/tests.py b/tests/null_fk/tests.py index 29e1fcb4bb..d5b68658ff 100644 --- a/tests/null_fk/tests.py +++ b/tests/null_fk/tests.py @@ -50,7 +50,7 @@ class NullFkTests(TestCase): item = Item.objects.create(title='Some Item') pv = PropertyValue.objects.create(label='Some Value') item.props.create(key='a', value=pv) - item.props.create(key='b') # value=NULL + item.props.create(key='b') # value=NULL q1 = Q(props__key='a', props__value=pv) q2 = Q(props__key='b', props__value__isnull=True) diff --git a/tests/queries/tests.py b/tests/queries/tests.py index c1d461f485..bdff134b27 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -2224,12 +2224,12 @@ class ConditionalTests(BaseQuerysetTest): self.assertRaisesMessage( FieldError, 'Infinite loop caused by ordering.', - lambda: list(LoopX.objects.all()) # Force queryset evaluation with list() + lambda: list(LoopX.objects.all()) # Force queryset evaluation with list() ) self.assertRaisesMessage( FieldError, 'Infinite loop caused by ordering.', - lambda: list(LoopZ.objects.all()) # Force queryset evaluation with list() + lambda: list(LoopZ.objects.all()) # Force queryset evaluation with list() ) # Note that this doesn't cause an infinite loop, since the default diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py index 7ce4348c1a..077ac6f59c 100644 --- a/tests/queryset_pickle/tests.py +++ b/tests/queryset_pickle/tests.py @@ -10,7 +10,7 @@ from .models import Group, Event, Happening, Container, M2MModel class PickleabilityTestCase(TestCase): def setUp(self): - Happening.objects.create() # make sure the defaults are working (#20158) + Happening.objects.create() # make sure the defaults are working (#20158) def assert_pickles(self, qs): self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs)) diff --git a/tests/requests/tests.py b/tests/requests/tests.py index 137b324588..c00f5bb5e0 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -524,7 +524,7 @@ class HostValidationTests(SimpleTestCase): '12.34.56.78:443', '[2001:19f0:feee::dead:beef:cafe]', '[2001:19f0:feee::dead:beef:cafe]:8080', - 'xn--4ca9at.com', # Punnycode for öäü.com + 'xn--4ca9at.com', # Punnycode for öäü.com 'anything.multitenant.com', 'multitenant.com', 'insensitive.com', @@ -594,7 +594,7 @@ class HostValidationTests(SimpleTestCase): '12.34.56.78:443', '[2001:19f0:feee::dead:beef:cafe]', '[2001:19f0:feee::dead:beef:cafe]:8080', - 'xn--4ca9at.com', # Punnycode for öäü.com + 'xn--4ca9at.com', # Punnycode for öäü.com ] for host in legit_hosts: @@ -636,11 +636,11 @@ class HostValidationTests(SimpleTestCase): msg_suggestion = msg_invalid_host + "You may need to add %r to ALLOWED_HOSTS." msg_suggestion2 = msg_invalid_host + "The domain name provided is not valid according to RFC 1034/1035" - for host in [ # Valid-looking hosts + for host in [ # Valid-looking hosts 'example.com', '12.34.56.78', '[2001:19f0:feee::dead:beef:cafe]', - 'xn--4ca9at.com', # Punnycode for öäü.com + 'xn--4ca9at.com', # Punnycode for öäü.com ]: request = HttpRequest() request.META = {'HTTP_HOST': host} @@ -650,7 +650,7 @@ class HostValidationTests(SimpleTestCase): request.get_host ) - for domain, port in [ # Valid-looking hosts with a port number + for domain, port in [ # Valid-looking hosts with a port number ('example.com', 80), ('12.34.56.78', 443), ('[2001:19f0:feee::dead:beef:cafe]', 8080), diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index a56abe0b6b..7f65921aff 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -256,21 +256,21 @@ The end."""), (data_obj, 301, Anchor, "Anchor 2"), (data_obj, 302, UniqueAnchor, "UAnchor 1"), - (fk_obj, 400, FKData, 300), # Post reference - (fk_obj, 401, FKData, 500), # Pre reference - (fk_obj, 402, FKData, None), # Empty reference + (fk_obj, 400, FKData, 300), # Post reference + (fk_obj, 401, FKData, 500), # Pre reference + (fk_obj, 402, FKData, None), # Empty reference - (m2m_obj, 410, M2MData, []), # Empty set - (m2m_obj, 411, M2MData, [300, 301]), # Post reference - (m2m_obj, 412, M2MData, [500, 501]), # Pre reference - (m2m_obj, 413, M2MData, [300, 301, 500, 501]), # Pre and Post reference + (m2m_obj, 410, M2MData, []), # Empty set + (m2m_obj, 411, M2MData, [300, 301]), # Post reference + (m2m_obj, 412, M2MData, [500, 501]), # Pre reference + (m2m_obj, 413, M2MData, [300, 301, 500, 501]), # Pre and Post reference - (o2o_obj, None, O2OData, 300), # Post reference - (o2o_obj, None, O2OData, 500), # Pre reference + (o2o_obj, None, O2OData, 300), # Post reference + (o2o_obj, None, O2OData, 500), # Pre reference - (fk_obj, 430, FKSelfData, 431), # Pre reference - (fk_obj, 431, FKSelfData, 430), # Post reference - (fk_obj, 432, FKSelfData, None), # Empty reference + (fk_obj, 430, FKSelfData, 431), # Pre reference + (fk_obj, 431, FKSelfData, 430), # Post reference + (fk_obj, 432, FKSelfData, None), # Empty reference (m2m_obj, 440, M2MSelfData, []), (m2m_obj, 441, M2MSelfData, []), @@ -288,7 +288,7 @@ The end."""), (im2m_obj, 470, M2MIntermediateData, None), - #testing post- and prereferences and extra fields + # testing post- and prereferences and extra fields (im_obj, 480, Intermediate, {'right': 300, 'left': 470}), (im_obj, 481, Intermediate, {'right': 300, 'left': 490}), (im_obj, 482, Intermediate, {'right': 500, 'left': 470}), diff --git a/tests/template_tests/filters.py b/tests/template_tests/filters.py index 36a519fd90..f9e59fd542 100644 --- a/tests/template_tests/filters.py +++ b/tests/template_tests/filters.py @@ -352,7 +352,7 @@ def get_filter_tests(): 'date01': (r'{{ d|date:"m" }}', {'d': datetime(2008, 1, 1)}, '01'), 'date02': (r'{{ d|date }}', {'d': datetime(2008, 1, 1)}, 'Jan. 1, 2008'), - #Ticket 9520: Make sure |date doesn't blow up on non-dates + # Ticket 9520: Make sure |date doesn't blow up on non-dates 'date03': (r'{{ d|date:"m" }}', {'d': 'fail_string'}, ''), # ISO date formats 'date04': (r'{{ d|date:"o" }}', {'d': datetime(2008, 12, 29)}, '2009'), diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index a39f952e4c..041a17c9f1 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -840,7 +840,7 @@ class TemplateTests(TransRealMixin, TestCase): # Numbers as filter arguments should work 'filter-syntax19': ('{{ var|truncatewords:1 }}', {"var": "hello world"}, "hello ..."), - #filters should accept empty string constants + # filters should accept empty string constants 'filter-syntax20': ('{{ ""|default_if_none:"was none" }}', {}, ""), # Fail silently for non-callable attribute and dict lookups which diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py index cd59f50213..5e4673c3c5 100644 --- a/tests/test_client/tests.py +++ b/tests/test_client/tests.py @@ -438,7 +438,7 @@ class ClientTest(TestCase): "Request a page that is known to throw an error" self.assertRaises(KeyError, self.client.get, "/test_client/broken_view/") - #Try the same assertion, a different way + # Try the same assertion, a different way try: self.client.get('/test_client/broken_view/') self.fail('Should raise an error') diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py index 8a371cb52b..459c110803 100644 --- a/tests/test_client_regress/tests.py +++ b/tests/test_client_regress/tests.py @@ -121,14 +121,14 @@ class AssertContainsTests(TestCase): def test_unicode_contains(self): "Unicode characters can be found in template context" - #Regression test for #10183 + # Regression test for #10183 r = self.client.get('/test_client_regress/check_unicode/') self.assertContains(r, 'さかき') self.assertContains(r, b'\xe5\xb3\xa0'.decode('utf-8')) def test_unicode_not_contains(self): "Unicode characters can be searched for, and not found in template context" - #Regression test for #10183 + # Regression test for #10183 r = self.client.get('/test_client_regress/check_unicode/') self.assertNotContains(r, 'はたけ') self.assertNotContains(r, b'\xe3\x81\xaf\xe3\x81\x9f\xe3\x81\x91'.decode('utf-8')) @@ -1193,7 +1193,7 @@ class UnicodePayloadTests(TestCase): def test_unicode_payload_non_utf(self): "A non-ASCII unicode data as a non-UTF based encoding can be POSTed" - #Regression test for #10571 + # Regression test for #10571 json = '{"dog": "собака"}' response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json; charset=koi8-r") diff --git a/tests/view_tests/__init__.py b/tests/view_tests/__init__.py index 3f16dadae2..9030f07239 100644 --- a/tests/view_tests/__init__.py +++ b/tests/view_tests/__init__.py @@ -6,5 +6,5 @@ class BrokenException(Exception): except_args = (b'Broken!', # plain exception with ASCII text '¡Broken!', # non-ASCII unicode data - '¡Broken!'.encode('utf-8'), # non-ASCII, utf-8 encoded bytestring + '¡Broken!'.encode('utf-8'), # non-ASCII, utf-8 encoded bytestring b'\xa1Broken!', ) # non-ASCII, latin1 bytestring diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index b22c7aad43..225215e475 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -375,7 +375,7 @@ class ExceptionReportTestMixin(object): Asserts that potentially sensitive info are displayed in the email report. """ with self.settings(ADMINS=(('Admin', 'admin@fattie-breakie.com'),)): - mail.outbox = [] # Empty outbox + mail.outbox = [] # Empty outbox request = self.rf.post('/some_url/', self.breakfast_data) view(request) self.assertEqual(len(mail.outbox), 1) @@ -408,7 +408,7 @@ class ExceptionReportTestMixin(object): Asserts that certain sensitive info are not displayed in the email report. """ with self.settings(ADMINS=(('Admin', 'admin@fattie-breakie.com'),)): - mail.outbox = [] # Empty outbox + mail.outbox = [] # Empty outbox request = self.rf.post('/some_url/', self.breakfast_data) view(request) self.assertEqual(len(mail.outbox), 1) @@ -448,7 +448,7 @@ class ExceptionReportTestMixin(object): Asserts that no variables or POST parameters are displayed in the email report. """ with self.settings(ADMINS=(('Admin', 'admin@fattie-breakie.com'),)): - mail.outbox = [] # Empty outbox + mail.outbox = [] # Empty outbox request = self.rf.post('/some_url/', self.breakfast_data) view(request) self.assertEqual(len(mail.outbox), 1) diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py index 13e56d604b..128fb7cb07 100644 --- a/tests/view_tests/tests/test_defaults.py +++ b/tests/view_tests/tests/test_defaults.py @@ -10,8 +10,8 @@ from ..models import UrlArticle class DefaultsTests(TestCase): """Test django views in django/views/defaults.py""" fixtures = ['testdata.json'] - non_existing_urls = ['/views/non_existing_url/', # this is in urls.py - '/views/other_non_existing_url/'] # this NOT in urls.py + non_existing_urls = ['/views/non_existing_url/', # this is in urls.py + '/views/other_non_existing_url/'] # this NOT in urls.py def test_page_not_found(self): "A 404 status is returned by the page_not_found view"