Exemplo n.º 1
0
    def __init__(self, cn):
        check_schema(cn, "classname", ["name", "labeling"],
                     ["description", "group"])
        Designation.__init__(self)

        try:
            if isinstance(cn['name'], str):
                self.name = Identifier({'nice': cn['name']})
            else:
                self.name = Identifier(cn['name'])
            if isinstance(cn['labeling'], str):
                self.labeling = Substitution({'nice': cn['labeling']})
            else:
                self.labeling = Substitution(cn['labeling'])
        except ParsingError as e:
            e.set_class(self.id)
            raise e

        self.description = cn.get('description', '')

        if 'group' in cn:
            if isinstance(cn['group'], str):
                self.group = Identifier({'nice': cn['group']})
            else:
                self.group = Identifier(cn['group'])
        else:
            self.group = Identifier({'nice': ""})
Exemplo n.º 2
0
    def __init__(self, sn):
        check_schema(sn, 'classstandard', ['standard', 'labeling', 'body'],
                     ['group', 'year', 'status', 'replaces', 'description'])
        Designation.__init__(self)

        if isinstance(sn['standard'], str):
            self.standard = Identifier({'nice': sn['standard']})
        else:
            self.standard = Identifier(sn['standard'])
        if 'group' in sn:
            if isinstance(sn['group'], str):
                self.group = Identifier({'nice': sn['group']})
            else:
                self.group = Identifier(sn['group'])
        else:
            self.group = Identifier({'nice': ""})
        if isinstance(sn['labeling'], str):
            self.labeling = Substitution({'nice': sn['labeling']})
        else:
            self.labeling = Substitution(sn['labeling'])

        self.body = sn['body']
        self.year = sn.get('year', None)
        self.status = sn.get('status', 'active')

        self.replacedby = None

        self.replaces = sn.get('replaces', None)
        self.description = sn.get('description', '')
Exemplo n.º 3
0
    def __init__(self, coll):
        check_schema(coll, "collection",
                     ["id", "author", "license", "blt-version", "classes"],
                     ["name", "description"])

        version = coll["blt-version"]
        if version != CURRENT_VERSION:
            raise VersionError(version)

        self.id = coll["id"]

        self.name = coll.get("name", "")
        self.description = coll.get("description", "")

        self.authors = coll["author"]
        if isinstance(self.authors, str):
            self.authors = [self.authors]

        self.author_names = []
        self.author_mails = []
        for author in self.authors:
            match = parse_angled(author)
            self.author_names.append(match[0])
            self.author_mails.append(match[1])

        self.license = coll["license"]
        match = parse_angled(self.license)
        self.license_name = match[0]
        self.license_url = match[1]
Exemplo n.º 4
0
    def test_wellformed(self):
        res = yaml.load("""
a: 100
b: Eimer
c: 3.4
""")
        common.check_schema(res, "Tests", ["a", "b"], ["c", "d"])
Exemplo n.º 5
0
    def __init__(self, sn):
        check_schema(
            sn,
            "classstandard",
            ["standard", "labeling", "body"],
            ["group", "year", "status", "replaces", "description"],
        )
        Designation.__init__(self)

        if isinstance(sn["standard"], str):
            self.standard = Identifier({"nice": sn["standard"]})
        else:
            self.standard = Identifier(sn["standard"])
        if "group" in sn:
            if isinstance(sn["group"], str):
                self.group = Identifier({"nice": sn["group"]})
            else:
                self.group = Identifier(sn["group"])
        else:
            self.group = Identifier({"nice": ""})
        if isinstance(sn["labeling"], str):
            self.labeling = Substitution({"nice": sn["labeling"]})
        else:
            self.labeling = Substitution(sn["labeling"])

        self.body = sn["body"]
        self.year = sn.get("year", None)
        self.status = sn.get("status", "active")

        self.replacedby = None

        self.replaces = sn.get("replaces", None)
        self.description = sn.get("description", "")
Exemplo n.º 6
0
    def __init__(self, coll):
        check_schema(coll, "collection", ["id", "author", "license", "blt-version", "classes"], ["name", "description"])

        version = coll["blt-version"]
        if version != CURRENT_VERSION:
            raise VersionError(version)

        self.id = coll["id"]

        self.name = coll.get("name", "")
        self.description = coll.get("description", "")

        self.authors = coll["author"]
        if isinstance(self.authors, str):
            self.authors = [self.authors]

        self.author_names = []
        self.author_mails = []
        for author in self.authors:
            match = parse_angled(author)
            self.author_names.append(match[0])
            self.author_mails.append(match[1])

        self.license = coll["license"]
        match = parse_angled(self.license)
        self.license_name = match[0]
        self.license_url = match[1]
Exemplo n.º 7
0
    def __init__(self, cn):
        check_schema(cn, "classname", ["name", "labeling"], ["description", "group"])
        Designation.__init__(self)

        try:
            if isinstance(cn["name"], str):
                self.name = Identifier({"nice": cn["name"]})
            else:
                self.name = Identifier(cn["name"])
            if isinstance(cn["labeling"], str):
                self.labeling = Substitution({"nice": cn["labeling"]})
            else:
                self.labeling = Substitution(cn["labeling"])
        except ParsingError as e:
            e.set_class(self.id)
            raise e

        self.description = cn.get("description", "")

        if "group" in cn:
            if isinstance(cn["group"], str):
                self.group = Identifier({"nice": cn["group"]})
            else:
                self.group = Identifier(cn["group"])
        else:
            self.group = Identifier({"nice": ""})
Exemplo n.º 8
0
 def __init__(self, cs):
     check_schema(cs, "connectors", ["name", "arguments", "locations"], [])
     self.name = cs["name"]
     self.arguments = cs["arguments"]
     if not "location" in self.arguments:
         raise MissingLocationError(self.arguments)
     self.locations = cs["locations"]
Exemplo n.º 9
0
	def test_wellformed(self):
		res = yaml.load(
"""
a: 100
b: Eimer
c: 3.4
""")
		common.check_schema(res,"Tests",["a","b"],["c","d"])
Exemplo n.º 10
0
	def __init__(self,basefile,collname,backend_root):
		check_schema(basefile,"drawing",
			["filename","author","license","type","classids","location"],
			["source"]
		)
		Drawing.__init__(self,basefile,collname,backend_root)

		self.location = basefile["location"]
Exemplo n.º 11
0
    def __init__(self, basefile, collname, backend_root):
        check_schema(
            basefile, "drawing",
            ["filename", "author", "license", "type", "classids", "location"],
            ["source"])
        Drawing.__init__(self, basefile, collname, backend_root)

        self.location = basefile["location"]
Exemplo n.º 12
0
	def __init__(self,coll):
		check_schema(coll,"collection",
			["id","author","license","blt-version","classes"],
			["name","description"]
		)

		version = coll["blt-version"]
		if version != CURRENT_VERSION:
			raise VersionError(version)

		self.id = coll["id"]

		self.name = ""
		if "name" in coll:
			self.name = coll["name"]

		self.description = ""
		if "description" in coll:
			self.description = coll["description"]

		self.authors = coll["author"]
		if isinstance(self.authors,str):
			self.authors = [self.authors]

		self.author_names = []
		self.author_mails = []
		for author in self.authors:
			match = parse_angled(author)
			self.author_names.append(match[0])
			self.author_mails.append(match[1])

		self.license = coll["license"]
		match = parse_angled(self.license)
		self.license_name = match[0]
		self.license_url = match[1]

		#parse classes
		if not isinstance(coll["classes"],list):
			raise MalformedCollectionError("No class in collection %s"% self.id)

		self.classes = []
		classids = []
		for cl in coll["classes"]:
			names = cl["id"]
			if cl["id"] in classids:
				raise NonUniqueClassIdError(cl["id"])
			classids.append(cl["id"])
			if "standard" in cl:
				names = cl["standard"]
			if isinstance(names,str):
				names = [names]
			for name in names:
				try:
					self.classes.append(BOLTSClass(cl,name))
				except ParsingError as e:
					e.set_class(name)
					raise
Exemplo n.º 13
0
	def __init__(self,cs):
		check_schema(cs,"connectors",
			["name","arguments","locations"],
			[])
		self.name = cs["name"]
		self.arguments = cs["arguments"]
		if not "location" in self.arguments:
			raise MissingLocationError(self.arguments)
		self.locations = cs["locations"]
Exemplo n.º 14
0
	def __init__(self,cl):
		check_schema(cl,"basesolidworks",
			["classid"],
			["naming"]
		)

		self.classid = cl["classid"]
		
		self.naming = Substitution(cl.get("naming",None))
Exemplo n.º 15
0
	def __init__(self,basefile,collname):
		check_schema(basefile,"basestl",
			["filename","author","license","type","classids"],
			["source"])
		OpenSCADGeometry.__init__(self,basefile,collname)
		self.classids = basefile["classids"]

		if "parameters" in basefile:
			self.parameters = BOLTSParameters(basefile["parameters"])
		else:
			self.parameters = BOLTSParameters({})
Exemplo n.º 16
0
	def __init__(self,cl):
		check_schema(cl,"basesolidworks",
			["classid"],
			["naming"]
		)

		self.classid = cl["classid"]
		
		self.naming = None
		if "naming" in cl:
			self.naming = BOLTSNaming(cl["naming"])
Exemplo n.º 17
0
    def __init__(self, mod, basefile, collname):
        check_schema(mod, "basemodule", ["name", "arguments", "classids"],
                     ["parameters", "connectors"])
        check_schema(basefile, "basemodule",
                     ["filename", "author", "license", "type", "modules"],
                     ["source"])

        BaseElement.__init__(self, basefile)

        self.name = mod["name"]
        self.arguments = mod["arguments"]
        self.classids = mod["classids"]

        self.parameters = Parameters(mod.get("parameters", {"types": {}}))
Exemplo n.º 18
0
	def __init__(self,function,basefile,collname,backend_root):
		check_schema(function,"basefunction",
			["name","classids"],
			["parameters"]
		)
		check_schema(basefile,"basefunction",
			["filename","author","license","type","functions"],
			["source"]
		)

		FreeCADGeometry.__init__(self,basefile,collname,backend_root)
		self.name = function["name"]
		self.classids = function["classids"]
		self.module_name = splitext(basename(self.filename))[0]
		self.parameters = Parameters(function.get("parameters",{"types" : {}}))
Exemplo n.º 19
0
    def __init__(self, cl):
        check_schema(cl, "class", ["source", "id"], ["names", "standards", "parameters", "url", "notes"])

        self.id = cl["id"]

        try:
            self.parameters = Parameters(cl.get("parameters", {"types": {}}))
        except ParsingError as e:
            e.set_class(self.id)
            raise e

        self.url = cl.get("url", "")
        self.notes = cl.get("notes", "")

        self.source = cl["source"]
Exemplo n.º 20
0
	def __init__(self,mod,basefile,collname):
		check_schema(mod,"basemodule",
			["name", "arguments","classids"],
			["parameters","connectors"])
		check_schema(basefile,"basemodule",
			["filename","author","license","type","modules"],
			["source"])

		BaseElement.__init__(self,basefile)

		self.name = mod["name"]
		self.arguments = mod["arguments"]
		self.classids = mod["classids"]

		self.parameters = Parameters(mod.get("parameters",{"types" : {}}))
Exemplo n.º 21
0
	def __init__(self,basefile,collname,backend_root):
		BaseElement.__init__(self,basefile,collname)
		check_schema(basefile,"drawing",
			["filename","author","license","type","classids"],
			["source"]
		)
		self.collection = collname
		self.filename = basefile["filename"]
		self.path = join(backend_root,collname,self.filename)
		self.classids = basefile["classids"]

		self.versions = {}
	 	for version in iglob(self.path + ".*"):
			ext = splitext(version)[1][1:]
			self.versions[ext] = version
Exemplo n.º 22
0
def get_vehicle_schema():
    """
    Create the schema for the Agency GET /vehicles endpoint.
    """
    # load schema template and insert definitions
    schema = common.load_json("./templates/agency/get_vehicle.json")
    definitions = common.load_definitions(
        "propulsion_types",
        "string",
        "timestamp",
        "vehicle_type",
        "uuid"
    )
    schema["definitions"].update(definitions)

    # merge the state machine definitions and transition combinations rule
    state_machine_defs, transitions = common.vehicle_state_machine("state", "prev_events")
    schema["definitions"].update(state_machine_defs)
    schema["allOf"].append(transitions)

    # merge common vehicle information, with Agency tweaks
    vehicle = common.vehicle_definition(provider_name=False)
    schema["required"] = vehicle["required"] + schema["required"]
    schema["properties"] = { **vehicle["properties"], **schema["properties"] }

    # verify and return
    return common.check_schema(schema)
def vehicles_schema():
    """
    Create the schema for the /vehicles endpoint.
    """
    definitions, properties = {}, {}

    prop, defn = common.property_definition("links")
    definitions.update(defn)
    properties.update(prop)

    prop, _ = common.property_definition("last_updated",
                                         ref=common.definition_id("timestamp"))
    properties.update(prop)

    prop, defn = common.property_definition("ttl")
    definitions.update(defn)
    properties.update(prop)

    state_defs, transitions = common.vehicle_state_machine(
        "last_vehicle_state", "last_event_types")
    definitions.update(state_defs)

    schema = endpoint_schema("vehicles", definitions)

    # update list of required and properties object
    schema["required"].extend(["last_updated", "ttl"])
    schema["properties"].update(properties)

    # add state machine transition rules
    schema["properties"]["data"]["properties"]["vehicles"]["items"][
        "allOf"].append(transitions)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 24
0
    def __init__(self, cl):
        check_schema(cl, "class", ["source", "id"],
                     ["names", "standards", "parameters", "url", "notes"])

        self.id = cl["id"]

        try:
            self.parameters = Parameters(cl.get("parameters", {"types": {}}))
        except ParsingError as e:
            e.set_class(self.id)
            raise e

        self.url = cl.get("url", "")
        self.notes = cl.get("notes", "")

        self.source = cl["source"]
def stops_schema():
    """
    Create the schema for the /stops endpoint.
    """
    definitions, properties = {}, {}

    prop, _ = common.property_definition("last_updated",
                                         ref=common.definition_id("timestamp"))
    properties.update(prop)

    prop, defn = common.property_definition("ttl")
    definitions.update(defn)
    properties.update(prop)

    stop_defs = common.stop_definitions()
    definitions.update(stop_defs)

    schema = endpoint_schema("stops", definitions)

    # update list of required and properties object
    schema["required"].extend(["last_updated", "ttl"])
    schema["properties"].update(properties)

    # verify and return
    return common.check_schema(schema)
def trips_schema():
    """
    Create the schema for the /trips endpoint.
    """
    # generate the route definition
    mds_feature_collection_route = feature_collection_schema(
        id=common.definition_id("MDS_FeatureCollection_Route"),
        title="MDS GeoJSON FeatureCollection Route",
        # 1. Only allow MDS Feature Points
        # 2. There must be *at least* two Features in the FeatureCollection.
        features={
            "items": {
                "$ref": common.definition_id("MDS_Feature_Point")
            },
            "minItems": 2
        })
    trips_definitions = {
        "currency": common.load_definitions("currency"),
        "MDS_FeatureCollection_Route": mds_feature_collection_route
    }

    # create the trips schema
    schema = endpoint_schema("trips", trips_definitions)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 27
0
	def test_missing_field(self):
		res = yaml.load(
"""
a: 100
c: 3.4
""")
		self.assertRaises(MissingFieldError,lambda: common.check_schema(res,"Tests",["a","b"],["c","d"]))
Exemplo n.º 28
0
    def test_missing_field(self):
        res = yaml.load("""
a: 100
c: 3.4
""")
        self.assertRaises(
            MissingFieldError,
            lambda: common.check_schema(res, "Tests", ["a", "b"], ["c", "d"]))
Exemplo n.º 29
0
    def test_unknown_field(self):
        res = yaml.load("""
a: 100
b: Eimer
c: 3.4
e: foo
""")
        self.assertRaises(UnknownFieldError,lambda: common.check_schema(res,"Tests",["a","b"],["c","d"]))
Exemplo n.º 30
0
	def test_unknown_field(self):
		res = yaml.load(
"""
a: 100
b: Eimer
c: 3.4
e: foo
""")
		self.assertRaises(UnknownFieldError,lambda: common.check_schema(res,"Tests",["a","b"],["c","d"]))
Exemplo n.º 31
0
def geographies_schema():
    """
    Create the schema for the Geographies endpoint.
    """
    # load schema template and insert definitions from geography
    geography = geography_schema()
    schema = common.load_json("./templates/geography/geographies.json")
    schema["definitions"].update(geography["definitions"])

    return common.check_schema(schema)
Exemplo n.º 32
0
def post_stops_schema():
    """
    Create the schema for the Agency POST /stops endpoint.
    """
    # load schema template and insert definitions
    schema = common.load_json("./templates/agency/post_stops.json")
    stops = common.stop_definitions()
    schema["definitions"].update(stops)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 33
0
	def __init__(self,obj,basefile, collname,backend_root):
		check_schema(basefile,"basefcstd",
			["filename","author","license","type","objects"],
			["source"])
		check_schema(obj,"basefcstd",
			["objectname","classids"],
			["proptoparam","parameters"]
		)

		FreeCADGeometry.__init__(self,basefile,collname,backend_root)
		self.objectname = obj["objectname"]
		self.proptoparam = {self.objectname : {"Label" : "name"}}
		if "proptoparam" in obj:
			self.proptoparam = obj["proptoparam"]
		if "parameters" in obj:
			self.parameters = BOLTSParameters(obj["parameters"])
		else:
			self.parameters = BOLTSParameters({})

		self.classids = obj["classids"]
Exemplo n.º 34
0
def post_vehicle_telemetry_schema():
    """
    Create the schema for the Agency POST /vehicles/telemetry endpoint.
    """
    # load schema template and insert definitions
    schema = common.load_json("./templates/agency/post_vehicle_telemetry.json")
    definitions = common.load_definitions("timestamp", "uuid")
    definitions["vehicle_telemetry"] = vehicle_telemetry()
    schema["definitions"].update(definitions)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 35
0
    def __init__(self, designtable, collname, backend_root):
        BaseElement.__init__(self, designtable, collname)
        check_schema(designtable, "basesolidworks", [
            "filename", "author", "license", "type", "suffix", "params",
            "classes"
        ], ["source", "metadata"])

        self.filename = designtable["filename"]
        self.path = join(backend_root, collname, self.filename)

        self.suffix = designtable["suffix"]

        self.outname = "%s-%s.xls" % (splitext(self.filename)[0], self.suffix)

        self.params = designtable["params"]

        self.metadata = designtable.get("metadata", {})

        self.classes = []
        for cl in designtable["classes"]:
            self.classes.append(DesignTableClass(cl))
Exemplo n.º 36
0
	def __init__(self,designtable,collname,backend_root):
		BaseElement.__init__(self,designtable,collname)
		check_schema(designtable,"basesolidworks",
			["filename","author","license","type","suffix","params","classes"],
			["source","metadata"]
		)

		self.filename = designtable["filename"]
		self.path = join(backend_root,collname,self.filename)

		self.suffix = designtable["suffix"]

		self.outname = "%s-%s.xls" % (splitext(self.filename)[0],self.suffix)

		self.params = designtable["params"]

		self.metadata = designtable.get("metadata",{})

		self.classes = []
		for cl in designtable["classes"]:
			self.classes.append(DesignTableClass(cl))
Exemplo n.º 37
0
	def __init__(self,mod,basefile,collname):
		check_schema(mod,"basemodule",
			["name", "arguments","classids"],
			["parameters","connectors"])
		check_schema(basefile,"basemodule",
			["filename","author","license","type","modules"],
			["source"])

		OpenSCADGeometry.__init__(self,basefile,collname)
		self.name = mod["name"]
		self.arguments = mod["arguments"]
		self.classids = mod["classids"]

		if "parameters" in mod:
			self.parameters = BOLTSParameters(mod["parameters"])
		else:
			self.parameters = BOLTSParameters({"types" : {}})

		self.connectors = None
		if "connectors" in mod:
			self.connectors = Connectors(mod["connectors"])
Exemplo n.º 38
0
def geography_schema():
    """
    Create the schema for the Geography endpoint.
    """
    # load schema template and insert definitions
    schema = common.load_json("./templates/geography/geography.json")
    definitions = common.load_definitions("string", "timestamp", "uuid",
                                          "version")
    definitions.update(
        common.load_definitions("timestamp", "uuid_array", allow_null=True))
    schema["definitions"].update(definitions)

    # verify and return
    return common.check_schema(schema)
def events_schema():
    """
    Create the schema for the /events endpoint.
    """
    links_prop, links_def = common.property_definition("links")

    # events is the same as status_changes, but allows paging
    schema = status_changes_schema()
    schema["$id"] = schema["$id"].replace("status_changes", "events")
    schema["title"] = schema["title"].replace("status_changes", "events")
    schema["definitions"].update(links_def)
    schema["properties"].update(links_prop)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 40
0
def post_vehicle_schema():
    """
    Create the schema for the Agency POST /vehicles endpoint.
    """
    # load schema template and insert definitions
    schema = common.load_json("./templates/agency/post_vehicle.json")
    definitions = common.load_definitions("propulsion_types", "string",
                                          "vehicle_type", "uuid")
    schema["definitions"].update(definitions)

    # merge common vehicle information, with Agency tweaks
    vehicle = common.vehicle_definition(provider_name=False, provider_id=False)

    schema["required"] = vehicle["required"] + schema["required"]
    schema["properties"] = {**vehicle["properties"], **schema["properties"]}

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 41
0
def put_stops_schema():
    """
    Create the schema for the Agency POST /stops endpoint.
    """
    # load schema template and insert definitions

    # the PUT body allows a small subset of fields
    schema = common.load_json("./templates/agency/put_stops.json")

    stops = common.stop_definitions()
    needed_defs = ["stop_status", "uuid", "vehicle_type_counts"]
    for key in [k for k in stops.keys() if k not in needed_defs]:
        del stops[key]

    schema["definitions"].update(stops)

    # verify and return
    return common.check_schema(schema)
def status_changes_schema():
    """
    Create the schema for the /status_changes endpoint.
    """
    schema = endpoint_schema("status_changes")
    items = schema["properties"]["data"]["properties"]["status_changes"][
        "items"]

    # merge the state machine definitions and transition combinations rule
    state_machine_defs, transitions = common.vehicle_state_machine(
        "vehicle_state", "event_types")
    schema["definitions"].update(state_machine_defs)
    items["allOf"].append(transitions)

    trip_id_ref = common.load_definitions("trip_id_reference")
    items["allOf"].append(trip_id_ref)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 43
0
def post_vehicle_event_schema():
    """
    Create the schema for the Agency POST /vehicles/:id/event endpoint.
    """
    # load schema template and insert definitions
    schema = common.load_json("./templates/agency/post_vehicle_event.json")
    definitions = common.load_definitions("timestamp", "uuid")
    definitions["vehicle_telemetry"] = vehicle_telemetry()
    schema["definitions"].update(definitions)

    # merge the state machine definitions and transition combinations rule
    state_machine_defs, transitions = common.vehicle_state_machine(
        "vehicle_state", "event_types")
    schema["definitions"].update(state_machine_defs)
    schema["allOf"].append(transitions)

    # add the conditionally-required trip_id rule
    trip_id_ref = common.load_definitions("trip_id_reference")
    schema["allOf"].append(trip_id_ref)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 44
0
def policy_schema():
    """
    Create the schema for the Policy endpoint.
    """
    # load schema template and insert definitions
    schema = common.load_json("./templates/policy/policy.json")
    definitions = common.load_definitions("currency", "day", "propulsion_type",
                                          "string", "timestamp", "uuid",
                                          "uuid_array", "vehicle_event",
                                          "vehicle_state", "vehicle_type",
                                          "version")
    definitions.update(
        common.load_definitions("days",
                                "iso_time",
                                "propulsion_types",
                                "timestamp",
                                "uuid_array",
                                "vehicle_types",
                                allow_null=True))
    schema["definitions"].update(definitions)

    # verify and return
    return common.check_schema(schema)
Exemplo n.º 45
0
    def __init__(self, cl):
        check_schema(cl, "basesolidworks", ["classid"], ["naming"])

        self.classid = cl["classid"]

        self.naming = Substitution(cl.get("naming", None))
Exemplo n.º 46
0
	def __init__(self,cl,name):
		check_schema(cl,"class",
			["naming","source","id"],
			["description","standard","status","replaces","parameters",
				"url","notes"]
		)

		self.id = cl["id"]

		try:
			self.naming = BOLTSNaming(cl["naming"])
		except ParsingError as e:
			e.set_class(self.id)
			raise e

		self.drawing = None
		if "drawing" in cl:
			self.drawing = cl["drawing"]

		self.description = ""
		if "description" in cl:
			self.description = cl["description"]

		self.standard_body = None
		self.standard = None
		self.body = None
		self.status = "active"
		self.replaces = None
		if "standard" in cl:
			self.standard = cl["standard"]
			if isinstance(self.standard,str):
				self.standard = [self.standard]
			if "status" in cl:
				self.status = cl["status"]
				if not self.status in ["active","withdrawn"]:
					raise ValueError
			if "replaces" in cl:
				self.replaces = cl["replaces"]
		#gets updated later by the repo
		self.replacedby = None

		try:
			if "parameters" in cl:
				self.parameters = BOLTSParameters(cl["parameters"])
			else:
				self.parameters = BOLTSParameters({"types" : {}})
		except ParsingError as e:
			e.set_class(self.id)
			raise e

		self.url = ""
		if "url" in cl:
			self.url = cl["url"]

		self.notes = ""
		if "notes" in cl:
			self.notes = cl["notes"]

		self.source = cl["source"]

		self.name = name
		self.openscadname = name.replace("-","_").replace(" ","_").replace(".","_")