Skip to content

Commit e8fe52c

Browse files
committed
fix(mapping): correctly detect external transformer
1 parent d7d1280 commit e8fe52c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/ontoweaver/mapping.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
import yaml
44
import logging
5+
import inspect
56

67
import pandera.pandas as pa
78

@@ -417,10 +418,13 @@ def parse_properties(self, properties_of, possible_subject_types, transformers_l
417418

418419
for transformer_type, field_dict in transformer_types.items():
419420
if not field_dict:
420-
logger.warning(f"There is no field for the {n_transformer}th transformer: '{transformer_type}',"
421+
if hasattr(transformer, transformer_type):
422+
trans_class = getattr(transformer, transformer_type)
423+
if not "transformer.py" in inspect.getfile(trans_class):
424+
logger.warning(
425+
f"There is no field for the {n_transformer}th transformer: '{transformer_type}',"
421426
f" did you forget an indentation?"
422-
f" If it is a User defined trasnformer, please disregard this warning. ")
423-
427+
f" If it is a User defined transformer, please disregard this warning. ")
424428
continue
425429

426430
if any(field in field_dict for field in base.MappingParser.k_properties):

0 commit comments

Comments
 (0)