mypy: Amend code & typing of integrations, to pass with strict-optional.

This commit is contained in:
neiljp (Neil Pilgrim) 2017-12-22 09:51:14 -08:00 committed by showell
parent 08bfe9d8c7
commit 33ccc04a32
6 changed files with 15 additions and 13 deletions

View file

@ -11,10 +11,10 @@ import unicodedata
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'api'))
import zulip
from typing import Set
from typing import Set, Optional
def fetch_public_streams():
# type: () -> Set[bytes]
# type: () -> Optional[Set[bytes]]
public_streams = set()
try:

View file

@ -21,7 +21,7 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from __future__ import absolute_import
from typing import IO, Any, Dict, List, Text, Union, Set, Tuple
from typing import IO, Any, Dict, List, Text, Union, Set, Tuple, Optional
from types import FrameType
import sys
@ -309,7 +309,7 @@ def parse_zephyr_body(zephyr_data, notice_format):
return (zsig, body)
def parse_crypt_table(zephyr_class, instance):
# type: (Text, str) -> str
# type: (Text, str) -> Optional[str]
try:
crypt_table = open(os.path.join(os.environ["HOME"], ".crypt-table"))
except IOError:
@ -604,7 +604,7 @@ def send_unauthed_zephyr(zwrite_args, content):
return send_zephyr(zwrite_args + ["-d"], content)
def zcrypt_encrypt_content(zephyr_class, instance, content):
# type: (str, str, str) -> str
# type: (str, str, str) -> Optional[str]
keypath = parse_crypt_table(zephyr_class, instance)
if keypath is None:
return None