Reformat code with Black 23

Due to a bump in our Python dependencies, we now install Black 23
instead of 22, which detects some of our files as badly formatted.
This commit is contained in:
Alex Pyrgiotis 2023-03-27 14:24:42 +03:00
parent b102b2bd49
commit 1f308e9cc5
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
7 changed files with 1 additions and 14 deletions

View file

@ -133,7 +133,6 @@ class DangerzoneConverter:
return timeout return timeout
async def document_to_pixels(self) -> None: async def document_to_pixels(self) -> None:
conversions: Dict[str, Dict[str, Optional[str]]] = { conversions: Dict[str, Dict[str, Optional[str]]] = {
# .pdf # .pdf
"application/pdf": {"type": None}, "application/pdf": {"type": None},

View file

@ -106,7 +106,6 @@ class DangerzoneGui(DangerzoneCore):
for filename in os.listdir(search_path): for filename in os.listdir(search_path):
full_filename = os.path.join(search_path, filename) full_filename = os.path.join(search_path, filename)
if os.path.splitext(filename)[1] == ".desktop": if os.path.splitext(filename)[1] == ".desktop":
# See which ones can open PDFs # See which ones can open PDFs
desktop_entry = DesktopEntry(full_filename) desktop_entry = DesktopEntry(full_filename)
if ( if (

View file

@ -277,7 +277,6 @@ class ContentWidget(QtWidgets.QWidget):
def documents_selected(self, new_docs: List[Document]) -> None: def documents_selected(self, new_docs: List[Document]) -> None:
if not self.conversion_started: if not self.conversion_started:
# assumed all files in batch are in the same directory # assumed all files in batch are in the same directory
first_doc = new_docs[0] first_doc = new_docs[0]
output_dir = os.path.dirname(first_doc.input_filename) output_dir = os.path.dirname(first_doc.input_filename)

View file

@ -31,7 +31,6 @@ class NoContainerTechException(Exception):
class Container(IsolationProvider): class Container(IsolationProvider):
# Name of the dangerzone container # Name of the dangerzone container
CONTAINER_NAME = "dangerzone.rocks/dangerzone" CONTAINER_NAME = "dangerzone.rocks/dangerzone"
@ -317,7 +316,6 @@ class Container(IsolationProvider):
return success return success
def get_max_parallel_conversions(self) -> int: def get_max_parallel_conversions(self) -> int:
# FIXME hardcoded 1 until timeouts are more limited and better handled # FIXME hardcoded 1 until timeouts are more limited and better handled
# https://github.com/freedomofpress/dangerzone/issues/257 # https://github.com/freedomofpress/dangerzone/issues/257
return 1 return 1

View file

@ -56,7 +56,7 @@ class Dummy(IsolationProvider):
[False, "Safe PDF created", 100.0], [False, "Safe PDF created", 100.0],
] ]
for (error, text, percentage) in progress: for error, text, percentage in progress:
self.print_progress(document, error, text, percentage) # type: ignore [arg-type] self.print_progress(document, error, text, percentage) # type: ignore [arg-type]
if stdout_callback: if stdout_callback:
stdout_callback(error, text, percentage) stdout_callback(error, text, percentage)

View file

@ -48,7 +48,6 @@ def run_tests_in_sequence(pytest_args):
if __name__ == "__main__": if __name__ == "__main__":
pytest_args = sys.argv[1:] # exclude program names pytest_args = sys.argv[1:] # exclude program names
if Container.get_runtime_name() == "docker": if Container.get_runtime_name() == "docker":

View file

@ -769,31 +769,26 @@ class QADebianBased(QALinux):
class QADebianBullseye(QADebianBased): class QADebianBullseye(QADebianBased):
DISTRO = "debian" DISTRO = "debian"
VERSION = "bullseye" VERSION = "bullseye"
class QADebianBookworm(QADebianBased): class QADebianBookworm(QADebianBased):
DISTRO = "debian" DISTRO = "debian"
VERSION = "bookworm" VERSION = "bookworm"
class QAUbuntu2004(QADebianBased): class QAUbuntu2004(QADebianBased):
DISTRO = "ubuntu" DISTRO = "ubuntu"
VERSION = "20.04" VERSION = "20.04"
class QAUbuntu2204(QADebianBased): class QAUbuntu2204(QADebianBased):
DISTRO = "ubuntu" DISTRO = "ubuntu"
VERSION = "22.04" VERSION = "22.04"
class QAUbuntu2210(QADebianBased): class QAUbuntu2210(QADebianBased):
DISTRO = "ubuntu" DISTRO = "ubuntu"
VERSION = "22.10" VERSION = "22.10"
@ -816,12 +811,10 @@ class QAFedora(QALinux):
class QAFedora36(QAFedora): class QAFedora36(QAFedora):
VERSION = "36" VERSION = "36"
class QAFedora37(QAFedora): class QAFedora37(QAFedora):
VERSION = "37" VERSION = "37"