Skip to content

Conversation

@kroq-gar78
Copy link
Collaborator

@kroq-gar78 kroq-gar78 commented Dec 15, 2025

Resolves several issues caught by linter:

  • Consistent whitespace
  • Removes unused imports and sorts current imports (ruff check --select=I --fix)
  • Explicit imports instead of from [...] import *
  • Removes some Python 2-specific logic

Copy link
Contributor

Copilot AI left a 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, configparser fallback)
  • 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)
Copy link

Copilot AI Dec 26, 2025

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_copy

This 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).

Suggested change
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 uses AI. Check for mistakes.
import cPickle as pickle
except ImportError:
import pickle
#from .utils import *
Copy link

Copilot AI Dec 26, 2025

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.

Suggested change
#from .utils import *

Copilot uses AI. Check for mistakes.

class GzipInputStream(object):

class GzipInputStream:
Copy link

Copilot AI Dec 26, 2025

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant