fix: codecs.open を組み込みの open へ置き換え - #21
Merged
Merged
Conversation
codecs.open は非推奨。組み込みの open に encoding を渡せば済むため codecs のインポートごと削除した。 main.py 側は index.html / jsonschema.json をリクエスト毎に読み直していたのを ndc8/ndc9 データと同じく起動時に一度だけ読み込む形に揃えた (単純に open() へ置き換えただけだと ruff の ASYNC230 「async関数内でのブロッキングI/O」に引っかかりCIが落ちるため)。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JDwuuz1Km2CuC6pAEfHQAN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
main.py(2箇所)・validate.py(1箇所)のcodecs.openを組み込みのopen(..., encoding='utf-8')に置き換え、不要になったimport codecsを削除main.py側は単純な置き換えだと ruff のASYNC230(async関数内のブロッキングI/O)に引っかかりCIが落ちるため、index.html/jsonschema.jsonをndc8_items/ndc9_itemsと同じく起動時に一度だけ読み込む形に揃えた(毎リクエストの読み込みも無くなり効率も向上)Test plan
uv run ruff check ./ruff format --check .パスuv run python -c "import main; ..."(CIの読み込み確認と同内容)でindex_html・json_schemaが正しくロードされることを確認