当我在 Pycharm 自己的计算机上运行代码时,它运行良好,但在 semaphoreci 中出现以下错误:
TypeError: calculateILPSelection() got multiple values for argument 'fun'
在此之前,我正在努力寻找乐趣,然后我为所有功能添加了乐趣,现在我遇到了这个错误。
细节:
Traceback (most recent call last):00:02
File "/home/semaphore/RelationalGraph/examples/graph_coloring/main.py", line 83, in <module>00:02
main()00:02
File "/home/semaphore/RelationalGraph/examples/graph_coloring/main.py", line 58, in main00:02
datanode.inferILPResults(*conceptsRelations, fun=None, minimizeObjective=True) 00:02
File "/home/semaphore/RelationalGraph/examples/graph_coloring/../../regr/graph/dataNode.py", line 1111, in inferILPResults00:02
myilpOntSolver.calculateILPSelection(self, *conceptsRelations, fun=fun, epsilon = epsilon, minimizeObjective = minimizeObjective, ignorePinLCs = ignorePinLCs) 00:02
TypeError: calculateILPSelection() got multiple values for argument 'fun'
这些是相互关联的功能:
第一次调用该行:
datanode.inferILPResults(*conceptsRelations, fun=None, minimizeObjective=True)
这是定义函数的地方:
def inferILPResults(self, *_conceptsRelations, fun=None, epsilon = 0.00001, minimizeObjective = False, ignorePinLCs = False):
if len(_conceptsRelations) == 0:
_DataNode__Logger.info('Called with empty list of concepts and relations for inference')
else:
_DataNode__Logger.info('Called with - %s - list of concepts and relations for inference'%([x.name if isinstance(x, Concept) else x for x in _conceptsRelations]))
# Check if concepts and/or relations have been provided for inference, if provide translate then to tuple concept info form
_conceptsRelations = self.collectConceptsAndRelations(_conceptsRelations) # Collect all concepts and relation from graph as default set
if len(_conceptsRelations) == 0:
_DataNode__Logger.error('Not found any concepts or relations for inference in provided DataNode %s'%(self))
raise DataNode.DataNodeError('Not found any concepts or relations for inference in provided DataNode %s'%(self))
else:
_DataNode__Logger.info('Found - %s - as a set of concepts and relations for inference'%([x[1] if isinstance(x, tuple) else x for x in _conceptsRelations]))
myilpOntSolver, conceptsRelations = self.__getILPSolver(_conceptsRelations)
# Call ilpOntsolver with the collected probabilities for chosen candidates
_DataNode__Logger.info("Calling ILP solver")
self.inferLocal()
print("hello")
print(conceptsRelations)
myilpOntSolver.calculateILPSelection(self, *conceptsRelations, fun=fun, epsilon = epsilon, minimizeObjective = minimizeObjective, ignorePinLCs = ignorePinLCs)
前面代码的最后一行连接到下一个函数,并且在错误之前打印了 hello。
@abc.abstractmethod
def calculateILPSelection(self, phrase, fun=None, epsilon = 0.00001, graphResultsForPhraseToken=None, graphResultsForPhraseRelation=None, graphResultsForPhraseTripleRelation=None, minimizeObjective = False, hardConstrains = []):
pass