Skip to content

Commit c1dec25

Browse files
committed
Fix typos and update config files
1 parent 4b89497 commit c1dec25

File tree

3 files changed

+47
-18
lines changed

3 files changed

+47
-18
lines changed

mypy.ini

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,45 @@
1-
; We don't run mypy in the CI. This is just to help anyone who would like to use it manually.
2-
; Namely, the mypy_primer tool.
1+
# SPDX-License-Identifier: MIT
2+
# Copyright 2024 Beslogic Inc.
3+
4+
# The source skeleton for this configuration can be found at
5+
# https://github.com/BesLogic/shared-configs/blob/main/mypy.ini
6+
# Modifications to this file that are not project-specific should also be done upstream.
7+
8+
# https://mypy.readthedocs.io/en/stable/config_file.html
39
[mypy]
4-
python_version = 3.11
10+
###
11+
# General settings
12+
###
513
show_column_numbers = true
6-
mypy_path = $MYPY_CONFIG_FILE_DIR/typings
7-
implicit_reexport = true
8-
914
strict = true
10-
; Implicit return types !
15+
report_deprecated_as_note = true
16+
17+
# All below are rules and codes not enabled by default even with strict=true
18+
; <removed section from upstream>
19+
; We don't run mypy in the CI. This is just to help anyone who would like to use it manually.
20+
; Namely, the mypy_primer tool.
21+
22+
# Implicit return types using pyright ! (mypy doesn't do implicit return types)
23+
# Note: mypy still has issues with some boolean inferred returns:
24+
# https://github.com/python/mypy/issues/4409
25+
# https://github.com/python/mypy/issues/10149
26+
# Comment out if not using pyright or implicit types
1127
check_untyped_defs = true
1228
disallow_untyped_calls = false
1329
disallow_untyped_defs = false
1430
disallow_incomplete_defs = false
15-
disable_error_code = return
16-
# Note: mypy still has issues with some boolean infered returns like `is_valid_hwnd`
17-
# https://github.com/python/mypy/issues/4409
18-
# https://github.com/python/mypy/issues/10149
31+
32+
###
33+
# Specific to this project
34+
###
1935

2036
; exclude mypyc build
2137
exclude = .*(build)/.*
2238

39+
python_version = 3.11
40+
mypy_path = $MYPY_CONFIG_FILE_DIR/typings
41+
implicit_reexport = true
42+
2343
; Auto-generated code, not much we can do there
2444
[mypy-gen.*]
2545
disable_error_code = attr-defined, arg-type

ruff.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# https://docs.astral.sh/ruff/configuration/
99
line-length = 100
1010
preview = true
11-
required-version = ">=0.11.0" # tool.ruff.target-version is infered from project.requires-python
11+
required-version = ">=0.11.0" # tool.ruff.target-version is inferred from project.requires-python
1212

1313
[format]
1414
docstring-code-format = true
@@ -20,7 +20,7 @@ ignore = [
2020
###
2121
# Not needed or wanted
2222
###
23-
"D1", # pydocstyle Missing doctring
23+
"D1", # pydocstyle Missing docstring
2424
"D401", # pydocstyle: non-imperative-mood
2525
"EM", # flake8-errmsg
2626
# This is often something we can't control: https://github.com/astral-sh/ruff/issues/9497
@@ -47,6 +47,15 @@ ignore = [
4747
"D212", # pydocstyle: multi-line-summary-first-line
4848
# Allow differentiating between broken (FIXME) and to be done/added/completed (TODO)
4949
"TD001", # flake8-todos: invalid-todo-tag
50+
# Often just leads to redundant more verbose code when needing an actual str
51+
"PTH208", # Use `pathlib.Path.iterdir()` instead.
52+
# Typeshed doesn't want complex or non-literal defaults for maintenance and testing reasons.
53+
# This doesn't affect us, let's have more complete stubs.
54+
# This doesn't affect us, let's have more complete stubs.
55+
"PYI011", # typed-argument-default-in-stub
56+
"PYI011", # typed-argument-default-in-stub
57+
"PYI014", # argument-default-in-stub
58+
"PYI053", # string-or-bytes-too-long
5059

5160
###
5261
# These should be warnings (https://github.com/astral-sh/ruff/issues/1256 & https://github.com/astral-sh/ruff/issues/1774)
@@ -57,6 +66,8 @@ ignore = [
5766

5867
# False-positives
5968
"TC004", # https://github.com/astral-sh/ruff/issues/3821
69+
# Too many magic number "2" that are preferable inline. https://github.com/astral-sh/ruff/issues/10009
70+
"PLR2004", # magic-value-comparison
6071

6172
###
6273
# Conflict with formatter (you can remove this section if you don't use Ruff as a formatter)
@@ -107,8 +118,6 @@ allow-multiline = false
107118
[lint.isort]
108119
combine-as-imports = true
109120
split-on-trailing-comma = false
110-
# This should be automatically detected in src layout, but somehow pre-commit messes it up
111-
known-first-party = ["gen"]
112121

113122
# https://docs.astral.sh/ruff/settings/#mccabe
114123
[lint.mccabe]
@@ -149,8 +158,8 @@ max-branches = 15
149158
"cv2.imread".msg = """\
150159
it doesn't support special characters. \
151160
Use `cv2.imdecode(np.fromfile(filename, dtype=np.uint8), flags)` instead.
152-
https://github.com/opencv/opencv/issues/4292#issuecomment-2266019697"""
161+
https://github.com/opencv/opencv/issues/18305#issuecomment-2847972863"""
153162
"cv2.imwrite".msg = """\
154163
it doesn't support special characters. \
155164
Use `cv2.imencode(os.path.splitext(filename)[1], img)[1].tofile(filename)` instead.
156-
https://github.com/opencv/opencv/issues/4292#issuecomment-2266019697"""
165+
https://github.com/opencv/opencv/issues/18305#issuecomment-2847972863"""

src/user_profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def load_check_for_updates_on_open(autosplit: "AutoSplit"):
228228
Retrieve the "Check For Updates On Open" QSettings and set the checkbox state
229229
These are only global settings values. They are not *toml settings values.
230230
"""
231-
# Type not infered by PySide6: https://bugreports.qt.io/browse/PYSIDE-2542
231+
# Type not inferred by PySide6: https://bugreports.qt.io/browse/PYSIDE-2542
232232
value = cast(
233233
bool,
234234
QtCore.QSettings(

0 commit comments

Comments
 (0)