Skip to content

Commit da65bc3

Browse files
committed
black
1 parent cf9a94a commit da65bc3

6 files changed

+33
-20
lines changed

autogpt/memory/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ def get_memory(cfg, init=False):
6060
memory = RedisMemory(cfg)
6161
elif cfg.memory_backend == "weaviate":
6262
if not WeaviateMemory:
63-
print("Error: Weaviate is not installed. Please install weaviate-client to"
64-
" use Weaviate as a memory backend.")
63+
print(
64+
"Error: Weaviate is not installed. Please install weaviate-client to"
65+
" use Weaviate as a memory backend."
66+
)
6567
else:
6668
memory = WeaviateMemory(cfg)
6769
elif cfg.memory_backend == "milvus":
@@ -93,5 +95,5 @@ def get_supported_memory_backends():
9395
"PineconeMemory",
9496
"NoMemory",
9597
"MilvusMemory",
96-
"WeaviateMemory"
98+
"WeaviateMemory",
9799
]

autogpt/memory/no_memory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def clear(self) -> str:
5353
"""
5454
return ""
5555

56-
def get_relevant(self, data: str, num_relevant: int = 5) ->list[Any] | None:
56+
def get_relevant(self, data: str, num_relevant: int = 5) -> list[Any] | None:
5757
"""
5858
Returns all the data in the memory that is relevant to the given data.
5959
NoMemory always returns None.

autogpt/spinner.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def update_message(self, new_message, delay=0.1):
5858
delay: Delay in seconds before updating the message
5959
"""
6060
time.sleep(delay)
61-
sys.stdout.write(f"\r{' ' * (len(self.message) + 2)}\r") # Clear the current message
61+
sys.stdout.write(
62+
f"\r{' ' * (len(self.message) + 2)}\r"
63+
) # Clear the current message
6264
sys.stdout.flush()
6365
self.message = new_message

autogpt/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def readable_file_size(size, decimal_places=2):
3232
size: Size in bytes
3333
decimal_places (int): Number of decimal places to display
3434
"""
35-
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
35+
for unit in ["B", "KB", "MB", "GB", "TB"]:
3636
if size < 1024.0:
3737
break
3838
size /= 1024.0

autogpt/workspace.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def safe_path_join(base: Path, *paths: str | Path) -> Path:
3636
joined_path = base.joinpath(*paths).resolve()
3737

3838
if not joined_path.is_relative_to(base):
39-
raise ValueError(f"Attempted to access path '{joined_path}' outside of working directory '{base}'.")
39+
raise ValueError(
40+
f"Attempted to access path '{joined_path}' outside of working directory '{base}'."
41+
)
4042

4143
return joined_path

benchmark/benchmark_entrepeneur_gpt_with_difficult_user.py

+20-13
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ def benchmark_entrepeneur_gpt_with_difficult_user():
99

1010
# Read the current ai_settings.yaml file and store its content.
1111
ai_settings = None
12-
if os.path.exists('ai_settings.yaml'):
13-
with open('ai_settings.yaml', 'r') as f:
12+
if os.path.exists("ai_settings.yaml"):
13+
with open("ai_settings.yaml", "r") as f:
1414
ai_settings = f.read()
15-
os.remove('ai_settings.yaml')
15+
os.remove("ai_settings.yaml")
1616

17-
input_data = '''Entrepreneur-GPT
17+
input_data = """Entrepreneur-GPT
1818
an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth.
1919
Increase net worth.
2020
Develop and manage multiple businesses autonomously.
@@ -72,27 +72,34 @@ def benchmark_entrepeneur_gpt_with_difficult_user():
7272
Disappointing suggestion.
7373
Not helpful.
7474
Needs improvement.
75-
Not what I need.'''
75+
Not what I need."""
7676
# TODO: add questions above, to distract it even more.
7777

78-
command = f'{sys.executable} -m autogpt'
78+
command = f"{sys.executable} -m autogpt"
7979

80-
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
81-
shell=True)
80+
process = subprocess.Popen(
81+
command,
82+
stdin=subprocess.PIPE,
83+
stdout=subprocess.PIPE,
84+
stderr=subprocess.PIPE,
85+
shell=True,
86+
)
8287

8388
stdout_output, stderr_output = process.communicate(input_data.encode())
8489

8590
# Decode the output and print it
86-
stdout_output = stdout_output.decode('utf-8')
87-
stderr_output = stderr_output.decode('utf-8')
91+
stdout_output = stdout_output.decode("utf-8")
92+
stderr_output = stderr_output.decode("utf-8")
8893
print(stderr_output)
8994
print(stdout_output)
9095
print("Benchmark Version: 1.0.0")
9196
print("JSON ERROR COUNT:")
92-
count_errors = stdout_output.count("Error: The following AI output couldn't be converted to a JSON:")
93-
print(f'{count_errors}/50 Human feedbacks')
97+
count_errors = stdout_output.count(
98+
"Error: The following AI output couldn't be converted to a JSON:"
99+
)
100+
print(f"{count_errors}/50 Human feedbacks")
94101

95102

96103
# Run the test case.
97-
if __name__ == '__main__':
104+
if __name__ == "__main__":
98105
benchmark_entrepeneur_gpt_with_difficult_user()

0 commit comments

Comments
 (0)