mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
fix: Fix flake8 errors based on the flake8 command with a narrower definition of errors
This commit is contained in:
@@ -45,8 +45,6 @@ def improve_code(suggestions: List[str], code: str) -> str:
|
|||||||
result_string = call_ai_function(function_string, args, description_string)
|
result_string = call_ai_function(function_string, args, description_string)
|
||||||
return result_string
|
return result_string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def write_tests(code: str, focus: List[str]) -> str:
|
def write_tests(code: str, focus: List[str]) -> str:
|
||||||
"""
|
"""
|
||||||
A function that takes in code and focus topics and returns a response from create chat completion api call.
|
A function that takes in code and focus topics and returns a response from create chat completion api call.
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ class ConsoleHandler(logging.StreamHandler):
|
|||||||
except Exception:
|
except Exception:
|
||||||
self.handleError(record)
|
self.handleError(record)
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Allows to handle custom placeholders 'title_color' and 'message_no_color'.
|
Allows to handle custom placeholders 'title_color' and 'message_no_color'.
|
||||||
To use this formatter, make sure to pass 'color', 'title' as log extras.
|
To use this formatter, make sure to pass 'color', 'title' as log extras.
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ def get_memory(cfg, init=False):
|
|||||||
def get_supported_memory_backends():
|
def get_supported_memory_backends():
|
||||||
return supported_memory
|
return supported_memory
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"get_memory",
|
"get_memory",
|
||||||
"LocalCache",
|
"LocalCache",
|
||||||
|
|||||||
@@ -45,5 +45,6 @@ class TestLocalCache(unittest.TestCase):
|
|||||||
self.assertEqual(len(relevant_texts), k)
|
self.assertEqual(len(relevant_texts), k)
|
||||||
self.assertIn(self.example_texts[1], relevant_texts)
|
self.assertIn(self.example_texts[1], relevant_texts)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -47,5 +47,6 @@ class TestLocalCache(unittest.TestCase):
|
|||||||
stats = self.cache.get_stats()
|
stats = self.cache.get_stats()
|
||||||
self.assertEqual(stats, (1, self.cache.data.embeddings.shape))
|
self.assertEqual(stats, (1, self.cache.data.embeddings.shape))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ Additional aspects:
|
|||||||
- The function uses a generator expression to split the text into lines and chunks, which can improve performance for large amounts of text.
|
- The function uses a generator expression to split the text into lines and chunks, which can improve performance for large amounts of text.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestScrapeText:
|
class TestScrapeText:
|
||||||
|
|
||||||
# Tests that scrape_text() returns the expected text when given a valid URL.
|
# Tests that scrape_text() returns the expected text when given a valid URL.
|
||||||
|
|||||||
@@ -66,8 +66,6 @@ class TestParseJson(unittest.TestCase):
|
|||||||
# Assert that this raises an exception:
|
# Assert that this raises an exception:
|
||||||
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_json_leading_sentence_with_gpt(self):
|
def test_invalid_json_leading_sentence_with_gpt(self):
|
||||||
# Test that a REALLY invalid JSON string raises an error when try_to_fix_with_gpt is False
|
# Test that a REALLY invalid JSON string raises an error when try_to_fix_with_gpt is False
|
||||||
json_str = """I will first need to browse the repository (https://github.com/Torantulino/Auto-GPT) and identify any potential bugs that need fixing. I will use the "browse_website" command for this.
|
json_str = """I will first need to browse the repository (https://github.com/Torantulino/Auto-GPT) and identify any potential bugs that need fixing. I will use the "browse_website" command for this.
|
||||||
@@ -108,6 +106,5 @@ class TestParseJson(unittest.TestCase):
|
|||||||
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ class TestParseJson(unittest.TestCase):
|
|||||||
# Assert that this raises an exception:
|
# Assert that this raises an exception:
|
||||||
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_json_leading_sentence_with_gpt(self):
|
def test_invalid_json_leading_sentence_with_gpt(self):
|
||||||
# Test that a REALLY invalid JSON string raises an error when try_to_fix_with_gpt is False
|
# Test that a REALLY invalid JSON string raises an error when try_to_fix_with_gpt is False
|
||||||
json_str = """I will first need to browse the repository (https://github.com/Torantulino/Auto-GPT) and identify any potential bugs that need fixing. I will use the "browse_website" command for this.
|
json_str = """I will first need to browse the repository (https://github.com/Torantulino/Auto-GPT) and identify any potential bugs that need fixing. I will use the "browse_website" command for this.
|
||||||
@@ -110,6 +108,5 @@ class TestParseJson(unittest.TestCase):
|
|||||||
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user