Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
andialbrecht committed Jul 12, 2024
1 parent 974617d commit 3ea660e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sqlparse/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ def create_parser():
default=False,
type=bool,
help='Insert linebreak before comma (default False)')

group.add_argument(
'--compact',
dest='compact',
default=False,
type=bool,
help='Try to produce more compact output (default False)')

group.add_argument(
'--encoding',
dest='encoding',
Expand Down
3 changes: 1 addition & 2 deletions sqlparse/filters/reindent.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def _process_case(self, tlist):
str_cond = ''.join(str(x) for x in cond or [])
str_value = ''.join(str(x) for x in value)
end_pos = self.offset + 1 + len(str_cond) + len(str_value)
if (not self.compact
and end_pos > self.wrap_after):
if (not self.compact and end_pos > self.wrap_after):
token = value[0] if cond is None else cond[0]
tlist.insert_before(token, self.nl())

Expand Down
4 changes: 2 additions & 2 deletions sqlparse/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from sqlparse.exceptions import SQLParseError


def validate_options(options):
def validate_options(options): # noqa: C901
"""Validates options."""
kwcase = options.get('keyword_case')
if kwcase not in [None, 'upper', 'lower', 'capitalize']:
Expand Down Expand Up @@ -115,7 +115,7 @@ def validate_options(options):
if comma_first not in [True, False]:
raise SQLParseError('comma_first requires a boolean value')
options['comma_first'] = comma_first

compact = options.get('compact', False)
if compact not in [True, False]:
raise SQLParseError('compact requires a boolean value')
Expand Down

0 comments on commit 3ea660e

Please sign in to comment.