Skip to content

Commit

Permalink
Merge pull request #1599 from freedomofpress/update-dev-dependencies
Browse files Browse the repository at this point in the history
Update dev dependencies
  • Loading branch information
rocodes authored Nov 22, 2022
2 parents ddd0ebd + 88f22c7 commit 8aa77b8
Show file tree
Hide file tree
Showing 12 changed files with 1,063 additions and 1,006 deletions.
563 changes: 287 additions & 276 deletions requirements/dev-bookworm-requirements.txt

Large diffs are not rendered by default.

563 changes: 287 additions & 276 deletions requirements/dev-bullseye-requirements.txt

Large diffs are not rendered by default.

883 changes: 458 additions & 425 deletions requirements/dev-sdw-requirements.txt

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions securedrop_client/api_jobs/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import math
import os
from tempfile import NamedTemporaryFile
from typing import Any, Tuple, Type, Union
from typing import Any, Optional, Tuple, Type, Union

from sdclientapi import API, BaseError
from sdclientapi import Reply as SdkReply
Expand Down Expand Up @@ -100,7 +100,7 @@ def call_download_api(
"""
raise NotImplementedError

def call_decrypt(self, filepath: str, session: Session = None) -> str:
def call_decrypt(self, filepath: str, session: Optional[Session] = None) -> str:
"""
Method for decrypting the file and storing the plaintext result.
Expand Down Expand Up @@ -265,7 +265,7 @@ def call_download_api(self, api: API, db_object: Reply) -> Tuple[str, str]:
api.default_request_timeout = 20
return api.download_reply(sdk_object)

def call_decrypt(self, filepath: str, session: Session = None) -> str:
def call_decrypt(self, filepath: str, session: Optional[Session] = None) -> str:
"""
Override DownloadJob.
Expand Down Expand Up @@ -319,7 +319,7 @@ def call_download_api(self, api: API, db_object: Message) -> Tuple[str, str]:
sdk_object, timeout=self._get_realistic_timeout(db_object.size)
)

def call_decrypt(self, filepath: str, session: Session = None) -> str:
def call_decrypt(self, filepath: str, session: Optional[Session] = None) -> str:
"""
Override DownloadJob.
Expand Down Expand Up @@ -375,7 +375,7 @@ def call_download_api(self, api: API, db_object: File) -> Tuple[str, str]:
sdk_object, timeout=self._get_realistic_timeout(db_object.size)
)

def call_decrypt(self, filepath: str, session: Session = None) -> str:
def call_decrypt(self, filepath: str, session: Optional[Session] = None) -> str:
"""
Override DownloadJob.
Expand Down
4 changes: 2 additions & 2 deletions securedrop_client/gui/base/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from typing import NewType
from typing import NewType, Optional

from PyQt5.QtWidgets import QPushButton, QWidget

Expand All @@ -39,7 +39,7 @@ class SDPushButton(QPushButton):
Alignment = NewType("Alignment", str)
AlignLeft = Alignment("left-aligned")

def __init__(self, parent: QWidget = None) -> None:
def __init__(self, parent: Optional[QWidget] = None) -> None:
super().__init__(parent)
self.setStyleSheet(load_css("button.css"))

Expand Down
18 changes: 9 additions & 9 deletions securedrop_client/gui/base/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from typing import Union
from typing import Optional, Union

from PyQt5.QtCore import QSize, Qt
from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton, QWidget
Expand All @@ -39,7 +39,7 @@ class SvgToggleButton(QPushButton):
The display size of the SVG, defaults to filling the entire size of the widget.
"""

def __init__(self, on: str, off: str, svg_size: str = None):
def __init__(self, on: str, off: str, svg_size: Optional[str] = None):
super().__init__()

# Set layout
Expand Down Expand Up @@ -85,10 +85,10 @@ class SvgPushButton(QPushButton):
def __init__(
self,
normal: str,
disabled: str = None,
active: str = None,
selected: str = None,
svg_size: str = None,
disabled: Optional[str] = None,
active: Optional[str] = None,
selected: Optional[str] = None,
svg_size: Optional[str] = None,
) -> None:
super().__init__()

Expand Down Expand Up @@ -124,7 +124,7 @@ class SvgLabel(QLabel):
The display size of the SVG, defaults to filling the entire size of the widget.
"""

def __init__(self, filename: str, svg_size: str = None) -> None:
def __init__(self, filename: str, svg_size: Optional[str] = None) -> None:
super().__init__()

# Remove margins and spacing
Expand All @@ -138,7 +138,7 @@ def __init__(self, filename: str, svg_size: str = None) -> None:
self.svg.setFixedSize(svg_size) if svg_size else self.svg.setFixedSize(QSize())
layout.addWidget(self.svg)

def update_image(self, filename: str, svg_size: str = None) -> None:
def update_image(self, filename: str, svg_size: Optional[str] = None) -> None:
self.svg = load_svg(filename)
self.svg.setFixedSize(svg_size) if svg_size else self.svg.setFixedSize(QSize())
child = self.layout().takeAt(0)
Expand All @@ -154,7 +154,7 @@ class SecureQLabel(QLabel):
def __init__(
self,
text: str = "",
parent: QWidget = None,
parent: Optional[QWidget] = None,
flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags(),
wordwrap: bool = True,
max_length: int = 0,
Expand Down
2 changes: 1 addition & 1 deletion securedrop_client/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def setup(self, controller: Controller) -> None:
self.main_view.setup(self.controller)
self.show_login()

def show_main_window(self, db_user: User = None) -> None:
def show_main_window(self, db_user: Optional[User] = None) -> None:
"""
Show main application window.
"""
Expand Down
2 changes: 1 addition & 1 deletion securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ def update(self) -> None:

@pyqtSlot(str, str, str)
def set_snippet(
self, source_uuid: str, collection_uuid: str = None, content: str = None
self, source_uuid: str, collection_uuid: Optional[str] = None, content: Optional[str] = None
) -> None:
"""
Update the preview snippet if the source_uuid matches our own.
Expand Down
2 changes: 1 addition & 1 deletion securedrop_client/locale/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n"
"Generated-By: Babel 2.11.0\n"

msgid "{application_name} is already running"
msgstr ""
Expand Down
15 changes: 8 additions & 7 deletions securedrop_client/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
from typing import Optional

from pkg_resources import resource_filename, resource_string
from PyQt5.QtCore import QDir
Expand Down Expand Up @@ -47,13 +48,13 @@ def load_font(font_folder_name: str) -> None:

def load_icon(
normal: str,
disabled: str = None,
active: str = None,
selected: str = None,
normal_off: str = None,
disabled_off: str = None,
active_off: str = None,
selected_off: str = None,
disabled: Optional[str] = None,
active: Optional[str] = None,
selected: Optional[str] = None,
normal_off: Optional[str] = None,
disabled_off: Optional[str] = None,
active_off: Optional[str] = None,
selected_off: Optional[str] = None,
) -> QIcon:
"""
Add the contents of Scalable Vector Graphics (SVG) files provided for associated icon modes and
Expand Down
4 changes: 2 additions & 2 deletions securedrop_client/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import shutil
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Tuple, Type, Union
from typing import Any, Dict, List, Optional, Tuple, Type, Union

from dateutil.parser import parse
from sdclientapi import API
Expand Down Expand Up @@ -902,7 +902,7 @@ def mark_as_decrypted(
uuid: str,
session: Session,
is_decrypted: bool = True,
original_filename: str = None,
original_filename: Optional[str] = None,
) -> None:
"""
Mark object as downloaded in the database.
Expand Down
3 changes: 2 additions & 1 deletion securedrop_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


def safe_mkdir(
base_path: Union[Path, str], relative_path: Union[Optional[Path], Optional[str]] = None
base_path: Union[Path, str],
relative_path: Optional[Union[Optional[Path], Optional[str]]] = None,
) -> None:
"""
Safely create directories with restricted 700 permissions inside the base_path directory. The
Expand Down

0 comments on commit 8aa77b8

Please sign in to comment.