Skip to content

Commit

Permalink
Apply pre-commit fix
Browse files Browse the repository at this point in the history
From the artifact of the previous workflow run
  • Loading branch information
geo-ghci-int[bot] committed Dec 2, 2024
1 parent a39d63d commit e162279
Show file tree
Hide file tree
Showing 78 changed files with 428 additions and 266 deletions.
4 changes: 3 additions & 1 deletion admin/c2cgeoportal_admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def get_tm_session(
)

# Add fake user as we do not have authentication from geoportal
from c2cgeoportal_commons.models.static import User # pylint: disable=import-outside-toplevel
from c2cgeoportal_commons.models.static import (
User, # pylint: disable=import-outside-toplevel
)

config.add_request_method(
lambda request: User(
Expand Down
5 changes: 2 additions & 3 deletions admin/c2cgeoportal_admin/lib/ogcserver_synchronizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@

import pyramid.request
import requests
from defusedxml import ElementTree
from sqlalchemy.orm.session import Session

from c2cgeoportal_commons.lib.url import get_url2
from c2cgeoportal_commons.models import main
from defusedxml import ElementTree
from sqlalchemy.orm.session import Session


class dry_run_transaction: # noqa ignore=N801: class names should use CapWords convention
Expand Down
3 changes: 1 addition & 2 deletions admin/c2cgeoportal_admin/schemas/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@

import colander
from c2cgeoform.schema import GeoFormSchemaNode
from c2cgeoportal_commons.models.main import Dimension
from deform.widget import MappingWidget, SequenceWidget
from sqlalchemy.orm.attributes import InstrumentedAttribute

from c2cgeoportal_commons.models.main import Dimension


def dimensions_schema_node(
prop: InstrumentedAttribute[Any], # pylint: disable=unsubscriptable-object
Expand Down
4 changes: 1 addition & 3 deletions admin/c2cgeoportal_admin/schemas/functionalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@
import colander
from c2cgeoform.ext.deform_ext import RelationCheckBoxListWidget
from c2cgeoform.schema import GeoFormManyToManySchemaNode, manytomany_validator
from c2cgeoportal_commons.models.main import Functionality
from sqlalchemy import inspect, select
from sqlalchemy.orm.attributes import InstrumentedAttribute
from sqlalchemy.sql.functions import concat

from c2cgeoportal_commons.models.main import Functionality


def available_functionalities_for(settings: dict[str, Any], model: type[Any]) -> list[dict[str, Any]]:
"""Return filtered list of functionality definitions."""
Expand Down Expand Up @@ -81,7 +80,6 @@ def functionalities_schema_node(
prop: InstrumentedAttribute[Any], model: type[Any]
) -> colander.SequenceSchema:
"""Get the schema of the functionalities."""

return colander.SequenceSchema(
GeoFormManyToManySchemaNode(Functionality, None),
name=prop.key,
Expand Down
3 changes: 1 addition & 2 deletions admin/c2cgeoportal_admin/schemas/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
import colander
from c2cgeoform.ext.deform_ext import RelationCheckBoxListWidget
from c2cgeoform.schema import GeoFormManyToManySchemaNode, manytomany_validator
from sqlalchemy.orm.attributes import InstrumentedAttribute

from c2cgeoportal_commons.models.main import Interface
from sqlalchemy.orm.attributes import InstrumentedAttribute


def interfaces_schema_node(
Expand Down
5 changes: 2 additions & 3 deletions admin/c2cgeoportal_admin/schemas/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
import colander
import pyramid.request
from c2cgeoform.schema import GeoFormSchemaNode
from c2cgeoportal_commons.lib.validators import url
from c2cgeoportal_commons.models.main import Metadata
from deform.widget import MappingWidget, SelectWidget, SequenceWidget, TextAreaWidget
from sqlalchemy import inspect
from sqlalchemy.orm.attributes import InstrumentedAttribute
from sqlalchemy.orm.mapper import Mapper

from c2cgeoportal_admin import _
from c2cgeoportal_commons.lib.validators import url
from c2cgeoportal_commons.models.main import Metadata


def get_relevant_for(model: type[Any] | Mapper[Any]) -> set[str]:
Expand Down Expand Up @@ -202,7 +202,6 @@ def _translate_available_metadata(

def metadata_schema_node(prop: InstrumentedAttribute[Any], model: type[Any]) -> colander.SequenceSchema:
"""Get the schema of a collection of metadata."""

# Deferred which returns a dictionary with metadata name as key and metadata definition as value.
# Needed to get the metadata types on UI side.
metadata_definitions_dict = colander.deferred(
Expand Down
3 changes: 1 addition & 2 deletions admin/c2cgeoportal_admin/schemas/restriction_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
import colander
from c2cgeoform.ext.deform_ext import RelationCheckBoxListWidget
from c2cgeoform.schema import GeoFormManyToManySchemaNode, manytomany_validator
from sqlalchemy.orm.attributes import InstrumentedAttribute

from c2cgeoportal_commons.models.main import RestrictionArea
from sqlalchemy.orm.attributes import InstrumentedAttribute


def restrictionareas_schema_node(
Expand Down
3 changes: 1 addition & 2 deletions admin/c2cgeoportal_admin/schemas/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
import colander
from c2cgeoform.ext.deform_ext import RelationCheckBoxListWidget
from c2cgeoform.schema import GeoFormManyToManySchemaNode, manytomany_validator
from sqlalchemy.orm.attributes import InstrumentedAttribute

from c2cgeoportal_commons.models.main import Role
from sqlalchemy.orm.attributes import InstrumentedAttribute


def roles_schema_node(
Expand Down
6 changes: 3 additions & 3 deletions admin/c2cgeoportal_admin/schemas/treegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
import pyramid.request
import sqlalchemy
from c2cgeoform.schema import GeoFormSchemaNode
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models.main import LayergroupTreeitem, TreeGroup, TreeItem
from sqlalchemy.orm import aliased
from sqlalchemy.sql.expression import case, func

from c2cgeoportal_admin import _
from c2cgeoportal_admin.widgets import ChildrenWidget, ChildWidget
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models.main import LayergroupTreeitem, TreeGroup, TreeItem

_LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -123,7 +123,7 @@ def treeitems(
def children_validator(node, cstruct):
"""Get the validator on the children nodes."""
for dict_ in cstruct:
if not dict_["treeitem_id"] in [item["id"] for item in node.candidates]:
if dict_["treeitem_id"] not in [item["id"] for item in node.candidates]:
raise colander.Invalid(
node,
_("Value {} does not exist in table {} or is not allowed to avoid cycles").format(
Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/views/dimension_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

import sqlalchemy.orm.query
from c2cgeoform.views.abstract_views import ListField
from c2cgeoportal_commons.models.main import DimensionLayer
from sqlalchemy.orm import subqueryload

from c2cgeoportal_admin.views.layers import LayerViews
from c2cgeoportal_commons.models.main import DimensionLayer

_list_field = partial(ListField, DimensionLayer)

Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/views/functionalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.models.main import Functionality
from deform.widget import FormWidget
from pyramid.view import view_config, view_defaults

from c2cgeoportal_admin import _
from c2cgeoportal_admin.views.logged_views import LoggedViews
from c2cgeoportal_commons.models.main import Functionality

_list_field = partial(ListField, Functionality)

Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/views/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.models.main import Interface
from pyramid.view import view_config, view_defaults

from c2cgeoportal_admin.views.logged_views import LoggedViews
from c2cgeoportal_commons.models.main import Interface

_list_field = partial(ListField, Interface)

Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/views/layer_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.models.main import LayerGroup, TreeGroup
from deform.widget import FormWidget
from pyramid.view import view_config, view_defaults

from c2cgeoportal_admin.schemas.metadata import metadata_schema_node
from c2cgeoportal_admin.schemas.treegroup import children_schema_node
from c2cgeoportal_admin.schemas.treeitem import parent_id_node
from c2cgeoportal_admin.views.treeitems import TreeItemViews
from c2cgeoportal_commons.models.main import LayerGroup, TreeGroup

_list_field = partial(ListField, LayerGroup)

Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/views/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import sqlalchemy
import sqlalchemy.orm.query
from c2cgeoform.views.abstract_views import ListField
from c2cgeoportal_commons.models.main import Interface, Layer
from sqlalchemy.orm import subqueryload

from c2cgeoportal_admin.views.treeitems import TreeItemViews
from c2cgeoportal_commons.models.main import Interface, Layer

_list_field = partial(ListField, Layer)

Expand Down
4 changes: 2 additions & 2 deletions admin/c2cgeoportal_admin/views/layers_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models.main import LayerCOG, LayerGroup
from deform.widget import FormWidget
from pyramid.httpexceptions import HTTPNotFound
from pyramid.view import view_config, view_defaults
Expand All @@ -50,8 +52,6 @@
from c2cgeoportal_admin.schemas.restriction_areas import restrictionareas_schema_node
from c2cgeoportal_admin.schemas.treeitem import parent_id_node
from c2cgeoportal_admin.views.layers import LayerViews
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models.main import LayerCOG, LayerGroup

_list_field = partial(ListField, LayerCOG)

Expand Down
4 changes: 2 additions & 2 deletions admin/c2cgeoportal_admin/views/layers_vectortiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models.main import LayerGroup, LayerVectorTiles
from deform.widget import FormWidget
from pyramid.httpexceptions import HTTPNotFound
from pyramid.view import view_config, view_defaults
Expand All @@ -50,8 +52,6 @@
from c2cgeoportal_admin.schemas.restriction_areas import restrictionareas_schema_node
from c2cgeoportal_admin.schemas.treeitem import parent_id_node
from c2cgeoportal_admin.views.dimension_layers import DimensionLayerViews
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models.main import LayerGroup, LayerVectorTiles

_list_field = partial(ListField, LayerVectorTiles)

Expand Down
9 changes: 8 additions & 1 deletion admin/c2cgeoportal_admin/views/layers_wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.models.main import (
LayerGroup,
LayerWMS,
LayerWMTS,
LogAction,
OGCServer,
TreeItem,
)
from deform.widget import FormWidget
from pyramid.view import view_config, view_defaults
from sqlalchemy import delete, insert, inspect, update
Expand All @@ -52,7 +60,6 @@
from c2cgeoportal_admin.schemas.restriction_areas import restrictionareas_schema_node
from c2cgeoportal_admin.schemas.treeitem import parent_id_node
from c2cgeoportal_admin.views.dimension_layers import DimensionLayerViews
from c2cgeoportal_commons.models.main import LayerGroup, LayerWMS, LayerWMTS, LogAction, OGCServer, TreeItem

_list_field = partial(ListField, LayerWMS)

Expand Down
9 changes: 8 additions & 1 deletion admin/c2cgeoportal_admin/views/layers_wmts.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.models.main import (
LayerGroup,
LayerWMS,
LayerWMTS,
LogAction,
OGCServer,
TreeItem,
)
from deform.widget import FormWidget
from pyramid.view import view_config, view_defaults
from sqlalchemy import delete, insert, inspect, update
Expand All @@ -52,7 +60,6 @@
from c2cgeoportal_admin.schemas.restriction_areas import restrictionareas_schema_node
from c2cgeoportal_admin.schemas.treeitem import parent_id_node
from c2cgeoportal_admin.views.dimension_layers import DimensionLayerViews
from c2cgeoportal_commons.models.main import LayerGroup, LayerWMS, LayerWMTS, LogAction, OGCServer, TreeItem

_list_field = partial(ListField, LayerWMTS)

Expand Down
8 changes: 7 additions & 1 deletion admin/c2cgeoportal_admin/views/layertree.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@

import pyramid.request
from c2cgeoform.views.abstract_views import DeleteResponse, ItemAction
from c2cgeoportal_commons.models.main import (
Interface,
Layer,
LayergroupTreeitem,
Theme,
TreeItem,
)
from pyramid.httpexceptions import HTTPNotFound
from pyramid.view import view_config, view_defaults
from translationstring import TranslationStringFactory

from c2cgeoportal_admin import _
from c2cgeoportal_commons.models.main import Interface, Layer, LayergroupTreeitem, Theme, TreeItem

itemtypes_tables = {
"theme": "themes",
Expand Down
3 changes: 1 addition & 2 deletions admin/c2cgeoportal_admin/views/logged_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
from typing import Generic, TypeVar

from c2cgeoform.views.abstract_views import AbstractViews, DeleteResponse, SaveResponse
from pyramid.httpexceptions import HTTPFound

from c2cgeoportal_commons.models import Base
from c2cgeoportal_commons.models.main import Log, LogAction
from pyramid.httpexceptions import HTTPFound

_T = TypeVar("_T", bound=Log)

Expand Down
11 changes: 8 additions & 3 deletions admin/c2cgeoportal_admin/views/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
from functools import partial

from c2cgeoform import JSONDict
from c2cgeoform.views.abstract_views import AbstractViews, GridResponse, IndexResponse, ItemAction, ListField
from pyramid.view import view_config, view_defaults

from c2cgeoform.views.abstract_views import (
AbstractViews,
GridResponse,
IndexResponse,
ItemAction,
ListField,
)
from c2cgeoportal_commons.models import _
from c2cgeoportal_commons.models.main import AbstractLog
from pyramid.view import view_config, view_defaults

_list_field = partial(ListField, AbstractLog)

Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/views/oauth2_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.models.static import Log, OAuth2Client
from pyramid.view import view_config, view_defaults

from c2cgeoportal_admin.views.logged_views import LoggedViews
from c2cgeoportal_commons.models.static import Log, OAuth2Client

_list_field = partial(ListField, OAuth2Client)

Expand Down
6 changes: 3 additions & 3 deletions admin/c2cgeoportal_admin/views/ogc_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
SaveResponse,
UserMessage,
)
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models import cache_invalidate_cb
from c2cgeoportal_commons.models.main import LogAction, OGCServer
from deform.widget import FormWidget
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config, view_defaults
Expand All @@ -53,9 +56,6 @@
from c2cgeoportal_admin import _
from c2cgeoportal_admin.lib.ogcserver_synchronizer import OGCServerSynchronizer
from c2cgeoportal_admin.views.logged_views import LoggedViews
from c2cgeoportal_commons.lib.literal import Literal
from c2cgeoportal_commons.models import cache_invalidate_cb
from c2cgeoportal_commons.models.main import LogAction, OGCServer

_list_field = partial(ListField, OGCServer)

Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/views/restriction_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
ObjectResponse,
SaveResponse,
)
from c2cgeoportal_commons.models.main import Layer, RestrictionArea
from deform.widget import FormWidget
from pyramid.view import view_config, view_defaults
from sqlalchemy.orm import subqueryload
Expand All @@ -47,7 +48,6 @@
from c2cgeoportal_admin.schemas.treegroup import treeitem_edit_url
from c2cgeoportal_admin.views.logged_views import LoggedViews
from c2cgeoportal_admin.widgets import ChildrenWidget, ChildWidget
from c2cgeoportal_commons.models.main import Layer, RestrictionArea

_list_field = partial(ListField, RestrictionArea)

Expand Down
Loading

0 comments on commit e162279

Please sign in to comment.