Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__str__ method of Atom in as_pyasp fails if arguments are of different types #16

Closed
cfrioux opened this issue May 28, 2019 · 1 comment

Comments

@cfrioux
Copy link

cfrioux commented May 28, 2019

Pyasp supports having a str and a int as arguments for an atom (Term). Apparently clyngor.as_pyasp does not. Here is a MWE:

from pyasp import *
from clyngor.as_pyasp import TermSet, Atom
elem = 'plop'
weight = 2
cofactors_pyasp = Term('cofactor', ["\""+elem+"\"",+weight])
cofactors_clyngor = Atom('cofactor', ["\""+elem+"\"",+weight])
print(cofactors_pyasp)
print(cofactors_clyngor)

gives the following error for the clyngor version:

Traceback (most recent call last):
  File "../menetools/test_print.py", line 10, in <module>
    print(cofactors_clyngor)
  File "/Users/cfrioux/wd/scripts/MeneTools/venv_clyngor/lib/python3.7/site-packages/clyngor/as_pyasp.py", line 32, in __str__
    return '{}({})'.format(self.predicate, ','.join(self.arguments))
TypeError: sequence item 1: expected str instance, int found

whereas the pyasp version gives:

cofactor("plop",2)
@Aluriak
Copy link
Owner

Aluriak commented May 29, 2019

That's an obvious problem ; will fix this tomorrow !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants