From 73f29610e5ac250cec4b108fee712a7a70d0c33f Mon Sep 17 00:00:00 2001 From: Yoom Lam Date: Wed, 3 Apr 2024 21:47:36 -0500 Subject: [PATCH] ci: Add ruff linter (#10) --- .github/workflows/ci-linter-ruff.yml | 8 ++++++++ 01-resource-referral/langgraph-workflow.py | 2 -- 01-resource-referral/my_tools.py | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci-linter-ruff.yml diff --git a/.github/workflows/ci-linter-ruff.yml b/.github/workflows/ci-linter-ruff.yml new file mode 100644 index 0000000..85f3253 --- /dev/null +++ b/.github/workflows/ci-linter-ruff.yml @@ -0,0 +1,8 @@ +name: Ruff linter +on: [ push, pull_request ] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 diff --git a/01-resource-referral/langgraph-workflow.py b/01-resource-referral/langgraph-workflow.py index 8b73ca5..710b9c2 100755 --- a/01-resource-referral/langgraph-workflow.py +++ b/01-resource-referral/langgraph-workflow.py @@ -3,10 +3,8 @@ from datetime import datetime from dotenv import main import operator -import json from typing import TypedDict, Annotated, Sequence # import os -import textwrap import graphviz # type: ignore from langgraph.prebuilt import ToolInvocation # type: ignore diff --git a/01-resource-referral/my_tools.py b/01-resource-referral/my_tools.py index 9100dec..0e8e6bb 100644 --- a/01-resource-referral/my_tools.py +++ b/01-resource-referral/my_tools.py @@ -49,14 +49,14 @@ def get_services_from_211(city:str, keyword:str | list[str]): # difficult to find param {location_id}, location_id returns dataowner location_id = first_result["idLocation"] print("211 location_id: " + location_id) - except: + except Exception: print("Failed to get location result") try: # In Query: /api/Locations/complete/{location_id}, location_id is inconsistent with other queries service_list = f"{TWO_ONE_ONE_BASE_SEARCH_ENDPOINT}/ServicesAtLocation?idLocation={location_id}" service_search = requests.get(service_list, headers=headers) return json.dumps(service_search.json(), indent=2) - except: + except Exception: print("Failed to get services at location") return "[]"