diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-05-24 06:44:09 -0700 |
|---|---|---|
| committer | Jon Dufresne <jon.dufresne@gmail.com> | 2020-08-31 17:27:38 -0700 |
| commit | 3e3892f939031d58d98275ce8a237689225d299a (patch) | |
| tree | 93b64d7fd8aa1cc19335db11c915dfc59376eae9 /sqlparse/formatter.py | |
| parent | 28a2acdd9b307c95d2111f1f831b1a5afc634691 (diff) | |
| download | sqlparse-3e3892f939031d58d98275ce8a237689225d299a.tar.gz | |
Remove support for end-of-life Pythons
Python 2.7 and 3.4 are end-of-life. They are no longer receiving bug
fixes, including for security issues. Python 2.7 went EOL on 2020-01-01
and 3.4 on 2019-03-18. For additional details on support Python
versions, see:
Supported: https://devguide.python.org/#status-of-python-branches
EOL: https://devguide.python.org/devcycle/#end-of-life-branches
Removing support for EOL Pythons will reduce testing and maintenance
resources while allowing the library to move towards modern Python 3.
Using pypinfo, we can show the PyPI download statistics, showing less
than 10% of users are using Python 2.7.
| python_version | percent | download_count |
| -------------- | ------: | -------------: |
| 3.7 | 45.36% | 3,056,010 |
| 3.6 | 26.46% | 1,782,778 |
| 3.8 | 12.22% | 823,213 |
| 2.7 | 9.97% | 671,459 |
| 3.5 | 5.86% | 394,846 |
| 3.4 | 0.10% | 6,700 |
| 3.9 | 0.03% | 2,346 |
| 2.6 | 0.00% | 57 |
| 3.3 | 0.00% | 21 |
| 3.10 | 0.00% | 6 |
| Total | | 6,737,436 |
Library users who continue to use Python 2.7 will still be able to
install previous versions of sqlparse.
Compatibility shims have been dropped, simplifying the code.
Using pyupgrade, the codebase has been updated to take advantage of
modern syntax <https://github.com/asottile/pyupgrade>.
The wheel is no longer marked as "universal" as it is now Python 3 only.
Diffstat (limited to 'sqlparse/formatter.py')
| -rw-r--r-- | sqlparse/formatter.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/sqlparse/formatter.py b/sqlparse/formatter.py index 8962759..8016f87 100644 --- a/sqlparse/formatter.py +++ b/sqlparse/formatter.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2009-2018 the sqlparse authors and contributors # <see AUTHORS file> @@ -17,32 +16,32 @@ def validate_options(options): kwcase = options.get('keyword_case') if kwcase not in [None, 'upper', 'lower', 'capitalize']: raise SQLParseError('Invalid value for keyword_case: ' - '{0!r}'.format(kwcase)) + '{!r}'.format(kwcase)) idcase = options.get('identifier_case') if idcase not in [None, 'upper', 'lower', 'capitalize']: raise SQLParseError('Invalid value for identifier_case: ' - '{0!r}'.format(idcase)) + '{!r}'.format(idcase)) ofrmt = options.get('output_format') if ofrmt not in [None, 'sql', 'python', 'php']: raise SQLParseError('Unknown output format: ' - '{0!r}'.format(ofrmt)) + '{!r}'.format(ofrmt)) strip_comments = options.get('strip_comments', False) if strip_comments not in [True, False]: raise SQLParseError('Invalid value for strip_comments: ' - '{0!r}'.format(strip_comments)) + '{!r}'.format(strip_comments)) space_around_operators = options.get('use_space_around_operators', False) if space_around_operators not in [True, False]: raise SQLParseError('Invalid value for use_space_around_operators: ' - '{0!r}'.format(space_around_operators)) + '{!r}'.format(space_around_operators)) strip_ws = options.get('strip_whitespace', False) if strip_ws not in [True, False]: raise SQLParseError('Invalid value for strip_whitespace: ' - '{0!r}'.format(strip_ws)) + '{!r}'.format(strip_ws)) truncate_strings = options.get('truncate_strings') if truncate_strings is not None: @@ -50,17 +49,17 @@ def validate_options(options): truncate_strings = int(truncate_strings) except (ValueError, TypeError): raise SQLParseError('Invalid value for truncate_strings: ' - '{0!r}'.format(truncate_strings)) + '{!r}'.format(truncate_strings)) if truncate_strings <= 1: raise SQLParseError('Invalid value for truncate_strings: ' - '{0!r}'.format(truncate_strings)) + '{!r}'.format(truncate_strings)) options['truncate_strings'] = truncate_strings options['truncate_char'] = options.get('truncate_char', '[...]') indent_columns = options.get('indent_columns', False) if indent_columns not in [True, False]: raise SQLParseError('Invalid value for indent_columns: ' - '{0!r}'.format(indent_columns)) + '{!r}'.format(indent_columns)) elif indent_columns: options['reindent'] = True # enforce reindent options['indent_columns'] = indent_columns @@ -68,27 +67,27 @@ def validate_options(options): reindent = options.get('reindent', False) if reindent not in [True, False]: raise SQLParseError('Invalid value for reindent: ' - '{0!r}'.format(reindent)) + '{!r}'.format(reindent)) elif reindent: options['strip_whitespace'] = True reindent_aligned = options.get('reindent_aligned', False) if reindent_aligned not in [True, False]: raise SQLParseError('Invalid value for reindent_aligned: ' - '{0!r}'.format(reindent)) + '{!r}'.format(reindent)) elif reindent_aligned: options['strip_whitespace'] = True indent_after_first = options.get('indent_after_first', False) if indent_after_first not in [True, False]: raise SQLParseError('Invalid value for indent_after_first: ' - '{0!r}'.format(indent_after_first)) + '{!r}'.format(indent_after_first)) options['indent_after_first'] = indent_after_first indent_tabs = options.get('indent_tabs', False) if indent_tabs not in [True, False]: raise SQLParseError('Invalid value for indent_tabs: ' - '{0!r}'.format(indent_tabs)) + '{!r}'.format(indent_tabs)) elif indent_tabs: options['indent_char'] = '\t' else: |
