This commit is contained in:
Andrej730
2024-11-27 11:07:30 +05:00
parent 25eecded4e
commit ab069f431a
5 changed files with 19 additions and 14 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ from functools import reduce
chars = string.digits + string.ascii_uppercase + string.ascii_lowercase + "_$"
def compress(g):
def compress(g: str) -> str:
bs = [int(g[i : i + 2], 16) for i in range(0, len(g), 2)]
def b64(v, l=4):
@@ -42,7 +42,7 @@ def compress(g):
return "".join([b64(bs[0], 2)] + [b64((bs[i] << 16) + (bs[i + 1] << 8) + bs[i + 2]) for i in range(1, 16, 3)])
def expand(g):
def expand(g: str) -> str:
def b64(v):
return reduce(lambda a, b: a * 64 + b, map(lambda c: chars.index(c), v))
@@ -53,9 +53,9 @@ def expand(g):
return "".join(["%02x" % b for b in bs])
def split(g):
def split(g: str) -> str:
return "{%s-%s-%s-%s-%s}" % (g[:8], g[8:12], g[12:16], g[16:20], g[20:])
def new():
def new() -> str:
return compress(uuid.uuid4().hex)
@@ -23,15 +23,15 @@ import ifcopenshell.api.pset
import ifcopenshell.api.geometry
import ifcopenshell.util
import ifcopenshell.util.attribute
import ifcopenshell.util.fm
import ifcopenshell.util.unit
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.geolocation
import ifcopenshell.util.classification
import ifcopenshell.util.element
import ifcopenshell.util.fm
import ifcopenshell.util.geolocation
import ifcopenshell.util.placement
import ifcopenshell.util.schema
import ifcopenshell.util.shape
import ifcopenshell.util.system
import ifcopenshell.util.unit
from decimal import Decimal
from typing import Optional, Any, Union, Iterable
@@ -393,6 +393,7 @@ def validate(f: Union[ifcopenshell.file, str], logger: Logger, express_rules=Fal
logger.error(f"Unsupported schema: {schema_name}")
return
assert isinstance(f, ifcopenshell.file)
log_internal_cpp_errors(f, filename, logger)
validate_ifc_header(f, logger)