mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
bsdd: warn about include_class_properties deprecation
See https://github.com/buildingSMART/bSDD/issues/149
This commit is contained in:
@@ -21,6 +21,7 @@ import http.server
|
|||||||
import time
|
import time
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import uuid
|
import uuid
|
||||||
|
import warnings
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from typing import TYPE_CHECKING, Any, Literal, Optional, TypedDict
|
from typing import TYPE_CHECKING, Any, Literal, Optional, TypedDict
|
||||||
|
|
||||||
@@ -769,6 +770,16 @@ class Client:
|
|||||||
Get Class details
|
Get Class details
|
||||||
this API replaces Classification
|
this API replaces Classification
|
||||||
"""
|
"""
|
||||||
|
# Not very well documented on bsdd side,
|
||||||
|
# the deprecation note only occurs when you run into rate limit.
|
||||||
|
# See https://github.com/buildingSMART/bSDD/issues/149
|
||||||
|
if include_class_properties:
|
||||||
|
warnings.warn(
|
||||||
|
"include_class_properties=True is deprecated and heavily rate-limited by the bSDD API. "
|
||||||
|
"Use get_class_properties() instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
endpoint = f"Class/v{version}"
|
endpoint = f"Class/v{version}"
|
||||||
params = {
|
params = {
|
||||||
"Uri": class_uri,
|
"Uri": class_uri,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ def test_get_nbs_classes():
|
|||||||
|
|
||||||
def test_get_class():
|
def test_get_class():
|
||||||
uri_light_fixture = next(l for l in get_ifc_classes()["classes"] if "IfcLightFixture" == l["code"])["uri"]
|
uri_light_fixture = next(l for l in get_ifc_classes()["classes"] if "IfcLightFixture" == l["code"])["uri"]
|
||||||
|
# TODO: fix deprecation warning.
|
||||||
ifc4x3_light_fixture = client.get_class(uri_light_fixture)
|
ifc4x3_light_fixture = client.get_class(uri_light_fixture)
|
||||||
assert "Maintenance Factor" and "Light Fixture Mounting Type" in [
|
assert "Maintenance Factor" and "Light Fixture Mounting Type" in [
|
||||||
l["name"] for l in ifc4x3_light_fixture["classProperties"]
|
l["name"] for l in ifc4x3_light_fixture["classProperties"]
|
||||||
|
|||||||
Reference in New Issue
Block a user