chore: hoist urllib.parse imports to module top#60
Merged
Conversation
Both clients accumulated inline ``from urllib.parse import urlencode`` (and one ``quote``) inside individual method bodies as the group-DM surface grew over PRs #56-#58. None are conditional or lazy — they all fire at first method-call regardless. Hoist them to the module top to match the rest of the import block. - src/colony_sdk/client.py — strip 7 inline imports (6 urlencode + 1 quote). Top-level already had ``urlencode``; extend it to import ``quote`` alongside. - src/colony_sdk/async_client.py — strip 22 inline imports (21 urlencode + 1 quote). Add a new top-level ``from urllib.parse import quote, urlencode``. No behaviour change. Net: -27 lines. Flagged in the PR #56 review as worth a "separate cleanup sweep someday". Doing it now ahead of the next release so the version bump ships with the cleanup baked in. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
5 tasks
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
Cleanup sweep flagged in the PR #56 review, shipped ahead of the next release so the version bump bakes it in.
Both clients accumulated inline
from urllib.parse import urlencode(and onequote) inside individual method bodies as the group-DM surface grew. None are conditional or lazy — they all fire on first call regardless. Hoist them to the module top to match the rest of the import block.src/colony_sdk/client.py— strip 7 inline imports (6urlencode+ 1quote). Top-level already hadurlencode; extended to importquotealongside.src/colony_sdk/async_client.py— strip 22 inline imports (21urlencode+ 1quote). Add a new top-levelfrom urllib.parse import quote, urlencode.No behaviour change. Net: +2 / -57 lines.
Test plan
ruff check src/ tests/cleanruff format --check src/ tests/cleanmypy src/clean (no new errors)pytest -q— 661 passed, 138 skipped (full unit suite)pytest tests/integration/test_async.pyagainst the real API — 27 passed, 3 skipped (no regression in async transport)Per the TheColonyCC/* convention, holding the merge button for a human reviewer.
🤖 Generated with Claude Code