Skip to content

Commit

Permalink
fixed syntax for py35
Browse files Browse the repository at this point in the history
  • Loading branch information
twheys committed Mar 31, 2020
1 parent 33517e8 commit f898a25
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions pypika/terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def wrap_constant(val, wrapper_cls=None):
querybuilder will be returned as inputted.
"""
from .queries import QueryBuilder

if isinstance(val, Node):
return val
Expand Down Expand Up @@ -476,14 +475,11 @@ def replace_table(self, current_table, new_table):
"""
self.table = new_table if self.table == current_table else self.table

def get_sql(
self,
with_alias=False,
with_namespace=False,
quote_char=None,
secondary_quote_char="'",
**kwargs,
):
def get_sql(self, **kwargs):
with_alias = kwargs.pop("with_alias", False)
with_namespace = kwargs.pop("with_namespace", False)
quote_char = kwargs.pop("quote_char", None)

field_sql = format_quotes(self.name, quote_char)

# Need to add namespace if the table has an alias
Expand Down Expand Up @@ -571,10 +567,10 @@ def get_sql(self, **kwargs):
dialect = kwargs.get("dialect", None)
values = ",".join(term.get_sql(**kwargs) for term in self.values)
sql = (
f"ARRAY[{values}]"
"ARRAY[{}]"
if dialect in (Dialects.POSTGRESQL, Dialects.REDSHIFT)
else f"[{values}]"
)
else "[{}]"
).format(values)
return format_alias_sql(sql, self.alias, **kwargs)


Expand Down Expand Up @@ -1153,14 +1149,12 @@ def get_function_sql(self, **kwargs):
special=(" " + special_params_sql) if special_params_sql else "",
)

def get_sql(
self,
with_alias=False,
with_namespace=False,
quote_char=None,
dialect=None,
**kwargs,
):
def get_sql(self, **kwargs):
with_alias = kwargs.pop("with_alias", False)
with_namespace = kwargs.pop("with_namespace", False)
quote_char = kwargs.pop("quote_char", None)
dialect = kwargs.pop("dialect", None)

# FIXME escape
function_sql = self.get_function_sql(
with_namespace=with_namespace, quote_char=quote_char, dialect=dialect
Expand Down

0 comments on commit f898a25

Please sign in to comment.