Skip to content

Commit

Permalink
Update CI dependencies (master) (#11696)
Browse files Browse the repository at this point in the history
* Update CI dependencies

* Apply pre-commit fix

From the artifact of the previous workflow run

* Apply pre-commit fix

From the artifact of the previous workflow run

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: geo-ghci-int[bot] <146321879+geo-ghci-int[bot]@users.noreply.github.com>
  • Loading branch information
renovate[bot] and geo-ghci-int[bot] authored Feb 4, 2025
1 parent 8140f51 commit d461faf
Show file tree
Hide file tree
Showing 23 changed files with 63 additions and 78 deletions.
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ repos:
- id: check-symlinks
- id: fix-byte-order-marker
- repo: https://github.com/sbrunner/hooks
rev: 1.1.2
rev: 1.2.1
hooks:
- id: copyright
- id: workflows-require-timeout
- id: poetry-lock
exclude: ^geoportal/c2cgeoportal_geoportal/scaffolds/[a-z_]+/{{cookiecutter\.project}}/
additional_dependencies:
- poetry==1.8.5 # pypi
- poetry==2.0.1 # pypi
- id: npm-lock
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
exclude: |-
Expand Down Expand Up @@ -80,12 +80,12 @@ repos:
hooks:
- id: git-check
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
rev: 0.31.1
hooks:
- id: check-github-workflows
- id: check-renovate
additional_dependencies:
- pyjson5==1.6.7 # pypi
- pyjson5==1.6.8 # pypi
- id: check-github-actions
- id: check-jsonschema
name: Check GitHub Workflows set timeout-minutes
Expand All @@ -105,7 +105,7 @@ repos:
|geoportal/c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter\.project}}/mapserver/data/TM_EUROPE_BORDERS-0.3\.sql
)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
rev: v0.9.4
hooks:
- id: ruff-format
args:
Expand All @@ -125,15 +125,15 @@ repos:
- --die-on-tool-error
- --output-format=pylint
additional_dependencies:
- prospector-profile-duplicated==1.10.0 # pypi
- prospector-profile-duplicated==1.10.4 # pypi
- prospector-profile-utils==1.17.0 # pypi
- ruff==0.8.4 # pypi
- ruff==0.9.4 # pypi
- repo: https://github.com/sbrunner/jsonschema-validator
rev: 1.0.0
hooks:
- id: jsonschema-validator
files: ^ci/config\.yaml$
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 39.86.3
rev: 39.159.0
hooks:
- id: renovate-config-validator
12 changes: 3 additions & 9 deletions admin/tests/test_learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ class TestUser:
def test_view_rendering_in_app(self, dbsession, test_app):
res = test_app.get("/users_nb", status=200)
expected = (
"['users len is: 1', <br/>,"
" 'first is: babar', <br/>,"
" 'project is: c2cgeoportal_admin', <br/>]"
"['users len is: 1', <br/>, 'first is: babar', <br/>, 'project is: c2cgeoportal_admin', <br/>]"
)
assert expected == str(res.html.contents)

Expand All @@ -56,18 +54,14 @@ def test_commit_in_app(self, dbsession, test_app):
res = test_app.get("/user_add", status=200)
res = test_app.get("/users_nb", status=200)
expected = (
"['users len is: 2', <br/>,"
" 'first is: babar', <br/>,"
" 'project is: c2cgeoportal_admin', <br/>]"
"['users len is: 2', <br/>, 'first is: babar', <br/>, 'project is: c2cgeoportal_admin', <br/>]"
)
assert expected == str(res.html.contents)

@pytest.mark.usefixtures("test_app")
def test_commit_in_app_rollbacked(self, dbsession, test_app):
res = test_app.get("/users_nb", status=200)
expected = (
"['users len is: 1', <br/>,"
" 'first is: babar', <br/>,"
" 'project is: c2cgeoportal_admin', <br/>]"
"['users len is: 1', <br/>, 'first is: babar', <br/>, 'project is: c2cgeoportal_admin', <br/>]"
)
assert expected == str(res.html.contents)
4 changes: 2 additions & 2 deletions ci/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (c) 2019-2024, Camptocamp SA
# Copyright (c) 2019-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -247,7 +247,7 @@ def main() -> None:
md_file.write(f"##### {release}\n\n")
title = False
md_file.write(
f'- {pull["title"].strip()} [{repo}#{pull["number"]}]({pull["html_url"]})\n'
f"- {pull['title'].strip()} [{repo}#{pull['number']}]({pull['html_url']})\n"
)

subprocess.run(["pre-commit", "run", "--file=CHANGELOG.md"]) # pylint: disable=subprocess-run-check
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
c2cciutils[checks,publish]==1.7.3
pre-commit==4.0.1
pre-commit==4.1.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2024, Camptocamp SA
# Copyright (c) 2015-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -155,7 +155,7 @@ def upgrade() -> None:
op.drop_table("layer_internal_wms", schema=schema)

# update layer type in treeitems
op.execute(f"UPDATE {schema}.treeitem " "SET type='l_wms' " "WHERE type='l_int_wms' OR type='l_ext_wms'")
op.execute(f"UPDATE {schema}.treeitem SET type='l_wms' WHERE type='l_int_wms' OR type='l_ext_wms'")


def downgrade() -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2024, Camptocamp SA
# Copyright (c) 2014-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -101,7 +101,7 @@ def upgrade() -> None:
Column("readwrite", Boolean, default=False),
schema=schema,
)
op.execute(f"SELECT AddGeometryColumn('{schema}', 'restrictionarea', " f"'area', {srid}, 'POLYGON', 2)")
op.execute(f"SELECT AddGeometryColumn('{schema}', 'restrictionarea', 'area', {srid}, 'POLYGON', 2)")
op.create_table(
"shorturl",
Column("id", Integer, primary_key=True),
Expand All @@ -121,7 +121,7 @@ def upgrade() -> None:
Column("description", Unicode),
schema=schema,
)
op.execute(f"SELECT AddGeometryColumn('{schema}', 'role', " f"'extent', {srid}, 'POLYGON', 2)")
op.execute(f"SELECT AddGeometryColumn('{schema}', 'role', 'extent', {srid}, 'POLYGON', 2)")
role = Table("role", MetaData(), Column("name", Unicode, unique=True, nullable=False), schema=schema)
op.bulk_insert(role, [{"name": "role_admin"}])

Expand Down Expand Up @@ -174,7 +174,7 @@ def upgrade() -> None:
Column("params", Unicode, nullable=True),
schema=schema,
)
op.execute(f"SELECT AddGeometryColumn('{schema}', 'tsearch', 'the_geom', " f"{srid}, 'GEOMETRY', 2)")
op.execute(f"SELECT AddGeometryColumn('{schema}', 'tsearch', 'the_geom', {srid}, 'GEOMETRY', 2)")
op.create_index("tsearch_ts_idx", "tsearch", ["ts"], schema=schema, postgresql_using="gin")
op.create_table(
"treegroup",
Expand Down Expand Up @@ -252,7 +252,7 @@ def upgrade() -> None:
schema=schema,
)

op.execute(f'INSERT INTO {schema}.treeitem (type, name, "order") ' "VALUES ('group', 'background', 0)")
op.execute(f"INSERT INTO {schema}.treeitem (type, name, \"order\") VALUES ('group', 'background', 0)")
op.execute(f"INSERT INTO {schema}.treegroup (id) SELECT id FROM {schema}.treeitem")
op.execute(f"INSERT INTO {schema}.layergroup (id) SELECT id FROM {schema}.treeitem")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2024, Camptocamp SA
# Copyright (c) 2014-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -271,8 +271,8 @@ def downgrade() -> None:
op.alter_column("layergroup", "is_internal_wms", new_column_name="isInternalWMS", schema=schema)
op.alter_column("layergroup", "is_base_layer", new_column_name="isBaseLayer", schema=schema)

op.execute(f"UPDATE ONLY {schema}.theme AS t " 'SET "inDesktopViewer" = FALSE')
op.execute(f"UPDATE ONLY {schema}.layer AS t " 'SET "inDesktopViewer" = FALSE')
op.execute(f'UPDATE ONLY {schema}.theme AS t SET "inDesktopViewer" = FALSE')
op.execute(f'UPDATE ONLY {schema}.layer AS t SET "inDesktopViewer" = FALSE')

op.execute(
f"UPDATE ONLY {schema}.theme AS t "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2024, Camptocamp SA
# Copyright (c) 2016-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -53,10 +53,7 @@ def upgrade() -> None:

op.add_column("layerv1", Column("layer", Unicode), schema=schema)
op.execute(
f"UPDATE {schema}.layerv1 AS l1 "
"SET layer = name "
f"FROM {schema}.treeitem AS ti "
"WHERE l1.id = ti.id"
f"UPDATE {schema}.layerv1 AS l1 SET layer = name FROM {schema}.treeitem AS ti WHERE l1.id = ti.id"
)


Expand Down
4 changes: 2 additions & 2 deletions commons/c2cgeoportal_commons/testing/initializedb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2017-2024, Camptocamp SA
# Copyright (c) 2017-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -40,7 +40,7 @@
def usage(argv: list[str]) -> None:
"""Get the usage."""
cmd = os.path.basename(argv[0])
print(f"usage: {cmd} <config_uri> [var=value]\n" '(example: "{cmd} development.ini")')
print(f'usage: {cmd} <config_uri> [var=value]\n(example: "{{cmd}} development.ini")')
sys.exit(1)


Expand Down
2 changes: 1 addition & 1 deletion doc/import_ngeo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _format_type(type_definition: dict[str, Any]) -> str:
if type_definition["type"] == "reference":
postfix = ""
if "typeArguments" in type_definition:
postfix = f'\\<{", ".join([_format_type(t) for t in type_definition["typeArguments"]])}>'
postfix = f"\\<{', '.join([_format_type(t) for t in type_definition['typeArguments']])}>"

return f":ref:`integrator_guide_ngeo_properties_{type_definition['name']}`{postfix}"

Expand Down
2 changes: 1 addition & 1 deletion docker/config/bin/eval-templates
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _convert_location(location: str, raster_base: RasterBase, verify_first: bool
return location # ignored

location_split = location.split("/")
return f"{raster_base.value}{'/'.join(location_split[raster_base.length + 1:])}"
return f"{raster_base.value}{'/'.join(location_split[raster_base.length + 1 :])}"


def _convert_qgis_project(project: bytes, raster_base: RasterBase) -> bytes:
Expand Down
4 changes: 2 additions & 2 deletions docker/qgisserver/geomapfish_qgisserver/accesscontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,6 @@ def cacheKey(self) -> str: # pylint: disable=invalid-name
_LOG.error("Unknown values for roles: %s", roles)
return f"{self.serverInterface().getEnv('HTTP_HOST')}-ROOT"
return (
f'{self.serverInterface().getEnv("HTTP_HOST")}-'
f'{",".join(str(role.id) for role in sorted(roles, key=lambda role: role.id))}'
f"{self.serverInterface().getEnv('HTTP_HOST')}-"
f"{','.join(str(role.id) for role in sorted(roles, key=lambda role: role.id))}"
)
8 changes: 4 additions & 4 deletions docker/qgisserver/tests/functional/accesscontrol_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018-2024, Camptocamp SA
# Copyright (c) 2018-2025, Camptocamp SA
# All rights reserved.

# This program is free software; you can redistribute it and/or modify it under the terms of the
Expand Down Expand Up @@ -322,9 +322,9 @@ def test_get_restriction_areas(self, server_iface, DBSession, test_data): # noq
]
roles = [dbsession.query(Role).filter(Role.name == role_name).one() for role_name in role_names]
ras = ogcserver_accesscontrol.get_restriction_areas(layers, rw, roles)
assert (
expected == ras
), f"get_restriction_areas with {(layer_names, rw, role_names)} should return {expected}"
assert expected == ras, (
f"get_restriction_areas with {(layer_names, rw, role_names)} should return {expected}"
)

def test_get_area(self, server_iface, DBSession, test_data): # noqa: ignore=N803
dbsession = DBSession()
Expand Down
6 changes: 3 additions & 3 deletions geoportal/c2cgeoportal_geoportal/lib/checker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011-2024, Camptocamp SA
# Copyright (c) 2011-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -276,9 +276,9 @@ def __call__(self, request: pyramid.request.Request) -> None:
except subprocess.TimeoutExpired as exception:
raise Exception( # pylint: disable=broad-exception-raised
f"""Timeout:
command: {' '.join(exception.cmd)}
command: {" ".join(exception.cmd)}
output:
{exception.output.decode('utf-8')}"""
{exception.output.decode("utf-8")}"""
) from exception

name = "checker_phantomjs_" + route.get("checker_name", route["name"])
Expand Down
14 changes: 7 additions & 7 deletions geoportal/c2cgeoportal_geoportal/lib/filter_capabilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2024, Camptocamp SA
# Copyright (c) 2014-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -219,12 +219,12 @@ def __init__(
self._downstream = downstream
self._accumulator: list[str] = []

assert (
layers_blacklist is not None or layers_whitelist is not None
), "either layers_blacklist OR layers_whitelist must be set"
assert not (
layers_blacklist is not None and layers_whitelist is not None
), "only either layers_blacklist OR layers_whitelist can be set"
assert layers_blacklist is not None or layers_whitelist is not None, (
"either layers_blacklist OR layers_whitelist must be set"
)
assert not (layers_blacklist is not None and layers_whitelist is not None), (
"only either layers_blacklist OR layers_whitelist can be set"
)

if layers_blacklist is not None:
layers_blacklist = {layer.lower() for layer in layers_blacklist}
Expand Down
3 changes: 1 addition & 2 deletions geoportal/c2cgeoportal_geoportal/lib/lingva_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,7 @@ def _layer_attributes(self, url: str, layer: str) -> tuple[list[str], list[str]]
except AttributeError:
print(
colorize(
"ERROR! an error occurred while trying to "
"read the Mapfile and recover the themes.",
"ERROR! an error occurred while trying to read the Mapfile and recover the themes.",
Color.RED,
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
c2cciutils[checks,publish]==1.7.3
pre-commit==4.0.1
pre-commit==4.1.0
4 changes: 2 additions & 2 deletions geoportal/c2cgeoportal_geoportal/scripts/pcreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_argparser() -> ArgumentParser:
"--scaffold",
dest="scaffold_names",
action="append",
help=("Add a scaffold to the create process " "(multiple -s args accepted)"),
help=("Add a scaffold to the create process (multiple -s args accepted)"),
)
parser.add_argument(
"-l",
Expand Down Expand Up @@ -84,7 +84,7 @@ def get_argparser() -> ArgumentParser:
"output_directory",
nargs="?",
default=None,
help="The directory where the project will be " "created.",
help="The directory where the project will be created.",
)
return parser

Expand Down
4 changes: 2 additions & 2 deletions geoportal/c2cgeoportal_geoportal/views/entry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011-2024, Camptocamp SA
# Copyright (c) 2011-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -135,7 +135,7 @@ def canvas_view(request: pyramid.request.Request, interface_config: dict[str, An
"request": request,
"header": f"""
<meta name="dynamicUrl" content="{request.route_url("dynamic")}">
<meta name="interface" content="{interface_config['name']}">
<meta name="interface" content="{interface_config["name"]}">
{css}""",
"footer": "\n ".join(
[f'<script src="{request.static_url(js)}" crossorigin="anonymous"></script>' for js in js_files]
Expand Down
3 changes: 1 addition & 2 deletions geoportal/c2cgeoportal_geoportal/views/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ def change_password(self) -> pyramid.response.Response:
otp = self.request.POST.get("otp")
if new_password is None or new_password_confirm is None or old_password is None:
raise HTTPBadRequest(
"'oldPassword', 'newPassword' and 'confirmNewPassword' should be available in "
"request params."
"'oldPassword', 'newPassword' and 'confirmNewPassword' should be available in request params."
)
if self.two_factor_auth and otp is None:
raise HTTPBadRequest("The second factor is missing.")
Expand Down
6 changes: 2 additions & 4 deletions geoportal/c2cgeoportal_geoportal/views/printproxy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011-2024, Camptocamp SA
# Copyright (c) 2011-2025, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -111,9 +111,7 @@ def report_create(self) -> pyramid.response.Response:
"""Create PDF."""
return self._proxy_response(
"print",
Url(
f"{ self.request.get_organization_print_url()}/report.{self.request.matchdict.get('format')}"
),
Url(f"{self.request.get_organization_print_url()}/report.{self.request.matchdict.get('format')}"),
)

@view_config(route_name="printproxy_status") # type: ignore[misc]
Expand Down
6 changes: 3 additions & 3 deletions geoportal/tests/functional/test_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ def _create_entry(self):

def _assert_has_error(self, errors, error):
self.assertIn(error, errors)
assert (
len([e for e in errors if e == error]) == 1
), f"Error '{error}' more than one time in errors:\n{errors!r}"
assert len([e for e in errors if e == error]) == 1, (
f"Error '{error}' more than one time in errors:\n{errors!r}"
)

def test_json_extent(self):
from c2cgeoportal_commons.models import DBSession
Expand Down
Loading

0 comments on commit d461faf

Please sign in to comment.