[pre-commit.ci] pre-commit autoupdate (#3736)

This commit is contained in:
pre-commit-ci[bot] 2024-04-04 09:21:19 +02:00 committed by GitHub
parent 780d6b3a90
commit 6f7ae21aa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 75 additions and 96 deletions

View File

@ -16,15 +16,15 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.1.14"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.5"
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v17.0.6"
rev: "v18.1.2"
hooks:
- id: clang-format
types_or: [c++, c, cuda]
@ -39,7 +39,7 @@ repos:
- id: rst-inline-touching-normal
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.6"
rev: "v0.10.0.1"
hooks:
- id: shellcheck
exclude: ^src/templates/python$
@ -56,7 +56,7 @@ repos:
exclude: ^(benchmark/benchmarks/pystone_benchmarks/pystone\.py|src/js/package-lock\.json)$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.8.0"
rev: "v1.9.0"
hooks:
- id: mypy
files: ^(packages/.*/src|src|pyodide-build/pyodide_build)
@ -86,7 +86,7 @@ repos:
additional_dependencies: *mypy-deps
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier

View File

@ -46,7 +46,6 @@ Version History:
"""
LOOPS = 50000
from time import perf_counter

View File

@ -72,9 +72,7 @@ def test_import(
if name in UNSUPPORTED_PACKAGES[selenium_standalone.browser]:
pytest.xfail(
"{} fails to load and is not supported on {}.".format(
name, selenium_standalone.browser
)
f"{name} fails to load and is not supported on {selenium_standalone.browser}."
)
selenium_standalone.run("import glob, os, site")

View File

@ -1052,7 +1052,7 @@ done:
dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
dt = H5FL_FREE(H5T_t, dt);
} /* end if */
} /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5T__init_native() */

View File

@ -122,9 +122,10 @@ def _compile(
else:
compression = zipfile.ZIP_STORED
with zipfile.ZipFile(
input_path
) as fh_zip_in, TemporaryDirectory() as temp_dir_str:
with (
zipfile.ZipFile(input_path) as fh_zip_in,
TemporaryDirectory() as temp_dir_str,
):
temp_dir = Path(temp_dir_str)
output_path_tmp = temp_dir / output_name
with zipfile.ZipFile(

View File

@ -166,9 +166,10 @@ class RecipeBuilder:
self._prepare_source()
self._patch()
with chdir(self.pkg_root), get_bash_runner(
self._get_helper_vars()
) as bash_runner:
with (
chdir(self.pkg_root),
get_bash_runner(self._get_helper_vars()) as bash_runner,
):
if self.recipe.is_rust_package():
bash_runner.run(
RUST_BUILD_PRELUDE,

View File

@ -244,9 +244,15 @@ def repack_zip_archive(archive_path: Path, compression_level: int = 6) -> None:
with TemporaryDirectory() as temp_dir:
input_path = Path(temp_dir) / archive_path.name
shutil.move(archive_path, input_path)
with zipfile.ZipFile(input_path) as fh_zip_in, zipfile.ZipFile(
archive_path, "w", compression=compression, compresslevel=compression_level
) as fh_zip_out:
with (
zipfile.ZipFile(input_path) as fh_zip_in,
zipfile.ZipFile(
archive_path,
"w",
compression=compression,
compresslevel=compression_level,
) as fh_zip_out,
):
for name in fh_zip_in.namelist():
fh_zip_out.writestr(name, fh_zip_in.read(name))

View File

@ -7,6 +7,7 @@ The gist is we compile the package replacing calls to the compiler and linker
with wrappers that adjusting include paths and flags as necessary for
cross-compiling and then pass the command long to emscripten.
"""
import json
import os
import sys

View File

@ -365,14 +365,12 @@ class JsPromise(JsProxy, Generic[T]):
@overload
def then(
self, onfulfilled: None, onrejected: Callable[[BaseException], Awaitable[S]], /
) -> "JsPromise[S]":
...
) -> "JsPromise[S]": ...
@overload
def then(
self, onfulfilled: None, onrejected: Callable[[BaseException], S], /
) -> "JsPromise[S]":
...
) -> "JsPromise[S]": ...
@overload
def then(
@ -380,8 +378,7 @@ class JsPromise(JsProxy, Generic[T]):
onfulfilled: Callable[[T], Awaitable[S]],
onrejected: Callable[[BaseException], Awaitable[S]] | None = None,
/,
) -> "JsPromise[S]":
...
) -> "JsPromise[S]": ...
@overload
def then(
@ -389,8 +386,7 @@ class JsPromise(JsProxy, Generic[T]):
onfulfilled: Callable[[T], S],
onrejected: Callable[[BaseException], S] | None = None,
/,
) -> "JsPromise[S]":
...
) -> "JsPromise[S]": ...
@docs_argspec(
"(self, onfulfilled: Callable[[T], Awaitable[S] | S] | None, onrejected: Callable[[BaseException], Awaitable[S] | S] | None = None, /) -> 'JsPromise[S]'"
@ -410,12 +406,10 @@ class JsPromise(JsProxy, Generic[T]):
@overload
def catch(
self, onrejected: Callable[[BaseException], Awaitable[S]], /
) -> "JsPromise[S]":
...
) -> "JsPromise[S]": ...
@overload
def catch(self, onrejected: Callable[[BaseException], S], /) -> "JsPromise[S]":
...
def catch(self, onrejected: Callable[[BaseException], S], /) -> "JsPromise[S]": ...
@docs_argspec(
"(self, onrejected: Callable[[BaseException], Awaitable[S] | S], /) -> 'JsPromise[S]'"
@ -670,8 +664,7 @@ class JsGenerator(JsIterable[T_co], Generic[T_co, T_contra, V_co]):
val: BaseException | object = ...,
tb: TracebackType | None = ...,
/,
) -> T_co:
...
) -> T_co: ...
@overload
def throw(
@ -680,8 +673,7 @@ class JsGenerator(JsIterable[T_co], Generic[T_co, T_contra, V_co]):
val: None = ...,
tb: TracebackType | None = ...,
/,
) -> T_co:
...
) -> T_co: ...
@docs_argspec("(self, error: BaseException, /) -> T_co")
def throw(
@ -801,8 +793,7 @@ class JsAsyncGenerator(JsAsyncIterable[T_co], Generic[T_co, T_contra, V_co]):
val: BaseException | object = ...,
tb: TracebackType | None = ...,
/,
) -> Awaitable[T_co]:
...
) -> Awaitable[T_co]: ...
@overload
def athrow(
@ -811,8 +802,7 @@ class JsAsyncGenerator(JsAsyncIterable[T_co], Generic[T_co, T_contra, V_co]):
val: None = ...,
tb: TracebackType | None = ...,
/,
) -> Awaitable[T_co]:
...
) -> Awaitable[T_co]: ...
@docs_argspec("(self, error: BaseException, /) -> T_co")
def athrow(self, value: Any, *args: Any) -> Awaitable[T_co]:
@ -856,23 +846,19 @@ class JsArray(JsIterable[T], Generic[T], MutableSequence[T], metaclass=_ABCMeta)
_js_type_flags = ["IS_ARRAY", "IS_NODE_LIST", "IS_TYPEDARRAY"]
@overload
def __getitem__(self, idx: int) -> T:
...
def __getitem__(self, idx: int) -> T: ...
@overload
def __getitem__(self, idx: slice) -> "JsArray[T]":
...
def __getitem__(self, idx: slice) -> "JsArray[T]": ...
def __getitem__(self, idx):
raise NotImplementedError
@overload
def __setitem__(self, idx: int, value: T) -> None:
...
def __setitem__(self, idx: int, value: T) -> None: ...
@overload
def __setitem__(self, idx: slice, value: Iterable[T]) -> None:
...
def __setitem__(self, idx: slice, value: Iterable[T]) -> None: ...
def __setitem__(self, idx, value):
pass
@ -999,12 +985,10 @@ class JsMap(JsIterable[KT], Generic[KT, VT_co], Mapping[KT, VT_co], metaclass=_A
raise NotImplementedError
@overload
def get(self, key: KT, /) -> VT_co | None:
...
def get(self, key: KT, /) -> VT_co | None: ...
@overload
def get(self, key: KT, default: VT_co | T, /) -> VT_co | T:
...
def get(self, key: KT, default: VT_co | T, /) -> VT_co | T: ...
@docs_argspec("(self, key: KT, default: VT_co | None, /) -> VT_co")
def get(self, key: KT, default: Any = None, /) -> VT_co:
@ -1013,11 +997,9 @@ class JsMap(JsIterable[KT], Generic[KT, VT_co], Mapping[KT, VT_co], metaclass=_A
class _SupportsKeysAndGetItem(Protocol[KT, VT_co]):
def keys(self) -> Iterable[KT]:
...
def keys(self) -> Iterable[KT]: ...
def __getitem__(self, __key: KT) -> VT_co:
...
def __getitem__(self, __key: KT) -> VT_co: ...
class JsMutableMap(
@ -1037,12 +1019,10 @@ class JsMutableMap(
_js_type_flags = ["HAS_GET | HAS_SET | HAS_LENGTH | IS_ITERABLE", "IS_OBJECT_MAP"]
@overload
def pop(self, key: KT, /) -> VT:
...
def pop(self, key: KT, /) -> VT: ...
@overload
def pop(self, key: KT, default: VT | T = ..., /) -> VT | T:
...
def pop(self, key: KT, default: VT | T = ..., /) -> VT | T: ...
@docs_argspec("(self, key: KT, default: VT | None = None, /) -> VT")
def pop(self, key: KT, default: Any = None, /) -> Any:
@ -1067,16 +1047,13 @@ class JsMutableMap(
"""Empty out the map entirely."""
@overload
def update(self, __m: _SupportsKeysAndGetItem[KT, VT], **kwargs: VT) -> None:
...
def update(self, __m: _SupportsKeysAndGetItem[KT, VT], **kwargs: VT) -> None: ...
@overload
def update(self, __m: Iterable[tuple[KT, VT]], **kwargs: VT) -> None:
...
def update(self, __m: Iterable[tuple[KT, VT]], **kwargs: VT) -> None: ...
@overload
def update(self, **kwargs: VT) -> None:
...
def update(self, **kwargs: VT) -> None: ...
@docs_argspec(
"(self, other : Mapping[KT, VT] | Iterable[tuple[KT, VT]] = None , /, **kwargs) -> None"
@ -1277,8 +1254,7 @@ def to_js(
]
| None
) = None,
) -> JsArray[Any]:
...
) -> JsArray[Any]: ...
@overload
@ -1296,8 +1272,7 @@ def to_js(
]
| None
) = None,
) -> JsMap[Any, Any]:
...
) -> JsMap[Any, Any]: ...
@overload
@ -1315,8 +1290,7 @@ def to_js(
]
| None
) = None,
) -> Any:
...
) -> Any: ...
def to_js(

View File

@ -283,9 +283,9 @@ class Console:
self.buffer = []
self._lock = asyncio.Lock()
self._streams_redirected = False
self._stream_generator: Generator[
None, None, None
] | None = None # track persistent stream redirection
self._stream_generator: Generator[None, None, None] | None = (
None # track persistent stream redirection
)
if persistent_stream_redirection:
self.persistent_redirect_streams()
self._completer = rlcompleter.Completer(self.globals)

View File

@ -30,32 +30,28 @@ class PyodideFuture(Future[T]):
self,
onfulfilled: None,
onrejected: Callable[[BaseException], Awaitable[S]],
) -> "PyodideFuture[S]":
...
) -> "PyodideFuture[S]": ...
@overload
def then(
self,
onfulfilled: None,
onrejected: Callable[[BaseException], S],
) -> "PyodideFuture[S]":
...
) -> "PyodideFuture[S]": ...
@overload
def then(
self,
onfulfilled: Callable[[T], Awaitable[S]],
onrejected: Callable[[BaseException], Awaitable[S]] | None = None,
) -> "PyodideFuture[S]":
...
) -> "PyodideFuture[S]": ...
@overload
def then(
self,
onfulfilled: Callable[[T], S],
onrejected: Callable[[BaseException], S] | None = None,
) -> "PyodideFuture[S]":
...
) -> "PyodideFuture[S]": ...
def then(
self,
@ -128,12 +124,10 @@ class PyodideFuture(Future[T]):
@overload
def catch(
self, onrejected: Callable[[BaseException], Awaitable[S]]
) -> "PyodideFuture[S]":
...
) -> "PyodideFuture[S]": ...
@overload
def catch(self, onrejected: Callable[[BaseException], S]) -> "PyodideFuture[S]":
...
def catch(self, onrejected: Callable[[BaseException], S]) -> "PyodideFuture[S]": ...
def catch(
self, onrejected: Callable[[BaseException], object]

View File

@ -75,15 +75,19 @@ def test_load_relative_url(
pytz1_wheel = pytz_wheel.replace("pytz", "pytz1")
shutil.copy(DIST_PATH / pytz_wheel, tmp_path / pytz1_wheel)
with spawn_web_server(tmp_path) as web_server, selenium_common(
request,
runtime,
web_server,
load_pyodide=False,
browsers=playwright_browsers,
script_type="classic",
) as selenium, set_webdriver_script_timeout(
selenium, script_timeout=parse_driver_timeout(request.node)
with (
spawn_web_server(tmp_path) as web_server,
selenium_common(
request,
runtime,
web_server,
load_pyodide=False,
browsers=playwright_browsers,
script_type="classic",
) as selenium,
set_webdriver_script_timeout(
selenium, script_timeout=parse_driver_timeout(request.node)
),
):
if selenium.browser != "node":
selenium.goto(f"http://{url}:{web_server[1]}/test_temp.html")

View File

@ -5,6 +5,7 @@ Get the current versions of Chrome and Firefox to aid in tagging Docker images.
Old Docker image tag: 20230411-chromelatest-firefoxlatest
New Docker image tag: 20230411-chrome112-firefox112-py311
"""
from datetime import date
from sys import version_info