mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 02:49:12 +00:00
fix for glob pattern in 62d53ba62d
This commit is contained in:
@@ -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]:
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user