Skip to content

Boolean function called without the parenthesis #394

@spanningwings

Description

@spanningwings

Describe the bug
In openssa/openssa/core/programming/hierarchical/plan.py,

" # if Reasoner's result is unsatisfactory,
# and if there is still allowed recursive depth,
# use Programmer to decompose Problem into sub-HTPs

    #                  vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv    Here the parenthesis is missing
    elif (self.task.is_attempted and not self.task.is_done) and (self.programmer and self.programmer.max_depth):
        decomposed_htp: HTP = self.programmer.create_htp(task=self.task, knowledge=knowledge,
                                                         reasoner=self.reasoner)"

Here 'self.task.is_attempted' and 'self.task.is_done' are two functions. When used without (), the system will return the function itself, and the value will be interpreted as non None.

The system will not check the real value using the functions. Therefore, the logic is corrupted.

Expected behavior

Anywhere using is_done and is_attempted should be changed to is_done() and is_attempted().

For example,

'elif (self.task.is_attempted() and not self.task.is_done())'

Desktop (please complete the following information):

  • OS: Ubuntu
  • Python Version: 3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions