feat: proxybroker as a service - #210
Open
ngctnnnn wants to merge 1 commit into
Open
Conversation
dannyeuu
pushed a commit
to dannyeuu/ProxyBroker
that referenced
this pull request
May 12, 2026
…op() (constverum#210) Closes constverum#203 — refactor remaining stdlib deprecation sites flagged for Python 3.14+/3.16 compatibility, plus enable lint-time prevention of the encoding= class of bug surfaced during review. ## Deprecation fixes **`argparse.FileType` → deferred open via ExitStack** (`cli.py`) - `--data` (find/serve): `FileType("r")` → path string, opened in `cli()` with `encoding="utf-8"` - `--outfile` (find/grab): `FileType("w", 1)` → path string, opened with `buffering=1, encoding="utf-8"` (line-buffered preserved) - Stdin/stdout via `-` preserved per `argparse.FileType` original semantics - Empty paths now error visibly instead of silently falling back (per codex review) **`asyncio.get_event_loop()` → `asyncio.get_running_loop()`** (`proxy.py`) - Two call sites inside `_start_tls` upgrade path; both inside async coroutines so running loop is guaranteed ## Lint-time prevention - Enable ruff `PLW1514` (`unspecified-encoding`) in lint config to catch the `open()`-without-`encoding=` class of bug going forward - Pin `select` to make ruleset explicit; scope preview-rule selection via `explicit-preview-rules` - Fix 9 existing PLW1514 violations in `examples/` (3) and `tests/` (6) - Drop redundant `import os` in `utils.py` (surfaced by F401 default rule) ## Out of scope - `cli.py:12 set_event_loop_policy(WindowsSelectorEventLoopPolicy())` — Python 3.16 removes the policy system entirely. Tracked in #228 (needs Windows-specific testing). ## Verification - 293/293 tests pass locally; all 24 CI checks green - Verified against [Python 3.14 docs](https://docs.python.org/3.14/library/argparse.html): `argparse.FileType` deferred-open pattern matches the recommended replacement exactly - Matrix audit: (command × file flag × value) and (Proxy.connect call site × loop state) — all cells handled correctly Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
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.
Hosting proxybroker as a service for scalable applications