From 0a16d948eeb779baf68a8867a4608f90d4904909 Mon Sep 17 00:00:00 2001 From: Tuomas Haapala Date: Wed, 23 Oct 2024 22:37:02 +0300 Subject: [PATCH] style: add noqa to all current line length violations --- audit_log/utils.py | 2 +- events/admin.py | 6 +- events/api.py | 236 +++++++++--------- events/api_pagination.py | 4 +- events/extensions.py | 4 +- events/filters.py | 22 +- events/importer/base.py | 4 +- events/importer/enkora.py | 62 ++--- events/importer/espoo.py | 10 +- events/importer/kulke.py | 36 +-- events/importer/lippupiste.py | 12 +- events/importer/osoite.py | 14 +- events/importer/sync.py | 6 +- events/importer/tprek.py | 2 +- events/importer/utils.py | 6 +- events/importer/yso.py | 2 +- events/keywords.py | 12 +- .../commands/add_helsinki_audience.py | 4 +- .../commands/add_helsinki_topics.py | 2 +- .../commands/check_deprecated_yso_keywords.py | 6 +- .../commands/populate_local_event_cache.py | 6 +- .../management/commands/refresh_full_text.py | 6 +- .../commands/remove_unused_permissions.py | 2 +- events/models.py | 16 +- events/permissions.py | 8 +- events/schema.py | 154 ++++++------ events/serializers.py | 12 +- events/sql.py | 2 +- events/utils.py | 2 +- helevents/models.py | 8 +- helevents/utils.py | 18 +- linkedevents/fields.py | 2 +- linkedevents/schema_utils.py | 8 +- linkedevents/serializers.py | 6 +- linkedevents/settings.py | 22 +- registrations/api.py | 82 +++--- registrations/exports.py | 10 +- registrations/filters.py | 14 +- registrations/forms.py | 6 +- .../delete_signups_with_expired_payments.py | 4 +- .../commands/encrypt_fields_with_new_key.py | 4 +- .../commands/mark_payments_expired.py | 10 +- registrations/models.py | 26 +- registrations/notifications.py | 224 ++++++++--------- registrations/schema.py | 86 +++---- registrations/serializers.py | 36 +-- registrations/signals.py | 2 +- registrations/utils.py | 4 +- 48 files changed, 616 insertions(+), 616 deletions(-) diff --git a/audit_log/utils.py b/audit_log/utils.py index 6c165afb5..32ddf0fbd 100644 --- a/audit_log/utils.py +++ b/audit_log/utils.py @@ -94,7 +94,7 @@ def _get_target(request): def commit_to_audit_log(request, response): current_time = timezone.now() - iso_8601_datetime = f"{current_time.replace(tzinfo=None).isoformat(sep='T', timespec='milliseconds')}Z" + iso_8601_datetime = f"{current_time.replace(tzinfo=None).isoformat(sep='T', timespec='milliseconds')}Z" # noqa: E501 message = { "audit_event": { diff --git a/events/admin.py b/events/admin.py index 380a6ef88..299a97dd3 100644 --- a/events/admin.py +++ b/events/admin.py @@ -114,9 +114,9 @@ def get_form(self, request, obj=None, **kwargs): form.base_fields["maximum_attendee_capacity"].help_text = _( "If the attendee capacity for the event is not restricted, please give a " - "rough estimate of at least the maximum attendee capacity. The information will be " - "used for statistical purposes. Maximum attendee capacity is a measure in the city " - "strategy that monitors the volumes of events held in the city. The estimate may be " + "rough estimate of at least the maximum attendee capacity. The information will be " # noqa: E501 + "used for statistical purposes. Maximum attendee capacity is a measure in the city " # noqa: E501 + "strategy that monitors the volumes of events held in the city. The estimate may be " # noqa: E501 "changed later if it is uncertain at the moment." ) diff --git a/events/api.py b/events/api.py index a6e08b19e..f26ab0665 100644 --- a/events/api.py +++ b/events/api.py @@ -191,7 +191,7 @@ def parse_hours(val, param): ) if not (0 <= hour <= 23): raise ParseError( - f"Hours should be between 0 and 23 in {param}, for example: 16:00. You have passed {hour}." + f"Hours should be between 0 and 23 in {param}, for example: 16:00. You have passed {hour}." # noqa: E501 ) if len(val) == 2 and val[1]: try: @@ -202,7 +202,7 @@ def parse_hours(val, param): ) if not (0 <= minute <= 59): raise ParseError( - f"Minutes should be between 0 and 59 in {param} as in 16:20. You passed {minute}." + f"Minutes should be between 0 and 59 in {param} as in 16:20. You passed {minute}." # noqa: E501 ) return hour, minute return hour, 0 @@ -290,9 +290,9 @@ class KeywordViewSet( @extend_schema( summary="Update a keyword", description=( - "Keyword can be updated if the user has appropriate access permissions. The original " - "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " - "its value is retained in database. In order to ensure consistent behaviour, users " + "Keyword can be updated if the user has appropriate access permissions. The original " # noqa: E501 + "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " # noqa: E501 + "its value is retained in database. In order to ensure consistent behaviour, users " # noqa: E501 "should always supply every field in PUT call." ), responses={ @@ -327,7 +327,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete a keyword", - description="Keyword can be deleted if the user has appropriate access permissions.", + description="Keyword can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description="Keyword has been successfully deleted.", @@ -419,7 +419,7 @@ def create(self, request, *args, **kwargs): name="data_source", type=OpenApiTypes.STR, description=( - "Search for keywords (note: NOT events) that come from the specified " + "Search for keywords (note: NOT events) that come from the specified " # noqa: E501 "data source (see data source in keyword definition)." ), ), @@ -428,8 +428,8 @@ def create(self, request, *args, **kwargs): name="text", type=OpenApiTypes.STR, description=( - "Search for keywords (note: NOT events) that contain the given string. " - "This applies even when show_all_keywords is specified. " + "Search for keywords (note: NOT events) that contain the given string. " # noqa: E501 + "This applies even when show_all_keywords is specified. " # noqa: E501 "Alternative name for the parameter is filter." ), ), @@ -437,8 +437,8 @@ def create(self, request, *args, **kwargs): name="free_text", type=OpenApiTypes.STR, description=( - "While the text search is looking for the keywords containg " - "exact matches of the search string, free_text retrieves keywords " + "While the text search is looking for the keywords containg " # noqa: E501 + "exact matches of the search string, free_text retrieves keywords " # noqa: E501 "on the basis of similarity. Results are sorted by similarity." ), ), @@ -446,7 +446,7 @@ def create(self, request, *args, **kwargs): name="has_upcoming_events", type=OpenApiTypes.BOOL, description=( - "To show only the keywords which are used in the upcoming events supply the " + "To show only the keywords which are used in the upcoming events supply the " # noqa: E501 "has_upcoming_events query parameter." ), ), @@ -454,9 +454,9 @@ def create(self, request, *args, **kwargs): name="show_all_keywords", type=OpenApiTypes.BOOL, description=( - "Show all keywords, including those that are not associated with any events. " - "Otherwise such keywords are hidden. When show_all_keywords is " - "specified, no other filter is applied, except filter and " + "Show all keywords, including those that are not associated with any events. " # noqa: E501 + "Otherwise such keywords are hidden. When show_all_keywords is " # noqa: E501 + "specified, no other filter is applied, except filter and " # noqa: E501 "text (match for keywords beginning with string)." ), ), @@ -464,8 +464,8 @@ def create(self, request, *args, **kwargs): name="show_deprecated", type=OpenApiTypes.BOOL, description=( - "Show all keywords, including those that are deprecated. By default such " - "keywords are hidden. When show_all_keywords is specified, no " + "Show all keywords, including those that are deprecated. By default such " # noqa: E501 + "keywords are hidden. When show_all_keywords is specified, no " # noqa: E501 "other filter is applied, except filter and " "text (match for keywords beginning with string)." ), @@ -474,9 +474,9 @@ def create(self, request, *args, **kwargs): name="sort", type=OpenApiTypes.STR, description=( - "Sort the returned keywords in the given order. Possible sorting criteria are " + "Sort the returned keywords in the given order. Possible sorting criteria are " # noqa: E501 "n_events, id, name and " - "data_source. The default ordering is -data_source, " + "data_source. The default ordering is -data_source, " # noqa: E501 "-n_events, name." ), ), @@ -498,7 +498,7 @@ def get_queryset(self): filter (only keywords containing the specified string are included) show_all_keywords (keywords without events are included) show_deprecated (deprecated keywords are included) - """ + """ # noqa: E501 queryset = self.queryset data_source = self.request.query_params.get("data_source") @@ -576,9 +576,9 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update a keyword set", description=( - "Keyword set can be updated if the user has appropriate access permissions. The " - "original implementation behaves like PATCH, ie. if some field is left out from the " - "PUT call, its value is retained in database. In order to ensure consistent " + "Keyword set can be updated if the user has appropriate access permissions. The " # noqa: E501 + "original implementation behaves like PATCH, ie. if some field is left out from the " # noqa: E501 + "PUT call, its value is retained in database. In order to ensure consistent " # noqa: E501 "behaviour, users should always supply every field in PUT call." ), responses={ @@ -613,7 +613,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete a keyword set", - description="Keyword set can be deleted if the user has appropriate access permissions.", + description="Keyword set can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description="Keyword set has been successfully deleted.", @@ -636,15 +636,15 @@ def destroy(self, request, *args, **kwargs): name="text", type=OpenApiTypes.STR, description=( - "Search for keyword sets that contain the given string in name or id fields." + "Search for keyword sets that contain the given string in name or id fields." # noqa: E501 ), ), OpenApiParameter( name="sort", type=OpenApiTypes.STR, description=( - "Sort the returned keyword sets in the given order. Possible sorting criteria " - "are name, usage and data_source." + "Sort the returned keyword sets in the given order. Possible sorting criteria " # noqa: E501 + "are name, usage and data_source." # noqa: E501 ), ), ], @@ -696,7 +696,7 @@ def filter_queryset(self, queryset): unallowed_params = set(vals) - allowed_fields if unallowed_params: raise ParseError( - f"It is possible to sort with the following params only: {allowed_fields}" + f"It is possible to sort with the following params only: {allowed_fields}" # noqa: E501 ) qset = qset.order_by(*vals) return qset @@ -730,9 +730,9 @@ def get_serializer_context(self): @extend_schema( summary="Update a place", description=( - "Place can be updated if the user has appropriate access permissions. The original " - "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " - "its value is retained in database. In order to ensure consistent behaviour, users " + "Place can be updated if the user has appropriate access permissions. The original " # noqa: E501 + "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " # noqa: E501 + "its value is retained in database. In order to ensure consistent behaviour, users " # noqa: E501 "should always supply every field in PUT call." ), responses={ @@ -767,7 +767,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete a place", - description="Place can be deleted if the user has appropriate access permissions.", + description="Place can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 404: OpenApiResponse( description="Place was not found.", @@ -861,8 +861,8 @@ class PlaceListViewSet( name="text", type=OpenApiTypes.STR, description=( - "Search for places that contain the given string. This applies even when " - "show_all_places is specified. Alternative name for the parameter is " + "Search for places that contain the given string. This applies even when " # noqa: E501 + "show_all_places is specified. Alternative name for the parameter is " # noqa: E501 "filter." ), ), @@ -870,7 +870,7 @@ class PlaceListViewSet( name="has_upcoming_events", type=OpenApiTypes.BOOL, description=( - "To show only the places which are used in the upcoming events supply the " + "To show only the places which are used in the upcoming events supply the " # noqa: E501 "has_upcoming_events query parameter." ), ), @@ -879,7 +879,7 @@ class PlaceListViewSet( type=OpenApiTypes.BOOL, description=( "Show all places, including those that are not hosting any events. " - "Otherwise such places are hidden. When show_all_places is specified, " + "Otherwise such places are hidden. When show_all_places is specified, " # noqa: E501 "no other filter is applied." ), ), @@ -895,7 +895,7 @@ class PlaceListViewSet( name="sort", type=OpenApiTypes.STR, description=( - "Sort the returned places in the given order. Possible sorting criteria are " + "Sort the returned places in the given order. Possible sorting criteria are " # noqa: E501 "n_events, id, name, " "street_address and postal_code. " "The default ordering is -n_events." @@ -932,7 +932,7 @@ def get_queryset(self): filter (only places containing the specified string are included) show_all_places (places without events are included) show_deleted (deleted places are included) - """ + """ # noqa: E501 queryset = Place.objects.select_related( "data_source", # Select related to support ordering ).prefetch_related( @@ -991,7 +991,7 @@ class LanguageViewSet( filterset_fields = ("service_language",) @extend_schema( - summary="Return a list of languages used for describing events and registrations", + summary="Return a list of languages used for describing events and registrations", # noqa: E501 description=render_to_string("swagger/language_list_description.html"), auth=[], parameters=[ @@ -999,7 +999,7 @@ class LanguageViewSet( name="service_language", type=OpenApiTypes.BOOL, description=( - "Show only service languages or languages that are not service languages." + "Show only service languages or languages that are not service languages." # noqa: E501 ), ), ], @@ -1047,7 +1047,7 @@ class OrganizationViewSet( name="parent", type=OpenApiTypes.STR, description=( - "Get all suborganizations and their descendants for the given organization id." + "Get all suborganizations and their descendants for the given organization id." # noqa: E501 ), ), ], @@ -1071,9 +1071,9 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update an organization", description=( - "Organization can be updated if the user has appropriate access permissions. " - "The original implementation behaves like PATCH, ie. if some field is left out from " - "the PUT call, its value is retained in database. In order to ensure consistent " + "Organization can be updated if the user has appropriate access permissions. " # noqa: E501 + "The original implementation behaves like PATCH, ie. if some field is left out from " # noqa: E501 + "the PUT call, its value is retained in database. In order to ensure consistent " # noqa: E501 "behaviour, users should always supply every field in PUT call." ), responses={ @@ -1108,7 +1108,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete an organization", - description="Organization can be deleted if the user has appropriate access permissions.", + description="Organization can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description="Organization has been successfully deleted.", @@ -1191,8 +1191,8 @@ def _get_web_store_objects(organization, relation_name): operation_id="organization_merchants_list", summary="Return a list of merchants for an organization", description=( - "Returns a list of merchants for an organization. If the organization itself does not " - "have merchants, they will be returned from the closest ancestor that has them. " + "Returns a list of merchants for an organization. If the organization itself does not " # noqa: E501 + "have merchants, they will be returned from the closest ancestor that has them. " # noqa: E501 "Only admin users are allowed to use this endpoint." ), responses={ @@ -1233,8 +1233,8 @@ def merchants(self, request, pk=None, version=None): operation_id="organization_accounts_list", summary="Return a list of accounts for an organization", description=( - "Returns a list of accounts for an organization. If the organization itself does not " - "have accounts, they will be returned from the closest ancestor that has them. " + "Returns a list of accounts for an organization. If the organization itself does not " # noqa: E501 + "have accounts, they will be returned from the closest ancestor that has them. " # noqa: E501 "Only admin users are allowed to use this endpoint." ), responses={ @@ -1282,7 +1282,7 @@ class DataSourceViewSet( @extend_schema( summary="Return a list of data sources", description=( - "The returned list describes data sources. Only admin users are allowed to use " + "The returned list describes data sources. Only admin users are allowed to use " # noqa: E501 "this endpoint." ), ) @@ -1292,7 +1292,7 @@ def list(self, request, *args, **kwargs): @extend_schema( summary="Return information for a single data source", description=( - "Can be used to retrieve a single data source. Only admin users are allowed to " + "Can be used to retrieve a single data source. Only admin users are allowed to " # noqa: E501 "use this endpoint." ), ) @@ -1325,7 +1325,7 @@ def list(self, request, *args, **kwargs): @extend_schema( summary="Return information for a single organization class", description=( - "Can be used to retrieve a single organization class. Only admin users are allowed " + "Can be used to retrieve a single organization class. Only admin users are allowed " # noqa: E501 "to use this endpoint" ), ) @@ -1372,7 +1372,7 @@ class ImageViewSet( name="publisher", type=OpenApiTypes.STR, description=( - "Search for images published by the given organization as specified by id. " + "Search for images published by the given organization as specified by id. " # noqa: E501 "Multiple ids are separated by comma." ), ), @@ -1393,8 +1393,8 @@ class ImageViewSet( name="sort", type=OpenApiTypes.STR, description=( - "Default ordering is descending order by -last_modified_time. " - "You may also order results by id and name." + "Default ordering is descending order by -last_modified_time. " # noqa: E501 + "You may also order results by id and name." # noqa: E501 ), ), ], @@ -1405,9 +1405,9 @@ def list(self, request, *args, **kwargs): @extend_schema( summary="Create a new image", description=( - "There are two ways to create an image object. The image file can be posted as a " - "multipart request, but the endpoint also accepts a simple JSON object with an " - "external url in the url field. This allows using external images for events without " + "There are two ways to create an image object. The image file can be posted as a " # noqa: E501 + "multipart request, but the endpoint also accepts a simple JSON object with an " # noqa: E501 + "external url in the url field. This allows using external images for events without " # noqa: E501 "saving them on the API server." ), request={ @@ -1434,9 +1434,9 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update an image", description=( - "Image can be updated if the user has appropriate access permissions. The original " - "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " - "its value is retained in database. In order to ensure consistent behaviour, users " + "Image can be updated if the user has appropriate access permissions. The original " # noqa: E501 + "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " # noqa: E501 + "its value is retained in database. In order to ensure consistent behaviour, users " # noqa: E501 "should always supply every field in PUT call." ), responses={ @@ -1471,7 +1471,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete an image", - description="Image can be deleted if the user has appropriate access permissions.", + description="Image can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description="Image has been successfully deleted.", @@ -1731,7 +1731,7 @@ def _filter_event_queryset(queryset, params, srs=None): # noqa: C901 langs = settings.FULLTEXT_SEARCH_LANGUAGES if language not in langs.keys(): raise ParseError( - f"{language} not supported. Supported options are: {' '.join(langs.values())}" + f"{language} not supported. Supported options are: {' '.join(langs.values())}" # noqa: E501 ) val = val.replace(",", " ") @@ -2016,7 +2016,7 @@ def _filter_event_queryset(queryset, params, srs=None): # noqa: C901 # Inconsistent behaviour, see test_inconsistent_tz_default dt = utils.parse_time(start, default_tz=pytz.timezone(settings.TIME_ZONE))[0] - # only return events with specified end times, or unspecified start times, during the whole of the event + # only return events with specified end times, or unspecified start times, during the whole of the event # noqa: E501 # this gets of rid pesky one-day events with no known end time (but known # start) after they started queryset = queryset.filter( @@ -2106,8 +2106,8 @@ def _filter_event_queryset(queryset, params, srs=None): # noqa: C901 # same as ?super_event_type=recurring queryset = queryset.filter(super_event_type=Event.SuperEventType.RECURRING) elif val == "sub": - # same as ?super_event_type=none,umbrella, weirdly yielding non-sub events too. - # don't know if users want this to remain tho. do we want that or is there a need + # same as ?super_event_type=none,umbrella, weirdly yielding non-sub events too. # noqa: E501 + # don't know if users want this to remain tho. do we want that or is there a need # noqa: E501 # to change this to actually filter only subevents of recurring events? queryset = queryset.exclude(super_event_type=Event.SuperEventType.RECURRING) @@ -2305,8 +2305,8 @@ def _filter_event_queryset(queryset, params, srs=None): # noqa: C901 queryset = queryset.exclude(offers__is_free=True) val = params.get("suitable_for", None) - # Excludes all the events that have max age limit below or min age limit above the age or age range specified. - # Suitable events with just one age boundary specified are returned, events with no age limits specified are + # Excludes all the events that have max age limit below or min age limit above the age or age range specified. # noqa: E501 + # Suitable events with just one age boundary specified are returned, events with no age limits specified are # noqa: E501 # excluded. if val: @@ -2557,9 +2557,9 @@ def allow_bulk_destroy(self, qs, filtered): @extend_schema( summary="Update an event", description=( - "Events can be updated if the user has appropriate access permissions. The original " - "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " - "its value is retained in database. In order to ensure consistent behaviour, users " + "Events can be updated if the user has appropriate access permissions. The original " # noqa: E501 + "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " # noqa: E501 + "its value is retained in database. In order to ensure consistent behaviour, users " # noqa: E501 "should always supply every field in PUT call." ), responses={ @@ -2638,9 +2638,9 @@ def perform_bulk_update(self, serializer: EventSerializer): operation_id="event_bulk_update", summary="Bulk update several events", description=( - "Events can be updated if the user has appropriate access permissions. The original " - "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " - "its value is retained in database. In order to ensure consistent behaviour, users " + "Events can be updated if the user has appropriate access permissions. The original " # noqa: E501 + "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " # noqa: E501 + "its value is retained in database. In order to ensure consistent behaviour, users " # noqa: E501 "should always supply every field in PUT call." ), request=EventSerializer(many=True), @@ -2790,7 +2790,7 @@ def perform_create(self, serializer): @extend_schema( summary="Delete an event", - description="Event can be deleted if the user has appropriate access permissions.", + description="Event can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description="Event has been successfully deleted.", @@ -2875,7 +2875,7 @@ def retrieve(self, request, *args, **kwargs): name="internet_ongoing_AND", type=OpenApiTypes.STR, description=( - "Search for internet events that are upcoming or have not ended yet. " + "Search for internet events that are upcoming or have not ended yet. " # noqa: E501 "Multiple search terms are separated by comma." ), ), @@ -2883,7 +2883,7 @@ def retrieve(self, request, *args, **kwargs): name="internet_ongoing_OR", type=OpenApiTypes.STR, description=( - "Search for internet events that are upcoming or have not ended yet. " + "Search for internet events that are upcoming or have not ended yet. " # noqa: E501 "Multiple search terms are separated by comma." ), ), @@ -2891,7 +2891,7 @@ def retrieve(self, request, *args, **kwargs): name="all_ongoing_AND", type=OpenApiTypes.STR, description=( - "Search for local and internet events that are upcoming or have not ended yet. " + "Search for local and internet events that are upcoming or have not ended yet. " # noqa: E501 "Multiple search terms are separated by comma." ), ), @@ -2899,7 +2899,7 @@ def retrieve(self, request, *args, **kwargs): name="all_ongoing_OR", type=OpenApiTypes.STR, description=( - "Search for local and internet events that are upcoming or have not ended yet. " + "Search for local and internet events that are upcoming or have not ended yet. " # noqa: E501 "Multiple search terms are separated by comma." ), ), @@ -2912,8 +2912,8 @@ def retrieve(self, request, *args, **kwargs): name="start", type=OpenApiTypes.DATETIME, description=( - "Search for events beginning or ending after this time. Dates can be " - "specified using ISO 8601 (for example, '2024-01-12') and additionally " + "Search for events beginning or ending after this time. Dates can be " # noqa: E501 + "specified using ISO 8601 (for example, '2024-01-12') and additionally " # noqa: E501 "today and now." ), ), @@ -2921,8 +2921,8 @@ def retrieve(self, request, *args, **kwargs): name="end", type=OpenApiTypes.DATETIME, description=( - "Search for events beginning or ending before this time. Dates can be " - "specified using ISO 8601 (for example, '2024-01-12') and additionally " + "Search for events beginning or ending before this time. Dates can be " # noqa: E501 + "specified using ISO 8601 (for example, '2024-01-12') and additionally " # noqa: E501 "today and now." ), ), @@ -2930,7 +2930,7 @@ def retrieve(self, request, *args, **kwargs): name="days", type=OpenApiTypes.INT, description=( - "Search for events that intersect with the current time and specified " + "Search for events that intersect with the current time and specified " # noqa: E501 "amount of days from current time." ), ), @@ -2972,8 +2972,8 @@ def retrieve(self, request, *args, **kwargs): name="bbox", type={"type": "array", "items": {"type": "string"}}, description=( - "Search for events that are within this bounding box. Decimal coordinates " - "are given in order west, south, east, north. Period is used as decimal " + "Search for events that are within this bounding box. Decimal coordinates " # noqa: E501 + "are given in order west, south, east, north. Period is used as decimal " # noqa: E501 "separator. Coordinate system is EPSG:4326." ), ), @@ -2989,7 +2989,7 @@ def retrieve(self, request, *args, **kwargs): name="dwithin_origin", type={"type": "array", "items": {"type": "string"}}, description=( - "To restrict the retrieved events to a certain distance from a point, use " + "To restrict the retrieved events to a certain distance from a point, use " # noqa: E501 "the query parameters dwithin_origin and " "dwithin_metres in the format " "dwithin_origin=lon,lat&dwithin_metres=distance." @@ -2999,7 +2999,7 @@ def retrieve(self, request, *args, **kwargs): name="dwithin_meters", type=OpenApiTypes.INT, description=( - "To restrict the retrieved events to a certain distance from a point, use " + "To restrict the retrieved events to a certain distance from a point, use " # noqa: E501 "the query parameters dwithin_origin and " "dwithin_metres in the format " "dwithin_origin=lon,lat&dwithin_metres=distance." @@ -3025,7 +3025,7 @@ def retrieve(self, request, *args, **kwargs): name="keyword!", type=OpenApiTypes.STR, description=( - "Search for events with given keywords not to be present as specified by id. " + "Search for events with given keywords not to be present as specified by id. " # noqa: E501 "Multiple ids are separated by comma." ), ), @@ -3033,7 +3033,7 @@ def retrieve(self, request, *args, **kwargs): name="keyword_set_AND", type=OpenApiTypes.STR, description=( - "Search for events that contains any of the keywords of defined keyword set. " + "Search for events that contains any of the keywords of defined keyword set. " # noqa: E501 "Multiple keyword sets are separated by comma." ), ), @@ -3041,7 +3041,7 @@ def retrieve(self, request, *args, **kwargs): name="keyword_set_OR", type=OpenApiTypes.STR, description=( - "Search for events that contains any of the keywords of defined keyword set. " + "Search for events that contains any of the keywords of defined keyword set. " # noqa: E501 "Multiple keyword sets are separated by comma." ), ), @@ -3061,7 +3061,7 @@ def retrieve(self, request, *args, **kwargs): name="ids", type=OpenApiTypes.STR, description=( - "Search for events with specific id, separating values by commas if you wish " + "Search for events with specific id, separating values by commas if you wish " # noqa: E501 "to query for several event ids." ), ), @@ -3077,7 +3077,7 @@ def retrieve(self, request, *args, **kwargs): name="event_type", type=OpenApiTypes.STR, description=( - "Search for events with the specified type in the type_id field." + "Search for events with the specified type in the type_id field." # noqa: E501 ), ), OpenApiParameter( @@ -3086,15 +3086,15 @@ def retrieve(self, request, *args, **kwargs): description=( "Search (case insensitive) through all multilingual text fields " "(name, description, short_description, info_url) of an event " - "(every language). Multilingual fields contain the text that users are " - "expected to care about, thus multilinguality is useful discriminator." + "(every language). Multilingual fields contain the text that users are " # noqa: E501 + "expected to care about, thus multilinguality is useful discriminator." # noqa: E501 ), ), OpenApiParameter( name="combined_text", type=OpenApiTypes.STR, description=( - "Search for events with exact text match for event text fields but retrieves " + "Search for events with exact text match for event text fields but retrieves " # noqa: E501 "expected keywords on the basis of similarity." ), ), @@ -3109,7 +3109,7 @@ def retrieve(self, request, *args, **kwargs): name="language", type=OpenApiTypes.STR, description=( - "Search for events that have data or are organized in this language." + "Search for events that have data or are organized in this language." # noqa: E501 ), ), OpenApiParameter( @@ -3158,21 +3158,21 @@ def retrieve(self, request, *args, **kwargs): name="suitable_for", type=OpenApiTypes.INT, description=( - "Search for events that are suitable for the age or age range specified." + "Search for events that are suitable for the age or age range specified." # noqa: E501 ), ), OpenApiParameter( name="publisher", type=OpenApiTypes.STR, description=( - "Search for events published by the given organization as specified by id." + "Search for events published by the given organization as specified by id." # noqa: E501 ), ), OpenApiParameter( name="publisher_ancestor", type=OpenApiTypes.STR, description=( - "Search for events published by any suborganization under the given " + "Search for events published by any suborganization under the given " # noqa: E501 "organization as specified by id." ), ), @@ -3208,7 +3208,7 @@ def retrieve(self, request, *args, **kwargs): name="registration__remaining_attendee_capacity__gte", type=OpenApiTypes.INT, description=( - "Search for events where the remaining registration attendee capacity is " + "Search for events where the remaining registration attendee capacity is " # noqa: E501 "greater than or equal to the applied parameter." ), ), @@ -3216,7 +3216,7 @@ def retrieve(self, request, *args, **kwargs): name="registration__remaining_attendee_capacity__isnull", type=OpenApiTypes.BOOL, description=( - "Search for events where the remaining registration attendee capacity is or " + "Search for events where the remaining registration attendee capacity is or " # noqa: E501 "is not NULL." ), ), @@ -3224,7 +3224,7 @@ def retrieve(self, request, *args, **kwargs): name="registration__remaining_waiting_list_capacity__gte", type=OpenApiTypes.INT, description=( - "Search for events where the remaining registration waiting_list capacity is " + "Search for events where the remaining registration waiting_list capacity is " # noqa: E501 "greater than or equal to the applied parameter." ), ), @@ -3232,7 +3232,7 @@ def retrieve(self, request, *args, **kwargs): name="registration__remaining_waiting_list_capacity__isnull", type=OpenApiTypes.BOOL, description=( - "Search for events where the remaining registration waiting_list capacity is " + "Search for events where the remaining registration waiting_list capacity is " # noqa: E501 "or is not NULL." ), ), @@ -3240,7 +3240,7 @@ def retrieve(self, request, *args, **kwargs): name="show_all", type=OpenApiTypes.BOOL, description=( - "Search for events that authenticated user can edit, including drafts, " + "Search for events that authenticated user can edit, including drafts, " # noqa: E501 "and public non-editable events." ), ), @@ -3256,7 +3256,7 @@ def retrieve(self, request, *args, **kwargs): name="admin_user", type=OpenApiTypes.BOOL, description=( - "Search for events that authenticated user can edit, including drafts, " + "Search for events that authenticated user can edit, including drafts, " # noqa: E501 "but no other public events." ), ), @@ -3270,12 +3270,12 @@ def retrieve(self, request, *args, **kwargs): name="sort", type=OpenApiTypes.STR, description=( - "Sort the returned events in the given order. Possible sorting criteria are " - "start_time, end_time, name, " + "Sort the returned events in the given order. Possible sorting criteria are " # noqa: E501 + "start_time, end_time, name, " # noqa: E501 "duration, last_modified_time, " - "enrolment_start_time, enrolment_end_time, " + "enrolment_start_time, enrolment_end_time, " # noqa: E501 "registration__enrolment_start_time, " - "registration__enrolment_end_time, enrolment_start " + "registration__enrolment_end_time, enrolment_start " # noqa: E501 "and enrolment_end. The default ordering is " "-last_modified_time." ), @@ -3339,8 +3339,8 @@ def get_serializer_class(self): name="type", type=OpenApiTypes.STR, description=( - "Comma-separated list of resource types to search for. Currently allowed " - "values are event and place. type=event " + "Comma-separated list of resource types to search for. Currently allowed " # noqa: E501 + "values are event and place. type=event " # noqa: E501 "must be specified for event date filtering and relevancy sorting." ), ), @@ -3348,7 +3348,7 @@ def get_serializer_class(self): name="q", type=OpenApiTypes.STR, description=( - "Search for events and places matching this string. Mutually exclusive with " + "Search for events and places matching this string. Mutually exclusive with " # noqa: E501 "input typeahead search." ), ), @@ -3356,7 +3356,7 @@ def get_serializer_class(self): name="input", type=OpenApiTypes.STR, description=( - "Return autocompletition suggestions for this string. Mutually exclusive with " + "Return autocompletition suggestions for this string. Mutually exclusive with " # noqa: E501 "q full-text search." ), ), @@ -3364,8 +3364,8 @@ def get_serializer_class(self): name="start", type=OpenApiTypes.DATETIME, description=( - "Search for events beginning or ending after this time. Dates can be " - "specified using ISO 8601 (for example, '2024-01-12') and additionally " + "Search for events beginning or ending after this time. Dates can be " # noqa: E501 + "specified using ISO 8601 (for example, '2024-01-12') and additionally " # noqa: E501 "today and now." ), ), @@ -3373,8 +3373,8 @@ def get_serializer_class(self): name="end", type=OpenApiTypes.DATETIME, description=( - "Search for events beginning or ending before this time. Dates can be " - "specified using ISO 8601 (for example, '2024-01-12') and additionally " + "Search for events beginning or ending before this time. Dates can be " # noqa: E501 + "specified using ISO 8601 (for example, '2024-01-12') and additionally " # noqa: E501 "today and now." ), ), diff --git a/events/api_pagination.py b/events/api_pagination.py index ee5a92211..37b188e44 100644 --- a/events/api_pagination.py +++ b/events/api_pagination.py @@ -12,7 +12,7 @@ class CustomPagination(pagination.PageNumberPagination): page_size_query_param = "page_size" page_size_query_description = _( - "Number of results to return per page. %(max_page_size)s is the maximum value for page_size." + "Number of results to return per page. %(max_page_size)s is the maximum value for page_size." # noqa: E501 ) % {"max_page_size": max_page_size} def get_paginated_response(self, data): @@ -65,5 +65,5 @@ class LargeResultsSetPagination(CustomPagination): page_size = 1000 page_size_query_description = _( - "Number of results to return per page. %(max_page_size)s is the maximum value for page_size." + "Number of results to return per page. %(max_page_size)s is the maximum value for page_size." # noqa: E501 ) % {"max_page_size": max_page_size} diff --git a/events/extensions.py b/events/extensions.py index 779a8e030..b6a988640 100644 --- a/events/extensions.py +++ b/events/extensions.py @@ -10,7 +10,7 @@ class EventExtension(object): #: The identifier for the extension (as referred to in the `extensions` argument) identifier = None - #: The `related_name` for this extension's Event extension model. This will be added to + #: The `related_name` for this extension's Event extension model. This will be added to # noqa: E501 #: `select_related` queries done over the API. related_name = None @@ -42,7 +42,7 @@ def get_extension_serializer(self): :return: The serializer. :rtype: rest_framework.serializers.Serializer - """ + """ # noqa: E501 def post_create_event(self, request, event, data): # pragma: no cover """ diff --git a/events/filters.py b/events/filters.py index 81470dfad..7259b15cd 100644 --- a/events/filters.py +++ b/events/filters.py @@ -67,7 +67,7 @@ def _in_or_null_filter(field_name, queryset, name, value): """ Supports filtering objects by several values in the same field; null or none will trigger isnull filter. - """ + """ # noqa: E501 q = Q() if "null" in value or "none" in value: @@ -116,7 +116,7 @@ def filter_division(queryset, name: str, value: Iterable[str]): /event/?division=kunta:helsinki will match the Helsinki municipality, if correct country information is present in settings. - """ + """ # noqa: E501 ocd_ids = [] names = [] @@ -186,7 +186,7 @@ class EventFilter(django_filters.rest_framework.FilterSet): method=filter_division, help_text=_( "You may filter events by specific OCD division id, or by division name. " - "The latter query checks all divisions with the name, regardless of division type." + "The latter query checks all divisions with the name, regardless of division type." # noqa: E501 ), ) super_event_type = django_filters.Filter( @@ -203,7 +203,7 @@ class EventFilter(django_filters.rest_framework.FilterSet): widget=django_filters.widgets.CSVWidget(), method=partial(_in_or_null_filter, "super_event"), help_text=_( - "Search for events with the given superevent as specified by id, including none. " + "Search for events with the given superevent as specified by id, including none. " # noqa: E501 "Multiple ids are separated by comma." ), ) @@ -214,7 +214,7 @@ class EventFilter(django_filters.rest_framework.FilterSet): field_name="maximum_attendee_capacity", lookup_expr="gte", help_text=_( - "Search for events with maximum attendee capacity greater than or equal the " + "Search for events with maximum attendee capacity greater than or equal the " # noqa: E501 "applied parameter." ), ) @@ -222,7 +222,7 @@ class EventFilter(django_filters.rest_framework.FilterSet): field_name="minimum_attendee_capacity", lookup_expr="gte", help_text=_( - "Search for events with minimum attendee capacity greater than or equal the " + "Search for events with minimum attendee capacity greater than or equal the " # noqa: E501 "applied parameter." ), ) @@ -230,7 +230,7 @@ class EventFilter(django_filters.rest_framework.FilterSet): field_name="maximum_attendee_capacity", lookup_expr="lte", help_text=_( - "Search for events events with maximum attendee capacity less than or equal the " + "Search for events events with maximum attendee capacity less than or equal the " # noqa: E501 "applied parameter." ), ) @@ -238,14 +238,14 @@ class EventFilter(django_filters.rest_framework.FilterSet): field_name="minimum_attendee_capacity", lookup_expr="lte", help_text=_( - "Search for events events with minimum attendee capacity less than or equal the " + "Search for events events with minimum attendee capacity less than or equal the " # noqa: E501 "applied parameter." ), ) hide_recurring_children = django_filters.BooleanFilter( method="filter_hide_recurring_children", help_text=_( - "Hide all child events for super events which are of type recurring." + "Hide all child events for super events which are of type recurring." # noqa: E501 ), ) @@ -378,7 +378,7 @@ class OrganizationFilter(django_filters.rest_framework.FilterSet): dissolved = django_filters.BooleanFilter( method="filter_dissolved", help_text=_( - "Get or exclude dissolved organizations; true shows only dissolved and " + "Get or exclude dissolved organizations; true shows only dissolved and " # noqa: E501 "false excludes dissolved organizations." ), ) @@ -406,7 +406,7 @@ class PlaceFilter(django_filters.rest_framework.FilterSet): method="filter_divisions", help_text=_( "You may filter places by specific OCD division id, or by division name. " - "The latter query checks all divisions with the name, regardless of division type." + "The latter query checks all divisions with the name, regardless of division type." # noqa: E501 ), ) diff --git a/events/importer/base.py b/events/importer/base.py index a73e8b36d..d7fd4e491 100644 --- a/events/importer/base.py +++ b/events/importer/base.py @@ -513,7 +513,7 @@ def list_external_links(external_links): for link in new_links: if len(link.url) > 200: logger.error( - f"{obj} required external link of length {len(link.url)}, current limit 200" + f"{obj} required external link of length {len(link.url)}, current limit 200" # noqa: E501 ) continue new_link_objects.append( @@ -567,7 +567,7 @@ def list_external_links(external_links): self._set_field(obj, "event_status", status) if obj._changed or obj._created: - # Finally, we must save the whole object, even when only related fields changed. + # Finally, we must save the whole object, even when only related fields changed. # noqa: E501 # Also, we want to log all that happened. try: obj.save() diff --git a/events/importer/enkora.py b/events/importer/enkora.py index e81a444db..62e39fe44 100644 --- a/events/importer/enkora.py +++ b/events/importer/enkora.py @@ -163,7 +163,7 @@ class EnkoraImporter(Importer): 133: { "enkora-name": "Sovellettu liikunta", "keywords": { - SPORT_ADAPTED_PE # YSO: erityisliikunta, sisältää mm. soveltava liikunta + SPORT_ADAPTED_PE # YSO: erityisliikunta, sisältää mm. soveltava liikunta # noqa: E501 }, "image": None, }, @@ -206,7 +206,7 @@ class EnkoraImporter(Importer): 2: { "enkora-name": "Itäkeskuksen uimahalli", # 4 TPrek paikkaa "tprek-id": 41835, - "keywords": set(), # kuntosalikursseja, ryhmäliikuntaa, vesiliikuntaa ja uimakouluja + "keywords": set(), # kuntosalikursseja, ryhmäliikuntaa, vesiliikuntaa ja uimakouluja # noqa: E501 }, 3: { "enkora-name": "Jakomäen uimahalli", # 2 TPrek paikkaa @@ -228,12 +228,12 @@ class EnkoraImporter(Importer): 7: { "enkora-name": "Yrjönkadun uimahalli", # 3 TPrek paikkaa "tprek-id": 41102, - "keywords": set(), # kuntosalikursseja, ryhmäliikuntaa, vesiliikuntaa ja uimakouluja + "keywords": set(), # kuntosalikursseja, ryhmäliikuntaa, vesiliikuntaa ja uimakouluja # noqa: E501 }, 8: { "enkora-name": "Pirkkolan uimahalli", # 2 TPrek paikkaa "tprek-id": 40774, - "keywords": set(), # kuntosalikursseja, ryhmäliikuntaa, vesiliikuntaa ja uimakouluja + "keywords": set(), # kuntosalikursseja, ryhmäliikuntaa, vesiliikuntaa ja uimakouluja # noqa: E501 }, 10: { "enkora-name": "Töölön kisahalli", # 17 TPrek paikkaa @@ -522,19 +522,19 @@ class EnkoraImporter(Importer): "enkora-name": "Pohjoinen", "tprek-id": None, "keywords": set(), - "group": True, # Note: groups in Enkora are not actual geographical locations + "group": True, # Note: groups in Enkora are not actual geographical locations # noqa: E501 }, 247: { "enkora-name": "Länsi", "tprek-id": None, "keywords": set(), - "group": True, # Note: groups in Enkora are not actual geographical locations + "group": True, # Note: groups in Enkora are not actual geographical locations # noqa: E501 }, 248: { "enkora-name": "Itä", "tprek-id": None, "keywords": set(), - "group": True, # Note: groups in Enkora are not actual geographical locations + "group": True, # Note: groups in Enkora are not actual geographical locations # noqa: E501 }, 257: { "enkora-name": "Malmin pk, OV, Talvelantie 1", @@ -577,7 +577,7 @@ class EnkoraImporter(Importer): "keywords": set(), }, 285: { - "enkora-name": "Pirkkolan lähiliikuntapaikka", # kts. Pirkkolan liikuntapuisto + "enkora-name": "Pirkkolan lähiliikuntapaikka", # kts. Pirkkolan liikuntapuisto # noqa: E501 "tprek-id": 42006, "keywords": set(), }, @@ -931,7 +931,7 @@ def import_courses(self, months_back_from_today: int = 5) -> None: Handles importing courses from Enkora API. :param: months_back_from_today, int determines how many months back from today data should be queried :return: None - """ + """ # noqa: E501 kurssi_api = self.driver_cls( settings.ENKORA_API_USER, settings.ENKORA_API_PASSWORD, request_timeout=20.0 ) @@ -1066,7 +1066,7 @@ def import_courses(self, months_back_from_today: int = 5) -> None: # Delayed conversion exception? if errors: logger.error( - "Enkora course import finished with {} courses with {} events seen. {} courses synchronized. " + "Enkora course import finished with {} courses with {} events seen. {} courses synchronized. " # noqa: E501 "{} errors encounterd.".format( course_count, course_event_count, course_sync_count, len(errors) ) @@ -1075,7 +1075,7 @@ def import_courses(self, months_back_from_today: int = 5) -> None: # Success logger.info( - "Enkora course import finished with {} courses with {} events seen. {} courses synchronized. " + "Enkora course import finished with {} courses with {} events seen. {} courses synchronized. " # noqa: E501 "No errors encounterd.".format( course_count, course_event_count, course_sync_count ) @@ -1171,7 +1171,7 @@ def import_places(self, months_back_from_today: int = 5): # Location: if course["location_id"] not in EnkoraImporter.place_map: raise ValueError( - "Unknown Enkora location: {} for course {} / {}. Mapping missing!".format( + "Unknown Enkora location: {} for course {} / {}. Mapping missing!".format( # noqa: E501 course["location_id"], course["reservation_event_group_id"], course["reservation_event_group_name"], @@ -1197,7 +1197,7 @@ def import_places(self, months_back_from_today: int = 5): # Success logger.info( - "Enkora place import finished with {} courses having {} unique Enkora-places. No errors encounterd.".format( + "Enkora place import finished with {} courses having {} unique Enkora-places. No errors encounterd.".format( # noqa: E501 course_count, place_count ) ) @@ -1209,14 +1209,14 @@ def _is_course_expired(course: dict, now_is: datetime) -> bool: :param: course, dict containing data for a course :param: now_is, datetime.datetime current :return: bool, true if now isn't between public_visibility_start and public_visibility_end - """ + """ # noqa: E501 if not course["public_visibility_start"] or not course["public_visibility_end"]: logger.warning( - "Course with ID {} lacks public_visibility_start or public_visibility_end information.".format( + "Course with ID {} lacks public_visibility_start or public_visibility_end information.".format( # noqa: E501 course["reservation_event_group_id"] ) ) - return True # True, indicating that course shouldn't be processed before source data is valid + return True # True, indicating that course shouldn't be processed before source data is valid # noqa: E501 is_expired = not ( course["public_visibility_start"] @@ -1491,7 +1491,7 @@ def _keyword_helper(mapping: set) -> list: doc.add_heading("Enkora Service to Web Shop Link", level=2) doc.add_paragraph( "Importer sport/activity list mapping to Liikuntakauppa. " - "Optimally the link would point directly to a course. Current implementation of " + "Optimally the link would point directly to a course. Current implementation of " # noqa: E501 "liikuntakauppa doesn't allow this." ) ul = [] @@ -1591,7 +1591,7 @@ def _handle_course(self, course: dict) -> tuple[dict, list[dict]]: except AttributeError: logging.error( ( - "Enkora event ID {}: unable to add timezone info for field name {}" + "Enkora event ID {}: unable to add timezone info for field name {}" # noqa: E501 ", skipping event and related sub-events" ).format( course["reservation_event_group_id"], @@ -1729,7 +1729,7 @@ def _handle_course(self, course: dict) -> tuple[dict, list[dict]]: # Output commands to invalidate event cache for the course being imported if self.debug_print_cache_invalidation: print( - 'curl --header "Content-Type: application/json" https://harrastukset.hel.fi/api/revalidate --data' + 'curl --header "Content-Type: application/json" https://harrastukset.hel.fi/api/revalidate --data' # noqa: E501 """ '{{"secret": "", "uri": "/fi/courses/enkora:{}"}}' """.format( course["reservation_event_group_id"] ) @@ -1785,10 +1785,10 @@ def convert_keywords(course: dict) -> tuple[set, set, list]: Note: Course description is not part of this deduction, Service and location are. :param course: :return: set of keyword ids for service, set of keyword ids for audience, list of single image - """ + """ # noqa: E501 if course["location_id"] not in EnkoraImporter.place_map: raise ValueError( - "Unknown Enkora location: {} for course {} / {}. Mapping missing!".format( + "Unknown Enkora location: {} for course {} / {}. Mapping missing!".format( # noqa: E501 course["location_id"], course["reservation_event_group_id"], course["reservation_event_group_name"], @@ -1796,7 +1796,7 @@ def convert_keywords(course: dict) -> tuple[set, set, list]: ) if course["service_id"] not in EnkoraImporter.service_map: raise ValueError( - "Unknown Enkora service: {} for course {} / {}. Mapping missing!".format( + "Unknown Enkora service: {} for course {} / {}. Mapping missing!".format( # noqa: E501 course["service_id"], course["reservation_event_group_id"], course["reservation_event_group_name"], @@ -1927,7 +1927,7 @@ def convert_description( :param capacity_full: bool, if course capacity is known: true, if course is fully booked :param has_queue_capacity: bool, if course has a queue: true, if queue has capacity :return: dict, HTML-formatted course descriptions per language - """ + """ # noqa: E501 description = { lang: ( course.get(f"description_long_{lang}") @@ -1989,8 +1989,8 @@ def convert_description( desc_html += ( f'

{translated_description_text[lang]["add_on_text"]}

\n

' - f'Liikuntaluuri: ' - f'{EnkoraImporter.COURSE_CONTACT_PHONE}

' + f'Liikuntaluuri: ' # noqa: E501 + f'{EnkoraImporter.COURSE_CONTACT_PHONE}

' # noqa: E501 ) description.update({lang: desc_html}) @@ -2008,7 +2008,7 @@ def convert_location(course: dict) -> Optional[dict]: """ if course["location_id"] not in EnkoraImporter.place_map: raise ValueError( - "Unknown Enkora location: {} for course {} / {}. Mapping missing!".format( + "Unknown Enkora location: {} for course {} / {}. Mapping missing!".format( # noqa: E501 course["location_id"], course["reservation_event_group_id"], course["reservation_event_group_name"], @@ -2111,7 +2111,7 @@ def convert_price(self, course: dict, url: str) -> list[dict]: if do_fare_description: offer_desc = fare_product["fare_product_name"] if offer_desc.lower().startswith(fare_words_to_remove): - # Let loose the first word and any possible white-space after it. + # Let loose the first word and any possible white-space after it. # noqa: E501 # Capitalize the first letter of the description offer_desc = re.sub(r"^\b\w+\b\s*", "", offer_desc) offer_desc = offer_desc[0].upper() + offer_desc[1:] @@ -2207,7 +2207,7 @@ def infer_event_language(course_tags: list) -> str: only the first one encountered will be evaluated. :param course_tags: list, course tag data as a list of dicts :return: str, representing the abbreviated event language - """ + """ # noqa: E501 language_tag_id = None event_language = "fi" for tag_group in course_tags: @@ -2485,7 +2485,7 @@ def get_data_for_month( :param reservation_event_groups: list to append reservation event group data into :param reservation_events: list to append reservation event data into :return: reservation generator - """ + """ # noqa: E501 start_date = datetime(year=year, month=month, day=1).date() end_date = start_date + relativedelta(months=1) end_date = end_date - timedelta(days=1) @@ -2519,7 +2519,7 @@ def get_data_for_date_range( :param reservation_event_groups: list to append reservation event group data into :param reservation_events: list to append reservation event data into :return: reservation generator - """ + """ # noqa: E501 payload = { "start_date": "{0}-{1}-{2}--{3}-{4}-{5}".format( first_date.year, @@ -2563,7 +2563,7 @@ def get_data_for_region_and_year( :param reservation_event_groups: list to append reservation event group data into :param reservation_events: list to append reservation event data into :return: reservation generator - """ + """ # noqa: E501 start_date = end_date - timedelta(days=364) payload = { diff --git a/events/importer/espoo.py b/events/importer/espoo.py index c74c6c953..a058591c9 100644 --- a/events/importer/espoo.py +++ b/events/importer/espoo.py @@ -122,7 +122,7 @@ def _build_pre_map(mapping: dict[str, str]) -> PreMapper: :param mapping: a map of origin object values to target object values :return: a pre field mapper function - """ + """ # noqa: E501 def pre_map( field_name, field_data: Optional[Union[str, dict]], data: dict @@ -135,7 +135,7 @@ def pre_map( :param data: target object data :return: updated target object data with the field mapped - """ + """ # noqa: E501 if field_data is None: return {**data} # If the field is a dict, we map the id field to the target field @@ -159,7 +159,7 @@ def _build_pre_map_to_id(mapping: dict[str, str]) -> PreMapper: Build a pre field mapper that maps the origin object field value to a target object id. :param mapping: a map of origin object ids to target (local) object ids - """ + """ # noqa: E501 pre_mapper = _build_pre_map(mapping) def pre_map_to_id( @@ -355,7 +355,7 @@ def _import_origin_objs( post_field_mappers: fields that are mapped after saving all the model instances (source -> target) auto_id: set True for models that use AutoField pk syncher_key: - """ + """ # noqa: E501 logger.info(f"Importing related Espoo {model.__name__}s") def origin_id(instance): @@ -480,7 +480,7 @@ def purge_orphans(events_data: list[dict], skip_log=False) -> list[dict]: if drop: if not skip_log: logger.info( - f"Events referenced as super events are missing from the data: {', '.join(sorted(drop))}" + f"Events referenced as super events are missing from the data: {', '.join(sorted(drop))}" # noqa: E501 ) return purge_orphans(keep, skip_log=True) diff --git a/events/importer/kulke.py b/events/importer/kulke.py index 0ea77d0b3..ae76036dd 100644 --- a/events/importer/kulke.py +++ b/events/importer/kulke.py @@ -71,7 +71,7 @@ "leikkipuisto lampi": "57117", } -# "Etäosallistuminen" is also mapped to our new fancy "Tapahtuma vain internetissä." location +# "Etäosallistuminen" is also mapped to our new fancy "Tapahtuma vain internetissä." location # noqa: E501 INTERNET_LOCATION_ID = settings.SYSTEM_DATA_SOURCE_ID + ":internet" ADDRESS_TPREK_MAP = { @@ -135,7 +135,7 @@ 3, ] -# Events having one of these categories are courses - they are excluded when importing events +# Events having one of these categories are courses - they are excluded when importing events # noqa: E501 # and only they are included when importing courses. COURSE_CATEGORIES = { 70, @@ -450,7 +450,7 @@ def find_place(self, event): if tprek_id: event["location"]["id"] = self.tprek_by_id[tprek_id] elif Keyword.objects.get(id="yso:p26626") in event["keywords"]: - # "Etäosallistuminen" is also mapped to our new fancy "Tapahtuma vain internetissä." location + # "Etäosallistuminen" is also mapped to our new fancy "Tapahtuma vain internetissä." location # noqa: E501 event["location"]["id"] = INTERNET_LOCATION_ID elif "virtuaalinen" in loc_name.lower(): event["location"]["id"] = INTERNET_LOCATION_ID @@ -885,7 +885,7 @@ def _save_super_event(self, recurring_group): if n_super_events > 1: logger.error( - "Error: the superevent has an ambiguous aggregate group.\nAggregate ids: {}, group: {}".format( + "Error: the superevent has an ambiguous aggregate group.\nAggregate ids: {}, group: {}".format( # noqa: E501 superevent_aggregates.values_list("id", flat=True), recurring_group ) ) @@ -894,7 +894,7 @@ def _save_super_event(self, recurring_group): events = list(Event.objects.filter(id__in=kulke_ids)) if len(events) != len(recurring_group): logger.warning( - "Not all events referenced in the group were found in the database. Group: %s - Events: %s", + "Not all events referenced in the group were found in the database. Group: %s - Events: %s", # noqa: E501 recurring_group, set(e.id for e in events), ) @@ -923,8 +923,8 @@ def _save_super_event(self, recurring_group): else: aggregate = superevent_aggregates.first() if len(events) < 2: - # The imported event is not part of an aggregate but one was found it in the db. - # Remove the super event. This is the only case when an event is removed from + # The imported event is not part of an aggregate but one was found it in the db. # noqa: E501 + # Remove the super event. This is the only case when an event is removed from # noqa: E501 # a recurring aggregate. aggregate.super_event.soft_delete() aggregate.super_event.sub_events.all().update(super_event=None) @@ -1105,10 +1105,10 @@ def generate_documentation_md() -> str: doc.add_heading("Kulke Importer") doc.add_paragraph( - "When importing data from Elis to Linked Events, some mappings and transformations are " - "applied, and there is some special logic regarding the creation of super events. " - "This document covers these aspects of the importer with the target audience being someone " - "who creates events and needs to understand how the event will be represented in LE." + "When importing data from Elis to Linked Events, some mappings and transformations are " # noqa: E501 + "applied, and there is some special logic regarding the creation of super events. " # noqa: E501 + "This document covers these aspects of the importer with the target audience being someone " # noqa: E501 + "who creates events and needs to understand how the event will be represented in LE." # noqa: E501 ) # Section about field mapping @@ -1137,7 +1137,7 @@ def _md_doc_fields(doc): """ Some of the fields in Linked Events are different from Elis, so some mapping needs to be performed when importing events from Elis. The following is a non-exhaustive list of these mappings. - """ + """ # noqa: E501 ) ) doc.add_table( @@ -1175,7 +1175,7 @@ def _md_doc_super_events(doc): If there are inconsistent references, e.g. A refers to B and C, but B only refers to A, a warning will be logged and the super event construction may be unsuccessful. - """ + """ # noqa: E501 ) ) @@ -1209,7 +1209,7 @@ def _md_doc_super_events(doc): first event, as determined by start time. The subset of keywords and audiences that are common to all member events will be attached to the super event. - """ + """ # noqa: E501 ) ) @@ -1249,7 +1249,7 @@ def _md_doc_location(doc): If the place is not found using the location name, finding the location using the address is attempted, in both Finnish and Swedish. These addresses are mapped to the following cultural centers, which in turn are mapped to the Tprek IDs shown above. - """ + """ # noqa: E501 ) ) @@ -1293,7 +1293,7 @@ def md_doc_ignored_categories(doc): def _md_doc_courses(doc): doc.add_heading("Courses", level=3) doc.add_paragraph( - "Any event that has at least one of these categories is considered to be a course." + "Any event that has at least one of these categories is considered to be a course." # noqa: E501 ) id_to_name = { kw_id: name @@ -1321,11 +1321,11 @@ def _md_doc_keywords(doc): For some categories, this is done using a manual mapping, but for the remaining categories, the importer will attempt to perform a keyword match to determine the keywords. The mapping, both manual and automatic, is shown in the table below. - """ + """ # noqa: E501 ) ) - # At doc generation time we don't have access to the category type info, so this is + # At doc generation time we don't have access to the category type info, so this is # noqa: E501 # a dirty workaround to filter categories with these types out of the table categories_of_ignored_type = [36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49] diff --git a/events/importer/lippupiste.py b/events/importer/lippupiste.py index cba8ffd0b..5ee063dd4 100644 --- a/events/importer/lippupiste.py +++ b/events/importer/lippupiste.py @@ -76,7 +76,7 @@ } HKT_TPREK_PLACE_MAP = { - "Arena-näyttämö": "tprek:46367", # As of writing, tprek has duplicate, so we will map manually + "Arena-näyttämö": "tprek:46367", # As of writing, tprek has duplicate, so we will map manually # noqa: E501 "Gloria, Pieni Roobertinkatu, Helsinki": "tprek:8099", # String match fails "Helsingin Vanha kirkko": "tprek:43184", # String match fails } @@ -386,7 +386,7 @@ def _get_place_id_from_source_event(self, source_event): place_id = None if matches_by_address: logger.info( - "address match, pick the name with most common words and least different words, if any:" + "address match, pick the name with most common words and least different words, if any:" # noqa: E501 ) if len(matches_by_address) > 1: for _common_words, match_list in sorted( @@ -414,7 +414,7 @@ def _get_place_id_from_source_event(self, source_event): return place_id if matches_by_partial_name: logger.info( - "partial name match, pick the name with most common words and least different words:" + "partial name match, pick the name with most common words and least different words:" # noqa: E501 ) most_common_words = max(matches_by_partial_name.keys()) most_common_matches = matches_by_partial_name[most_common_words] @@ -453,7 +453,7 @@ def _update_event_data(self, event, source_event): event_date = datetime.strptime(source_event["EventDate"], "%d.%m.%Y").date() event_time = datetime.strptime(source_event["EventTime"], "%H:%M").time() event_datetime = LOCAL_TZ.localize(datetime.combine(event_date, event_time)) - # we would prefer to retain the local timezone, so as to better communicate it to base importer + # we would prefer to retain the local timezone, so as to better communicate it to base importer # noqa: E501 # event_datetime = event_datetime.astimezone(pytz.utc) event["start_time"] = event_datetime provider = source_event["EventPromoterName"] @@ -681,7 +681,7 @@ def import_events(self): # not ignored # check if the event already exists from another data source for data_source in DATA_SOURCES_TO_CHECK_FOR_DUPLICATES: - # the event name must *start* with an existing event name, as lippupiste uses suffixes + # the event name must *start* with an existing event name, as lippupiste uses suffixes # noqa: E501 # there is no standard django method for filtering startswith this # way around event_name = source_event["EventName"].lower() @@ -695,7 +695,7 @@ def import_events(self): logger.info("---------") logger.info(source_event["EventName"]) logger.info( - "omitting due to event existing already in another data source:" + "omitting due to event existing already in another data source:" # noqa: E501 ) logger.info(data_source) break diff --git a/events/importer/osoite.py b/events/importer/osoite.py index 47025a0fe..3c476b424 100644 --- a/events/importer/osoite.py +++ b/events/importer/osoite.py @@ -76,14 +76,14 @@ def delete_and_replace(self, obj): # we won't stand idly by and watch kymp delete used addresses willy-nilly # without raising a ruckus! if obj.events.count() > 0: - # sadly, addresses are identified by, well, address alone. Therefore we have no other data that + # sadly, addresses are identified by, well, address alone. Therefore we have no other data that # noqa: E501 # could be used to find out if there is a replacement location. logger.warning( - "Osoiteluettelo deleted address %s (%s) with events. This means that the street in " - "question has probably changed address numbers, as they do. Please check all " - "addresses on the street for events and save any new address numbers in the " - "replaced_by field. If several addresses have changed on the street, you may have to " - "manually move the events instead. Until then, events will stay mapped to the old " + "Osoiteluettelo deleted address %s (%s) with events. This means that the street in " # noqa: E501 + "question has probably changed address numbers, as they do. Please check all " # noqa: E501 + "addresses on the street for events and save any new address numbers in the " # noqa: E501 + "replaced_by field. If several addresses have changed on the street, you may have to " # noqa: E501 + "manually move the events instead. Until then, events will stay mapped to the old " # noqa: E501 "addresses." % (obj.id, str(obj)) ) return True @@ -152,7 +152,7 @@ def _import_address(self, syncher, address_obj): if obj.deleted: obj.deleted = False # address has been reinstated, hip hip hooray! - # there's no way we can find any events from other addresses that should now be in this address + # there's no way we can find any events from other addresses that should now be in this address # noqa: E501 # so we cannot do address replace here (the way we do with tprek units) obj._changed_fields.append("deleted") obj._changed = True diff --git a/events/importer/sync.py b/events/importer/sync.py index b180eb601..a77dfddf8 100644 --- a/events/importer/sync.py +++ b/events/importer/sync.py @@ -47,9 +47,9 @@ def finish(self, force=False): delete_list = [] for _obj_id, obj in self.obj_dict.items(): if obj._found: - # We have to reset _found so we don't mark or match the same object across several synchers. + # We have to reset _found so we don't mark or match the same object across several synchers. # noqa: E501 # Only relevant if consecutive synchers get different querysets; - # then the marked object might come from outside the initial syncher queryset. + # then the marked object might come from outside the initial syncher queryset. # noqa: E501 # That results in spurious _found values in both found and non-found # objects. obj._found = False @@ -64,7 +64,7 @@ def finish(self, force=False): and not force ): raise Exception( - f"Attempting to delete {len(delete_list)} out of a total of {len(self.obj_dict)} items" + f"Attempting to delete {len(delete_list)} out of a total of {len(self.obj_dict)} items" # noqa: E501 ) for obj in delete_list: if self.allow_deleting_func: diff --git a/events/importer/tprek.py b/events/importer/tprek.py index 05de1e22d..32ada1661 100644 --- a/events/importer/tprek.py +++ b/events/importer/tprek.py @@ -67,7 +67,7 @@ def delete_and_replace(self, obj): logger.warning( "Tprek deleted location %s (%s) with events." "No unambiguous replacement was found. " - "Please look for a replacement location and save it in the replaced_by field. " + "Please look for a replacement location and save it in the replaced_by field. " # noqa: E501 "Until then, events will stay mapped to the deleted location." % (obj.id, str(obj)) ) diff --git a/events/importer/utils.py b/events/importer/utils.py index 2a288c67f..a31f0022c 100644 --- a/events/importer/utils.py +++ b/events/importer/utils.py @@ -28,7 +28,7 @@ def clean_text(text, strip_newlines=False, parse_html=False): def clean_url(url): """ Takes in a string and returns it as a cleaned url, or empty if the string is not a valid URL. - """ + """ # noqa: E501 url = clean_text(url, True) url = url.replace(" ", "%20") if not re.match(r"^\w+?://", url): @@ -50,7 +50,7 @@ def separate_scripts(text, scripts): :param text: The plain text or html to separate paragraphs in by language. :param scripts: Iterable of allowed languages. :return: - """ + """ # noqa: E501 # separate the text by paragraphs, matching to select html and plain text # delimiters in data paragraphs = re.split(r"(

|\n|

|

| – |


)+", text) @@ -147,7 +147,7 @@ def replace_location( :param by_datasource: The data source to look for the location to replace by :param include_deleted: Include deleted locations when looking for replacements :return: Boolean that determines whether a new location was found for the hapless events - """ + """ # noqa: E501 if not by: replacements = Place.objects.filter( name__iexact=replace.name, data_source=by_source, deleted=False diff --git a/events/importer/yso.py b/events/importer/yso.py index 4926b0c5c..24e0993d7 100644 --- a/events/importer/yso.py +++ b/events/importer/yso.py @@ -25,7 +25,7 @@ "yso:p21160": "yso:p8113", # Suvilahti -> Suvilahti (Helsinki), missing YSO replacement "yso:p27158": "yso:p508707", - "yso:p21315": "yso:p508301", # Marskenttä -> Campus Martius, missing YSO replacement + "yso:p21315": "yso:p508301", # Marskenttä -> Campus Martius, missing YSO replacement # noqa: E501 } # yso keywords for the importers to automatically include in the audience field as well diff --git a/events/keywords.py b/events/keywords.py index 5cb88cfaa..f21b58b3e 100644 --- a/events/keywords.py +++ b/events/keywords.py @@ -17,7 +17,7 @@ def full_text_matching(self, text, language=None): if language: if language not in used_langs.keys(): raise ParseError( - f"{language} not supported. Supported options are: {' '.join(used_langs.keys())}" + f"{language} not supported. Supported options are: {' '.join(used_langs.keys())}" # noqa: E501 ) languages = [language] else: @@ -36,8 +36,8 @@ def full_text_matching(self, text, language=None): .order_by("-similarity") # noqa E124 .first() ) # noqa E124 - # storing the result in a dictionary of the following structure {similarity: label} - # in the edge case when similarity is the same for two different languages the label will be + # storing the result in a dictionary of the following structure {similarity: label} # noqa: E501 + # in the edge case when similarity is the same for two different languages the label will be # noqa: E501 # overwritten, which is not big deal as we don't have a way to select # between the two anyway. if label: @@ -51,9 +51,9 @@ def full_text_matching(self, text, language=None): return None def label_match(self, text, language=None): - # Let's use Postgres full-text search to find a label matched by lexeme and rank the results with - # TrigramSimilarity as fulltext SearchRank is not suitable for ranking matched individual words. If no language - # is passed we cycle through all options as specified in FULLTEXT_SEARCH_LANGUAGES and select the best match + # Let's use Postgres full-text search to find a label matched by lexeme and rank the results with # noqa: E501 + # TrigramSimilarity as fulltext SearchRank is not suitable for ranking matched individual words. If no language # noqa: E501 + # is passed we cycle through all options as specified in FULLTEXT_SEARCH_LANGUAGES and select the best match # noqa: E501 # according to similarity. label = self.full_text_matching(text, language) if label: diff --git a/events/management/commands/add_helsinki_audience.py b/events/management/commands/add_helsinki_audience.py index 4524b0756..3fb02147d 100644 --- a/events/management/commands/add_helsinki_audience.py +++ b/events/management/commands/add_helsinki_audience.py @@ -58,7 +58,7 @@ class Command(BaseCommand): - help = "Creates SOTE keywords and Helsinki audience keyword set and adds YSO audience keywords to events." + help = "Creates SOTE keywords and Helsinki audience keyword set and adds YSO audience keywords to events." # noqa: E501 @lru_cache() # noqa: B019 def get_keyword_obj(self, keyword_id): @@ -151,7 +151,7 @@ def add_yso_audience_keywords_to_events(self): ) def handle(self, *args, **options): - # Helsinki data source must be created if missing. Note that it is not necessarily the system data source. + # Helsinki data source must be created if missing. Note that it is not necessarily the system data source. # noqa: E501 # If we are creating it, it *may* still be the system data source, so it # must be user editable! helsinki_data_source_defaults = { diff --git a/events/management/commands/add_helsinki_topics.py b/events/management/commands/add_helsinki_topics.py index 1cc32123c..c68a7dcce 100644 --- a/events/management/commands/add_helsinki_topics.py +++ b/events/management/commands/add_helsinki_topics.py @@ -79,7 +79,7 @@ def create_helsinki_topics_keyword_set(self): ) def handle(self, *args, **options): - # Helsinki data source must be created if missing. Note that it is not necessarily the system data source. + # Helsinki data source must be created if missing. Note that it is not necessarily the system data source. # noqa: E501 # If we are creating it, it *may* still be the system data source, so it # must be user editable! helsinki_data_source_defaults = { diff --git a/events/management/commands/check_deprecated_yso_keywords.py b/events/management/commands/check_deprecated_yso_keywords.py index fcac28853..4467bf9be 100644 --- a/events/management/commands/check_deprecated_yso_keywords.py +++ b/events/management/commands/check_deprecated_yso_keywords.py @@ -46,7 +46,7 @@ def handle(self, **options): if invalid_keyword_ids: self.log_problems( - f"{len(invalid_keyword_ids)} replacement keywords do not exist in DB:", + f"{len(invalid_keyword_ids)} replacement keywords do not exist in DB:", # noqa: E501 invalid_keyword_ids, ) @@ -92,7 +92,7 @@ def get_replacements(self): ) self.stdout.write( - f"Found {len(deprecated_keywords_without_replacement)} deprecated keywords without replacements" + f"Found {len(deprecated_keywords_without_replacement)} deprecated keywords without replacements" # noqa: E501 ) if len(deprecated_keywords_without_replacement) == 0: @@ -123,7 +123,7 @@ def get_replacements(self): if invalid_yso_id_replacements_ids: self.log_problems( - f"Invalid replacement yso id for {len(invalid_yso_id_replacements_ids)} keywords:", + f"Invalid replacement yso id for {len(invalid_yso_id_replacements_ids)} keywords:", # noqa: E501 invalid_yso_id_replacements_ids, ) return replacements diff --git a/events/management/commands/populate_local_event_cache.py b/events/management/commands/populate_local_event_cache.py index 1aba979be..1017eec3e 100644 --- a/events/management/commands/populate_local_event_cache.py +++ b/events/management/commands/populate_local_event_cache.py @@ -11,9 +11,9 @@ class Command(BaseCommand): help = ( - "Update local and internet-based ongoing and upcoming events cache. Note that cache has to be set up and\ - its memory limits will probably need adjustment. In case memcached is used, check -m and\ - -I parameters." + "Update local and internet-based ongoing and upcoming events cache. Note that " + "cache has to be set up and its memory limits will probably need adjustment. " + "In case memcached is used, check -m and -I parameters." ) def handle(self, *args, **options): diff --git a/events/management/commands/refresh_full_text.py b/events/management/commands/refresh_full_text.py index 796d0d514..d5069169c 100644 --- a/events/management/commands/refresh_full_text.py +++ b/events/management/commands/refresh_full_text.py @@ -39,7 +39,7 @@ def add_arguments(self, parser): parser.add_argument( "--create-no-transaction", action="store_true", - help="Same as --create but without a transaction. Primary use case is for testing.", + help="Same as --create but without a transaction. Primary use case is for testing.", # noqa: E501 ) parser.add_argument("--force", action="store_true", help="Force refresh") @@ -69,7 +69,7 @@ def handle(self, *args, **options): elif options["create"] or options["create_no_transaction"]: self.stdout.write( - "Creating events_eventfulltext materialized view (this may take some seconds)" + "Creating events_eventfulltext materialized view (this may take some seconds)" # noqa: E501 ) with open(sql_filename("create_materialized_view.sql"), "r") as file: @@ -130,7 +130,7 @@ def check_refresh_needed(): return self.stdout.write( - "Refreshing events_eventfulltext materialized view (this may take some seconds)" + "Refreshing events_eventfulltext materialized view (this may take some seconds)" # noqa: E501 ) with connection.cursor() as cursor: cursor.execute( diff --git a/events/management/commands/remove_unused_permissions.py b/events/management/commands/remove_unused_permissions.py index c0952bbf5..39e8c26e9 100644 --- a/events/management/commands/remove_unused_permissions.py +++ b/events/management/commands/remove_unused_permissions.py @@ -9,7 +9,7 @@ class Command(BaseCommand): - help = "Remove unused admin and registration user permissions after expiration time has passed." + help = "Remove unused admin and registration user permissions after expiration time has passed." # noqa: E501 @staticmethod def _handle_event_admins(datetime_now): diff --git a/events/models.py b/events/models.py index ec2b39db0..99d15b4ac 100644 --- a/events/models.py +++ b/events/models.py @@ -537,7 +537,7 @@ def save(self, *args, **kwargs): if self._has_circular_replacement(): raise ValidationError( _( - "Trying to replace this keyword with a keyword that is replaced by this keyword. " + "Trying to replace this keyword with a keyword that is replaced by this keyword. " # noqa: E501 "Please refrain from creating circular replacements and" "remove one of the replacements." ) @@ -748,8 +748,8 @@ def save(self, *args, **kwargs): if self._has_circular_replacement(): raise ValidationError( _( - "Trying to replace this place with a place that is replaced by this place. " - "Please refrain from creating circular replacements and remove one of the " + "Trying to replace this place with a place that is replaced by this place. " # noqa: E501 + "Please refrain from creating circular replacements and remove one of the " # noqa: E501 "replacements. We don't want homeless events." ) ) @@ -1008,8 +1008,8 @@ class EventEnvironment(models.TextChoices): verbose_name=_("Event status"), choices=STATUSES, default=Status.SCHEDULED ) - # Whether or not this data about the event is ready to be viewed by the general public. - # DRAFT means the data is considered incomplete or is otherwise undergoing refinement -- + # Whether or not this data about the event is ready to be viewed by the general public. # noqa: E501 + # DRAFT means the data is considered incomplete or is otherwise undergoing refinement -- # noqa: E501 # or just waiting to be published for other reasons. publication_status = models.SmallIntegerField( verbose_name=_("Event data publication status"), @@ -1126,7 +1126,7 @@ def save(self, *args, **kwargs): if self._has_circular_replacement(): raise ValidationError( _( - "Trying to replace this event with an event that is replaced by this event. " + "Trying to replace this event with an event that is replaced by this event. " # noqa: E501 "Please refrain from creating circular replacements and " "remove one of the replacements." ) @@ -1226,7 +1226,7 @@ def save(self, *args, **kwargs): if event_deleted or event_cancelled: # If there weren't any Talpa payments, cancel the registration or notify the - # contact persons in the event transaction so that all changes can be reverted + # contact persons in the event transaction so that all changes can be reverted # noqa: E501 # in case of an exception. self.cancel_registration_signups_or_notify_contact_person( registration_to_cancel @@ -1380,7 +1380,7 @@ def get_start_and_end_time_display(self, lang="fi", date_only=False) -> str: return ( f"{formatter_func(self.start_time, lang)}" if self.start_time.date() == self.end_time.date() and date_only - else f"{formatter_func(self.start_time, lang)} - {formatter_func(self.end_time, lang)}" + else f"{formatter_func(self.start_time, lang)} - {formatter_func(self.end_time, lang)}" # noqa: E501 ) elif self.start_time: return f"{formatter_func(self.start_time, lang)} -" diff --git a/events/permissions.py b/events/permissions.py index 0fc4f48ed..a28ecf50e 100644 --- a/events/permissions.py +++ b/events/permissions.py @@ -181,7 +181,7 @@ def _is_editing_organization_users(request_data, obj=None): return any([request_data.get(key) for key in user_keys]) # Existing organization => can add or remove users - # => check if usernames are equal between request data and the organization's user relations. + # => check if usernames are equal between request data and the organization's user relations. # noqa: E501 return any( [ key in request_data @@ -197,7 +197,7 @@ def has_permission(self, request, view): # User must be a superuser to add users to a new organization. return request.user.is_authenticated and request.user.is_superuser elif self._is_editing_web_store_merchants_or_accounts(request.data): - # User must be a superuser or a financial admin with organization admin rights to + # User must be a superuser or a financial admin with organization admin rights to # noqa: E501 # add web store merchants or accounts to a new organization. return request.user.is_authenticated and ( request.user.is_superuser @@ -224,7 +224,7 @@ def has_object_permission(self, request: Request, view, obj): # users. return request.user.is_authenticated and request.user.is_superuser elif self._is_editing_web_store_merchants_or_accounts(request.data): - # User must be a superuser or a financial admin to edit an existing organization's + # User must be a superuser or a financial admin to edit an existing organization's # noqa: E501 # web store merchants or accounts. financial_perms = ( request.user.is_superuser or request.user.is_financial_admin_of(obj) @@ -233,7 +233,7 @@ def has_object_permission(self, request: Request, view, obj): if set(request.data.keys()).difference( {"web_store_merchants", "web_store_accounts"} ): - # If other organization data is also edited, organization admin rights are also + # If other organization data is also edited, organization admin rights are also # noqa: E501 # required from a financial admin. return financial_perms and utils.organization_can_be_edited_by( obj, request.user diff --git a/events/schema.py b/events/schema.py index 7021b1249..7c8324996 100644 --- a/events/schema.py +++ b/events/schema.py @@ -37,7 +37,7 @@ def get_security_definition(self, auto_schema): "in": "header", "name": "apikey", "description": ( - "Apikey authentication for trusted data sources. Issued by Linked Events." + "Apikey authentication for trusted data sources. Issued by Linked Events." # noqa: E501 ), } @@ -64,7 +64,7 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Source of the data, typically API provider specific identifier. Will also be used " + "Source of the data, typically API provider specific identifier. Will also be used " # noqa: E501 "to specify standardized namespaces as they are brought into use." ) @@ -83,7 +83,7 @@ def map_serializer(self, auto_schema, direction): "Boolean to define if past events may be created using API." ) result["properties"]["private"]["description"] = ( - "Boolean to define is data source private. By default events of private data source " + "Boolean to define is data source private. By default events of private data source " # noqa: E501 "are hidden." ) result["properties"]["owner"]["description"] = ( @@ -100,21 +100,21 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Describes the actual events. Linked events API supports organizing events into " - 'hierarchies. This is implemented with collection events called "super events". ' + "Describes the actual events. Linked events API supports organizing events into " # noqa: E501 + 'hierarchies. This is implemented with collection events called "super events". ' # noqa: E501 "Super events are normal event objects, that reference contained events in " - '"sub_events" property. Currently there are two major use cases: events such ' - 'as "Helsinki Festival", which consist of unique events over a span of time and ' - "recurring events such as theatrical productions with multiple showings. It is " - "implementation dependent how the grouping of events is done. It should be noted " - "that grouping might be automatic based on eg. event name and thus group unrelated " - "events together and miss related events. Users of data are advised to prepare for " + '"sub_events" property. Currently there are two major use cases: events such ' # noqa: E501 + 'as "Helsinki Festival", which consist of unique events over a span of time and ' # noqa: E501 + "recurring events such as theatrical productions with multiple showings. It is " # noqa: E501 + "implementation dependent how the grouping of events is done. It should be noted " # noqa: E501 + "that grouping might be automatic based on eg. event name and thus group unrelated " # noqa: E501 + "events together and miss related events. Users of data are advised to prepare for " # noqa: E501 "this." ) result["properties"]["id"]["description"] = ( - "Consists of source prefix and source specific identifier. These should be URIs " - "uniquely identifying the event, and preferably also well formed http-URLs pointing " + "Consists of source prefix and source specific identifier. These should be URIs " # noqa: E501 + "uniquely identifying the event, and preferably also well formed http-URLs pointing " # noqa: E501 "to more information about the event." ) @@ -127,8 +127,8 @@ def map_serializer(self, auto_schema, direction): "References the aggregate event containing this event." ) result["properties"]["super_event_type"]["description"] = ( - "If the event has sub_events, describes the type of the event. Current options are " - "null, recurring, which means a repeating event, and " + "If the event has sub_events, describes the type of the event. Current options are " # noqa: E501 + "null, recurring, which means a repeating event, and " # noqa: E501 "umbrella, which means a major event that has sub-events." ) result["properties"]["event_status"]["description"] = ( @@ -140,21 +140,21 @@ def map_serializer(self, auto_schema, direction): ) result["properties"]["publication_status"]["description"] = ( - "Specifies whether the event should be published in the API (public) or " + "Specifies whether the event should be published in the API (public) or " # noqa: E501 "not (draft)." ) result["required"].append("publication_status") result["properties"]["data_source"]["description"] = ( - "Unique identifier (URI)for the system from which this event came from, preferably " + "Unique identifier (URI)for the system from which this event came from, preferably " # noqa: E501 "URL with more information about the system and its policies." ) result["properties"]["publisher"]["description"] = ( "Id of the organization that published this event in Linked events." ) result["properties"]["sub_events"]["description"] = ( - "For aggregate events this contains references to all sub events. Usually this " - "means that the sub events are part of series. The field super_event_type " + "For aggregate events this contains references to all sub events. Usually this " # noqa: E501 + "means that the sub events are part of series. The field super_event_type " # noqa: E501 "tells the type of the aggregate event." ) result["properties"]["in_language"]["description"] = ( @@ -197,7 +197,7 @@ def map_serializer(self, auto_schema, direction): "Consent to user information of the external user." ) result["properties"]["environment"]["description"] = ( - "Environment of the event. Current options are in (Indoor) and out (Outdoor)." + "Environment of the event. Current options are in (Indoor) and out (Outdoor)." # noqa: E501 ) result["properties"]["environmental_certificate"]["description"] = ( "Url of the environmental certificate." @@ -212,7 +212,7 @@ def map_serializer(self, auto_schema, direction): "Whether this event has been deleted in the original data source." ) result["properties"]["maximum_attendee_capacity"]["description"] = ( - "Maximum number of people allowed to enrol to the event. Can also be an estimate of " + "Maximum number of people allowed to enrol to the event. Can also be an estimate of " # noqa: E501 "the maximum number of attendees." ) result["properties"]["minimum_attendee_capacity"]["description"] = ( @@ -276,7 +276,7 @@ def map_serializer(self, auto_schema, direction): for lang in get_fixed_lang_codes() }, "description": ( - 'Unstructured extra info about location (like "eastern door of railway station").' + 'Unstructured extra info about location (like "eastern door of railway station").' # noqa: E501 ), } @@ -290,7 +290,7 @@ def map_serializer(self, auto_schema, direction): for lang in get_fixed_lang_codes() }, "description": ( - "Description of who is responsible for the practical implementation of the event." + "Description of who is responsible for the practical implementation of the event." # noqa: E501 ), } @@ -331,9 +331,9 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Links to entities that the event publisher considers related to this event. Eg. " - "links to catering service available during theatrical production. The links will " - "most likely point to unstructured content, ie. web pages suitable for human viewing." + "Links to entities that the event publisher considers related to this event. Eg. " # noqa: E501 + "links to catering service available during theatrical production. The links will " # noqa: E501 + "most likely point to unstructured content, ie. web pages suitable for human viewing." # noqa: E501 ) result["properties"]["name"]["description"] = ( @@ -361,7 +361,7 @@ def map_serializer(self, auto_schema, direction): result["properties"]["id"]["description"] = "Identifier of the image." result["properties"]["license"]["description"] = ( - 'License data for the image. May be "cc_by" (default) or "event_only". The latter ' + 'License data for the image. May be "cc_by" (default) or "event_only". The latter ' # noqa: E501 "license restricts use of the image and is specified on the API front page." ) result["properties"]["created_time"]["description"] = ( @@ -386,8 +386,8 @@ def map_serializer(self, auto_schema, direction): "Name of the photographer." ) result["properties"]["data_source"]["description"] = ( - "Identifies the source for data, this is specific to API provider. This is useful " - "for API users, as any data quality issues are likely to be specific to data source " + "Identifies the source for data, this is specific to API provider. This is useful " # noqa: E501 + "for API users, as any data quality issues are likely to be specific to data source " # noqa: E501 "and workarounds can be applied as such." ) result["properties"]["publisher"]["description"] = ( @@ -416,17 +416,17 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Keywords are used to describe events. Linked events uses namespaced keywords in " - "order to support having events from different sources. Namespaces are needed because " - "keywords are defined by the organization sourcing the events and can therefore " - "overlap in meaning. Conversely the meaning of same keyword can vary between " - "organizations. Organization sourcing the keyword can be identified by data_source " - "field. Data_source field will later specify standardized namespaces as well." + "Keywords are used to describe events. Linked events uses namespaced keywords in " # noqa: E501 + "order to support having events from different sources. Namespaces are needed because " # noqa: E501 + "keywords are defined by the organization sourcing the events and can therefore " # noqa: E501 + "overlap in meaning. Conversely the meaning of same keyword can vary between " # noqa: E501 + "organizations. Organization sourcing the keyword can be identified by data_source " # noqa: E501 + "field. Data_source field will later specify standardized namespaces as well." # noqa: E501 ) result["properties"]["id"]["description"] = ( - "Consists of source prefix and source specific identifier. These should be URIs " - "uniquely identifying the keyword, and preferably also well formed http-URLs " + "Consists of source prefix and source specific identifier. These should be URIs " # noqa: E501 + "uniquely identifying the keyword, and preferably also well formed http-URLs " # noqa: E501 "pointing to more information about the keyword." ) result["properties"]["origin_id"]["description"] = ( @@ -455,7 +455,7 @@ def map_serializer(self, auto_schema, direction): "This keyword is an combination of several keywords at source." ) result["properties"]["deprecated"]["description"] = ( - "Whether this keyword has been deprecated in the original data source. It may " + "Whether this keyword has been deprecated in the original data source. It may " # noqa: E501 "still contain old events linked to it." ) result["properties"]["has_upcoming_events"]["description"] = ( @@ -468,7 +468,7 @@ def map_serializer(self, auto_schema, direction): "Id of the this keyword entry's image." ) result["properties"]["data_source"]["description"] = ( - "Source of the keyword, typically API provider specific identifier. Will also be " + "Source of the keyword, typically API provider specific identifier. Will also be " # noqa: E501 "used to specify standardized namespaces as they are brought into use." ) result["properties"]["publisher"]["description"] = ( @@ -498,14 +498,14 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Keyword sets are used to group keywords together into classification groups. " - "For example, one set of keywords might describe themes used by an event provider " + "Keyword sets are used to group keywords together into classification groups. " # noqa: E501 + "For example, one set of keywords might describe themes used by an event provider " # noqa: E501 "and another could be used to describe audience groups." ) result["properties"]["id"]["description"] = ( - "Unique identifier for this keyword set. These should be URIs identifying the " - "source and the keyword set itself, and preferably also well formed http-URLs " + "Unique identifier for this keyword set. These should be URIs identifying the " # noqa: E501 + "source and the keyword set itself, and preferably also well formed http-URLs " # noqa: E501 "pointing to more information about the keyword." ) result["properties"]["origin_id"]["description"] = ( @@ -525,13 +525,13 @@ def map_serializer(self, auto_schema, direction): "URL reference to the user that created this keyword set (user endpoint)." ) result["properties"]["last_modified_by"]["description"] = ( - "URL reference to the user that last modified this keyword set (user endpoint)." + "URL reference to the user that last modified this keyword set (user endpoint)." # noqa: E501 ) result["properties"]["image"]["description"] = ( "Id of the this keyword set entry's image." ) result["properties"]["data_source"]["description"] = ( - "Unique identifier (URI)for the system where this keyword set originated, if any." + "Unique identifier (URI)for the system where this keyword set originated, if any." # noqa: E501 ) result["properties"]["organization"]["description"] = ( "Organization that has defined this keyword set." @@ -547,7 +547,7 @@ def map_serializer(self, auto_schema, direction): for lang in get_fixed_lang_codes() }, "description": ( - "Name for this keyword set, multilingual. This should be human readable, such " + "Name for this keyword set, multilingual. This should be human readable, such " # noqa: E501 "that it could be shown as label in UI." ), } @@ -565,8 +565,8 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Primary purpose of the language endpoint is to allow users to identify which " - "languages are supported for multilingual fields. It also has translations for the " + "Primary purpose of the language endpoint is to allow users to identify which " # noqa: E501 + "languages are supported for multilingual fields. It also has translations for the " # noqa: E501 "names of the languages." ) @@ -588,9 +588,9 @@ def map_serializer(self, auto_schema, direction): for lang in get_fixed_lang_codes() }, "description": ( - "Translation for the language name. Properties shown here are examples, it is " - "suggested that every language supported has its name translated to every other " - "language. Users of the API cannot rely on any translations being present." + "Translation for the language name. Properties shown here are examples, it is " # noqa: E501 + "suggested that every language supported has its name translated to every other " # noqa: E501 + "language. Users of the API cannot rely on any translations being present." # noqa: E501 ), } result["required"].append("name") @@ -607,8 +607,8 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Price information record for an event. The prices are not in a structured format and " - "the format depends on information source. An exception to this is the case of free " + "Price information record for an event. The prices are not in a structured format and " # noqa: E501 + "the format depends on information source. An exception to this is the case of free " # noqa: E501 "event. These are indicated using is_free flag, which is searchable." ) @@ -618,9 +618,9 @@ def map_serializer(self, auto_schema, direction): if settings.WEB_STORE_INTEGRATION_ENABLED: result["properties"]["offer_price_groups"]["description"] = ( - "Customer group selections with concrete pricing for this offer. Used as initial " - "values for registration customer groups when creating a registration for the event " - "that this offer belongs to. When at least one customer group selection exists, " + "Customer group selections with concrete pricing for this offer. Used as initial " # noqa: E501 + "values for registration customer groups when creating a registration for the event " # noqa: E501 + "that this offer belongs to. When at least one customer group selection exists, " # noqa: E501 "the registration is considered to require a payment." ) @@ -634,7 +634,7 @@ def map_serializer(self, auto_schema, direction): for lang in get_fixed_lang_codes() }, "description": ( - "Public price information of the event. These are not bare numbers but instead " + "Public price information of the event. These are not bare numbers but instead " # noqa: E501 "descriptions of the pricing scheme." ), } @@ -678,19 +678,19 @@ def map_serializer(self, auto_schema, direction): ) result["properties"]["id"]["description"] = ( - "Consists of source prefix and source specific identifier. These should be URIs " - "uniquely identifying the organization, and preferably also well formed http-URLs " + "Consists of source prefix and source specific identifier. These should be URIs " # noqa: E501 + "uniquely identifying the organization, and preferably also well formed http-URLs " # noqa: E501 "pointing to more information about the organization." ) result["properties"]["origin_id"]["description"] = ( - "Identifier for the organization in the original data source. For standardized " + "Identifier for the organization in the original data source. For standardized " # noqa: E501 "namespaces this will be a shared identifier." ) result["properties"]["data_source"]["description"] = ( - "Source of the organization data, typically API provider specific identifier. " - "Will also be used to specify standardized namespaces as they are brought into use." + "Source of the organization data, typically API provider specific identifier. " # noqa: E501 + "Will also be used to specify standardized namespaces as they are brought into use." # noqa: E501 ) result["properties"]["classification"]["description"] = ( "Id of the organization type." @@ -700,7 +700,7 @@ def map_serializer(self, auto_schema, direction): "Time the organization was founded." ) result["properties"]["dissolution_date"]["description"] = ( - "Time the organization was dissolved. If present, the organization no longer exists." + "Time the organization was dissolved. If present, the organization no longer exists." # noqa: E501 ) result["properties"]["created_time"]["description"] = ( "Time when the organization was created." @@ -712,7 +712,7 @@ def map_serializer(self, auto_schema, direction): "URL reference to the user that created this organization (user endpoint)." ) result["properties"]["last_modified_by"]["description"] = ( - "URL reference to the user that last modified this organization (user endpoint)." + "URL reference to the user that last modified this organization (user endpoint)." # noqa: E501 ) result["properties"]["sub_organizations"] = { @@ -741,7 +741,7 @@ def map_serializer(self, auto_schema, direction): result["properties"]["has_regular_user"] = { "type": "boolean", "description": ( - "Whether the organization has non-admin users in addition to admin users." + "Whether the organization has non-admin users in addition to admin users." # noqa: E501 ), } @@ -805,8 +805,8 @@ def map_serializer(self, auto_schema, direction): ) result["properties"]["data_source"]["description"] = ( - "Source of the organization data, typically API provider specific identifier. " - "Will also be used to specify standardized namespaces as they are brought into use." + "Source of the organization data, typically API provider specific identifier. " # noqa: E501 + "Will also be used to specify standardized namespaces as they are brought into use." # noqa: E501 ) result["required"].remove("data_source") @@ -822,20 +822,20 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Places describe physical locations for events and means for contacting people " - "responsible for these locations. Place definitions come from organizations " - 'publishing events (field "publisher") and can thus have slightly different ' + "Places describe physical locations for events and means for contacting people " # noqa: E501 + "responsible for these locations. Place definitions come from organizations " # noqa: E501 + 'publishing events (field "publisher") and can thus have slightly different ' # noqa: E501 "semantics between places sourced from different organizations." ) result["properties"]["id"]["description"] = ( - "Consists of source prefix and source specific identifier. These should be URIs " - "uniquely identifying the place, and preferably also well formed http-URLs pointing " + "Consists of source prefix and source specific identifier. These should be URIs " # noqa: E501 + "uniquely identifying the place, and preferably also well formed http-URLs pointing " # noqa: E501 "to more information about the place." ) result["properties"]["origin_id"]["description"] = ( - "Place identifier in the originating system. Same as id but without the data " + "Place identifier in the originating system. Same as id but without the data " # noqa: E501 "source prefix." ) result["required"].append("origin_id") @@ -865,13 +865,13 @@ def map_serializer(self, auto_schema, direction): "Postal code of the location (as used by traditional mail)." ) result["properties"]["post_office_box_num"]["description"] = ( - "PO box for traditional mail, in case mail is not delivered to the building." + "PO box for traditional mail, in case mail is not delivered to the building." # noqa: E501 ) result["properties"]["address_country"]["description"] = ( "Country for the place, not multilingual." ) result["properties"]["deleted"]["description"] = ( - "This place entry is not used anymore, but old events still reference it. This might " + "This place entry is not used anymore, but old events still reference it. This might " # noqa: E501 "be because of duplicate removal." ) result["properties"]["has_upcoming_events"]["description"] = ( @@ -898,7 +898,7 @@ def map_serializer(self, auto_schema, direction): "type": "string", "enum": ["Point"], "description": ( - "Interpretation of the coordinates property. Only point is supported in " + "Interpretation of the coordinates property. Only point is supported in " # noqa: E501 "this version" ), }, @@ -967,7 +967,7 @@ def map_serializer(self, auto_schema, direction): for lang in get_fixed_lang_codes() }, "description": ( - "Describes where the address is located, typically this would be name of the city." + "Describes where the address is located, typically this would be name of the city." # noqa: E501 ), } diff --git a/events/serializers.py b/events/serializers.py index b473020de..83a134a3b 100644 --- a/events/serializers.py +++ b/events/serializers.py @@ -512,7 +512,7 @@ def _handle_position(self): ) else: raise ParseError( - f"Two coordinates have to be provided and they should be float. You provided {coord}" + f"Two coordinates have to be provided and they should be float. You provided {coord}" # noqa: E501 ) return None @@ -703,7 +703,7 @@ def create(self, validated_data): ] else: raise ParseError( - f"{org_type} should be a list, you provided {type(self.request.data[org_type])}" + f"{org_type} should be a list, you provided {type(self.request.data[org_type])}" # noqa: E501 ) web_store_merchants = validated_data.pop("web_store_merchants", None) @@ -1009,7 +1009,7 @@ def validate(self, data): if "publication_status" not in data: data["publication_status"] = PublicationStatus.PUBLIC - # If the event is a draft, postponed or cancelled, no further validation is performed + # If the event is a draft, postponed or cancelled, no further validation is performed # noqa: E501 # For external users do all validations. if ( data["publication_status"] == PublicationStatus.DRAFT @@ -1165,7 +1165,7 @@ def create(self, validated_data): { "created_by": user, "last_modified_by": user, - "created_time": Event.now(), # we must specify creation time as we are setting id + "created_time": Event.now(), # we must specify creation time as we are setting id # noqa: E501 "event_status": Event.Status.SCHEDULED, # mark all newly created events as scheduled } @@ -1240,7 +1240,7 @@ def update(self, instance, validated_data): } ) - # Update event_status if a PUBLIC SCHEDULED or CANCELLED event start_time is updated. + # Update event_status if a PUBLIC SCHEDULED or CANCELLED event start_time is updated. # noqa: E501 # DRAFT events will remain SCHEDULED up to publication. # Check that the event is not explicitly CANCELLED at the same time. if ( @@ -1353,7 +1353,7 @@ def to_representation(self, obj): ret["end_time"] = None else: - # If we're storing only the date part, do not pretend we have the exact time. + # If we're storing only the date part, do not pretend we have the exact time. # noqa: E501 # Timestamp is of the form %Y-%m-%dT00:00:00, so we report the previous # date. ret["end_time"] = utils.start_of_previous_day(obj.end_time).strftime( diff --git a/events/sql.py b/events/sql.py index e60371fa3..6730f85d7 100644 --- a/events/sql.py +++ b/events/sql.py @@ -27,7 +27,7 @@ def count_events_for_keywords(keyword_ids=(), all=False): SELECT keyword_id, event_id FROM events_event_audience WHERE keyword_id IN %s ) t GROUP BY t.keyword_id; - """, + """, # noqa: E501 [keyword_ids, keyword_ids], ) elif all: diff --git a/events/utils.py b/events/utils.py index b0e2503c1..ae18b5df8 100644 --- a/events/utils.py +++ b/events/utils.py @@ -258,7 +258,7 @@ def get_user_data_source_and_organization_from_request( if not publisher: raise PermissionDenied(_("Data source doesn't belong to any organization")) else: - # objects *created* by api are marked coming from the system data source unless api_key is provided + # objects *created* by api are marked coming from the system data source unless api_key is provided # noqa: E501 # we must optionally create the system data source here, as the settings # may have changed at any time system_data_source_defaults = { diff --git a/helevents/models.py b/helevents/models.py index bd562e029..d1f601a60 100644 --- a/helevents/models.py +++ b/helevents/models.py @@ -70,11 +70,11 @@ def is_admin_of(self, publisher): raise NotImplementedError() def is_registration_admin_of(self, publisher): - """Check if current user is a registration admin user of the publisher organization""" + """Check if current user is a registration admin user of the publisher organization""" # noqa: E501 raise NotImplementedError() def is_financial_admin_of(self, publisher): - """Check if current user is a financial admin user of the publisher organization""" + """Check if current user is a financial admin user of the publisher organization""" # noqa: E501 raise NotImplementedError() def is_regular_user_of(self, publisher): @@ -131,11 +131,11 @@ def organization_memberships(self): raise NotImplementedError() def can_create_event(self, publisher, publication_status): - """Check if current user can create an event with the given publisher and publication_status""" + """Check if current user can create an event with the given publisher and publication_status""" # noqa: E501 return self.can_edit_event(publisher, publication_status, created_by=self) def can_edit_event(self, publisher, publication_status, created_by=None): - """Check if current user can edit an event with the given publisher and publication_status""" + """Check if current user can edit an event with the given publisher and publication_status""" # noqa: E501 if self.is_admin_of(publisher): return True diff --git a/helevents/utils.py b/helevents/utils.py index 8f9795a4b..3bff10dd5 100644 --- a/helevents/utils.py +++ b/helevents/utils.py @@ -17,7 +17,7 @@ def get_user_for_gdpr_api(user: get_user_model()) -> get_user_model(): :param user: the User instance whose GDPR data is being queried :return: the same User instance - """ + """ # noqa: E501 return user @@ -32,7 +32,7 @@ def delete_user_and_gdpr_data( :param user: the User instance to be deleted along with related GDPR data :param dry_run: a boolean telling if this is a dry run of the function or not - """ + """ # noqa: E501 if settings.GDPR_DISABLE_API_DELETION: # Delete user is disabled. Returns 403 FORBIDDEN so that the GDPR view @@ -42,9 +42,9 @@ def delete_user_and_gdpr_data( Error( "GDPR_DISABLE_API_DELETION=1", { - "fi": "GDPR poistopyynnöt on estetty toistaiseksi Linked Events -palvelussa", - "en": "GDPR removal requests are temporarily unavailable in Linked Events", - "sv": "GDPR-borttagning begäran är tillfälligt inte tillgänglig i Linked Events", + "fi": "GDPR poistopyynnöt on estetty toistaiseksi Linked Events -palvelussa", # noqa: E501 + "en": "GDPR removal requests are temporarily unavailable in Linked Events", # noqa: E501 + "sv": "GDPR-borttagning begäran är tillfälligt inte tillgänglig i Linked Events", # noqa: E501 }, ) ] @@ -64,9 +64,9 @@ def delete_user_and_gdpr_data( Error( "UPCOMING_SIGNUPS", { - "fi": "Käyttäjällä on tulevia ilmoittautumisia, joten tietoja ei voida poistaa.", + "fi": "Käyttäjällä on tulevia ilmoittautumisia, joten tietoja ei voida poistaa.", # noqa: E501 "en": "User has upcoming signups, so data cannot be deleted.", - "sv": "Användaren har kommande registreringar, så data kan inte raderas.", + "sv": "Användaren har kommande registreringar, så data kan inte raderas.", # noqa: E501 }, ) ] @@ -91,9 +91,9 @@ def delete_user_and_gdpr_data( Error( "ONGOING_PAYMENTS", { - "fi": "Käyttäjällä on avoimia maksuja, joten tietoja ei voida poistaa.", + "fi": "Käyttäjällä on avoimia maksuja, joten tietoja ei voida poistaa.", # noqa: E501 "en": "User has ongoing payments, so data cannot be deleted.", - "sv": "Användaren har pågående betalningar, så data kan inte raderas.", + "sv": "Användaren har pågående betalningar, så data kan inte raderas.", # noqa: E501 }, ) ] diff --git a/linkedevents/fields.py b/linkedevents/fields.py index f286dbe5f..bd3356880 100644 --- a/linkedevents/fields.py +++ b/linkedevents/fields.py @@ -76,7 +76,7 @@ def is_expanded(self): return getattr(self, "expanded", False) def get_queryset(self): - # For certain related fields we preload the queryset to avoid *.objects.all() query which can easily overload + # For certain related fields we preload the queryset to avoid *.objects.all() query which can easily overload # noqa: E501 # the memory as database grows. if isinstance(self._kwargs["serializer"], str): return super().get_queryset() diff --git a/linkedevents/schema_utils.py b/linkedevents/schema_utils.py index d0f64eff4..1b1f6333e 100644 --- a/linkedevents/schema_utils.py +++ b/linkedevents/schema_utils.py @@ -6,7 +6,7 @@ def swagger_endpoint_filter(endpoints) -> list: """ Ensure that only the wanted Linked Events API endpoints are included in the Swagger schema. - """ + """ # noqa: E501 filtered = [] for path, path_regex, method, callback in endpoints: @@ -41,8 +41,8 @@ def swagger_postprocessing_hook(result, generator, request, public): }, }, "description": ( - "Meta record for result pagination. All results from API are paginated, ie. " - "delivered in chunks of X results. This records describes how many results there " + "Meta record for result pagination. All results from API are paginated, ie. " # noqa: E501 + "delivered in chunks of X results. This records describes how many results there " # noqa: E501 "are in total, and how to access previous and next pages." ), } @@ -132,7 +132,7 @@ def __init__(self, *args, **kwargs): kwargs.setdefault( "description", ( - "Embed given reference-type fields, comma-separated if several, directly into " + "Embed given reference-type fields, comma-separated if several, directly into " # noqa: E501 "the response, otherwise they are returned as URI references." ), ) diff --git a/linkedevents/serializers.py b/linkedevents/serializers.py index cf85e0d8e..30ea6cbfb 100644 --- a/linkedevents/serializers.py +++ b/linkedevents/serializers.py @@ -92,7 +92,7 @@ def to_internal_value(self, data): if not isinstance(obj, dict): raise serializers.ValidationError( { - field_name: "This field is a translated field. Instead of a string," + field_name: "This field is a translated field. Instead of a string," # noqa: E501 " you must supply an object with strings corresponding" " to desired language ids." } @@ -351,7 +351,7 @@ def _validate_publisher_for_org_user( _( "Setting %(field)s to %(given)s " "is not allowed for this user. The %(field)s " - "must be left blank or set to %(required)s or any other organization " + "must be left blank or set to %(required)s or any other organization " # noqa: E501 "the user belongs to." ) % { @@ -374,7 +374,7 @@ def validate_publisher( ) if value.replaced_by: - # for replaced organizations, we automatically update to the current organization + # for replaced organizations, we automatically update to the current organization # noqa: E501 # even if the POST uses the old id return value.replaced_by diff --git a/linkedevents/settings.py b/linkedevents/settings.py index f8e1d64b2..c215dfa0e 100644 --- a/linkedevents/settings.py +++ b/linkedevents/settings.py @@ -124,7 +124,7 @@ def sentry_anonymize_user_repr(obj, hint): MEDIA_ROOT=(environ.Path(), root("media")), MEDIA_URL=(str, "/media/"), # "helsinki_adfs" = Tunnistamo auth_backends.adfs.helsinki.HelsinkiADFS - # "helsinkiazuread" = Tunnistamo auth_backends.helsinki_azure_ad.HelsinkiAzureADTenantOAuth2 + # "helsinkiazuread" = Tunnistamo auth_backends.helsinki_azure_ad.HelsinkiAzureADTenantOAuth2 # noqa: E501 # "helsinkiad" Helsinki Keycloak AD authentication # "vantaalinkedevents" Vantaa AD authentication in Helsinki Keycloak NON_EXTERNAL_AUTHENTICATION_METHODS=( @@ -520,7 +520,7 @@ def haystack_connection_for_lang(language_code): return { "default-fi": { "ENGINE": "multilingual_haystack.backends.LanguageSearchEngine", - "BASE_ENGINE": "events.custom_elasticsearch_search_backend.CustomEsSearchEngine", + "BASE_ENGINE": "events.custom_elasticsearch_search_backend.CustomEsSearchEngine", # noqa: E501 "URL": env("ELASTICSEARCH_URL"), "INDEX_NAME": "linkedevents-fi", "SETTINGS": { @@ -540,7 +540,7 @@ def haystack_connection_for_lang(language_code): return { f"default-{language_code}": { "ENGINE": "multilingual_haystack.backends.LanguageSearchEngine", - "BASE_ENGINE": "events.custom_elasticsearch_search_backend.CustomEsSearchEngine", + "BASE_ENGINE": "events.custom_elasticsearch_search_backend.CustomEsSearchEngine", # noqa: E501 "URL": env("ELASTICSEARCH_URL"), "INDEX_NAME": f"linkedevents-{language_code}", } @@ -613,7 +613,7 @@ def dummy_haystack_connection_for_lang(language_code): secret.close() except IOError: raise Exception( - "Please create a %s file with random characters to generate your secret key!" + "Please create a %s file with random characters to generate your secret key!" # noqa: E501 % secret_file ) @@ -633,7 +633,7 @@ def dummy_haystack_connection_for_lang(language_code): else: if not DEBUG: print( - "Warning: EMAIL_HOST and/or EMAIL_PORT not set, using console backend for sending " + "Warning: EMAIL_HOST and/or EMAIL_PORT not set, using console backend for sending " # noqa: E501 "emails" ) MAILER_EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" @@ -759,16 +759,16 @@ def dummy_haystack_connection_for_lang(language_code): SPECTACULAR_SETTINGS = { "TITLE": "Linked Events information API", "DESCRIPTION": ( - "Linked Events provides categorized data on events and places using JSON-LD format." + "Linked Events provides categorized data on events and places using JSON-LD format." # noqa: E501 "\n\n" - "Events can be searched by date and location. Location can be exact address or larger " + "Events can be searched by date and location. Location can be exact address or larger " # noqa: E501 "area such as neighbourhood or borough." "\n\n" - "JSON-LD format is streamlined using include mechanism. API users can request that certain " - "fields are included directly into the result, instead of being hyperlinks to objects." + "JSON-LD format is streamlined using include mechanism. API users can request that certain " # noqa: E501 + "fields are included directly into the result, instead of being hyperlinks to objects." # noqa: E501 "\n\n" - "Several fields are multilingual. These are implemented as object with each language variant " - "as property. In this specification each multilingual field has (fi,sv,en) property triplet as " + "Several fields are multilingual. These are implemented as object with each language variant " # noqa: E501 + "as property. In this specification each multilingual field has (fi,sv,en) property triplet as " # noqa: E501 "example." ), "VERSION": None, diff --git a/registrations/api.py b/registrations/api.py index 9007ca624..6023016d9 100644 --- a/registrations/api.py +++ b/registrations/api.py @@ -135,7 +135,7 @@ def perform_destroy(self, instance): ): raise ConflictException( _( - "Refund or cancellation already exists. Please wait for the process " + "Refund or cancellation already exists. Please wait for the process " # noqa: E501 "to complete." ) ) @@ -212,9 +212,9 @@ def get_serializer_context(self): ), IncludeOpenApiParameter( description=( - "Embed given reference-type fields, comma-separated if several, directly into " - "the response, otherwise they are returned as URI references. The value " - "signups can be used to include signups' data, and the value " + "Embed given reference-type fields, comma-separated if several, directly into " # noqa: E501 + "the response, otherwise they are returned as URI references. The value " # noqa: E501 + "signups can be used to include signups' data, and the value " # noqa: E501 "event can be used to include the event's data." ), ), @@ -222,8 +222,8 @@ def get_serializer_context(self): name="text", type=OpenApiTypes.STR, description=( - "Search (case insensitive) through all event's multilingual text fields " - "(name, description, short_description, info_url) of a registration." + "Search (case insensitive) through all event's multilingual text fields " # noqa: E501 + "(name, description, short_description, info_url) of a registration." # noqa: E501 ), ), ], @@ -259,9 +259,9 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update a registration", description=( - "Registration can be updated if the user has appropriate access permissions. The " - "original implementation behaves like PATCH, ie. if some field is left out from the " - "PUT call, its value is retained in database. In order to ensure consistent behaviour, " + "Registration can be updated if the user has appropriate access permissions. The " # noqa: E501 + "original implementation behaves like PATCH, ie. if some field is left out from the " # noqa: E501 + "PUT call, its value is retained in database. In order to ensure consistent behaviour, " # noqa: E501 "users should always supply every field in PUT call." ), responses={ @@ -296,7 +296,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete a registration", - description="Registration can be deleted if the user has appropriate access permissions.", + description="Registration can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description=_("Registration has been successfully deleted."), @@ -327,7 +327,7 @@ def perform_update(self, serializer): def perform_destroy(self, instance): try: instance.delete() - # At the moment ProtecterError is raised only if user tries to remove registration with signups. + # At the moment ProtecterError is raised only if user tries to remove registration with signups. # noqa: E501 # Add logic to handle protected errors if more proteted fks are added in # the future. except ProtectedError: @@ -339,7 +339,7 @@ def filter_queryset(self, queryset): # Copy query_params to get mutable version of it query_params = self.request.query_params.copy() # By default _filter_event_queryset only returns events with GENERAL type. - # This causes problem when getting a registration details, so filter registrations + # This causes problem when getting a registration details, so filter registrations # noqa: E501 # by event_type only when explicitly set if not query_params.get("event_type"): event_types = {k[1].lower(): k[0] for k in Event.TYPE_IDS} @@ -399,7 +399,7 @@ def _get_messages(subject, cleaned_body, plain_text_body, contact_persons): @extend_schema( summary="Send a message to attendees", description=( - "Email message to registration attendees can be send if the user has appropriate " + "Email message to registration attendees can be send if the user has appropriate " # noqa: E501 "access permissions." ), ) @@ -415,7 +415,7 @@ def send_message(self, request, pk=None, version=None): if not signups_perm.has_object_permission(self.request, self, registration): raise DRFPermissionDenied( _( - "Only the admins of the registration organizations have access rights." + "Only the admins of the registration organizations have access rights." # noqa: E501 ) ) @@ -448,7 +448,7 @@ def send_message(self, request, pk=None, version=None): if not message_contact_persons: return Response( _( - "No contact persons with email addresses found for the given participants." + "No contact persons with email addresses found for the given participants." # noqa: E501 ), status=status.HTTP_404_NOT_FOUND, ) @@ -482,7 +482,7 @@ def send_message(self, request, pk=None, version=None): @extend_schema( summary="Export attendees as an XLSX file", description=( - "Registration attendees XLSX export can be made if the user has appropriate access " + "Registration attendees XLSX export can be made if the user has appropriate access " # noqa: E501 "permissions." ), parameters=[ @@ -490,7 +490,7 @@ def send_message(self, request, pk=None, version=None): name="ui_language", type=OpenApiTypes.STR, description=( - "UI language locale. Can be either fi, sv or " + "UI language locale. Can be either fi, sv or " # noqa: E501 "en. Defaults to fi if no value given." ), ), @@ -550,7 +550,7 @@ class RegistrationUserAccessViewSet(AuditLogApiViewMixin, viewsets.GenericViewSe responses={ 200: OpenApiResponse( RegistrationUserAccessSerializer, - description="Invitation was successfully sent to the registration user.", + description="Invitation was successfully sent to the registration user.", # noqa: E501 ), **get_common_api_error_responses(excluded_codes=[400]), 404: OpenApiResponse( @@ -599,8 +599,8 @@ class SignUpViewSet( name="sort", type=OpenApiTypes.STR, description=( - "Sort the returned signups in the given order. Possible sorting criteria are " - "first_name and last_name. The default ordering is " + "Sort the returned signups in the given order. Possible sorting criteria are " # noqa: E501 + "first_name and last_name. The default ordering is " # noqa: E501 "first_name,last_name." ), ), @@ -680,9 +680,9 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update a signup", description=( - "Signup can be updated if the user has appropriate access permissions. The original " - "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " - "its value is retained in database. In order to ensure consistent behaviour, users " + "Signup can be updated if the user has appropriate access permissions. The original " # noqa: E501 + "implementation behaves like PATCH, ie. if some field is left out from the PUT call, " # noqa: E501 + "its value is retained in database. In order to ensure consistent behaviour, users " # noqa: E501 "should always supply every field in PUT call." ), responses={ @@ -717,7 +717,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete a signup", - description="Signup can be deleted if the user has appropriate access permissions.", + description="Signup can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description="Signup has been successfully deleted.", @@ -812,7 +812,7 @@ def _ensure_shared_request_data(self, data): name="sort", type=OpenApiTypes.STR, description=( - "Sort the returned signup groups in the given order. Possible sorting " + "Sort the returned signup groups in the given order. Possible sorting " # noqa: E501 "criteria are first_name and last_name. " "The default ordering is first_name,last_name." ), @@ -828,7 +828,7 @@ def list(self, request, *args, **kwargs): 200: OpenApiResponse( SignUpGroupSerializer, description=( - "Single signup group object. Signup group can be retrieved if the user " + "Single signup group object. Signup group can be retrieved if the user " # noqa: E501 "has appropriate access permissions." ), ), @@ -859,9 +859,9 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update a signup group", description=( - "Signup group can be updated if the user has appropriate access permissions. " - "The original implementation behaves like PATCH, ie. if some field is left out " - "from the PUT call, its value is retained in database. In order to ensure consistent " + "Signup group can be updated if the user has appropriate access permissions. " # noqa: E501 + "The original implementation behaves like PATCH, ie. if some field is left out " # noqa: E501 + "from the PUT call, its value is retained in database. In order to ensure consistent " # noqa: E501 "behaviour, users should always supply every field in PUT call." ), responses={ @@ -900,7 +900,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete a signup group", - description="Signup group can be deleted if the user has appropriate access permissions.", + description="Signup group can be deleted if the user has appropriate access permissions.", # noqa: E501 responses={ 204: OpenApiResponse( description="Signup group has been successfully deleted.", @@ -950,9 +950,9 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update a seats reservation", description=( - "Seats reservation can be updated if the valid code is added to the payload. The " - "original implementation behaves like PATCH, ie. if some field is left out from the " - "PUT call, its value is retained in database. In order to ensure consistent " + "Seats reservation can be updated if the valid code is added to the payload. The " # noqa: E501 + "original implementation behaves like PATCH, ie. if some field is left out from the " # noqa: E501 + "PUT call, its value is retained in database. In order to ensure consistent " # noqa: E501 "behaviour, users should always supply every field in PUT call." ), responses={ @@ -1000,7 +1000,7 @@ class PriceGroupViewSet( name="sort", type=OpenApiTypes.STR, description=( - "Sort the returned customer groups in the given order by 'description'. " + "Sort the returned customer groups in the given order by 'description'. " # noqa: E501 ), ), ], @@ -1035,7 +1035,7 @@ def create(self, request, *args, **kwargs): @extend_schema( summary="Update a customer group", description=( - "Customer group can be updated if the user has appropriate access permissions. " + "Customer group can be updated if the user has appropriate access permissions. " # noqa: E501 "Default customer groups cannot be updated." ), responses={ @@ -1077,7 +1077,7 @@ def partial_update(self, request, *args, **kwargs): @extend_schema( summary="Delete a customer group", description=( - "Customer group can be deleted if the user has appropriate access permissions. " + "Customer group can be deleted if the user has appropriate access permissions. " # noqa: E501 "Default customer groups cannot be deleted." ), responses={ @@ -1188,7 +1188,7 @@ def order(self, request, pk=None, version=None): if order_status != WebStoreOrderStatus.CANCELLED.value: return Response( _( - "Order marked as cancelled in webhook payload, but not in Talpa API." + "Order marked as cancelled in webhook payload, but not in Talpa API." # noqa: E501 ), status=status.HTTP_400_BAD_REQUEST, ) @@ -1221,7 +1221,7 @@ def payment(self, request, pk=None, version=None): if payment_status != WebStorePaymentStatus.PAID.value: return Response( _( - "Payment marked as paid in webhook payload, but not in Talpa API." + "Payment marked as paid in webhook payload, but not in Talpa API." # noqa: E501 ), status=status.HTTP_400_BAD_REQUEST, ) @@ -1249,7 +1249,7 @@ def _get_refund(order_id: str, refund_id: str) -> Optional[SignUpPaymentRefund]: if not refund: raise NotFound( _( - "Refund not found with order ID %(order_id)s and refund ID %(refund_id)s." + "Refund not found with order ID %(order_id)s and refund ID %(refund_id)s." # noqa: E501 ) % {"order_id": order_id, "refund_id": refund_id} ) @@ -1300,7 +1300,7 @@ def refund(self, request, pk=None, version=None): if refund_status != WebStoreOrderRefundStatus.PAID_ONLINE.value: return Response( _( - "Refund marked as paid in webhook payload, but not in Talpa API." + "Refund marked as paid in webhook payload, but not in Talpa API." # noqa: E501 ), status=status.HTTP_400_BAD_REQUEST, ) @@ -1315,7 +1315,7 @@ def refund(self, request, pk=None, version=None): if refund_status != WebStoreOrderRefundStatus.CANCELLED.value: return Response( _( - "Refund marked as failed in webhook payload, but not in Talpa API." + "Refund marked as failed in webhook payload, but not in Talpa API." # noqa: E501 ), status=status.HTTP_400_BAD_REQUEST, ) diff --git a/registrations/exports.py b/registrations/exports.py index 44cb06c1d..9fd8ba1a1 100644 --- a/registrations/exports.py +++ b/registrations/exports.py @@ -68,7 +68,7 @@ def _get_columns() -> list[dict]: ), }, { - "header": "Status", # In the UI, this same word is used for all three languages + "header": "Status", # In the UI, this same word is used for all three languages # noqa: E501 "accessor": lambda signup: str(signup.get_attendee_status_display()), }, ] @@ -79,9 +79,9 @@ def _add_info_texts(worksheet: Worksheet, row: int = 1) -> None: row, 0, _( - "This material is subject to data protection. This material must be processed " - "in the manner required by data protection and only to verify \nthe participants " - "of the event. This list should be discarded when the event is over and the " + "This material is subject to data protection. This material must be processed " # noqa: E501 + "in the manner required by data protection and only to verify \nthe participants " # noqa: E501 + "of the event. This list should be discarded when the event is over and the " # noqa: E501 "attendees have been entered into the system." ), ) @@ -91,7 +91,7 @@ def _add_info_texts(worksheet: Worksheet, row: int = 1) -> None: row + 1, 0, _( - "Please note that the participant and the participant's contact information " + "Please note that the participant and the participant's contact information " # noqa: E501 "may be the information of different persons." ), ) diff --git a/registrations/filters.py b/registrations/filters.py index a87d4cff6..ef16c06b0 100644 --- a/registrations/filters.py +++ b/registrations/filters.py @@ -98,7 +98,7 @@ def filter_registration(self, queryset, name, value: list[str]): if not registrations: raise DRFPermissionDenied( _( - "Only the admins of the registration organizations have access rights." + "Only the admins of the registration organizations have access rights." # noqa: E501 ) ) @@ -163,8 +163,8 @@ class SignUpFilter(SignUpBaseFilter): text = django_filters.CharFilter( method="filter_text", help_text=_( - "Search (case insensitive) through the text fields of a signup (first_name, last_name) " - "and the signup's contact person (email, membership_number and phone_number)." + "Search (case insensitive) through the text fields of a signup (first_name, last_name) " # noqa: E501 + "and the signup's contact person (email, membership_number and phone_number)." # noqa: E501 ), ) @@ -196,8 +196,8 @@ class SignUpGroupFilter(SignUpBaseFilter): text = django_filters.CharFilter( method="filter_text", help_text=_( - "Search (case insensitive) through the text fields of signups (first_name, last_name) " - "and the contact person (email, membership_number and phone_number) in a signup group." + "Search (case insensitive) through the text fields of signups (first_name, last_name) " # noqa: E501 + "and the contact person (email, membership_number and phone_number) in a signup group." # noqa: E501 ), ) @@ -216,7 +216,7 @@ class PriceGroupFilter(ActionDependingFilter): widget=django_filters.widgets.CSVWidget(), method="filter_publisher", help_text=_( - "Search for customer groups belonging to an organization as specified by id. " + "Search for customer groups belonging to an organization as specified by id. " # noqa: E501 "Multiple ids are separated by comma. Use the value none for " "default customer groups." ), @@ -225,7 +225,7 @@ class PriceGroupFilter(ActionDependingFilter): description = django_filters.CharFilter( lookup_expr="icontains", help_text=_( - "Search (case insensitive) through customer groups' multilingual description field." + "Search (case insensitive) through customer groups' multilingual description field." # noqa: E501 ), ) diff --git a/registrations/forms.py b/registrations/forms.py index ea6cfbc04..07b142069 100644 --- a/registrations/forms.py +++ b/registrations/forms.py @@ -114,9 +114,9 @@ def __init__(self, *args, **kwargs): self.fields["maximum_attendee_capacity"].required = True self.fields["maximum_attendee_capacity"].help_text = _( "If the attendee capacity for the event is not restricted, please give a " - "rough estimate of at least the maximum attendee capacity. The information will be " - "used for statistical purposes. Maximum attendee capacity is a measure in the city " - "strategy that monitors the volumes of events held in the city. The estimate may be " + "rough estimate of at least the maximum attendee capacity. The information will be " # noqa: E501 + "used for statistical purposes. Maximum attendee capacity is a measure in the city " # noqa: E501 + "strategy that monitors the volumes of events held in the city. The estimate may be " # noqa: E501 "changed later if it is uncertain at the moment." ) diff --git a/registrations/management/commands/delete_signups_with_expired_payments.py b/registrations/management/commands/delete_signups_with_expired_payments.py index 66b02e165..5e0f51062 100644 --- a/registrations/management/commands/delete_signups_with_expired_payments.py +++ b/registrations/management/commands/delete_signups_with_expired_payments.py @@ -8,7 +8,7 @@ class Command(BaseCommand): help = ( - "Delete signups and signup groups that have payments that have expired at least the given " + "Delete signups and signup groups that have payments that have expired at least the given " # noqa: E501 "amount of days ago. The payments will be deleted along with the signups." ) @@ -17,7 +17,7 @@ def add_arguments(self, parser): "--threshold_days", type=int, default=14, - help="How many days ago the payments should have expired before they are deleted." + help="How many days ago the payments should have expired before they are deleted." # noqa: E501 "Default = 14.", ) diff --git a/registrations/management/commands/encrypt_fields_with_new_key.py b/registrations/management/commands/encrypt_fields_with_new_key.py index 717659fca..916a09d0d 100644 --- a/registrations/management/commands/encrypt_fields_with_new_key.py +++ b/registrations/management/commands/encrypt_fields_with_new_key.py @@ -6,8 +6,8 @@ class Command(BaseCommand): help = ( - "Encrypts existing encrypted data with a new encryption key. Please remember to prepend " - "the new key to the secrets value of the FIELD_ENCRYPTION_KEYS setting before running " + "Encrypts existing encrypted data with a new encryption key. Please remember to prepend " # noqa: E501 + "the new key to the secrets value of the FIELD_ENCRYPTION_KEYS setting before running " # noqa: E501 "this command." ) diff --git a/registrations/management/commands/mark_payments_expired.py b/registrations/management/commands/mark_payments_expired.py index a0de4cb8c..bd98931bc 100644 --- a/registrations/management/commands/mark_payments_expired.py +++ b/registrations/management/commands/mark_payments_expired.py @@ -24,7 +24,7 @@ class Command(BaseCommand): help = ( - "Mark signup payments expired if their expires_at timestamp has been exceeded and no " + "Mark signup payments expired if their expires_at timestamp has been exceeded and no " # noqa: E501 "payment exists in the Talpa web store for them." ) @@ -116,14 +116,14 @@ def handle(self, *args, **options): # Request failed => log error and skip processing for this # payment. logger.error( - f"mark_payments_expired: an error occurred while fetching payment " + f"mark_payments_expired: an error occurred while fetching payment " # noqa: E501 f"from the Talpa API (payment ID: {payment.pk}, order ID: " - f"{payment.external_order_id}, response.status_code: {status_code})" + f"{payment.external_order_id}, response.status_code: {status_code})" # noqa: E501 ) continue if resp_json.get("status") == WebStorePaymentStatus.PAID.value: - # Payment exists and is paid => mark our payment as paid and notify contact + # Payment exists and is paid => mark our payment as paid and notify contact # noqa: E501 # person. self._handle_payment_paid(payment) elif resp_json.get("status") == WebStorePaymentStatus.CANCELLED.value: @@ -140,7 +140,7 @@ def handle(self, *args, **options): ) > payment.expires_at ): - # Payer has entered the payment phase after expiry datetime and might make a + # Payer has entered the payment phase after expiry datetime and might make a # noqa: E501 # payment => check again later. pass else: diff --git a/registrations/models.py b/registrations/models.py index 0835e978a..d296b8bb3 100644 --- a/registrations/models.py +++ b/registrations/models.py @@ -351,7 +351,7 @@ def save(self, *args, **kwargs): old_instance and old_instance.paytrail_merchant_id != self.paytrail_merchant_id ): - # Whenever Paytrail merchant ID is changed, the merchant needs a new secret key + # Whenever Paytrail merchant ID is changed, the merchant needs a new secret key # noqa: E501 # mapping in Talpa and this requires the merchant to be re-created. created = True @@ -362,7 +362,7 @@ class PriceGroup(CreatedModifiedBaseModel): """Price group / pricing category that is selectable when creating a registration. These can be created and managed by admins for publishers / organizations. Default price groups do not have a publisher, but are system-wide default groups. - """ + """ # noqa: E501 publisher = models.ForeignKey( "django_orghierarchy.Organization", @@ -411,7 +411,7 @@ def save(self, *args, **kwargs): if not self.publisher_is_valid: raise PriceGroupValidationError( _( - "You may not change the publisher of a price group that has been used " + "You may not change the publisher of a price group that has been used " # noqa: E501 "in registrations." ) ) @@ -607,7 +607,7 @@ def move_first_waitlisted_to_attending_with_payment_link(self, first_on_list=Non ) except (ValidationError, AttributeError) as exc: logger.error( - f"Failed to create payment when moving waitlisted signup #{first_on_list.pk} " + f"Failed to create payment when moving waitlisted signup #{first_on_list.pk} " # noqa: E501 f"to attending: {exc}" ) return @@ -685,7 +685,7 @@ def to_web_store_product_mapping_data(self): if not (merchant := getattr(self, "registration_merchant", None)): raise WebStoreProductMappingValidationError( _( - "A WebStoreMerchant is required to create a product mapping in Talpa." + "A WebStoreMerchant is required to create a product mapping in Talpa." # noqa: E501 ) ) @@ -699,7 +699,7 @@ def to_web_store_product_accounting_data(self, vat_code: str): if not (account := getattr(self, "registration_account", None)): raise WebStoreProductMappingValidationError( _( - "A WebStoreAccount is required to create product accounting in Talpa." + "A WebStoreAccount is required to create product accounting in Talpa." # noqa: E501 ) ) @@ -811,7 +811,7 @@ class Meta: class RegistrationPriceGroup(RegistrationPriceGroupBaseModel): - """Price group selections for SignUps (= what the end-user doing a signup can choose from).""" + """Price group selections for SignUps (= what the end-user doing a signup can choose from).""" # noqa: E501 registration = models.ForeignKey( Registration, @@ -896,7 +896,7 @@ def _raise_web_store_refund_or_cancellation_exception( raise exception error_message_with_signup_id = _( - "Payment refund or cancellation failed for %(class_name)s with ID %(object_id)s." + "Payment refund or cancellation failed for %(class_name)s with ID %(object_id)s." # noqa: E501 ) % {"class_name": self.__class__.__name__, "object_id": self.pk} messages = [error_message_with_signup_id] messages.extend(exception.messages) @@ -917,7 +917,7 @@ def create_web_store_payment(self): and registration_merchant.external_merchant_id != registration_merchant.merchant.merchant_id ): - # New merchant has been created in Talpa because of an updated Paytrail merchant ID, + # New merchant has been created in Talpa because of an updated Paytrail merchant ID, # noqa: E501 # and the registration hasn't been updated after that # => need to update product mapping here. self.registration.create_or_update_web_store_product_mapping_and_accounting() @@ -1099,7 +1099,7 @@ def refund_or_cancel_web_store_payment(self, payment): class_name = self.__class__.__name__ logger.info( f"{class_name} delete: " - f"cancellation created for payment with order ID {payment.external_order_id} " + f"cancellation created for payment with order ID {payment.external_order_id} " # noqa: E501 f"({class_name} ID: {self.pk})." ) return False, True @@ -1505,7 +1505,7 @@ def price_groups(self): return [] def partially_refund_signup_group_web_store_payment(self, signup_group): - """Returns True if the signup group's payment was partially refunded, False otherwise.""" + """Returns True if the signup group's payment was partially refunded, False otherwise.""" # noqa: E501 if ( not (group_payment := getattr(signup_group, "payment", None)) @@ -1529,7 +1529,7 @@ def partially_refund_signup_group_web_store_payment(self, signup_group): class_name = self.__class__.__name__ logger.info( f"{class_name} delete: partial refund created for payment with " - f"order ID {group_payment.external_order_id} ({class_name} ID: {signup_group.pk})" + f"order ID {group_payment.external_order_id} ({class_name} ID: {signup_group.pk})" # noqa: E501 ) return True @@ -2007,7 +2007,7 @@ class Meta: class SignUpPriceGroup(RegistrationPriceGroupBaseModel, SoftDeletableBaseModel): """When a registration price group is selected when creating a signup for a registration, the pricing information that existed at that moment is stored into this model/table. - """ + """ # noqa: E501 signup = models.OneToOneField( SignUp, diff --git a/registrations/notifications.py b/registrations/notifications.py index 0313ae8ed..9b3805c65 100644 --- a/registrations/notifications.py +++ b/registrations/notifications.py @@ -60,7 +60,7 @@ class SignUpNotificationType: SignUpNotificationType.TRANSFERRED_AS_PARTICIPANT: _( "Registration confirmation - %(event_name)s" ), - SignUpNotificationType.TRANSFER_AS_PARTICIPANT_WITH_PAYMENT: CONFIRMATION_WITH_PAYMENT_HEADING, + SignUpNotificationType.TRANSFER_AS_PARTICIPANT_WITH_PAYMENT: CONFIRMATION_WITH_PAYMENT_HEADING, # noqa: E501 SignUpNotificationType.PAYMENT_EXPIRED: _( "Registration payment expired - %(event_name)s" ), @@ -79,13 +79,13 @@ class SignUpNotificationType: "heading": REGISTRATION_CANCELLED_HEADING, "secondary_heading": { Event.TypeId.GENERAL: _( - "%(username)s, registration to the event %(event_name)s has been cancelled." + "%(username)s, registration to the event %(event_name)s has been cancelled." # noqa: E501 ), Event.TypeId.COURSE: _( - "%(username)s, registration to the course %(event_name)s has been cancelled." + "%(username)s, registration to the course %(event_name)s has been cancelled." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( - "%(username)s, registration to the volunteering %(event_name)s has been cancelled." + "%(username)s, registration to the volunteering %(event_name)s has been cancelled." # noqa: E501 ), }, "secondary_heading_without_username": { @@ -101,25 +101,25 @@ class SignUpNotificationType: }, "text": { Event.TypeId.GENERAL: _( - "You have successfully cancelled your registration to the event %(event_name)s." + "You have successfully cancelled your registration to the event %(event_name)s." # noqa: E501 ), Event.TypeId.COURSE: _( - "You have successfully cancelled your registration to the course %(event_name)s." + "You have successfully cancelled your registration to the course %(event_name)s." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( - "You have successfully cancelled your registration to the volunteering %(event_name)s." + "You have successfully cancelled your registration to the volunteering %(event_name)s." # noqa: E501 ), }, "payment_cancelled": { "text": { Event.TypeId.GENERAL: _( - "Your registration and payment for the event %(event_name)s have been cancelled." + "Your registration and payment for the event %(event_name)s have been cancelled." # noqa: E501 ), Event.TypeId.COURSE: _( - "Your registration and payment for the course %(event_name)s have been cancelled." + "Your registration and payment for the course %(event_name)s have been cancelled." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( - "Your registration to the volunteering %(event_name)s has been cancelled." + "Your registration to the volunteering %(event_name)s has been cancelled." # noqa: E501 ), }, }, @@ -127,17 +127,17 @@ class SignUpNotificationType: "text": { Event.TypeId.GENERAL: _( "You have successfully cancelled your registration to the event " - "%(event_name)s. Your payment for the registration " + "%(event_name)s. Your payment for the registration " # noqa: E501 "has been refunded." ), Event.TypeId.COURSE: _( "You have successfully cancelled your registration to the course " - "%(event_name)s. Your payment for the registration " + "%(event_name)s. Your payment for the registration " # noqa: E501 "has been refunded." ), Event.TypeId.VOLUNTEERING: _( - "You have successfully cancelled your registration to the volunteering " - "%(event_name)s. Your payment for the registration " + "You have successfully cancelled your registration to the volunteering " # noqa: E501 + "%(event_name)s. Your payment for the registration " # noqa: E501 "has been refunded." ), }, @@ -146,17 +146,17 @@ class SignUpNotificationType: "text": { Event.TypeId.GENERAL: _( "You have successfully cancelled a registration to the event " - "%(event_name)s. Your payment has been partially refunded " + "%(event_name)s. Your payment has been partially refunded " # noqa: E501 "for the amount of the cancelled registration." ), Event.TypeId.COURSE: _( "You have successfully cancelled a registration to the course " - "%(event_name)s. Your payment has been partially refunded " + "%(event_name)s. Your payment has been partially refunded " # noqa: E501 "for the amount of the cancelled registration." ), Event.TypeId.VOLUNTEERING: _( - "You have successfully cancelled a registration to the volunteering " - "%(event_name)s. Your payment has been partially refunded " + "You have successfully cancelled a registration to the volunteering " # noqa: E501 + "%(event_name)s. Your payment has been partially refunded " # noqa: E501 "for the amount of the cancelled registration." ), }, @@ -178,10 +178,10 @@ class SignUpNotificationType: }, "text": { Event.TypeId.GENERAL: _( - "Congratulations! Your registration has been confirmed for the event %(event_name)s." + "Congratulations! Your registration has been confirmed for the event %(event_name)s." # noqa: E501 ), Event.TypeId.COURSE: _( - "Congratulations! Your registration has been confirmed for the course %(event_name)s." + "Congratulations! Your registration has been confirmed for the course %(event_name)s." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( "Congratulations! Your registration has been confirmed for the volunteering %(event_name)s." # noqa E501 @@ -197,7 +197,7 @@ class SignUpNotificationType: "Group registration to the course %(event_name)s has been saved." ), Event.TypeId.VOLUNTEERING: _( - "Group registration to the volunteering %(event_name)s has been saved." + "Group registration to the volunteering %(event_name)s has been saved." # noqa: E501 ), }, }, @@ -207,10 +207,10 @@ class SignUpNotificationType: "heading_without_username": CONFIRMATION_HEADING_WITHOUT_USERNAME, "secondary_heading": { Event.TypeId.GENERAL: _( - "Payment is required to confirm your registration to the event %(event_name)s." + "Payment is required to confirm your registration to the event %(event_name)s." # noqa: E501 ), Event.TypeId.COURSE: _( - "Payment is required to confirm your registration to the course %(event_name)s." + "Payment is required to confirm your registration to the course %(event_name)s." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( "Payment is required to confirm your registration to the volunteering " @@ -219,17 +219,17 @@ class SignUpNotificationType: }, "text": { Event.TypeId.GENERAL: _( - "Please use the payment link to confirm your registration for the event " + "Please use the payment link to confirm your registration for the event " # noqa: E501 "%(event_name)s. The payment link expires in " "%(expiration_hours)s hours." ), Event.TypeId.COURSE: _( - "Please use the payment link to confirm your registration for the course " + "Please use the payment link to confirm your registration for the course " # noqa: E501 "%(event_name)s. The payment link expires in " "%(expiration_hours)s hours." ), Event.TypeId.VOLUNTEERING: _( - "Please use the payment link to confirm your registration for the volunteering " + "Please use the payment link to confirm your registration for the volunteering " # noqa: E501 "%(event_name)s. The payment link expires in " "%(expiration_hours)s hours." ), @@ -238,15 +238,15 @@ class SignUpNotificationType: "heading": CONFIRMATION_HEADING_WITHOUT_USERNAME, "secondary_heading": { Event.TypeId.GENERAL: _( - "Payment is required to confirm your group registration to the event " + "Payment is required to confirm your group registration to the event " # noqa: E501 "%(event_name)s." ), Event.TypeId.COURSE: _( - "Payment is required to confirm your group registration to the course " + "Payment is required to confirm your group registration to the course " # noqa: E501 "%(event_name)s." ), Event.TypeId.VOLUNTEERING: _( - "Payment is required to confirm your group registration to the volunteering " + "Payment is required to confirm your group registration to the volunteering " # noqa: E501 "%(event_name)s." ), }, @@ -256,36 +256,36 @@ class SignUpNotificationType: "heading": CONFIRMATION_TO_WAITING_LIST_HEADING, "text": { Event.TypeId.GENERAL: _( - "You have successfully registered for the event %(event_name)s waiting list." + "You have successfully registered for the event %(event_name)s waiting list." # noqa: E501 ), Event.TypeId.COURSE: _( - "You have successfully registered for the course %(event_name)s waiting list." + "You have successfully registered for the course %(event_name)s waiting list." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( - "You have successfully registered for the volunteering %(event_name)s waiting list." + "You have successfully registered for the volunteering %(event_name)s waiting list." # noqa: E501 ), }, "secondary_text": { Event.TypeId.GENERAL: _( - "You will be automatically transferred as an event participant if a seat becomes available." + "You will be automatically transferred as an event participant if a seat becomes available." # noqa: E501 ), Event.TypeId.COURSE: _( - "You will be automatically transferred as a course participant if a seat becomes available." + "You will be automatically transferred as a course participant if a seat becomes available." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( - "You will be automatically transferred as a volunteering participant if a seat becomes available." + "You will be automatically transferred as a volunteering participant if a seat becomes available." # noqa: E501 ), }, "group": { "text": { Event.TypeId.GENERAL: _( - "The registration for the event %(event_name)s waiting list was successful." + "The registration for the event %(event_name)s waiting list was successful." # noqa: E501 ), Event.TypeId.COURSE: _( - "The registration for the course %(event_name)s waiting list was successful." + "The registration for the course %(event_name)s waiting list was successful." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( - "The registration for the volunteering %(event_name)s waiting list was successful." + "The registration for the volunteering %(event_name)s waiting list was successful." # noqa: E501 ), }, "secondary_text": { @@ -326,19 +326,19 @@ class SignUpNotificationType: Event.TypeId.GENERAL: _( "You have been selected to be moved from the waiting list of the event " "%(event_name)s to a participant. Please use the " - "payment link to confirm your participation. The payment link expires in " + "payment link to confirm your participation. The payment link expires in " # noqa: E501 "%(expiration_hours)s hours." ), Event.TypeId.COURSE: _( - "You have been selected to be moved from the waiting list of the course " + "You have been selected to be moved from the waiting list of the course " # noqa: E501 "%(event_name)s to a participant. Please use the " - "payment link to confirm your participation. The payment link expires in " + "payment link to confirm your participation. The payment link expires in " # noqa: E501 "%(expiration_hours)s hours." ), Event.TypeId.VOLUNTEERING: _( - "You have been selected to be moved from the waiting list of the volunteering " + "You have been selected to be moved from the waiting list of the volunteering " # noqa: E501 "%(event_name)s to a participant. Please use the " - "payment link to confirm your participation. The payment link expires in " + "payment link to confirm your participation. The payment link expires in " # noqa: E501 "%(expiration_hours)s hours." ), }, @@ -347,29 +347,29 @@ class SignUpNotificationType: "heading": PAYMENT_EXPIRED_HEADING, "secondary_heading": { Event.TypeId.GENERAL: _( - "Registration to the event %(event_name)s has been cancelled due to an expired " + "Registration to the event %(event_name)s has been cancelled due to an expired " # noqa: E501 "payment." ), Event.TypeId.COURSE: _( - "Registration to the course %(event_name)s has been cancelled due to an expired " + "Registration to the course %(event_name)s has been cancelled due to an expired " # noqa: E501 "payment." ), Event.TypeId.VOLUNTEERING: _( - "Registration to the volunteering %(event_name)s has been cancelled due to an " + "Registration to the volunteering %(event_name)s has been cancelled due to an " # noqa: E501 "expired payment." ), }, "text": { Event.TypeId.GENERAL: _( - "Your registration to the event %(event_name)s has been " + "Your registration to the event %(event_name)s has been " # noqa: E501 "cancelled due no payment received within the payment period." ), Event.TypeId.COURSE: _( - "Your registration to the course %(event_name)s has been " + "Your registration to the course %(event_name)s has been " # noqa: E501 "cancelled due no payment received within the payment period." ), Event.TypeId.VOLUNTEERING: _( - "Your registration to the volunteering %(event_name)s has been " + "Your registration to the volunteering %(event_name)s has been " # noqa: E501 "cancelled due no payment received within the payment period." ), }, @@ -387,14 +387,14 @@ class SignUpNotificationType: SignUpNotificationType.CONFIRMATION: _( "Registration confirmation - Recurring: %(event_name)s" ), - SignUpNotificationType.CONFIRMATION_WITH_PAYMENT: CONFIRMATION_WITH_PAYMENT_HEADING_RECURRING, + SignUpNotificationType.CONFIRMATION_WITH_PAYMENT: CONFIRMATION_WITH_PAYMENT_HEADING_RECURRING, # noqa: E501 SignUpNotificationType.CONFIRMATION_TO_WAITING_LIST: _( "Waiting list seat reserved - Recurring: %(event_name)s" ), SignUpNotificationType.TRANSFERRED_AS_PARTICIPANT: _( "Registration confirmation - Recurring: %(event_name)s" ), - SignUpNotificationType.TRANSFER_AS_PARTICIPANT_WITH_PAYMENT: CONFIRMATION_WITH_PAYMENT_HEADING_RECURRING, + SignUpNotificationType.TRANSFER_AS_PARTICIPANT_WITH_PAYMENT: CONFIRMATION_WITH_PAYMENT_HEADING_RECURRING, # noqa: E501 SignUpNotificationType.PAYMENT_EXPIRED: _( "Registration payment expired - Recurring: %(event_name)s" ), @@ -420,7 +420,7 @@ class SignUpNotificationType: "%(event_period)s has been cancelled." ), Event.TypeId.VOLUNTEERING: _( - "%(username)s, registration to the recurring volunteering %(event_name)s " + "%(username)s, registration to the recurring volunteering %(event_name)s " # noqa: E501 "%(event_period)s has been cancelled." ), }, @@ -434,21 +434,21 @@ class SignUpNotificationType: "has been cancelled." ), Event.TypeId.VOLUNTEERING: _( - "Registration to the recurring volunteering %(event_name)s %(event_period)s " + "Registration to the recurring volunteering %(event_name)s %(event_period)s " # noqa: E501 "has been cancelled." ), }, "text": { Event.TypeId.GENERAL: _( - "You have successfully cancelled your registration to the recurring event " + "You have successfully cancelled your registration to the recurring event " # noqa: E501 "%(event_name)s %(event_period)s." ), Event.TypeId.COURSE: _( - "You have successfully cancelled your registration to the recurring course " + "You have successfully cancelled your registration to the recurring course " # noqa: E501 "%(event_name)s %(event_period)s." ), Event.TypeId.VOLUNTEERING: _( - "You have successfully cancelled your registration to the recurring volunteering " + "You have successfully cancelled your registration to the recurring volunteering " # noqa: E501 "%(event_name)s %(event_period)s." ), }, @@ -456,32 +456,32 @@ class SignUpNotificationType: "text": { Event.TypeId.GENERAL: _( "Your registration and payment for the recurring event " - "%(event_name)s %(event_period)s have been cancelled." + "%(event_name)s %(event_period)s have been cancelled." # noqa: E501 ), Event.TypeId.COURSE: _( "Your registration and payment for the recurring course " - "%(event_name)s %(event_period)s have been cancelled." + "%(event_name)s %(event_period)s have been cancelled." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( "Your registration to the recurring volunteering " - "%(event_name)s %(event_period)s has been cancelled." + "%(event_name)s %(event_period)s has been cancelled." # noqa: E501 ), }, }, "payment_refunded": { "text": { Event.TypeId.GENERAL: _( - "You have successfully cancelled your registration to the recurring " + "You have successfully cancelled your registration to the recurring " # noqa: E501 "event %(event_name)s %(event_period)s. " "Your payment for the registration has been refunded." ), Event.TypeId.COURSE: _( - "You have successfully cancelled your registration to the recurring " + "You have successfully cancelled your registration to the recurring " # noqa: E501 "course %(event_name)s %(event_period)s. " "Your payment for the registration has been refunded." ), Event.TypeId.VOLUNTEERING: _( - "You have successfully cancelled your registration to the recurring " + "You have successfully cancelled your registration to the recurring " # noqa: E501 "volunteering %(event_name)s %(event_period)s. " "Your payment for the registration has been refunded." ), @@ -490,18 +490,18 @@ class SignUpNotificationType: "payment_partially_refunded": { "text": { Event.TypeId.GENERAL: _( - "You have successfully cancelled a registration to the recurring event " - "%(event_name)s %(event_period)s. Your payment has been " + "You have successfully cancelled a registration to the recurring event " # noqa: E501 + "%(event_name)s %(event_period)s. Your payment has been " # noqa: E501 "partially refunded for the amount of the cancelled registration." ), Event.TypeId.COURSE: _( - "You have successfully cancelled a registration to the recurring course " - "%(event_name)s %(event_period)s. Your payment has been " + "You have successfully cancelled a registration to the recurring course " # noqa: E501 + "%(event_name)s %(event_period)s. Your payment has been " # noqa: E501 "partially refunded for the amount of the cancelled registration." ), Event.TypeId.VOLUNTEERING: _( - "You have successfully cancelled a registration to the recurring volunteering " - "%(event_name)s %(event_period)s. Your payment has been " + "You have successfully cancelled a registration to the recurring volunteering " # noqa: E501 + "%(event_name)s %(event_period)s. Your payment has been " # noqa: E501 "partially refunded for the amount of the cancelled registration." ), }, @@ -520,21 +520,21 @@ class SignUpNotificationType: "has been saved." ), Event.TypeId.VOLUNTEERING: _( - "Registration to the recurring volunteering %(event_name)s %(event_period)s " + "Registration to the recurring volunteering %(event_name)s %(event_period)s " # noqa: E501 "has been saved." ), }, "text": { Event.TypeId.GENERAL: _( - "Congratulations! Your registration has been confirmed for the recurring event " + "Congratulations! Your registration has been confirmed for the recurring event " # noqa: E501 "%(event_name)s %(event_period)s." ), Event.TypeId.COURSE: _( - "Congratulations! Your registration has been confirmed for the recurring course " + "Congratulations! Your registration has been confirmed for the recurring course " # noqa: E501 "%(event_name)s %(event_period)s." ), Event.TypeId.VOLUNTEERING: _( - "Congratulations! Your registration has been confirmed for the recurring " + "Congratulations! Your registration has been confirmed for the recurring " # noqa: E501 "volunteering %(event_name)s %(event_period)s." ), }, @@ -542,11 +542,11 @@ class SignUpNotificationType: "heading": CONFIRMATION_HEADING_WITHOUT_USERNAME, "secondary_heading": { Event.TypeId.GENERAL: _( - "Group registration to the recurring event %(event_name)s %(event_period)s " + "Group registration to the recurring event %(event_name)s %(event_period)s " # noqa: E501 "has been saved." ), Event.TypeId.COURSE: _( - "Group registration to the recurring course %(event_name)s %(event_period)s " + "Group registration to the recurring course %(event_name)s %(event_period)s " # noqa: E501 "has been saved." ), Event.TypeId.VOLUNTEERING: _( @@ -561,32 +561,32 @@ class SignUpNotificationType: "heading_without_username": CONFIRMATION_HEADING_WITHOUT_USERNAME, "secondary_heading": { Event.TypeId.GENERAL: _( - "Payment is required to confirm your registration to the recurring event " + "Payment is required to confirm your registration to the recurring event " # noqa: E501 "%(event_name)s %(event_period)s." ), Event.TypeId.COURSE: _( - "Payment is required to confirm your registration to the recurring course " + "Payment is required to confirm your registration to the recurring course " # noqa: E501 "%(event_name)s %(event_period)s." ), Event.TypeId.VOLUNTEERING: _( - "Payment is required to confirm your registration to the recurring volunteering " + "Payment is required to confirm your registration to the recurring volunteering " # noqa: E501 "%(event_name)s %(event_period)s." ), }, "text": { Event.TypeId.GENERAL: _( - "Please use the payment link to confirm your registration for the recurring event " - "%(event_name)s %(event_period)s. The payment link expires in " + "Please use the payment link to confirm your registration for the recurring event " # noqa: E501 + "%(event_name)s %(event_period)s. The payment link expires in " # noqa: E501 "%(expiration_hours)s hours." ), Event.TypeId.COURSE: _( - "Please use the payment link to confirm your registration for the recurring course " - "%(event_name)s %(event_period)s. The payment link expires in " + "Please use the payment link to confirm your registration for the recurring course " # noqa: E501 + "%(event_name)s %(event_period)s. The payment link expires in " # noqa: E501 "%(expiration_hours)s hours." ), Event.TypeId.VOLUNTEERING: _( - "Please use the payment link to confirm your registration for the recurring " - "volunteering %(event_name)s %(event_period)s. The payment link " + "Please use the payment link to confirm your registration for the recurring " # noqa: E501 + "volunteering %(event_name)s %(event_period)s. The payment link " # noqa: E501 "expires in %(expiration_hours)s hours." ), }, @@ -594,15 +594,15 @@ class SignUpNotificationType: "heading": CONFIRMATION_HEADING_WITHOUT_USERNAME, "secondary_heading": { Event.TypeId.GENERAL: _( - "Payment is required to confirm your group registration to the recurring " + "Payment is required to confirm your group registration to the recurring " # noqa: E501 "event %(event_name)s %(event_period)s." ), Event.TypeId.COURSE: _( - "Payment is required to confirm your group registration to the recurring " + "Payment is required to confirm your group registration to the recurring " # noqa: E501 "course %(event_name)s %(event_period)s." ), Event.TypeId.VOLUNTEERING: _( - "Payment is required to confirm your group registration to the recurring " + "Payment is required to confirm your group registration to the recurring " # noqa: E501 "volunteering %(event_name)s %(event_period)s." ), }, @@ -631,15 +631,15 @@ class SignUpNotificationType: "text": { Event.TypeId.GENERAL: _( "The registration for the recurring event " - "%(event_name)s %(event_period)s waiting list was successful." + "%(event_name)s %(event_period)s waiting list was successful." # noqa: E501 ), Event.TypeId.COURSE: _( "The registration for the recurring course " - "%(event_name)s %(event_period)s waiting list was successful." + "%(event_name)s %(event_period)s waiting list was successful." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( "The registration for the recurring volunteering " - "%(event_name)s %(event_period)s waiting list was successful." + "%(event_name)s %(event_period)s waiting list was successful." # noqa: E501 ), }, "secondary_text": signup_email_texts[ @@ -660,7 +660,7 @@ class SignUpNotificationType: "%(event_name)s %(event_period)s to a participant." ), Event.TypeId.VOLUNTEERING: _( - "You have been moved from the waiting list of the recurring volunteering " + "You have been moved from the waiting list of the recurring volunteering " # noqa: E501 "%(event_name)s %(event_period)s to a participant." ), }, @@ -670,21 +670,21 @@ class SignUpNotificationType: "heading_without_username": CONFIRMATION_HEADING_WITHOUT_USERNAME, "text": { Event.TypeId.GENERAL: _( - "You have been selected to be moved from the waiting list of the recurring " - "event %(event_name)s %(event_period)s to a participant. " - "Please use the payment link to confirm your participation. The payment link " + "You have been selected to be moved from the waiting list of the recurring " # noqa: E501 + "event %(event_name)s %(event_period)s to a participant. " # noqa: E501 + "Please use the payment link to confirm your participation. The payment link " # noqa: E501 "expires in %(expiration_hours)s hours." ), Event.TypeId.COURSE: _( - "You have been selected to be moved from the waiting list of the recurring " - "course %(event_name)s %(event_period)s to a participant. " - "Please use the payment link to confirm your participation. The payment link " + "You have been selected to be moved from the waiting list of the recurring " # noqa: E501 + "course %(event_name)s %(event_period)s to a participant. " # noqa: E501 + "Please use the payment link to confirm your participation. The payment link " # noqa: E501 "expires in %(expiration_hours)s hours." ), Event.TypeId.VOLUNTEERING: _( - "You have been selected to be moved from the waiting list of the recurring " - "volunteering %(event_name)s %(event_period)s to a participant. " - "Please use the payment link to confirm your participation. The payment link " + "You have been selected to be moved from the waiting list of the recurring " # noqa: E501 + "volunteering %(event_name)s %(event_period)s to a participant. " # noqa: E501 + "Please use the payment link to confirm your participation. The payment link " # noqa: E501 "expires in %(expiration_hours)s hours." ), }, @@ -701,24 +701,24 @@ class SignUpNotificationType: "has been cancelled due to an expired payment." ), Event.TypeId.VOLUNTEERING: _( - "Registration to the recurring volunteering %(event_name)s %(event_period)s " + "Registration to the recurring volunteering %(event_name)s %(event_period)s " # noqa: E501 "has been cancelled due to an expired payment." ), }, "text": { Event.TypeId.GENERAL: _( "Your registration to the recurring event " - "%(event_name)s %(event_period)s has been cancelled due no " + "%(event_name)s %(event_period)s has been cancelled due no " # noqa: E501 "payment received within the payment period." ), Event.TypeId.COURSE: _( "Your registration to the recurring course " - "%(event_name)s %(event_period)s has been cancelled due no " + "%(event_name)s %(event_period)s has been cancelled due no " # noqa: E501 "payment received within the payment period." ), Event.TypeId.VOLUNTEERING: _( "Your registration to the recurring volunteering " - "%(event_name)s %(event_period)s has been cancelled due no " + "%(event_name)s %(event_period)s has been cancelled due no " # noqa: E501 "payment received within the payment period." ), }, @@ -740,19 +740,19 @@ class SignUpNotificationType: "registration_user_access": { "text": { Event.TypeId.GENERAL: _( - "The e-mail address %(email)s has been granted the rights to " - "read the participant list of the event %(event_name)s. Using " - "the Suomi.fi identification is required to be able to read the participant list." + "The e-mail address %(email)s has been granted the rights to " # noqa: E501 + "read the participant list of the event %(event_name)s. Using " # noqa: E501 + "the Suomi.fi identification is required to be able to read the participant list." # noqa: E501 ), Event.TypeId.COURSE: _( - "The e-mail address %(email)s has been granted the rights to " - "read the participant list of the course %(event_name)s. Using " - "the Suomi.fi identification is required to be able to read the participant list." + "The e-mail address %(email)s has been granted the rights to " # noqa: E501 + "read the participant list of the course %(event_name)s. Using " # noqa: E501 + "the Suomi.fi identification is required to be able to read the participant list." # noqa: E501 ), Event.TypeId.VOLUNTEERING: _( - "The e-mail address %(email)s has been granted the rights to " - "read the participant list of the volunteering %(event_name)s. " - "Using the Suomi.fi identification is required to be able to read the participant " + "The e-mail address %(email)s has been granted the rights to " # noqa: E501 + "read the participant list of the volunteering %(event_name)s. " # noqa: E501 + "Using the Suomi.fi identification is required to be able to read the participant " # noqa: E501 "list." ), } diff --git a/registrations/schema.py b/registrations/schema.py index 5faef82b5..df955125f 100644 --- a/registrations/schema.py +++ b/registrations/schema.py @@ -32,7 +32,7 @@ def map_serializer(self, auto_schema, direction): ) result["properties"]["reservation_code"]["description"] = ( - "Registration-specific reservation code value from the SeatsReservation object." + "Registration-specific reservation code value from the SeatsReservation object." # noqa: E501 ) result["properties"]["registration"]["description"] = ( "Id of the registration to which the user is going to signup." @@ -77,8 +77,8 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Customer group selection with concrete pricing for an event's price offer. Used as " - "initial values for registration customer groups when creating a registration for " + "Customer group selection with concrete pricing for an event's price offer. Used as " # noqa: E501 + "initial values for registration customer groups when creating a registration for " # noqa: E501 "the event that the offer belongs to." ) @@ -86,9 +86,9 @@ def map_serializer(self, auto_schema, direction): "Unique identifier for this offer customer group." ) result["properties"]["price_group"]["description"] = ( - "The organization-level customer group whose instance this offer customer group is. " + "The organization-level customer group whose instance this offer customer group is. " # noqa: E501 "Gives the name / label for the offer customer group and determines if the " - "customer group is free. Price will be forced to 0 if the customer group is free." + "customer group is free. Price will be forced to 0 if the customer group is free." # noqa: E501 ) result["properties"]["price"]["description"] = ( "Price of this customer group including VAT." @@ -101,7 +101,7 @@ def map_serializer(self, auto_schema, direction): ) } result["properties"]["price_without_vat"]["description"] = ( - "Price of this customer group excluding VAT. Calculated automatically based on " + "Price of this customer group excluding VAT. Calculated automatically based on " # noqa: E501 "price and vat_percentage." ) result["properties"]["vat"]["description"] = ( @@ -119,8 +119,8 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Customer group selection for an organization. Used for creating customer groups " - "with prices for events and registrations. Default customer groups are available to " + "Customer group selection for an organization. Used for creating customer groups " # noqa: E501 + "with prices for events and registrations. Default customer groups are available to " # noqa: E501 "all organizations." ) @@ -128,11 +128,11 @@ def map_serializer(self, auto_schema, direction): "Unique identifier for this customer group." ) result["properties"]["publisher"]["description"] = ( - "Unique identifier of the organization to which this customer group belongs to. " + "Unique identifier of the organization to which this customer group belongs to. " # noqa: E501 "Default customer group will have a null value here." ) result["properties"]["is_free"]["description"] = ( - "Determines if the customer group is free of charge or if it should have a price once " + "Determines if the customer group is free of charge or if it should have a price once " # noqa: E501 "it is used in registration customer group selections." ) result["properties"]["created_time"]["description"] = ( @@ -142,10 +142,10 @@ def map_serializer(self, auto_schema, direction): "Time when this customer group was last modified." ) result["properties"]["created_by"]["description"] = ( - "URL reference to the user that created this customer group (user endpoint)." + "URL reference to the user that created this customer group (user endpoint)." # noqa: E501 ) result["properties"]["last_modified_by"]["description"] = ( - "URL reference to the user that last modified this customer group (user endpoint)." + "URL reference to the user that last modified this customer group (user endpoint)." # noqa: E501 ) result["properties"]["description"] = { @@ -171,7 +171,7 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Registrations are used for event registrations. They allow users to sign up to events." + "Registrations are used for event registrations. They allow users to sign up to events." # noqa: E501 ) result["properties"]["id"]["description"] = ( @@ -185,29 +185,29 @@ def map_serializer(self, auto_schema, direction): ) result["properties"]["remaining_attendee_capacity"]["description"] = ( - "The number of seats remaining in the event. Returns null if attendee " + "The number of seats remaining in the event. Returns null if attendee " # noqa: E501 "capacity is not limited." ) result["required"].remove("remaining_attendee_capacity") result["properties"]["remaining_waiting_list_capacity"]["description"] = ( - "The number of seats remaining in the waiting list. Returns null if " + "The number of seats remaining in the waiting list. Returns null if " # noqa: E501 "waiting list capacity is not limited." ) result["required"].remove("remaining_waiting_list_capacity") result["properties"]["signups"]["description"] = ( - "The list of attendees in the registration. Only admin users of the publisher " + "The list of attendees in the registration. Only admin users of the publisher " # noqa: E501 "organization are allowed to see this information." ) result["required"].remove("signups") result["properties"]["data_source"]["description"] = ( - "Identifies the source for data, this is specific to API provider. This value is " + "Identifies the source for data, this is specific to API provider. This value is " # noqa: E501 "inherited from the event of the registration." ) result["properties"]["publisher"]["description"] = ( - "Id for the organization that published this registration. This value is inherited " + "Id for the organization that published this registration. This value is inherited " # noqa: E501 "from the event of the registration." ) result["properties"]["created_time"]["description"] = ( @@ -220,7 +220,7 @@ def map_serializer(self, auto_schema, direction): "URL reference to the user that created this registration (user endpoint)." ) result["properties"]["last_modified_by"]["description"] = ( - "URL reference to the user that last modified this registration (user endpoint)." + "URL reference to the user that last modified this registration (user endpoint)." # noqa: E501 ) result["properties"]["audience_min_age"]["description"] = ( "Minimum age of attendees." @@ -235,7 +235,7 @@ def map_serializer(self, auto_schema, direction): "Time when enrolment for the event ends." ) result["properties"]["maximum_attendee_capacity"]["description"] = ( - "Maximum number of attendees allowed for the event. Can also be an estimate of the " + "Maximum number of attendees allowed for the event. Can also be an estimate of the " # noqa: E501 "maximum number of attendees." ) result["properties"]["minimum_attendee_capacity"]["description"] = ( @@ -251,13 +251,13 @@ def map_serializer(self, auto_schema, direction): "Mandatory fields in the enrolment form." ) result["properties"]["registration_user_accesses"]["description"] = ( - "Registration user accesses are used to define registration specific permissions." + "Registration user accesses are used to define registration specific permissions." # noqa: E501 ) if settings.WEB_STORE_INTEGRATION_ENABLED: result["properties"]["registration_price_groups"]["description"] = ( - "Customer group selections that should be available when signing up to this " - "registration. When at least one customer group selection exists, the registration " + "Customer group selections that should be available when signing up to this " # noqa: E501 + "registration. When at least one customer group selection exists, the registration " # noqa: E501 "is considered to require a payment." ) @@ -304,9 +304,9 @@ def map_serializer(self, auto_schema, direction): "Unique identifier for this registration customer group." ) result["properties"]["price_group"]["description"] = ( - "The organization-level customer group whose instance this registration customer " - "group is. Gives the name / label for the registration customer group and determines " - "if the customer group is free. Price will be forced to 0 if the customer group is " + "The organization-level customer group whose instance this registration customer " # noqa: E501 + "group is. Gives the name / label for the registration customer group and determines " # noqa: E501 + "if the customer group is free. Price will be forced to 0 if the customer group is " # noqa: E501 "free." ) result["properties"]["price"]["description"] = ( @@ -320,7 +320,7 @@ def map_serializer(self, auto_schema, direction): ) } result["properties"]["price_without_vat"]["description"] = ( - "Price of this customer group excluding VAT. Calculated automatically based on " + "Price of this customer group excluding VAT. Calculated automatically based on " # noqa: E501 "price and vat_percentage." ) result["properties"]["vat"]["description"] = ( @@ -338,7 +338,7 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "List of email addresses which has registration specific permissions. Substitute " + "List of email addresses which has registration specific permissions. Substitute " # noqa: E501 "user permissions are also given through a registration user access." ) @@ -346,20 +346,20 @@ def map_serializer(self, auto_schema, direction): "Unique identifier for this registration user access." ) result["properties"]["email"]["description"] = ( - "Email address of the registration user. Unique per registration. Must end with one " + "Email address of the registration user. Unique per registration. Must end with one " # noqa: E501 "of the allowed domain names if is_substitute_user is set to " 'true (by default, only "hel.fi" domain is allowed).' ) result["properties"]["language"]["description"] = ( - "The registration user's service language that should be used in invitation emails." + "The registration user's service language that should be used in invitation emails." # noqa: E501 ) result["properties"]["language"]["example"] = "fi" result["properties"]["is_substitute_user"]["description"] = ( - "Determines if the registration user is a substitute user for the creator of the " - "registration. A substitute user has full administration rights for the registration. " - "The registration user's email must end with an allowed domain name to be able to set " + "Determines if the registration user is a substitute user for the creator of the " # noqa: E501 + "registration. A substitute user has full administration rights for the registration. " # noqa: E501 + "The registration user's email must end with an allowed domain name to be able to set " # noqa: E501 'this to true. By default, only "hel.fi" domain is allowed.' ) @@ -426,7 +426,7 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Signups are used as attendees for registrations. An attendee can have their own " + "Signups are used as attendees for registrations. An attendee can have their own " # noqa: E501 "contact person information if they are not part of a group." ) @@ -450,7 +450,7 @@ def map_serializer(self, auto_schema, direction): 'Status of the attendee. Options are "attending" and "waitlisted".' ) result["properties"]["presence_status"]["description"] = ( - 'Event presence status of the attendee. Options are "present" and "not_present".' + 'Event presence status of the attendee. Options are "present" and "not_present".' # noqa: E501 ) result["properties"]["registration"]["description"] = ( "Id of the registration to which this signup is related." @@ -487,7 +487,7 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Provides contact information for an attendee or an attendee group. In case of a " + "Provides contact information for an attendee or an attendee group. In case of a " # noqa: E501 "group, the information will be shared for the whole group." ) @@ -567,7 +567,7 @@ def map_serializer(self, auto_schema, direction): "URL reference to the user that created this signup group (user endpoint)." ) result["properties"]["last_modified_by"]["description"] = ( - "URL reference to the user that last modified this signup group (user endpoint)." + "URL reference to the user that last modified this signup group (user endpoint)." # noqa: E501 ) result["required"].remove("anonymization_time") @@ -589,7 +589,7 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "Customer group selection for an attendee. Determines the price of the signup." + "Customer group selection for an attendee. Determines the price of the signup." # noqa: E501 ) result["properties"]["registration_price_group"]["description"] = ( @@ -606,7 +606,7 @@ def map_serializer(self, auto_schema, direction): result = super().map_serializer(auto_schema, direction) result["description"] = ( - "A payment created for a signup or a signup group using the web store integration. " + "A payment created for a signup or a signup group using the web store integration. " # noqa: E501 "A signup is confirmed only when the payment is paid." ) @@ -614,15 +614,15 @@ def map_serializer(self, auto_schema, direction): "Unique identifier for this payment." ) result["properties"]["external_order_id"]["description"] = ( - "Unique identified for this payment in the Talpa web store. Returned by the web " + "Unique identified for this payment in the Talpa web store. Returned by the web " # noqa: E501 "store after the payment has been successfully created." ) result["properties"]["checkout_url"]["description"] = ( - "URL to Talpa web store's checkout UI. Does not require the user to be logged in. " - "The payment can be paid using either checkout_url or logged_in_checkout_url." + "URL to Talpa web store's checkout UI. Does not require the user to be logged in. " # noqa: E501 + "The payment can be paid using either checkout_url or logged_in_checkout_url." # noqa: E501 ) result["properties"]["logged_in_checkout_url"]["description"] = ( - "URL to Talpa web store's checkout UI. Requires the user to be logged in. The " + "URL to Talpa web store's checkout UI. Requires the user to be logged in. The " # noqa: E501 "payment can be paid using either checkout_url or logged_in_checkout_url." ) result["properties"]["amount"]["description"] = ( diff --git a/registrations/serializers.py b/registrations/serializers.py index 57fc382c7..a767e21ed 100644 --- a/registrations/serializers.py +++ b/registrations/serializers.py @@ -106,7 +106,7 @@ def _notify_contact_person( if payment_link else SignUpNotificationType.CONFIRMATION ), - SignUp.AttendeeStatus.WAITING_LIST: SignUpNotificationType.CONFIRMATION_TO_WAITING_LIST, + SignUp.AttendeeStatus.WAITING_LIST: SignUpNotificationType.CONFIRMATION_TO_WAITING_LIST, # noqa: E501 } access_code = ( @@ -483,7 +483,7 @@ def create(self, validated_data): and signup.attendee_status == SignUp.AttendeeStatus.ATTENDING and not signup.signup_group_id ): - # Payment can only be created here for an attending signup that is not part of a group. + # Payment can only be created here for an attending signup that is not part of a group. # noqa: E501 # A group will have a single shared payment that is created in the group # serializer. payment = self._create_payment(signup) @@ -533,7 +533,7 @@ def update(self, instance, validated_data): contact_person = getattr(instance, "contact_person", None) if instance.signup_group_id and contact_person: - # A signup in a group should never have a contact person - it's the group that has it, + # A signup in a group should never have a contact person - it's the group that has it, # noqa: E501 # so delete the individual signup's contact person. contact_person.delete() elif not instance.signup_group_id: @@ -561,7 +561,7 @@ def _validate_date_of_birth(self, registration, validated_data, errors): ): # Don't validate date_of_birth if one of the following is true: # - audience_min_age and registration.audience_max_age are not defined - # - request method is PATCH and field "date_of_birth" is missing from the payload + # - request method is PATCH and field "date_of_birth" is missing from the payload # noqa: E501 return date_of_birth = validated_data.get("date_of_birth") @@ -619,7 +619,7 @@ def _validate_price_group(self, registration, data, validated_data, errors): registration_price_group := price_group.get("registration_price_group") ) and registration_price_group.registration_id != registration.pk: errors["price_group"] = _( - "Price group is not one of the allowed price groups for this registration." + "Price group is not one of the allowed price groups for this registration." # noqa: E501 ) def validate(self, data): @@ -782,7 +782,7 @@ def validate(self, data): "is_substitute_user" ) and not has_allowed_substitute_user_email_domain(email): errors["is_substitute_user"] = _( - "The user's email domain is not one of the allowed domains for substitute users." + "The user's email domain is not one of the allowed domains for substitute users." # noqa: E501 ) if errors: @@ -1006,14 +1006,14 @@ def get_current_waiting_list_count(self, obj): @extend_schema_field(Optional[int]) def get_remaining_attendee_capacity(self, obj): - # Because there can be slight delay with capacity calculations in case of seat expiration, + # Because there can be slight delay with capacity calculations in case of seat expiration, # noqa: E501 # calculate the current value on the fly so that front-end gets the most # recent information. return obj.calculate_remaining_attendee_capacity() @extend_schema_field(Optional[int]) def get_remaining_waiting_list_capacity(self, obj): - # Because there can be slight delay with capacity calculations in case of seat expiration, + # Because there can be slight delay with capacity calculations in case of seat expiration, # noqa: E501 # calculate the current value on the fly so that front-end gets the most # recent information. return obj.calculate_remaining_waiting_list_capacity() @@ -1074,7 +1074,7 @@ def _create_or_update_registration_user_accesses( "registration_user_accesses": [ ErrorDetail( _( - "Registration user access with email %(email)s already exists." + "Registration user access with email %(email)s already exists." # noqa: E501 ) % {"email": data["email"]}, code="unique", @@ -1286,7 +1286,7 @@ def validate_registration_price_groups(self, value): def duplicate_error_detail_callback(price_group): return ErrorDetail( _( - "Registration price group with price_group %(price_group)s already exists." + "Registration price group with price_group %(price_group)s already exists." # noqa: E501 ) % {"price_group": price_group}, code="unique", @@ -1307,7 +1307,7 @@ def duplicate_error_detail_callback(price_group): "price_group": [ ErrorDetail( _( - "All registration price groups must have the same VAT percentage." + "All registration price groups must have the same VAT percentage." # noqa: E501 ), code="vat_percentage", ) @@ -1473,7 +1473,7 @@ def validate(self, data): { "signups": ErrorDetail( _( - "Amount of signups is greater than maximum group size: {max_group_size}." + "Amount of signups is greater than maximum group size: {max_group_size}." # noqa: E501 ).format(max_group_size=maximum_group_size), code="max_group_size", ) @@ -1495,7 +1495,7 @@ def validate(self, data): raise serializers.ValidationError( { "signups": _( - "Only one signup is supported when creating a Talpa web store payment." + "Only one signup is supported when creating a Talpa web store payment." # noqa: E501 ) } ) @@ -1885,7 +1885,7 @@ def _validate_registration_group_size(self, registration, validated_data, errors if validated_data["seats"] > maximum_group_size: errors["seats"] = ErrorDetail( _( - "Amount of seats is greater than maximum group size: {max_group_size}." + "Amount of seats is greater than maximum group size: {max_group_size}." # noqa: E501 ).format(max_group_size=maximum_group_size), code="max_group_size", ) @@ -1916,19 +1916,19 @@ def _validate_registration_capacities(self, registration, validated_data, errors capacity_left=max(attendee_capacity_left - reserved_seats_amount, 0) ) elif (waiting_list_capacity := registration.waiting_list_capacity) is not None: - # Validate waiting list capacity only if waiting_list_capacity is defined and + # Validate waiting list capacity only if waiting_list_capacity is defined and # noqa: E501 # all seats in the event are used. waiting_list_count = registration.current_waiting_list_count waiting_list_capacity_left = waiting_list_capacity - waiting_list_count - # Prevent to reserve seats to waiting list if all available seats in waiting list + # Prevent to reserve seats to waiting list if all available seats in waiting list # noqa: E501 # are already reserved if ( validated_data["seats"] > waiting_list_capacity_left - reserved_seats_amount ): errors["seats"] = _( - "Not enough capacity in the waiting list. Capacity left: {capacity_left}." + "Not enough capacity in the waiting list. Capacity left: {capacity_left}." # noqa: E501 ).format( capacity_left=max( waiting_list_capacity_left - reserved_seats_amount, 0 @@ -2024,7 +2024,7 @@ def _any_required_description_translation_exists(self, data, validated_data): Description is considered valid if 1. request is PATCH without any description fields given in data, OR 2. any of the description fields have a valid value. - """ + """ # noqa: E501 description_fields = ["description_fi", "description_en", "description_sv"] diff --git a/registrations/signals.py b/registrations/signals.py index b9b278c2a..f09fe5507 100644 --- a/registrations/signals.py +++ b/registrations/signals.py @@ -48,7 +48,7 @@ def _recalculate_registration_capacities(registration_id: int) -> None: and old_remaining_attendee_capacity is not None ) and new_remaining_attendee_capacity > old_remaining_attendee_capacity: # Registration attendee capacity has been increased - # => it's possible to add more attending signups to the registration from the waiting list + # => it's possible to add more attending signups to the registration from the waiting list # noqa: E501 # => add as many as possible. move_waitlisted_to_attending( registration, count=new_remaining_attendee_capacity diff --git a/registrations/utils.py b/registrations/utils.py index 60028e51d..f2036dec7 100644 --- a/registrations/utils.py +++ b/registrations/utils.py @@ -163,7 +163,7 @@ def strip_trailing_zeroes_from_decimal(value: Decimal): def move_waitlisted_to_attending(registration, count: int): - """Changes given number of wait-listed attendees in a registration to be attending.""" + """Changes given number of wait-listed attendees in a registration to be attending.""" # noqa: E501 waitlisted_signups = registration.get_waitlisted(count=count) price_groups_exist = ( settings.WEB_STORE_INTEGRATION_ENABLED @@ -357,7 +357,7 @@ def get_web_store_payment_status(order_id: str) -> Optional[str]: def get_web_store_refund_payment_status(refund_id: str) -> Optional[str]: payments_list = get_web_store_refund_payments(refund_id) if payments_list: - # Even though the API returns a list, it will contain only one payment in our case since + # Even though the API returns a list, it will contain only one payment in our case since # noqa: E501 # we create a new refund each time and it will have a single payment # created in Talpa. return payments_list[0].get("status")