Skip to content

Commit 4f3ee8d

Browse files
authored
Add mypy type checking for Python 3.14 and use open() instead of codecs.open() due to deprecation in 3.14 (#1470)
1 parent 37c03c5 commit 4f3ee8d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

.github/workflows/typecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
18+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1919
fail-fast: false
2020
defaults:
2121
run:

cmd2/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,12 @@ def is_text_file(file_path: str) -> bool:
183183
:return: True if the file is a non-empty text file, otherwise False
184184
:raises OSError: if file can't be read
185185
"""
186-
import codecs
187-
188186
expanded_path = os.path.abspath(os.path.expanduser(file_path.strip()))
189187
valid_text_file = False
190188

191189
# Only need to check for utf-8 compliance since that covers ASCII, too
192190
try:
193-
with codecs.open(expanded_path, encoding='utf-8', errors='strict') as f:
191+
with open(expanded_path, encoding='utf-8', errors='strict') as f:
194192
# Make sure the file has only utf-8 text and is not empty
195193
if sum(1 for _ in f) > 0:
196194
valid_text_file = True

0 commit comments

Comments
 (0)