Skip to content

Commit

Permalink
refactore code via black
Browse files Browse the repository at this point in the history
  • Loading branch information
devketanpro committed Oct 24, 2023
1 parent 27d4689 commit a433d9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 2 additions & 4 deletions server/planning/content_profiles/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ def get_multilingual_fields(resource: str) -> Set[str]:
)
)


def get_editor3_fields(resource: str) -> Set[str]:
content_type = get_planning_schema(resource)
resource_schema = content_type.get("schema") or {}
return set(
field_name
for field_name, field_schema in resource_schema.items()
if (
is_field_enabled(field_name, content_type)
and ((field_schema or {})).get("field_type", "") == "editor_3"
if (is_field_enabled(field_name, content_type) and ((field_schema or {})).get("field_type", "") == "editor_3")
)
)
7 changes: 2 additions & 5 deletions server/planning/feed_parsers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ def parse_duration(value: str) -> datetime.timedelta:
return datetime.timedelta(**kwargs)
raise ValueError(f"Could not parse duration string {value!r}")


def upgrade_rich_text_fields(item: Dict[str, Any], resource: str):
item.update({
field: plain_text_to_html(item[field])
for field in get_editor3_fields(resource)
if item.get(field)
})
item.update({field: plain_text_to_html(item[field]) for field in get_editor3_fields(resource) if item.get(field)})

0 comments on commit a433d9f

Please sign in to comment.