Replaced | syntax with Optional (Python types <3)

This commit is contained in:
Boyan 2024-12-02 18:27:33 +01:00
parent 96488ac69c
commit 5ba67e3b51

View File

@ -4,6 +4,7 @@
File to define the Submission class File to define the Submission class
""" """
from typing import Optional
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
class Submission: class Submission:
@ -48,7 +49,7 @@ class Submission:
return results return results
def get_info(self) -> dict[str, str] | None: def get_info(self) -> Optional[dict[str, str]]:
"""Submission information (in details)""" """Submission information (in details)"""
if self.__info: if self.__info:
return self.__info return self.__info
@ -74,7 +75,7 @@ class Submission:
return self.__info return self.__info
return None return None
def get_files(self) -> list[str] | None: def get_files(self) -> Optional[list[str]]:
"""Get a list of uploaded files in the format [(name, url)]""" """Get a list of uploaded files in the format [(name, url)]"""
if not self.__info: if not self.__info:
self.__info = self.get_info() self.__info = self.get_info()