Skip to content

Instantly share code, notes, and snippets.

@kushaldas
Created June 8, 2020 16:05
Show Gist options
  • Save kushaldas/884f639e7e823d5e50d7684ff6c15dba to your computer and use it in GitHub Desktop.
Save kushaldas/884f639e7e823d5e50d7684ff6c15dba to your computer and use it in GitHub Desktop.
diff --git a/securedrop/crypto_util.py b/securedrop/crypto_util.py
index 6918f3916..e525bcb9e 100644
--- a/securedrop/crypto_util.py
+++ b/securedrop/crypto_util.py
@@ -17,13 +17,11 @@ from redis import Redis
import rm
import typing
-# https://www.python.org/dev/peps/pep-0484/#runtime-or-type-checking
-if typing.TYPE_CHECKING:
- # flake8 can not understand type annotation yet.
- # That is why all type annotation relative import
- # statements has to be marked as noqa.
- # http://flake8.pycqa.org/en/latest/user/error-codes.html?highlight=f401stream
- from typing import Dict, List, Text # noqa: F401
+# flake8 can not understand type annotation yet.
+# That is why all type annotation relative import
+# statements has to be marked as noqa.
+# http://flake8.pycqa.org/en/latest/user/error-codes.html?highlight=f401stream
+from typing import Dict, List, Text # noqa: F401
# to fix gpg error #78 on production
diff --git a/securedrop/models.py b/securedrop/models.py
index 1b90fbad4..c3c2910b3 100644
--- a/securedrop/models.py
+++ b/securedrop/models.py
@@ -24,16 +24,15 @@ from db import db
import typing
-if typing.TYPE_CHECKING:
- # flake8 can not understand type annotation yet.
- # That is why all type annotation relative import
- # statements has to be marked as noqa.
- # http://flake8.pycqa.org/en/latest/user/error-codes.html?highlight=f401
- from typing import Callable, Optional, Union, Dict, List, Any # noqa: F401
- from io import BufferedIOBase # noqa: F401
- from logging import Logger # noqa: F401
- from sqlalchemy import Query # noqa: F401
- from pyotp import OTP # noqa: F401
+# flake8 can not understand type annotation yet.
+# That is why all type annotation relative import
+# statements has to be marked as noqa.
+# http://flake8.pycqa.org/en/latest/user/error-codes.html?highlight=f401
+from typing import Callable, Optional, Union, Dict, List, Any # noqa: F401
+from io import BufferedIOBase # noqa: F401
+from logging import Logger # noqa: F401
+from sqlalchemy import Query # noqa: F401
+from pyotp import OTP # noqa: F401
LOGIN_HARDENING = True
if os.environ.get('SECUREDROP_ENV') == 'test':
@@ -260,7 +259,7 @@ class Reply(db.Model):
deleted_by_source = Column(Boolean, default=False, nullable=False)
def __init__(self,
- journalist: Journalist,
+ journalist: 'Journalist',
source: Source,
filename: str) -> None:
self.journalist_id = journalist.id
diff --git a/securedrop/source_app/__init__.py b/securedrop/source_app/__init__.py
index 1845c2e46..2de48e061 100644
--- a/securedrop/source_app/__init__.py
+++ b/securedrop/source_app/__init__.py
@@ -23,12 +23,11 @@ from store import Storage
import typing
# https://www.python.org/dev/peps/pep-0484/#runtime-or-type-checking
-if typing.TYPE_CHECKING:
- # flake8 can not understand type annotation yet.
- # That is why all type annotation relative import
- # statements has to be marked as noqa.
- # http://flake8.pycqa.org/en/latest/user/error-codes.html?highlight=f401
- from sdconfig import SDConfig # noqa: F401
+# flake8 can not understand type annotation yet.
+# That is why all type annotation relative import
+# statements has to be marked as noqa.
+# http://flake8.pycqa.org/en/latest/user/error-codes.html?highlight=f401
+from sdconfig import SDConfig # noqa: F401
def create_app(config: SDConfig) -> Flask:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment