Skip to content

Enable typechecking for several files including filepaths.py#1272

Merged
rolandwalker merged 1 commit into
mainfrom
RW/typecheck-run-20250718
Jul 19, 2025
Merged

Enable typechecking for several files including filepaths.py#1272
rolandwalker merged 1 commit into
mainfrom
RW/typecheck-run-20250718

Conversation

@rolandwalker

Copy link
Copy Markdown
Contributor

Description

Add type annotations for

  • mycli/__init__.py
  • mycli/compat.py
  • mycli/lexer.py
  • mycli/packages/filepaths.py
  • mycli/packages/hybrid_redirection.py
  • mycli/packages/parseutils.py
  • mycli/packages/special/delimitercommand.py
  • mycli/packages/toolkit/fzf.py
  • mycli/packages/toolkit/history.py
  • mycli/packages/special/favoritequeries.py
  • mycli/packages/special/utils.py
  • mycli/packages/tabular_output/sql_format.py

and enable mypy checking for them in CI.

Convert capitalized types in toolkit/history.py to modern annotations.

Fix an int() cast on an env variable in test/utils.py, without enabling typecheck for the entire file.

Make query_starts_with() and queries_starts_with() take a list rather than a tuple for the second argument.

Fix a bug where extract_tables_from_complete_statements() could crash without checking for a None.

Fix a bug where table_format was not checked for None before treating as a string.

Move __main__ section of parseutils.py to bottom of file. Consider removing it.

Remove a needless inherit from object.

Convert an if/elif to the guard clause pattern.

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).

@rolandwalker rolandwalker force-pushed the RW/typecheck-run-20250718 branch 6 times, most recently from e5f9f40 to 27647cd Compare July 18, 2025 18:40
@rolandwalker rolandwalker requested a review from amjith July 18, 2025 18:48
@rolandwalker rolandwalker changed the title Typecheck for several files including filepaths.py Enable typechecking for several files including filepaths.py Jul 18, 2025
@rolandwalker rolandwalker self-assigned this Jul 19, 2025
add type annotations for
 * mycli/__init__.py
 * mycli/compat.py
 * mycli/lexer.py
 * mycli/packages/filepaths.py
 * mycli/packages/hybrid_redirection.py
 * mycli/packages/parseutils.py
 * mycli/packages/special/delimitercommand.py
 * mycli/packages/toolkit/fzf.py
 * mycli/packages/toolkit/history.py
 * mycli/packages/special/favoritequeries.py
 * mycli/packages/special/utils.py
 * mycli/packages/tabular_output/sql_format.py

and enable mypy checking for them in CI.

Convert capitalized types in toolkit/history.py to modern annotations.

Fix an int() cast on an env variable in test/utils.py, without enabling
typecheck for the entire file.

Make query_starts_with() and queries_starts_with() take a list rather
than a tuple for the second argument.

Fix a bug where extract_tables_from_complete_statements could crash
without checking for a None.

Fix a bug where table_format was not checked for None before treating
as a string.

Move __main__ section of parseutils.py to bottom of file.  Consider
removing it.

Remove a needless inherit from "object".

Convert an if/elif to the guard clause pattern.
@rolandwalker rolandwalker force-pushed the RW/typecheck-run-20250718 branch from 27647cd to 514b898 Compare July 19, 2025 16:21
@rolandwalker rolandwalker merged commit d76d4d3 into main Jul 19, 2025
7 checks passed
@rolandwalker rolandwalker deleted the RW/typecheck-run-20250718 branch July 19, 2025 16:24
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