From 64d2fd60a20804444c22822bc8b154382e7b0ab3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:52:32 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.7 → v0.6.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.7...v0.6.8) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6c4f60c3..a7926932 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.7 + rev: v0.6.8 hooks: - id: ruff From 25d87a16387b5eb1e7d3f71b09a758687d3fd0b5 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Thu, 3 Oct 2024 11:58:00 +0300 Subject: [PATCH 2/2] applied changes from "SIM910" rule Signed-off-by: Alexander Piskun --- nc_py_api/_session.py | 4 ++-- nc_py_api/users.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nc_py_api/_session.py b/nc_py_api/_session.py index 66326c7b..f3750160 100644 --- a/nc_py_api/_session.py +++ b/nc_py_api/_session.py @@ -301,7 +301,7 @@ def _response_event(self, response: Response) -> None: def download2fp(self, url_path: str, fp, dav: bool, params=None, **kwargs): adapter = self.adapter_dav if dav else self.adapter - with adapter.stream("GET", url_path, params=params, headers=kwargs.get("headers", None)) as response: + with adapter.stream("GET", url_path, params=params, headers=kwargs.get("headers")) as response: check_error(response) for data_chunk in response.iter_raw(chunk_size=kwargs.get("chunk_size", 5 * 1024 * 1024)): fp.write(data_chunk) @@ -425,7 +425,7 @@ async def _response_event(self, response: Response) -> None: async def download2fp(self, url_path: str, fp, dav: bool, params=None, **kwargs): adapter = self.adapter_dav if dav else self.adapter - async with adapter.stream("GET", url_path, params=params, headers=kwargs.get("headers", None)) as response: + async with adapter.stream("GET", url_path, params=params, headers=kwargs.get("headers")) as response: check_error(response) async for data_chunk in response.aiter_raw(chunk_size=kwargs.get("chunk_size", 5 * 1024 * 1024)): fp.write(data_chunk) diff --git a/nc_py_api/users.py b/nc_py_api/users.py index 581477e3..77e1fbfb 100644 --- a/nc_py_api/users.py +++ b/nc_py_api/users.py @@ -369,8 +369,8 @@ async def get_avatar( def _create(user_id: str, display_name: str | None, **kwargs) -> dict[str, typing.Any]: - password = kwargs.get("password", None) - email = kwargs.get("email", None) + password = kwargs.get("password") + email = kwargs.get("email") if not password and not email: raise ValueError("Either password or email must be set") data = {"userid": user_id}