Skip to content

Commit 86ecf52

Browse files
committed
Replace tabs with spaces in crew.py for backwards compatibility with agentstack < 0.2.1
1 parent fb3af36 commit 86ecf52

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

agentstack/frameworks/crewai.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ class CrewFile(asttools.File):
1919

2020
_base_class: Optional[ast.ClassDef] = None
2121

22+
def write(self):
23+
"""
24+
Early versions of the crew entrypoint file used tabs instead of spaces.
25+
This method replaces all tabs with 4 spaces before writing the file to
26+
avoid SyntaxErrors.
27+
"""
28+
self.source = self.source.replace('\t', ' ')
29+
super().write()
30+
2231
def get_base_class(self) -> ast.ClassDef:
2332
"""A base class is a class decorated with `@CrewBase`."""
2433
if self._base_class is None: # Gets cached to save repeat iteration

0 commit comments

Comments
 (0)