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

Add optional attribute to specification fields

- `auxiliary-info` is specified as an optional field.

- `lvcnrcheck` gives a return code of `0` if the only failing fields are
  option and missing.

  However if fields are present and fail for other reasons (for example
  wrong type such as `str` when it should be `int`) then the return code
  will be `1`.
parent dd622eb8
......@@ -63,7 +63,10 @@ def checkField(sim, field):
if isinstance(valid, err.Missing):
print FIELD_INVALID.format(,, 'undefined', msg).strip('')
return 1
if field.optional:
return 0
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.
......@@ -45,6 +47,7 @@ class Spec(object):
name = ""
dtype = object
values = None
optional = False
def __init(self, name, dtype, values=None): = 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