Skip to content
Snippets Groups Projects
Commit f583ce09 authored by Romin's avatar Romin :eye:
Browse files

Fix: PEP 484 prohibits implicit Optional (mypy-0.990)

parent 31b737f9
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ with Coscine servers.
###############################################################################
from __future__ import annotations
from typing import List, Union
from typing import List, Optional, Union
import urllib.parse
import json
import logging
......@@ -502,7 +502,7 @@ class Client:
###############################################################################
def project_form(self, data: dict = None) -> ProjectForm:
def project_form(self, data: Optional[dict] = None) -> ProjectForm:
"""
Returns an empty project form.
......@@ -519,7 +519,7 @@ class Client:
###############################################################################
def resource_form(self, data: dict = None) -> ResourceForm:
def resource_form(self, data: Optional[dict] = None) -> ResourceForm:
"""
Returns an empty resource form.
......
......@@ -649,6 +649,7 @@ class InputForm:
"""
Generates Coscine formatted json-ld from an InputForm.
"""
return {}
###############################################################################
......
......@@ -240,7 +240,7 @@ class FileObject:
###############################################################################
def __init__(self, resource: Resource, data: dict,
metadata: dict = None) -> None:
metadata: Optional[dict] = None) -> None:
"""
Initializes the Coscine FileObject.
......@@ -366,9 +366,12 @@ class FileObject:
###############################################################################
def download(self, path: str = "./",
callback: Callable[[int], None] = None,
preserve_path: bool = False) -> None:
def download(
self,
path: str = "./",
callback: Optional[Callable[[int], None]] = None,
preserve_path: Optional[bool] = False
) -> None:
"""
Downloads the file-like object to the local harddrive.
......
......@@ -139,7 +139,7 @@ class Project:
###############################################################################
def __init__(self, client: Client, data: dict,
parent: Project = None) -> None:
parent: Optional[Project] = None) -> None:
"""
Initializes a Coscine project object.
......
......@@ -397,7 +397,7 @@ class Resource:
###############################################################################
def objects(self, path: str = None) -> List[FileObject]:
def objects(self, path: Optional[str] = None) -> List[FileObject]:
"""
Returns a list of Objects stored within the resource.
......@@ -485,7 +485,7 @@ class Resource:
key: str,
file,
metadata: Union[MetadataForm, dict],
callback: Callable[[int], None] = None
callback: Optional[Callable[[int], None]] = None
) -> None:
"""
Uploads a file-like object to a resource on the Coscine server
......@@ -535,7 +535,7 @@ class Resource:
self,
key: str,
file_handle,
callback: Callable[[int], None] = None
callback: Optional[Callable[[int], None]] = None
) -> None:
uri = self.client.uri("Blob", "Blob", self.id)
fields = {"files": (key, file_handle, "application/octect-stream")}
......@@ -620,7 +620,7 @@ class Resource:
###############################################################################
def metadata_form(self, data: dict = None) -> MetadataForm:
def metadata_form(self, data: Optional[dict] = None) -> MetadataForm:
"""
Creates a MetadataForm for this resource
......
......@@ -150,7 +150,7 @@ class ProgressBar:
###############################################################################
def __init__(self, enabled: bool, filesize: int, key: str,
callback: Callable[[int], None] = None) -> None:
callback: Optional[Callable[[int], None]] = None) -> None:
"""
Initializes a state-aware tqdm ProgressBar.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment