Skip to content

Commit

Permalink
Changed to positive test for punning, instead of TypeError
Browse files Browse the repository at this point in the history
Pushed with no verify as the pylint errors are due to pylint upgrade
which finds errors in other parts of the core. This is addressed in another PR.
  • Loading branch information
francescalb committed Feb 2, 2023
1 parent bce7fe0 commit 5967df3
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions ontopy/ontodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,29 +393,29 @@ def itemdoc(
if hasattr(item, "instances"):
points = []
for instance in item.instances():
try:
if item in instance.is_instance_of:
points.append(
point_style.format(
point=asstring(instance, link_style),
ontology=onto,
)
)
if points:
value = points_style.format(
points="".join(points), ontology=onto
)
doc.append(
annotation_style.format(
key="Individuals", value=value, ontology=onto
)
)
except TypeError:
if isinstance(instance.is_instance_of, property):
warnings.warn(
f'Ignoring instance "{instance}" which is both and '
"indivudual and class. Ontodoc does not support "
"punning at the present moment."
)
continue
if item in instance.is_instance_of:
points.append(
point_style.format(
point=asstring(instance, link_style),
ontology=onto,
)
)
if points:
value = points_style.format(
points="".join(points), ontology=onto
)
doc.append(
annotation_style.format(
key="Individuals", value=value, ontology=onto
)
)

return "\n".join(doc)

Expand Down

0 comments on commit 5967df3

Please sign in to comment.