forked from emrgnt-cmplxty/automata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request emrgnt-cmplxty#160 from maks-ivanov/feature/al-23-…
…refactor-update_module-of-python-writer Feature/al 23 refactor update module of python writer
- Loading branch information
Showing
15 changed files
with
390 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Lint and Format Check | ||
|
||
on: [push, pull_request] | ||
on: [pull_request] | ||
|
||
jobs: | ||
lint-and-format: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Check Import Sorting | ||
|
||
on: [push, pull_request] | ||
on: [pull_request] | ||
|
||
jobs: | ||
import-sorting: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Type Checking | ||
|
||
on: [push, pull_request] | ||
on: [pull_request] | ||
|
||
jobs: | ||
type-check: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: Codecov Check | ||
on: [push] | ||
on: [pull-request] | ||
jobs: | ||
run: | ||
runs-on: ${{ matrix.os }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""This is a sample module""" | ||
import math | ||
|
||
|
||
def sample_function(name): | ||
"""This is a sample function.""" | ||
return f"Hello, {name}! Sqrt(2) = " + str(math.sqrt(2)) | ||
|
||
|
||
class Person: | ||
"""This is a sample class.""" | ||
|
||
def __init__(self, name): | ||
"""This is the constructor.""" | ||
self.name = name | ||
|
||
def say_hello(self): | ||
"""This is a sample method.""" | ||
return f"Hello, I am {self.name}." | ||
|
||
def run(self) -> str: | ||
... | ||
|
||
|
||
def f(x) -> int: | ||
"""This is my new function""" | ||
return x + 1 | ||
|
||
|
||
class EmptyClass: | ||
pass | ||
|
||
|
||
class OuterClass: | ||
class InnerClass: | ||
"""Inner doc strings""" | ||
|
||
def inner_method(self): | ||
"""Inner method doc strings""" |
41 changes: 41 additions & 0 deletions
41
automata/core/code_indexing/test/sample_modules/sample2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from typing import List | ||
|
||
from automata.core.base.tool import Tool | ||
from automata.tools.python_tools.python_agent import PythonAgent | ||
|
||
|
||
class PythonAgentToolBuilder: | ||
"""A class for building tools to interact with PythonAgent.""" | ||
|
||
def __init__(self, python_agent: PythonAgent): | ||
""" | ||
Initializes a PythonAgentToolBuilder with the given PythonAgent. | ||
Args: | ||
python_agent (PythonAgent): A PythonAgent instance representing the agent to work with. | ||
""" | ||
self.python_agent = python_agent | ||
|
||
def build_tools(self) -> List: | ||
""" | ||
Builds a list of Tool objects for interacting with PythonAgent. | ||
Args: | ||
- None | ||
Returns: | ||
- tools (List[Tool]): A list of Tool objects representing PythonAgent commands. | ||
""" | ||
|
||
def python_agent_python_task(): | ||
"""A sample task that utilizes PythonAgent.""" | ||
pass | ||
|
||
tools = [ | ||
Tool( | ||
"automata-task", | ||
python_agent_python_task, | ||
"Execute a Python task using the PythonAgent. Provide the task description in plain English.", | ||
) | ||
] | ||
return tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.