Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump mypy from 1.5.1 to 1.6.1 in /requirements #6152

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samcli/lib/docs/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import logging
from pathlib import Path
from typing import Any, Dict
from typing import Dict

from samcli.lib.docs.browser_configuration import BrowserConfiguration

Expand Down Expand Up @@ -58,7 +58,7 @@ def get_docs_link_for_command(self) -> str:
return Documentation.load().get(self.command, LANDING_PAGE)

@staticmethod
def load() -> Dict[str, Any]:
def load() -> Dict[str, str]:
"""
Opens the configuration file and returns the contents

Expand Down
10 changes: 5 additions & 5 deletions samcli/lib/providers/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def __init__(
location: str,
parameters: Optional[Dict],
template_dict: Dict,
metadata: Optional[Dict] = None,
metadata: Optional[Dict[str, str]] = None,
):
self.parent_stack_path = parent_stack_path
self.name = name
Expand All @@ -596,8 +596,8 @@ def __init__(

@property
def stack_id(self) -> str:
_metadata = self.metadata if self.metadata else {}
return _metadata.get(SAM_RESOURCE_ID_KEY, self.name) if self.metadata else self.name
_metadata: Dict[str, str] = self.metadata or {}
return _metadata.get(SAM_RESOURCE_ID_KEY, self.name)

@property
def stack_path(self) -> str:
Expand Down Expand Up @@ -626,7 +626,7 @@ def resources(self) -> Dict:
if self._resources is not None:
return self._resources
processed_template_dict: Dict[str, Dict] = SamBaseProvider.get_template(self.template_dict, self.parameters)
self._resources = cast(Dict, processed_template_dict.get("Resources", {}))
self._resources = processed_template_dict.get("Resources", {})
return self._resources

@property
Expand Down Expand Up @@ -937,7 +937,7 @@ def get_unique_resource_ids(
return output_resource_ids


def get_skip_build(metadata: Optional[Dict]) -> bool:
def get_skip_build(metadata: Optional[Dict[str, bool]]) -> bool:
"""
Returns the value of SkipBuild property from Metadata, False if it is not defined
"""
Expand Down
4 changes: 2 additions & 2 deletions samcli/lib/providers/sam_base_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _extract_lambda_function_imageuri(resource_properties: Dict, code_property_k
return cast(Optional[str], resource_properties.get(code_property_key, dict()).get("ImageUri", None))

@staticmethod
def _extract_sam_function_imageuri(resource_properties: Dict, code_property_key: str) -> Optional[str]:
def _extract_sam_function_imageuri(resource_properties: Dict[str, str], code_property_key: str) -> Optional[str]:
"""
Extracts the Serverless Function ImageUri from the Resource Properties

Expand All @@ -161,7 +161,7 @@ def _extract_sam_function_imageuri(resource_properties: Dict, code_property_key:
str
Representing the local imageuri
"""
return resource_properties.get(code_property_key, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this default to None anyways 🤔 , wonder why mypy doesn't like it if its explicitly defined.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I've changed this line since calling dict.get(key) is equal to dict.get(key, None) 😅. The actual part that we needed to update was at line 148.

return resource_properties.get(code_property_key)

@staticmethod
def get_template(
Expand Down
Loading