fix for glob pattern in 62d53ba62d

This commit is contained in:
Andrej730
2025-02-28 11:50:23 +05:00
parent 5a1f7000ec
commit 15a0d43180
2 changed files with 15 additions and 6 deletions
+14 -5
View File
@@ -215,11 +215,18 @@ def _extract_docs(cls: type, method_name: str, boilerplate_args: Union[Sequence[
doc = inspect.getdoc(method)
def is_valid_param_name(param_name: str) -> bool:
if param_name not in inputs:
print(
f"WARNING. Unexpected param name '{param_name}' in {cls.__name__} docstring (missing from signature)."
)
assert (
param_name in inputs
), f"Unexpected param name '{param_name}' in {cls.__name__} docstring (missing from signature)."
return True
def is_valid_filter_glob(filter_glob: str) -> bool:
# e.g. '*.ifc;*.ifczip;*.ifcxml'
if len(filter_glob) < 3:
return False
for pattern in filter_glob.split(";"):
if not re.fullmatch(r"\*\.\w+", pattern):
return False
return True
if doc is None:
@@ -238,7 +245,9 @@ def _extract_docs(cls: type, method_name: str, boilerplate_args: Union[Sequence[
for param_name in docstring_data["filter_glob"]:
if not is_valid_param_name(param_name):
continue
inputs[param_name]["filter_glob"] = docstring_data["filter_glob"][param_name]
filter_glob = docstring_data["filter_glob"][param_name]
assert is_valid_filter_glob(filter_glob), f"Invalid filter_glob pattern: '{filter_glob}'."
inputs[param_name]["filter_glob"] = filter_glob
for param_name in inputs:
if "description" not in inputs[param_name]:
+1 -1
View File
@@ -83,7 +83,7 @@ class Patcher:
:param database: Database path to save the SQL database to (already existing or not).
Could also be a directory, then the database will be stored
using default filename (e.g. 'database.db').
:filter_glob database: *.db,*.sqlite
:filter_glob database: *.db;*.sqlite
:param full_schema: if True, will create tables for all IFC classes,
regardless if they are used or not in the dataset. If False, will
only create tables for classes in the dataset.