Skip to content

Commit

Permalink
Merge pull request #155 from airtai/hot-fix-1
Browse files Browse the repository at this point in the history
Hot fix 1
  • Loading branch information
harishmohanraj authored Sep 29, 2023
2 parents e850d9f + 742121c commit 0cdf3b9
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 7 deletions.
2 changes: 1 addition & 1 deletion faststream_gen/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.5rc4"
__version__ = "0.1.6rc0"
5 changes: 3 additions & 2 deletions faststream_gen/_code_generator/app_and_test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@

# %% ../../nbs/App_And_Test_Generator.ipynb 5
_code_fix_prompt = """
Your task is to correct the provided code. Your response should consist solely of valid Python code. You must follow the below rules while responding:
Fix the provided Python code following these rules:
- Do not include explanations or wrap your response in ```python tags.
- Provide only valid Python code, no explanations or code tags.
- Do not modify the line starting with 'from app.application'; it must remain unchanged. Adherence to this rule is crucial.
"""

def _fix_generated_code(s: str) -> str:
Expand Down
23 changes: 23 additions & 0 deletions faststream_gen/_code_generator/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,29 @@ async def on_output_data(msg: DataBasic) -> DataBasic: # ERROR IN THIS LINE
async def on_output_data(msg: DataBasic): # ERROR FIXED IN THIS LINE
pass
==== Error ====
ImportError: cannot import name 'on_output_data' from 'app.application'
==== ERROR CODE ====
from app.application import InputData, broker, on_input_data, on_output_data
==== FIXED CODE ====
from app.application import InputData, broker, on_input_data
==== Error ====
assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))
==== ERROR CODE ====
assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))
==== FIXED CODE ====
on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))
==== APP DESCRIPTION ====
Expand Down
Binary file modified faststream_gen/package_data/docs/index.faiss
Binary file not shown.
Binary file modified faststream_gen/package_data/docs/index.pkl
Binary file not shown.
Binary file modified faststream_gen/package_data/examples/index.faiss
Binary file not shown.
Binary file modified faststream_gen/package_data/examples/index.pkl
Binary file not shown.
7 changes: 4 additions & 3 deletions nbs/App_And_Test_Generator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@
"# | export\n",
"\n",
"_code_fix_prompt = \"\"\"\n",
"Your task is to correct the provided code. Your response should consist solely of valid Python code. You must follow the below rules while responding:\n",
"Fix the provided Python code following these rules:\n",
"\n",
"- Do not include explanations or wrap your response in ```python tags.\n",
"- Provide only valid Python code, no explanations or code tags.\n",
"- Do not modify the line starting with 'from app.application'; it must remain unchanged. Adherence to this rule is crucial.\n",
"\"\"\"\n",
"\n",
"def _fix_generated_code(s: str) -> str:\n",
Expand Down Expand Up @@ -284,7 +285,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"['\\x1b[1m============================= test session starts ==============================\\x1b[0m\\nplatform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0\\nrootdir: /tmp/tmp_y4g4zm7\\nplugins: anyio-3.7.1, asyncio-0.21.1\\nasyncio: mode=Mode.STRICT\\ncollected 1 item\\n\\ntests/test_application.py \\x1b[31mF\\x1b[0m\\x1b[31m [100%]\\x1b[0m\\n\\n=================================== FAILURES ===================================\\n\\x1b[31m\\x1b[1m______________________________ test_always_fails _______________________________\\x1b[0m\\n\\x1b[1m\\x1b[31mtests/test_application.py\\x1b[0m:3: in test_always_fails\\n \\x1b[94massert\\x1b[39;49;00m \\x1b[94mFalse\\x1b[39;49;00m\\x1b[90m\\x1b[39;49;00m\\n\\x1b[1m\\x1b[31mE assert False\\x1b[0m\\n\\x1b[36m\\x1b[1m=========================== short test summary info ============================\\x1b[0m\\n\\x1b[31mFAILED\\x1b[0m tests/test_application.py::\\x1b[1mtest_always_fails\\x1b[0m - assert False\\n\\x1b[31m============================== \\x1b[31m\\x1b[1m1 failed\\x1b[0m\\x1b[31m in 0.04s\\x1b[0m\\x1b[31m ===============================\\x1b[0m\\n']\n",
"['\\x1b[1m============================= test session starts ==============================\\x1b[0m\\nplatform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0\\nrootdir: /tmp/tmp858giugx\\nplugins: anyio-3.7.1, asyncio-0.21.1\\nasyncio: mode=Mode.STRICT\\ncollected 1 item\\n\\ntests/test_application.py \\x1b[31mF\\x1b[0m\\x1b[31m [100%]\\x1b[0m\\n\\n=================================== FAILURES ===================================\\n\\x1b[31m\\x1b[1m______________________________ test_always_fails _______________________________\\x1b[0m\\n\\x1b[1m\\x1b[31mtests/test_application.py\\x1b[0m:3: in test_always_fails\\n \\x1b[94massert\\x1b[39;49;00m \\x1b[94mFalse\\x1b[39;49;00m\\x1b[90m\\x1b[39;49;00m\\n\\x1b[1m\\x1b[31mE assert False\\x1b[0m\\n\\x1b[36m\\x1b[1m=========================== short test summary info ============================\\x1b[0m\\n\\x1b[31mFAILED\\x1b[0m tests/test_application.py::\\x1b[1mtest_always_fails\\x1b[0m - assert False\\n\\x1b[31m============================== \\x1b[31m\\x1b[1m1 failed\\x1b[0m\\x1b[31m in 0.04s\\x1b[0m\\x1b[31m ===============================\\x1b[0m\\n']\n",
"OK\n"
]
}
Expand Down
23 changes: 23 additions & 0 deletions nbs/Prompts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,29 @@
"async def on_output_data(msg: DataBasic): # ERROR FIXED IN THIS LINE\n",
"pass\n",
"\n",
"==== Error ====\n",
"\n",
"ImportError: cannot import name 'on_output_data' from 'app.application'\n",
"\n",
"==== ERROR CODE ====\n",
"\n",
"from app.application import InputData, broker, on_input_data, on_output_data\n",
"\n",
"==== FIXED CODE ====\n",
"\n",
"from app.application import InputData, broker, on_input_data\n",
"\n",
"==== Error ====\n",
"\n",
"assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))\n",
"\n",
"==== ERROR CODE ====\n",
"\n",
"assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))\n",
"\n",
"==== FIXED CODE ====\n",
"\n",
"on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))\n",
"\n",
"==== APP DESCRIPTION ====\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Python library ###
repo = faststream-gen
lib_name = %(repo)s
version = 0.1.5rc4
version = 0.1.6rc0
min_python = 3.8
license = apache2
black_formatting = False
Expand Down

0 comments on commit 0cdf3b9

Please sign in to comment.