From 1904d4e8facdaabb73b2588a003870559d62614e Mon Sep 17 00:00:00 2001 From: Alex Ioannidis Date: Wed, 31 Jan 2024 13:49:23 +0100 Subject: [PATCH] global: black formatting --- .../communities/services/service.py | 2 +- invenio_communities/generators.py | 8 +++---- .../members/services/service.py | 18 +++++++------- tests/conftest.py | 24 +++++++++---------- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/invenio_communities/communities/services/service.py b/invenio_communities/communities/services/service.py index eb268b6bc..b2aebeada 100644 --- a/invenio_communities/communities/services/service.py +++ b/invenio_communities/communities/services/service.py @@ -211,7 +211,7 @@ def rename( data, context={"identity": identity}, raise_errors=raise_errors, # if False, flow is continued with - schema_args={"partial": True} # data only containing valid data, + schema_args={"partial": True}, # data only containing valid data, # but errors are reported ) # (as warnings) diff --git a/invenio_communities/generators.py b/invenio_communities/generators.py index af72a499a..45e263740 100644 --- a/invenio_communities/generators.py +++ b/invenio_communities/generators.py @@ -132,10 +132,10 @@ class IfPolicyClosed(IfRestrictedBase): def __init__(self, field, then_, else_): """Initialize.""" super().__init__( - lambda r: getattr(r.access, field, None) - if hasattr(r, "access") - else r.get("access", {}).get( - field + lambda r: ( + getattr(r.access, field, None) + if hasattr(r, "access") + else r.get("access", {}).get(field) ), # needed for running permission check at serialization time and avoid db query f"access.{field}", "closed", diff --git a/invenio_communities/members/services/service.py b/invenio_communities/members/services/service.py index 28315c791..fe97ce3cf 100644 --- a/invenio_communities/members/services/service.py +++ b/invenio_communities/members/services/service.py @@ -478,14 +478,16 @@ def _members_search( identity, search_result, params, - links_tpl=None - if scan - else LinksTemplate( - self.config.links_search, - context={ - "args": params, - "community_id": community_id, - }, + links_tpl=( + None + if scan + else LinksTemplate( + self.config.links_search, + context={ + "args": params, + "community_id": community_id, + }, + ) ), schema=schema, ) diff --git a/tests/conftest.py b/tests/conftest.py index 655cafe97..b345fb822 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -79,12 +79,12 @@ def build(cls, **kwargs): @pytest.fixture(scope="module") def app_config(app_config): """Override pytest-invenio app_config fixture.""" - app_config[ - "RECORDS_REFRESOLVER_CLS" - ] = "invenio_records.resolver.InvenioRefResolver" - app_config[ - "RECORDS_REFRESOLVER_STORE" - ] = "invenio_jsonschemas.proxies.current_refresolver_store" + app_config["RECORDS_REFRESOLVER_CLS"] = ( + "invenio_records.resolver.InvenioRefResolver" + ) + app_config["RECORDS_REFRESOLVER_STORE"] = ( + "invenio_jsonschemas.proxies.current_refresolver_store" + ) # Variable not used. We set it to silent warnings app_config["JSONSCHEMAS_HOST"] = "not-used" @@ -106,9 +106,9 @@ def app_config(app_config): app_config["COMMUNITIES_IDENTITIES_CACHE_REDIS_URL"] = "redis://localhost:6379/4" # Cache handler - app_config[ - "COMMUNITIES_IDENTITIES_CACHE_HANDLER" - ] = "invenio_communities.cache.redis:IdentityRedisCache" + app_config["COMMUNITIES_IDENTITIES_CACHE_HANDLER"] = ( + "invenio_communities.cache.redis:IdentityRedisCache" + ) app_config["MAIL_DEFAULT_SENDER"] = "test@invenio-rdm-records.org" @@ -135,9 +135,9 @@ def app_config(app_config): ] # Extending preferences schemas, to include notification preferences. Should not matter for most test cases - app_config[ - "ACCOUNTS_USER_PREFERENCES_SCHEMA" - ] = UserPreferencesNotificationsSchema() + app_config["ACCOUNTS_USER_PREFERENCES_SCHEMA"] = ( + UserPreferencesNotificationsSchema() + ) app_config["USERS_RESOURCES_SERVICE_SCHEMA"] = NotificationsUserSchema # Users are verified by default. This will disable the automatic creation of moderation requests after publishing a record.