Невозможно указывать метод экземпляра объекта или классовый метод в качестве источника значения переменной #54

Closed
opened 3 years ago by icerider · 0 comments
Collaborator
class A:
    @classmethod
    def test(cls):
        return "test"


Variable("test", type=StringType, source=Calculate(A.test))
  File "/var/calculate/.project/trunk4/calculate-lib/calculate/variables/datavars.py", line 445, in check
    self._check_function(self.depend_function)                                                                        
  File "/var/calculate/.project/trunk4/calculate-lib/calculate/variables/datavars.py", line 500, in _check_function
    for node in ast.walk(ast.parse(getsource(function_to_check))):                                             
  File "/usr/lib64/python3.6/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)                                                             
  File "<unknown>", line 1
    @classmethod                                                                                                      
    ^           
IndentationError: unexpected indent
``` class A: @classmethod def test(cls): return "test" Variable("test", type=StringType, source=Calculate(A.test)) ``` ``` File "/var/calculate/.project/trunk4/calculate-lib/calculate/variables/datavars.py", line 445, in check self._check_function(self.depend_function) File "/var/calculate/.project/trunk4/calculate-lib/calculate/variables/datavars.py", line 500, in _check_function for node in ast.walk(ast.parse(getsource(function_to_check))): File "/usr/lib64/python3.6/ast.py", line 35, in parse return compile(source, filename, mode, PyCF_ONLY_AST) File "<unknown>", line 1 @classmethod ^ IndentationError: unexpected indent ```
icerider added the low label 3 years ago
derzeitgeist closed this issue 3 years ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: calculate/calculate-utils-4-lib#54
Loading…
There is no content yet.