Skip to content

Commit 2b3fd6d

Browse files
[pre-commit.ci] pre-commit autoupdate (#161)
<!--pre-commit.ci start--> updates: - [github.com/psf/black: 23.10.1 → 23.11.0](psf/black@23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](tox-dev/pyproject-fmt@1.4.1...1.5.1) - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.5](astral-sh/ruff-pre-commit@v0.1.4...v0.1.5) - [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.7.0](pre-commit/mirrors-mypy@v1.6.1...v1.7.0) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 76bdad3 commit 2b3fd6d

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
)
2525
2626
- repo: https://github.com/psf/black
27-
rev: 23.10.1
27+
rev: 23.11.0
2828
hooks:
2929
- id: black
3030
files: >-
@@ -36,17 +36,17 @@ repos:
3636
)
3737
3838
- repo: https://github.com/tox-dev/pyproject-fmt
39-
rev: 1.4.1
39+
rev: 1.5.1
4040
hooks:
4141
- id: pyproject-fmt
4242

4343
- repo: https://github.com/astral-sh/ruff-pre-commit
44-
rev: v0.1.4
44+
rev: v0.1.5
4545
hooks:
4646
- id: ruff
4747

4848
- repo: https://github.com/pre-commit/mirrors-mypy
49-
rev: v1.6.1
49+
rev: v1.7.0
5050
hooks:
5151
- id: mypy
5252
files: nc_py_api/

nc_py_api/_deffered_error.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""DeferredError class taken from PIL._util.py file."""
22

3+
34
class DeferredError: # pylint: disable=too-few-public-methods
45
"""Allow failing import when using it in the client mode, without `app` dependencies."""
56

nc_py_api/_session.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,13 +414,11 @@ def _dav_stream(self, method: str, path: str, headers: dict, data: Optional[byte
414414

415415
def _create_adapter(self) -> Client:
416416
adapter = Client(follow_redirects=True, limits=self.limits, verify=self.cfg.options.nc_cert)
417-
adapter.headers.update(
418-
{
419-
"AA-VERSION": self.cfg.aa_version,
420-
"EX-APP-ID": self.cfg.app_name,
421-
"EX-APP-VERSION": self.cfg.app_version,
422-
}
423-
)
417+
adapter.headers.update({
418+
"AA-VERSION": self.cfg.aa_version,
419+
"EX-APP-ID": self.cfg.app_name,
420+
"EX-APP-VERSION": self.cfg.app_version,
421+
})
424422
return adapter
425423

426424
def sign_request(self, headers: dict) -> None:

nc_py_api/ex_app/integration_fastapi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
def nc_app(request: Request) -> NextcloudApp:
2626
"""Authentication handler for requests from Nextcloud to the application."""
27-
user = get_username_secret_from_headers(
28-
{"AUTHORIZATION-APP-API": request.headers.get("AUTHORIZATION-APP-API", "")}
29-
)[0]
27+
user = get_username_secret_from_headers({
28+
"AUTHORIZATION-APP-API": request.headers.get("AUTHORIZATION-APP-API", "")
29+
})[0]
3030
request_id = request.headers.get("AA-REQUEST-ID", None)
3131
headers = {"AA-REQUEST-ID": request_id} if request_id else {}
3232
nextcloud_app = NextcloudApp(user=user, headers=headers)

tests/_app_security_checks.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ def sign_request(req_headers: dict, secret=None, user: str = ""):
1616
headers = {}
1717
result = requests.put(request_url, headers=headers)
1818
assert result.status_code == 401 # Missing headers
19-
headers.update(
20-
{
21-
"AA-VERSION": environ.get("AA_VERSION", "1.0.0"),
22-
"EX-APP-ID": environ.get("APP_ID", "nc_py_api"),
23-
"EX-APP-VERSION": environ.get("APP_VERSION", "1.0.0"),
24-
}
25-
)
19+
headers.update({
20+
"AA-VERSION": environ.get("AA_VERSION", "1.0.0"),
21+
"EX-APP-ID": environ.get("APP_ID", "nc_py_api"),
22+
"EX-APP-VERSION": environ.get("APP_VERSION", "1.0.0"),
23+
})
2624
sign_request(headers)
2725
result = requests.put(request_url, headers=headers)
2826
assert result.status_code == 200

0 commit comments

Comments
 (0)