Skip to content

Commit 71cfc00

Browse files
author
Test User
committed
Fix ty errors
1 parent 52ed7c2 commit 71cfc00

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

line_profiler/_logger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import logging
77
from abc import ABC, abstractmethod
88
import sys
9-
from typing import ClassVar
9+
from typing import ClassVar, cast
1010
from logging import INFO, DEBUG, ERROR, WARNING, CRITICAL # NOQA
1111

1212

@@ -168,7 +168,7 @@ def configure(
168168
'path': None,
169169
'format': '%(asctime)s : [file] %(levelname)s : %(message)s',
170170
}
171-
streaminfo = {
171+
streaminfo: dict[str, bool | None | str] = {
172172
'__enable__': None, # will be determined below
173173
'format': '%(levelname)s: %(message)s',
174174
}
@@ -195,7 +195,7 @@ def configure(
195195

196196
# Add a stream handler if enabled
197197
if streaminfo['__enable__']:
198-
streamformat = streaminfo.get('format')
198+
streamformat = cast(str, streaminfo.get('format'))
199199
sh = logging.StreamHandler(sys.stdout)
200200
sh.setFormatter(logging.Formatter(streamformat))
201201
self.logger.addHandler(sh)

line_profiler/cli_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
import shutil
1313
import sys
1414
from os import PathLike
15-
from typing import Protocol, Sequence, TypeVar, cast
15+
from typing import cast
1616
from .toml_config import ConfigSource
1717

1818

19-
_BOOLEAN_VALUES = {
19+
_BOOLEAN_VALUES: dict[str, bool] = {
2020
**{k.casefold(): False for k in ('', '0', 'off', 'False', 'F', 'no', 'N')},
2121
**{k.casefold(): True for k in ('1', 'on', 'True', 'T', 'yes', 'Y')},
2222
}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,4 @@ docstring-code-format = false
123123
[tool.ty.rules]
124124
unused-ignore-comment = "ignore"
125125
unused-type-ignore-comment = "ignore"
126+
unresolved-import = "ignore"

0 commit comments

Comments
 (0)