Skip to content

Commit

Permalink
deal with naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Полищук Александр committed Sep 13, 2024
1 parent d5efe65 commit 084c809
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions clickhouse_sqlalchemy/drivers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,14 @@ def _parse_detetime_params(spec):

@staticmethod
def _parse_options(option_string):
def _fix_invalid_enum_member_name(member_name):
def _fix_invalid_enum_option_name(option_name):
# Python Enum does not support blank string ("")
# or "mro" as member name
if member_name == '':
member_name = '_'
elif member_name == 'mro':
member_name = '__'
return member_name
# or "mro" as option name
if option_name == '':
option_name = '_'
elif option_name == 'mro':
option_name = '__'
return option_name

options = {}
after_name = False
Expand All @@ -372,7 +372,7 @@ def _fix_invalid_enum_member_name(member_name):
if ch in (' ', '='):
pass
elif ch == ',':
name = _fix_invalid_enum_member_name(name)
name = _fix_invalid_enum_option_name(name)
options[name] = int(value)
after_name = False
name = ''
Expand All @@ -394,7 +394,7 @@ def _fix_invalid_enum_member_name(member_name):
quote_character = ch

if after_name:
name = _fix_invalid_enum_member_name(name)
name = _fix_invalid_enum_option_name(name)
options.setdefault(name, int(value)) # Word after last comma

return options
Expand Down

0 comments on commit 084c809

Please sign in to comment.