Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzbrand committed Jan 22, 2024
1 parent 84eac46 commit 6ce9c7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions home/content_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def export_csv_content(queryset: PageQuerySet, response: HttpResponse) -> None:
export_rows = exporter.perform_export()
ExportWriter(export_rows).write_csv(response)


def style_sheet(wb: Workbook, sheet: Worksheet) -> Tuple[Workbook, Worksheet]:
"""Sets the style for the workbook adding any formatting that will make the sheet more aesthetically pleasing"""
# Adjustment is because the size in openxlsx and google sheets are not equivalent
Expand Down Expand Up @@ -276,6 +277,7 @@ def get_content_sheet(queryset: PageQuerySet) -> List[list]:
)
return content_sheet


def import_ordered_sets(file, filetype, progress_queue, purge=False):
def create_ordered_set_from_row(row):
set_name = row["Name"]
Expand Down
5 changes: 4 additions & 1 deletion home/tests/test_content_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def ignore_certain_fields(entry: ExpDict) -> ExpDict:
}
return {k: v for k, v in entry.items() if k not in ignored_fields}


@filter_both
def strip_leading_whitespace(entry: ExpDict) -> ExpDict:
# FIXME: Do we expect imported content to have leading spaces removed?
Expand All @@ -104,6 +105,7 @@ def strip_leading_whitespace(entry: ExpDict) -> ExpDict:
strip_leading_whitespace,
]


def filter_exports(srcs: ExpDicts, dsts: ExpDicts, importer: str) -> ExpDictsPair:
fsrcs, fdsts = [], []
for src, dst in zip(srcs, dsts, strict=True):
Expand Down Expand Up @@ -269,6 +271,7 @@ def normalise_related_page_ids(page: DbDict) -> DbDict:
}
return page | {"fields": fields}


@per_page
def null_to_emptystr(page: DbDict) -> DbDict:
# FIXME: Confirm that there's no meaningful difference here, potentially
Expand Down Expand Up @@ -425,7 +428,7 @@ class ImportExport:

@property
def _import_content(self) -> Callable[..., None]:
#TODO: Should this still be a method, as there is only one being returned?
# TODO: Should this still be a method, as there is only one being returned?
return {
"new": import_content,
}[self.importer]
Expand Down

0 comments on commit 6ce9c7a

Please sign in to comment.