Skip to content

Commit ae05326

Browse files
committed
Clean-up quoting
1 parent 47dbacf commit ae05326

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

sqlparse/sql.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ def __str__(self):
4444
def __repr__(self):
4545
cls = self._get_repr_name()
4646
value = self._get_repr_value()
47-
if value.startswith("'") and value.endswith("'"):
48-
q = '"'
49-
else:
50-
q = "'"
47+
48+
q = '"' if value.startswith("'") and value.endswith("'") else "'"
5149
return "<{cls} {q}{value}{q} at 0x{id:2X}>".format(
5250
id=id(self), **locals())
5351

@@ -170,10 +168,8 @@ def _pprint_tree(self, max_depth=None, depth=0, f=None):
170168
for idx, token in enumerate(self.tokens):
171169
cls = token._get_repr_name()
172170
value = token._get_repr_value()
173-
if value.startswith("'") and value.endswith("'"):
174-
q = '"'
175-
else:
176-
q = "'"
171+
172+
q = '"' if value.startswith("'") and value.endswith("'") else "'"
177173
print("{indent}{idx:2d} {cls} {q}{value}{q}"
178174
.format(**locals()), file=f)
179175

0 commit comments

Comments
 (0)