chore: Clean up python 2 legacy - #796
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #796 +/- ##
==========================================
- Coverage 96.65% 95.48% -1.17%
==========================================
Files 27 27
Lines 3554 3858 +304
==========================================
+ Hits 3435 3684 +249
- Misses 119 174 +55 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e05442d to
075c81a
Compare
|
Hey @ThosRTanner, thanks for the PR. I will review it by end of the week. If there is any other issue you would like to work on, please feel free to tackle it; I will have some free time for the next couple of weeks and will be able to be more reactive in my reviews. Thanks again, really appreciate the time you put in this project. |
There was a problem hiding this comment.
🔵 Needs a closer look
The broad cross-cutting cleanup and differing readiness assessments warrant final human review.
Pull request overview
Modernizes the codebase by removing Python 2 compatibility patterns and adopting Python 3 idioms.
Changes:
- Simplifies class declarations,
super()calls, and comprehensions. - Modernizes imports, file handling, subprocess usage, and EINTR handling.
- Adds coverage for interrupted connection retries.
File summaries
| File | Description |
|---|---|
tox.ini |
Removes redundant Python declarations. |
kazoo/tests/util.py |
Modernizes tuple and class syntax. |
kazoo/tests/test_watchers.py |
Simplifies superclass calls. |
kazoo/tests/test_utils.py |
Tests interrupted connection retries. |
kazoo/tests/test_selectors_select.py |
Uses subprocess.Popen; obsolete os import remains as a nit. |
kazoo/tests/test_party.py |
Simplifies superclass calls. |
kazoo/tests/test_partitioner.py |
Simplifies superclass calls. |
kazoo/tests/test_lock.py |
Modernizes classes and superclass calls. |
kazoo/tests/test_lease.py |
Modernizes class and superclass syntax. |
kazoo/tests/test_gevent_handler.py |
Uses typed state constants. |
kazoo/tests/test_election.py |
Simplifies superclass calls. |
kazoo/tests/test_connection.py |
Modernizes setup and state comparisons. |
kazoo/tests/test_cache.py |
Simplifies lifecycle calls. |
kazoo/testing/harness.py |
Modernizes tuple and constructor syntax. |
kazoo/testing/common.py |
Modernizes classes and file handling. |
kazoo/security.py |
Modernizes class syntax. |
kazoo/retry.py |
Modernizes class syntax. |
kazoo/recipe/watchers.py |
Modernizes watcher classes. |
kazoo/recipe/queue.py |
Modernizes inheritance calls. |
kazoo/recipe/party.py |
Modernizes class syntax. |
kazoo/recipe/lock.py |
Modernizes synchronization classes. |
kazoo/recipe/lease.py |
Modernizes lease classes. |
kazoo/recipe/election.py |
Modernizes class syntax. |
kazoo/recipe/counter.py |
Modernizes class syntax. |
kazoo/recipe/cache.py |
Removes obsolete compatibility constructs. |
kazoo/recipe/barrier.py |
Modernizes barrier classes. |
kazoo/protocol/connection.py |
Modernizes connection classes. |
kazoo/handlers/utils.py |
Simplifies interrupted-connect handling. |
kazoo/handlers/threading.py |
Removes legacy imports and simplifies super(). |
kazoo/handlers/gevent.py |
Removes Python 2 compatibility syntax. |
kazoo/handlers/eventlet.py |
Removes Python 2 compatibility syntax. |
kazoo/client.py |
Modernizes classes and tuple construction. |
Review details
- Files reviewed: 32/32 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes python-zk#788 Remove python2 specific code Use python 3 style for constructors etc Use python3.8 techniques in a few places
075c81a to
e7224a3
Compare
Fixes #788
Remove python2 specific code
Use python 3 style for constructors etc
Use python3.8 techniques in a few places
Why is this needed?
Code cleanup. This moves off deprecated python constructs (such as
class X(object))Proposed Changes
class X(object):toclass X:super(Class, self)tosuper()EINTRfrom __future__ import absolute_import(an early python 3-ism)Does this PR introduce any breaking change?
No
Coverage changes
These appear to be because it's based on 2 commits ago on master, rather than current master. This change actually increases coverage because there's now coverage of the
InterruptedExceptionpath inutils.py