Commit 14beeedf authored by Edward Fauchon-Jones's avatar Edward Fauchon-Jones
Browse files

Merge branch 'allow-optional-fields' into 'master'

Add optional attribute to specification fields

See merge request !7
parents dd622eb8 b077ca02
......@@ -63,7 +63,10 @@ def checkField(sim, field):
if isinstance(valid, err.Missing):
print FIELD_INVALID.format(
valid.name, field.name, 'undefined', msg).strip('')
return 1
if field.optional:
return 0
else:
return 1
# Condition on being an attribute
isAttribute = not isinstance(
......
......@@ -31,6 +31,8 @@ class Spec(object):
values: (list of `dtype`), optional
List of values that the format specification field `Spec` represents
may take.
optional: bool
Specify if the specifcation field is optional.
Attributes
----------
......@@ -45,6 +47,7 @@ class Spec(object):
name = ""
dtype = object
values = None
optional = False
def __init(self, name, dtype, values=None):
self.name = name
......@@ -247,6 +250,7 @@ class SimulationType(Spec):
class AuxiliaryInfo(GroupSpec):
"""Specification for the `auxiliary-info` field"""
name = 'auxiliary-info'
optional = True
class NRTechniques(Spec):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment