Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update black #675

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions server/belga/io/feed_parsers/belga_dpa_newsml_2_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ def parse(self, xml, provider=None):
try:
genre_role = genre_name.attrib["role"]
if genre_role == "nrol:display":
item[
"headline"
] = "({genre}): {headline}".format(
genre=genre_name.text,
headline=item["headline"],
item["headline"] = (
"({genre}): {headline}".format(
genre=genre_name.text,
headline=item["headline"],
)
)
break
except KeyError:
Expand Down
6 changes: 3 additions & 3 deletions server/belga/planning_exports/format_news_events_tommorow.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def format_event_for_tommorow(
dates = formatted_event["dates"]
start_local = utc_to_local(dates["tz"], dates["start"])
end_local = utc_to_local(dates["tz"], dates["end"])
formatted_event[
"time"
] = f"{start_local.strftime('%H:%M')} - {end_local.strftime('%H:%M')}"
formatted_event["time"] = (
f"{start_local.strftime('%H:%M')} - {end_local.strftime('%H:%M')}"
)

# Check if calendar has changed
if formatted_event["calendars"] != calendar:
Expand Down
12 changes: 6 additions & 6 deletions server/belga/publish/belga_newsml_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ def _format_identification(self, newsitem):
SubElement(news_identifier, "RevisionId", attrib=revision).text = str(
self._current_item.get(config.VERSION, "")
)
SubElement(
news_identifier, "PublicIdentifier"
).text = self._generate_public_identifier(
self._current_item[config.ID_FIELD],
self._current_item.get(config.VERSION, ""),
revision.get("Update", ""),
SubElement(news_identifier, "PublicIdentifier").text = (
self._generate_public_identifier(
self._current_item[config.ID_FIELD],
self._current_item.get(config.VERSION, ""),
revision.get("Update", ""),
)
)

def _format_newsmanagement(self, newsitem):
Expand Down
6 changes: 3 additions & 3 deletions server/belga/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ def init_app(app):
for resource in ("ingest", "archive", "published"):
for field in ("body_html",):
mapping = app.config["DOMAIN"][resource]["schema"][field]["mapping"]
mapping[
"search_analyzer"
] = "default" # use custom analyzer from settings.py
mapping["search_analyzer"] = (
"default" # use custom analyzer from settings.py
)
8 changes: 3 additions & 5 deletions server/belga/search_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,9 @@ def format_list_item(self, data):
"ednote": get_text(data.get("editorialInfo")),
}
if data.get("assetType") == "RelatedArticle" and data.get("comments"):
formatted_data["firstcreated"] = formatted_data[
"versioncreated"
] = formatted_data["firstpublished"] = get_datetime(
datetime.strptime(data.get("comments"), "%Y%m%d%H%M%S")
)
formatted_data["firstcreated"] = formatted_data["versioncreated"] = (
formatted_data["firstpublished"]
) = get_datetime(datetime.strptime(data.get("comments"), "%Y%m%d%H%M%S"))

return formatted_data

Expand Down
2 changes: 1 addition & 1 deletion server/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt

black==23.12.1
black==25.1.0
flake8==7.1.1
pep8==1.7.1
httmock==1.4.0
Expand Down
6 changes: 3 additions & 3 deletions server/tests/io/feed_parsers/belga_anp_newsml_1_2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def test_extract_city_from_body(self):
city = BelgaANPNewsMLOneFeedParser().extract_city(item)
self.assertEqual(city, "San Mateo")

item[
"body_html"
] = "NL<p>San Mateo (ANP/RTL) - FNV kondigt werkonderbrekingen aan bij PostNL,"
item["body_html"] = (
"NL<p>San Mateo (ANP/RTL) - FNV kondigt werkonderbrekingen aan bij PostNL,"
)
city = BelgaANPNewsMLOneFeedParser().extract_city(item)
self.assertEqual(city, "San Mateo")