Explicitly mark arguments as optional
mypy now considers implicitly Optional arguments to be errors - I have made them now explicitly Optional, which passes.
This commit is contained in:
parent
ba62bdf867
commit
8e50a90fb2
3 changed files with 8 additions and 6 deletions
|
|
@ -30,7 +30,7 @@ import logging
|
|||
import time
|
||||
|
||||
# Type hinting
|
||||
from typing import BinaryIO, Tuple, Union
|
||||
from typing import BinaryIO, Tuple, Union, Optional
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ class PiCameraStreamer(BaseCamera):
|
|||
self.picamera.zoom = new_fov
|
||||
|
||||
def start_preview(
|
||||
self, fullscreen: bool = True, window: Tuple[int, int, int, int] = None
|
||||
self, fullscreen: bool = True, window: Optional[Tuple[int, int, int, int]] = None
|
||||
):
|
||||
"""Start the on board GPU camera preview."""
|
||||
with self.lock(timeout=1):
|
||||
|
|
@ -462,9 +462,9 @@ class PiCameraStreamer(BaseCamera):
|
|||
output: Union[str, BinaryIO],
|
||||
fmt: str = "jpeg",
|
||||
use_video_port: bool = False,
|
||||
resize: Tuple[int, int] = None,
|
||||
resize: Optional[Tuple[int, int]] = None,
|
||||
bayer: bool = True,
|
||||
thumbnail: Tuple[int, int, int] = None,
|
||||
thumbnail: Optional[Tuple[int, int, int]] = None,
|
||||
):
|
||||
"""
|
||||
Capture a still image to a StreamObject.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from typing import Optional
|
||||
|
||||
|
||||
from .json import JSONEncoder
|
||||
from .paths import CONFIGURATION_FILE_PATH, SETTINGS_FILE_PATH
|
||||
|
|
@ -17,7 +19,7 @@ class OpenflexureSettingsFile:
|
|||
expand (bool): Expand paths to valid auxillary config files.
|
||||
"""
|
||||
|
||||
def __init__(self, path: str, defaults: dict = None):
|
||||
def __init__(self, path: str, defaults: Optional[dict] = None):
|
||||
defaults = defaults or {}
|
||||
|
||||
# Set arguments
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ class Microscope:
|
|||
folder: str = "",
|
||||
temporary: bool = False,
|
||||
use_video_port: bool = False,
|
||||
resize: Tuple[int, int] = None,
|
||||
resize: Optional[Tuple[int, int]] = None,
|
||||
bayer: bool = True,
|
||||
fmt: str = "jpeg",
|
||||
annotations: Optional[Dict[str, str]] = None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue