Skip to content

Commit

Permalink
fix: Fix flake8 errors based on the flake8 command with a narrower de…
Browse files Browse the repository at this point in the history
…finition of errors
  • Loading branch information
drikusroor committed Apr 12, 2023
1 parent 8d0d413 commit 1f83796
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 15 deletions.
2 changes: 0 additions & 2 deletions scripts/ai_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def improve_code(suggestions: List[str], code: str) -> str:
result_string = call_ai_function(function_string, args, description_string)
return result_string



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.
Expand Down
2 changes: 1 addition & 1 deletion scripts/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def scrape_text(url):
# Restrict access to local files
if check_local_file_access(url):
return "Error: Access to local files is restricted"

# Validate the input URL
if not is_valid_url(url):
# Sanitize the input URL
Expand Down
2 changes: 1 addition & 1 deletion scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self):

self.use_mac_os_tts = False
self.use_mac_os_tts = os.getenv("USE_MAC_OS_TTS")

self.google_api_key = os.getenv("GOOGLE_API_KEY")
self.custom_search_engine_id = os.getenv("CUSTOM_SEARCH_ENGINE_ID")

Expand Down
2 changes: 1 addition & 1 deletion scripts/file_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ def search_files(directory):
relative_path = os.path.relpath(os.path.join(root, file), working_directory)
found_files.append(relative_path)

return found_files
return found_files
1 change: 1 addition & 0 deletions scripts/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def emit(self, record):
except Exception:
self.handleError(record)


'''
Allows to handle custom placeholders 'title_color' and 'message_no_color'.
To use this formatter, make sure to pass 'color', 'title' as log extras.
Expand Down
1 change: 1 addition & 0 deletions scripts/memory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def get_memory(cfg, init=False):
def get_supported_memory_backends():
return supported_memory


__all__ = [
"get_memory",
"LocalCache",
Expand Down
4 changes: 2 additions & 2 deletions scripts/speak.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def gtts_speech(text):
def macos_tts_speech(text, voice_index=0):
if voice_index == 0:
os.system(f'say "{text}"')
else:
else:
if voice_index == 1:
os.system(f'say -v "Ava (Premium)" "{text}"')
else:
Expand All @@ -79,7 +79,7 @@ def speak():
success = eleven_labs_speech(text, voice_index)
if not success:
gtts_speech(text)

queue_semaphore.release()

queue_semaphore.acquire(True)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/memory_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ def test_get_relevant(self):
self.assertEqual(len(relevant_texts), k)
self.assertIn(self.example_texts[1], relevant_texts)


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions tests/local_cache_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ def test_get_stats(self):
stats = self.cache.get_stats()
self.assertEqual(stats, (1, self.cache.data.embeddings.shape))


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tests/test_browse_scrape_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
- 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:

# Tests that scrape_text() returns the expected text when given a valid URL.
Expand Down
3 changes: 0 additions & 3 deletions tests/test_json_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def test_invalid_json_leading_sentence_with_gpt(self):
# Assert that this raises an exception:
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):
# 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.
Expand Down Expand Up @@ -108,6 +106,5 @@ def test_invalid_json_leading_sentence_with_gpt(self):
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)



if __name__ == '__main__':
unittest.main()
3 changes: 0 additions & 3 deletions tests/unit/json_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ def test_invalid_json_leading_sentence_with_gpt(self):
# Assert that this raises an exception:
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):
# 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.
Expand Down Expand Up @@ -110,6 +108,5 @@ def test_invalid_json_leading_sentence_with_gpt(self):
self.assertEqual(fix_and_parse_json(json_str, try_to_fix_with_gpt=False), good_obj)



if __name__ == '__main__':
unittest.main()

0 comments on commit 1f83796

Please sign in to comment.