Skip to content

Commit

Permalink
global: black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
slint committed Jan 31, 2024
1 parent 05cac15 commit 1904d4e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion invenio_communities/communities/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions invenio_communities/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 10 additions & 8 deletions invenio_communities/members/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
24 changes: 12 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"] = "[email protected]"

Expand All @@ -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.
Expand Down

0 comments on commit 1904d4e

Please sign in to comment.