mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-31 17:06:29 +00:00
ifctester - added some typing for IDE type hints
This commit is contained in:
@@ -23,6 +23,7 @@ import ifcopenshell.util.element
|
|||||||
import ifcopenshell.util.classification
|
import ifcopenshell.util.classification
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from xmlschema.validators import identities
|
from xmlschema.validators import identities
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
def cast_to_value(from_value, to_value):
|
def cast_to_value(from_value, to_value):
|
||||||
@@ -55,8 +56,8 @@ def get_psets(element):
|
|||||||
class Facet:
|
class Facet:
|
||||||
def __init__(self, *parameters):
|
def __init__(self, *parameters):
|
||||||
self.status = None
|
self.status = None
|
||||||
self.failed_entities = []
|
self.failed_entities: List[Facet] = []
|
||||||
self.failed_reasons = []
|
self.failed_reasons: List[str] = []
|
||||||
for i, name in enumerate(self.parameters):
|
for i, name in enumerate(self.parameters):
|
||||||
setattr(self, name.replace("@", ""), parameters[i])
|
setattr(self, name.replace("@", ""), parameters[i])
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import datetime
|
|||||||
from xmlschema import XMLSchema
|
from xmlschema import XMLSchema
|
||||||
from xmlschema import etree_tostring
|
from xmlschema import etree_tostring
|
||||||
from xml.etree import ElementTree as ET
|
from xml.etree import ElementTree as ET
|
||||||
from .facet import Entity, Attribute, Classification, Property, PartOf, Material, Restriction, get_pset, get_psets
|
from .facet import Facet, Entity, Attribute, Classification, Property, PartOf, Material, Restriction, get_pset, get_psets
|
||||||
|
from typing import List, Set
|
||||||
|
|
||||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||||
schema = None
|
schema = None
|
||||||
@@ -59,7 +59,7 @@ class Ids:
|
|||||||
self.filepath = None
|
self.filepath = None
|
||||||
self.filename = None
|
self.filename = None
|
||||||
|
|
||||||
self.specifications = []
|
self.specifications: List[Specification] = []
|
||||||
self.info = {}
|
self.info = {}
|
||||||
self.info["title"] = title or "Untitled"
|
self.info["title"] = title or "Untitled"
|
||||||
if copyright:
|
if copyright:
|
||||||
@@ -141,8 +141,8 @@ class Specification:
|
|||||||
instructions=None,
|
instructions=None,
|
||||||
):
|
):
|
||||||
self.name = name or "Unnamed"
|
self.name = name or "Unnamed"
|
||||||
self.applicability = []
|
self.applicability: List[Facet] = []
|
||||||
self.requirements = []
|
self.requirements: List[Facet] = []
|
||||||
self.minOccurs = minOccurs
|
self.minOccurs = minOccurs
|
||||||
self.maxOccurs = maxOccurs
|
self.maxOccurs = maxOccurs
|
||||||
self.ifcVersion = ifcVersion
|
self.ifcVersion = ifcVersion
|
||||||
@@ -150,7 +150,7 @@ class Specification:
|
|||||||
self.description = description
|
self.description = description
|
||||||
self.instructions = instructions
|
self.instructions = instructions
|
||||||
|
|
||||||
self.applicable_entities = []
|
self.applicable_entities: List[Entity] = []
|
||||||
self.status = None
|
self.status = None
|
||||||
|
|
||||||
def asdict(self):
|
def asdict(self):
|
||||||
@@ -209,7 +209,7 @@ class Specification:
|
|||||||
|
|
||||||
def reset_status(self):
|
def reset_status(self):
|
||||||
self.applicable_entities.clear()
|
self.applicable_entities.clear()
|
||||||
self.failed_entities = set()
|
self.failed_entities: Set[Entity] = set()
|
||||||
for facet in self.requirements:
|
for facet in self.requirements:
|
||||||
facet.status = None
|
facet.status = None
|
||||||
facet.failed_entities.clear()
|
facet.failed_entities.clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user