Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #343 from simphony/allow-for-plain-sstrings-defaults
Browse files Browse the repository at this point in the history
Ensures strings are initialized with the proper empty default
  • Loading branch information
mehdisadeghi committed Nov 3, 2016
2 parents 2b6e5f7 + a337f47 commit cd4b326
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,12 @@ def generate_initializer(self, file_out):
# However if the default value is a CUBA key,
# we set it to None in the init
default = content['default']
if isinstance(default, str) and default.startswith('CUBA.'):
kwargs.append('{key}=None'.format(key=key))
if isinstance(default, str):
if default.startswith('CUBA.'):
kwargs.append('{key}=None'.format(key=key))
else:
kwargs.append('{key}=\"{value}\"'.format(
key=key, value=default))
elif isinstance(default, MutableSequence):
# Should not use mutable in the signature
kwargs.append('{key}=None'.format(key=key))
Expand Down

0 comments on commit cd4b326

Please sign in to comment.