-
Notifications
You must be signed in to change notification settings - Fork 16
MNT linting fixes #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
MNT linting fixes #112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR applies linting fixes to improve code quality and consistency across the cottoncandy codebase. The changes focus on modernizing the code by removing Python 2 compatibility logic and improving import organization.
Key changes include:
- Added ruff configuration to pyproject.toml for standardized linting
- Replaced wildcard imports with explicit imports for better code clarity
- Removed Python 2-specific compatibility code (e.g.,
cPickle,raw_input,configparserfallback) - Standardized whitespace formatting and import sorting
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Added ruff linter configuration with line length and exclusions |
| cottoncandy/utils.py | Reorganized imports (removed unused, sorted), fixed whitespace, simplified exception handling, removed Python 2 compatibility |
| cottoncandy/s3client.py | Replaced wildcard import with explicit imports, removed Python 2 compatibility for pickle and urllib |
| cottoncandy/options.py | Removed Python 2 configparser fallback and sys.version_info checks |
| cottoncandy/localclient.py | Consolidated imports and removed Python 2 StringIO fallback |
| cottoncandy/interfaces.py | Reorganized imports, improved formatting, removed unused glob import |
| cottoncandy/gdriveclient.py | Replaced raw_input with input, removed Python 2 compatibility check |
| cottoncandy/browser.py | Reduced imports to only used functions, improved formatting |
| cottoncandy/backend.py | Updated class definitions to Python 3 style, added whitespace |
| cottoncandy/appdirs.py | Added consistent whitespace between function definitions |
| cottoncandy/init.py | Removed unused imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sdir_copy = sdir[:] | ||
| # clean numbers | ||
| sdir_copy = 'NUM_%s'%sdir_copy if has_start_digit(sdir) else sdir_copy | ||
| sdir_copy = 'NUM_%s' % (sdir_copy if has_start_digit(sdir) else sdir_copy) |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting change here introduces a logic error. The original code was likely:
sdir_copy = 'NUM_%s'%sdir_copy if has_start_digit(sdir) else sdir_copyThis means: prepend 'NUM_' only if the string starts with a digit, otherwise use the original string.
The current code evaluates to:
sdir_copy = 'NUM_%s' % (sdir_copy if has_start_digit(sdir) else sdir_copy)This always formats the string with 'NUM_%s', regardless of whether it starts with a digit, because the conditional only determines which version of sdir_copy to use (which are the same).
| sdir_copy = 'NUM_%s' % (sdir_copy if has_start_digit(sdir) else sdir_copy) | |
| sdir_copy = 'NUM_%s' % sdir_copy if has_start_digit(sdir) else sdir_copy |
| import cPickle as pickle | ||
| except ImportError: | ||
| import pickle | ||
| #from .utils import * |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commented-out import should be removed rather than left in the code. If it's being kept as documentation of what was replaced, consider removing it entirely since the git history shows the change.
| #from .utils import * |
|
|
||
| class GzipInputStream(object): | ||
|
|
||
| class GzipInputStream: |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class GzipInputStream is returned as an iterator (by iter) but does not fully implement the iterator interface.
Resolves several issues caught by linter:
ruff check --select=I --fix)from [...] import *