Skip to content

Commit deefba2

Browse files
authored
Merge pull request #116 from tcdent/crew-patch
Replace tabs with spaces in crew.py for backwards compatibility with agentstack < 0.2.1
2 parents 981cded + 86ecf52 commit deefba2

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)