diff --git a/server/cp/commands/update_event_types.py b/server/cp/commands/update_event_types.py index 49d2b21e..483040e0 100644 --- a/server/cp/commands/update_event_types.py +++ b/server/cp/commands/update_event_types.py @@ -5,7 +5,6 @@ class UpdateEventTypesCommand(superdesk.Command): - """Update event_types in Vocabularies""" """ @@ -48,9 +47,11 @@ def run(self, filename: str): "qcode": name, "is_active": True, "subject": self.get_subject(event), - "onclusive_ids": event["sourceMeta"][0]["key"] - if event.get("sourceMeta") - else None, + "onclusive_ids": ( + event["sourceMeta"][0]["key"] + if event.get("sourceMeta") + else None + ), } if type(event["name"]) is not str: obj["translations"] = { diff --git a/server/cp/macros/usd_to_cad.py b/server/cp/macros/usd_to_cad.py index 087c5fcc..65cc0928 100644 --- a/server/cp/macros/usd_to_cad.py +++ b/server/cp/macros/usd_to_cad.py @@ -70,15 +70,15 @@ def repl(m, is_fr=False): fixed = _format.format(converted).replace(".00", "") # keep leeding whitespace so on client it won't # replace $500 in C$500 - diff[ - m.group(0).rstrip() - ] = "{whitespace} ({en_currency}{value}{mil}{fr_currency})".format( - whitespace=m.group(0).rstrip(), - en_currency="" if is_fr else "C$", - value=fixed if not is_fr else fixed.replace(",", " ").replace(".", ","), - mil=m.group("mil") or "", - fr_currency=" $ CAN" if is_fr else "", - ).rstrip() + diff[m.group(0).rstrip()] = ( + "{whitespace} ({en_currency}{value}{mil}{fr_currency})".format( + whitespace=m.group(0).rstrip(), + en_currency="" if is_fr else "C$", + value=fixed if not is_fr else fixed.replace(",", " ").replace(".", ","), + mil=m.group("mil") or "", + fr_currency=" $ CAN" if is_fr else "", + ).rstrip() + ) re.sub(CURRENCY_REGEX, repl, text) re.sub(CURRENCY_REGEX_FR, functools.partial(repl, is_fr=True), text) diff --git a/server/cp/output/formatter/newsmlg2.py b/server/cp/output/formatter/newsmlg2.py index f547c821..65ba2b9d 100644 --- a/server/cp/output/formatter/newsmlg2.py +++ b/server/cp/output/formatter/newsmlg2.py @@ -16,9 +16,9 @@ def _format_headline(self, article, content_meta): try: headline = article["extra"][cp.HEADLINE2] SubElement(content_meta, "headline").text = headline - SubElement( - content_meta, "headline", attrib={"role": "short"} - ).text = article.get("headline", "") + SubElement(content_meta, "headline", attrib={"role": "short"}).text = ( + article.get("headline", "") + ) except KeyError: super()._format_headline(article, content_meta) diff --git a/server/cp/planning_exports/common.py b/server/cp/planning_exports/common.py index a77b216b..96bb53ba 100644 --- a/server/cp/planning_exports/common.py +++ b/server/cp/planning_exports/common.py @@ -138,9 +138,9 @@ def set_item_location(item, event): item["address"] = { "country": address["country"] if address.get("country") else None, - "locality": address["locality"] - if address.get("locality") - else None, + "locality": ( + address["locality"] if address.get("locality") else None + ), "city": address["city"] if address.get("city") else "", "state": address["state"] if address.get("state") else None, "name": address.get("city") or address_item.get("name") or "", diff --git a/server/dev-requirements.txt b/server/dev-requirements.txt index ceb16f45..78487edf 100644 --- a/server/dev-requirements.txt +++ b/server/dev-requirements.txt @@ -8,7 +8,7 @@ mypy<=1.9.0 httmock==1.4.0 wooper==0.4.4 requests_mock -black~=23.0 +black~=24.0 types-python-dateutil types-pytz diff --git a/server/tests/output/publish_service_test.py b/server/tests/output/publish_service_test.py index bd36ffd0..392eb1d0 100644 --- a/server/tests/output/publish_service_test.py +++ b/server/tests/output/publish_service_test.py @@ -56,9 +56,9 @@ def test_get_filename_non_jimi(self): } self.assertEqual("foo-bar.xml", CPPublishService.get_filename(queue_item)) - queue_item[ - "formatted_item" - ] = "" + queue_item["formatted_item"] = ( + "" + ) self.assertEqual("foo-bar.xml", CPPublishService.get_filename(queue_item)) queue_item[