Skip to content

Commit

Permalink
Fix mypy violations due to the breaking change in the new version which
Browse files Browse the repository at this point in the history
changed the default value from no_implicit_optional = false to
no_implicit_optional = true.
  • Loading branch information
Kami committed Jul 31, 2023
1 parent 54ed0cd commit 831d7a1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion libcloud/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class LibcloudError(Exception):
"""The base class for other libcloud exceptions"""

def __init__(self, value, driver=None):
# type: (str, BaseDriver) -> None
# type: (str, Optional[BaseDriver]) -> None
super().__init__(value)
self.value = value
self.driver = driver
Expand Down
24 changes: 12 additions & 12 deletions libcloud/compute/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class UuidMixin:
Mixin class for get_uuid function.
"""

def __init__(self):
self._uuid = None # type: str
def __init__(self) -> None:
self._uuid = None # type: Optional[str]

def get_uuid(self):
"""
Expand Down Expand Up @@ -208,10 +208,10 @@ def __init__(
public_ips, # type: List[str]
private_ips, # type: List[str]
driver,
size=None, # type: NodeSize
image=None, # type: NodeImage
extra=None, # type: dict
created_at=None, # type: datetime.datetime
size=None, # type: Optional[NodeSize]
image=None, # type: Optional[NodeImage]
extra=None, # type: Optional[dict]
created_at=None, # type: Optional[datetime.datetime]
):
"""
:param id: Node ID.
Expand Down Expand Up @@ -500,7 +500,7 @@ def __init__(
image_id, # type: str
state, # type: NodeImageMemberState
driver, # type: NodeDriver
created=None, # type: datetime.datetime
created=None, # type: Optional[datetime.datetime]
extra=None, # type: Optional[dict]
):
"""
Expand Down Expand Up @@ -755,10 +755,10 @@ def __init__(
self,
id, # type: str
driver, # type: NodeDriver
size=None, # type: int
size=None, # type: Optional[int]
extra=None, # type: Optional[Dict]
created=None, # type: Optional[datetime.datetime]
state=None, # type: StorageVolumeState
state=None, # type: Optional[StorageVolumeState]
name=None, # type: Optional[str]
):
# type: (...) -> None
Expand Down Expand Up @@ -935,7 +935,7 @@ def create_node(
size, # type: NodeSize
image, # type: NodeImage
location=None, # type: Optional[NodeLocation]
auth=None, # type: T_Auth
auth=None, # type: Optional[T_Auth]
):
# type: (...) -> Node
"""
Expand Down Expand Up @@ -1028,11 +1028,11 @@ def deploy_node(
ssh_timeout=10, # type: int
ssh_key=None, # type: Optional[T_Ssh_key]
ssh_key_password=None, # type: Optional[str]
auth=None, # type: T_Auth
auth=None, # type: Optional[T_Auth]
timeout=SSH_CONNECT_TIMEOUT, # type: int
max_tries=3, # type: int
ssh_interface="public_ips", # type: str
at_exit_func=None, # type: Callable
at_exit_func=None, # type: Optional[Callable]
wait_period=5, # type: int
**create_node_kwargs,
):
Expand Down
8 changes: 4 additions & 4 deletions libcloud/container/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def __init__(
state, # type: ContainerState
ip_addresses, # type: List[str]
driver, # type: ContainerDriver
extra=None, # type: dict
created_at=None, # type: str
extra=None, # type: Optional[dict]
created_at=None, # type: Optional[str]
):
"""
:param id: Container id.
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(
path, # type: str
version, # type: str
driver, # type: ContainerDriver
extra=None, # type: dict
extra=None, # type: Optional[dict]
):
"""
:param id: Container Image id.
Expand Down Expand Up @@ -164,7 +164,7 @@ def __init__(
id, # type: str
name, # type: str
driver, # type: ContainerDriver
extra=None, # type: dict
extra=None, # type: Optional[dict]
):
"""
:param id: Container Image id.
Expand Down
6 changes: 3 additions & 3 deletions libcloud/dns/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
type, # type: str
ttl, # type: int
driver, # type: DNSDriver
extra=None, # type: dict
extra=None, # type: Optional[dict]
):
"""
:param id: Zone id.
Expand Down Expand Up @@ -116,8 +116,8 @@ def __init__(
data, # type: str
zone, # type: Zone
driver, # type: DNSDriver
ttl=None, # type: int
extra=None, # type: dict
ttl=None, # type: Optional[int]
extra=None, # type: Optional[dict]
):
"""
:param id: Record id
Expand Down

0 comments on commit 831d7a1

Please sign in to comment.