近代的な Python 3 へのリファクタリングと CI/ツール刷新 - #117
Open
takano32 wants to merge 1 commit into
Open
Conversation
コードの挙動を変えない範囲で近代化したリファクタリング。
Code:
- isinstance(x, T) に統一(type(x) is T を廃止)
- f-string 化(%, + 連結を置換)
- 不要な `# -*- coding: utf-8 -*-` ヘッダと `(object)` 基底を削除
- `is True` / `is False` / `is not True` を真偽値の素直な評価に
- open() を with 文に、bare except を except Exception に
- HTMLParser の dead code(convert_charrefs で呼ばれない unescape ハンドラ)を削除
- バグ修正: redis.py の `e.message`(Py3 で AttributeError)を str(e) に
- os.system("make update_packages") を subprocess.run に置換
Tooling:
- Travis (Python 2.7) を GitHub Actions (Python 3.12 + redis + mecab) に置換
- Makefile setup を virtualenv から `python3 -m venv` に
- requirements.txt から不要な ipaddress(Py3 標準) を削除
- README を更新(GH Actions バッジ / 現行セットアップ手順)
- .gitignore に venv/pytest 生成物を追加
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
yuiseki
self-requested a review
June 29, 2026 00:18
yuiseki
requested changes
Jun 29, 2026
yuiseki
left a comment
Collaborator
There was a problem hiding this comment.
CI で Lint が落ちている模様です。 Lint ルールを実装に揃えるなどの対応していただけるとありがたいです 🙏
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.
概要
挙動を変えない範囲で、コードを近代的な Python 3 のイディオムに整理し、周辺ツールも刷新しました。
コード変更
type(x) is T→isinstance(x, T)%/+連結 → f-string# -*- coding: utf-8 -*-ヘッダ・(object)基底クラスを削除is True/is False/is not Trueを素直な評価にopen()をwith文に、bare except:→except Exception:HTMLParserのunescapeハンドラを削除(convert_charrefs=Trueのため呼ばれず、かつ Py3.9 でunescapeは削除済み)バグ修正
subculture/redis.py:e.message(Python 3 ではAttributeError)をstr(e)に修正SelfUpdateSubculture:os.system("make update_packages")をsubprocess.run([...])に置換(シェル経由を排除)ツール刷新
setupをvirtualenvから標準ライブラリのpython3 -m venvにipaddressを削除検証
py_compileを確認🤖 Generated with Claude Code