Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
FabriceSalvaire committed Feb 22, 2017
1 parent 8865623 commit 13cc613
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions PySpice/Spice/Netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,35 +274,35 @@ def __new__(cls, class_name, super_classes, attributes):
# else:
# raise NotImplementedError
d[attribute_name] = obj

# Build dictionnary : attribute_name -> parameter
attributes['_positional_parameters'] = OrderedDict(sorted(list(positional_parameters.items()),
key=lambda t: t[1].position))

# optional parameter order is not required for SPICE, but for unit test
attributes['_optional_parameters'] = OrderedDict(sorted(list(parameters.items()), key=lambda t: t[0]))

# Positional parameter array
attributes['_parameters_from_args'] = [parameter
for parameter in sorted(positional_parameters.values())
if not parameter.key_parameter]

# Implement alias for parameters
attributes['_spice_to_parameters'] = {parameter.spice_name:parameter
for parameter in attributes['_optional_parameters'].values()}
for parameter in attributes['_spice_to_parameters'].values():
if (parameter.spice_name in attributes
and parameter.spice_name != parameter.attribute_name):
_module_logger.error('Spice parameter "{}" clash with attributes'.format(parameter.spice_name))

return super().__new__(cls, class_name, super_classes, attributes)

##############################################

def __init__(cls, class_name, super_classes, attributes):

type.__init__(cls, class_name, super_classes, attributes)

# Collect basic element classes
if 'prefix' in attributes:
prefix = attributes['prefix']
Expand Down
4 changes: 2 additions & 2 deletions PySpice/Spice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def function(self, *args, **kwargs):
setattr(Netlist, function_name, _make_function(element_class))

####################################################################################################
#
#
# End
#
#
####################################################################################################

0 comments on commit 13cc613

Please sign in to comment.