Skip to content

Commit

Permalink
chore: enable other linters in ruff (#37)
Browse files Browse the repository at this point in the history
* chore: enable other linters in ruff

* fix: we do not need to call `.value` as it will be already available as string
  • Loading branch information
debajyoti-truefoundry authored Oct 26, 2023
1 parent 68cb40d commit 2cdcccd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions async_processor/function_service/async_function_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ async def get_output(request_id: str, timeout: float = 2):
data = await output_subscriber.get_output_message(request_id, timeout)
return OutputMessage(**json.loads(data.decode("utf-8")))
except OutputMessageFetchTimeoutError as ex:
raise HTTPException(status_code=404, detail=str(ex))
raise HTTPException(status_code=404, detail=str(ex)) from ex
except NotImplementedError as ex:
raise HTTPException(status_code=501, detail=str(ex))
raise HTTPException(status_code=501, detail=str(ex)) from ex

app.add_api_route(
RESULT_ENDPOINT,
Expand Down
3 changes: 1 addition & 2 deletions async_processor/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ async def _handle_msg(
serialized_output_message = self._processor.output_serializer(
output_message
)
collector.set_output_status(output_message.status)
except Exception as ex:
logger.exception("error raised while handling message")
if input_message:
Expand All @@ -137,8 +138,6 @@ async def _handle_msg(
output_message
)
raise ex
else:
collector.set_output_status(output_message.status.value)
finally:
if input_message and input_message.published_at_epoch_ns:
MESSAGE_INPUT_LATENCY.set(
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ target_version = ["py38", "py39", "py310"]
profile = "black"

[tool.ruff]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"C", # flake8-comprehensions
"B", # flake8-bugbear
"Q", # flake8-quotes
]
ignore = ["E501"]

[tool.pytest.ini_options]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_create_pydantic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
def dummy_function_with_annotations(
a: Annotated[int, Field(description="a description")],
b: str,
d: List[str],
c: bool = True,
d: List[str] = [],
) -> None:
pass


class DummyModel(BaseModel):
a: int = Field(description="a description")
b: str
d: List[str]
c: bool = True
d: List[str] = []


def test_create_pydantic_model_from_function_signature():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def process(self, input_message: InputMessage):
results[input_message.request_id].append(1)

for P in (DummyProcessor, AsyncDummyProcessor):
results = dict(a=[], b=[], c=[])
results = {"a": [], "b": [], "c": []}
messages = [
InputMessage(request_id="a", body={}),
InputMessage(request_id="b", body={}),
Expand Down

0 comments on commit 2cdcccd

Please sign in to comment.