Skip to content

Commit d2adee2

Browse files
authored
type: Fix type errors (#8629)
1 parent be626fd commit d2adee2

10 files changed

Lines changed: 12 additions & 10 deletions

File tree

panel/command/compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def run_compile(
4848
file_loaders = file_loaders or []
4949
errors = 0
5050
for bundle, components in bundles.items():
51-
component_names = '\n- '.join(c.name for c in components)
51+
component_names = '\n- '.join([cn for c in components if (cn := c.name) is not None])
5252
print(f"Building {bundle} containing the following components:\n\n- {component_names}\n") # noqa
5353
out = compile_components(
5454
components,

panel/io/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
PROCESSES: dict[int, Process] = {}
4545

46-
log_sessions = []
46+
log_sessions: list = []
4747

4848
class LogFilter(logging.Filter):
4949

panel/io/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
log = logging.getLogger('panel.io.handlers')
4343

44-
CELL_DISPLAY = []
44+
CELL_DISPLAY: list = []
4545

4646

4747
@contextmanager

panel/io/mime_render.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def _convert_expr(expr: ast.Expr) -> ast.Expression:
112112
expr.lineno, expr.col_offset = 0, 0
113113
return ast.Expression(expr.value)
114114

115-
_OUT_BUFFER = []
115+
_OUT_BUFFER: list = []
116116

117117
def _display(*objs, **kwargs):
118118
"""

panel/io/pyodide.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _read_json(*args, **kwargs):
127127
return _read_json_original(*args, **kwargs)
128128
pandas.read_json = _read_json # type: ignore
129129

130-
_tasks = set()
130+
_tasks: set = set()
131131

132132
def async_execute(func: t.Any):
133133
event_loop = asyncio.get_running_loop()
@@ -268,7 +268,7 @@ def _process_document_events(doc: Document, events: list[t.Any]):
268268
})
269269
""")
270270

271-
_current_buffers = []
271+
_current_buffers: list = []
272272
_patching = False
273273

274274
def _bytes_converter(value, converter, other):
@@ -323,7 +323,7 @@ def _convert_json_patch(json_patch):
323323
return serialized
324324

325325
# Holds proxied functions so they are not GCed
326-
_proxies = []
326+
_proxies: list = []
327327

328328
def _link_docs(pydoc: Document, jsdoc: t.Any) -> None:
329329
"""

panel/io/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _path_template_to_tornado_route(route: str) -> str:
207207
return route
208208
return '/' + '/'.join(converted_segments)
209209

210-
_tasks = set()
210+
_tasks: set = set()
211211

212212
def async_execute(func: Callable[..., None]) -> None:
213213
"""

panel/pane/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from bokeh.model import Model
2626

27-
_tasks = set()
27+
_tasks: set = set()
2828

2929

3030
class FileBase(HTMLBasePane):

panel/pane/vtk/synchronizable_serializer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def buildDependencyCallList(self, idstr, newList, addMethod, removeMethod):
293293
# Global variables
294294
# -----------------------------------------------------------------------------
295295

296-
SERIALIZERS = {}
296+
SERIALIZERS: dict = {}
297297
context = None
298298

299299
# -----------------------------------------------------------------------------

pixi.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ types-psutil = "*"
267267
types-requests = "*"
268268
types-tqdm = "*"
269269
typing-extensions = "*"
270+
param = ">=2.4.1rc1"
270271

271272
[feature.type.tasks]
272273
test-type = 'mypy panel'

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ explicit_package_bases = true
258258
disable_error_code = "attr-defined"
259259
mypy_path = ""
260260
exclude = []
261+
plugins = ["param.mypy_plugin"]
261262

262263
[[tool.mypy.overrides]]
263264
module = [

0 commit comments

Comments
 (0)