Skip to content

MNT remove obsolete Python 2 syntax, add some types - #664

Closed
kroq-gar78 wants to merge 2 commits into
gallantlab:mainfrom
kroq-gar78:types-02-py23-cleanup
Closed

MNT remove obsolete Python 2 syntax, add some types#664
kroq-gar78 wants to merge 2 commits into
gallantlab:mainfrom
kroq-gar78:types-02-py23-cleanup

Conversation

@kroq-gar78

Copy link
Copy Markdown
Contributor

This will make it easier to use newer Python features (e.g. type annotations).

@kroq-gar78
kroq-gar78 requested a lite review from Copilot August 13, 2026 00:18
@kroq-gar78 kroq-gar78 changed the title Remove some old Python 2/3 syntax Remove some old Python 2 syntax, add some types Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 modernizes the codebase by removing legacy Python 2/early-Python-3 compatibility patterns, making it easier to adopt newer Python features (e.g., clearer type annotations and super() usage).

Changes:

  • Replace Python 2-era class declarations (class X(object)) with Python 3 syntax (class X), and modernize super(...) calls to super().
  • Convert dict((k, v) for ...) patterns to dict comprehensions and update string formatting to f-strings.
  • Remove builtins/__future__ compatibility imports and a Python 2-only setdefaultencoding block.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cortex/xfm.py Update class declaration to Python 3 style.
cortex/utils.py Convert dict construction to comprehension (but leaves one Python 3-incompatible expression nearby).
cortex/svgoverlay.py Remove builtins compatibility import and modernize class declarations.
cortex/segment.py Remove Python 2 builtins.input compatibility import.
cortex/rois.py Update class declaration and dict-building syntax.
cortex/quickflat/utils.py Use f-strings and dict comprehensions for cleaner modern Python.
cortex/quickflat/composite.py Use f-strings for exceptions/logging.
cortex/mayavi_aligner.py Use super() and dict comprehensions; modernize legacy patterns.
cortex/mapper/mapper.py Update class declaration to Python 3 style.
cortex/mapper/init.py Use f-string for cache filename construction.
cortex/freesurfer.py Remove __future__/builtins Python 2 compatibility imports; modernize class declaration.
cortex/dataset/views.py Update class declarations, dict comprehension usage, and modern super() calls; refine typing.
cortex/dataset/viewRGB.py Modernize super() calls.
cortex/dataset/view2D.py Modernize super() calls.
cortex/dataset/dataset.py Update class declaration to Python 3 style.
cortex/dataset/braindata.py Modernize super() usage and simplify Python 2 string-type compatibility logic for xfmname.
cortex/database.py Remove Python 2 builtins.input compatibility import; update class declarations and dict-building syntax.
cortex/brainctm.py Update class declarations and modernize super() usage.
cortex/appdirs.py Update class declaration to Python 3 style.
cortex/align.py Remove Python 2 builtins.input compatibility import.
cortex/init.py Update deprecated helper class syntax and remove Python 2-only encoding workaround.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cortex/utils.py
This happens whenever fail_for_missing_rois=False and a
requested ROI isn't in overlays.svg.
@kroq-gar78
kroq-gar78 marked this pull request as ready for review August 13, 2026 00:37
@kroq-gar78 kroq-gar78 changed the title Remove some old Python 2 syntax, add some types MNT remove obsolete Python 2 syntax, add some types Aug 13, 2026
@kroq-gar78
kroq-gar78 requested a review from mvdoc August 13, 2026 02:46
@kroq-gar78
kroq-gar78 marked this pull request as draft August 13, 2026 08:19
@kroq-gar78
kroq-gar78 removed the request for review from mvdoc August 14, 2026 02:05
@kroq-gar78

Copy link
Copy Markdown
Contributor Author

Superseded by #666 .

@kroq-gar78 kroq-gar78 closed this Aug 14, 2026
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.

2 participants