Skip to content

Commit

Permalink
chore: Batch update dev dependencies (#2936)
Browse files Browse the repository at this point in the history
  • Loading branch information
aahung authored Feb 24, 2023
1 parent 3e173da commit a1aee5d
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 31 deletions.
4 changes: 2 additions & 2 deletions bin/parse_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def main() -> None:
if args.cfn and not re.match(r"^\w+::\w+::\w+( \w+)?$", title):
continue
page = title if args.cfn else path.stem
for name, description in parse(text):
for name, raw_description in parse(text):
if page not in props:
props[page] = {}
description = remove_first_line(description) # Remove property name; already in the schema title
description = remove_first_line(raw_description) # Remove property name; already in the schema title
description = fix_markdown_code_link(description)
prefix = (
"https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/"
Expand Down
26 changes: 13 additions & 13 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
coverage~=5.3
pytest-cov~=2.10.1
pytest-xdist~=2.5
pytest-env~=0.6.2
pytest-rerunfailures~=9.1.1
pyyaml~=5.4
ruff==0.0.244 # loose the requirement once it is more stable
coverage>=5.3,<8
pytest-cov>=2.10,<5
pytest-xdist>=2.5,<4
pytest-env>=0.6,<1
pytest-rerunfailures>=9.1,<12
pyyaml~=6.0
ruff==0.0.252 # loose the requirement once it is more stable

# Test requirements
pytest~=6.2.5
parameterized~=0.7.4
pytest>=6.2,<8
parameterized~=0.7

# Integration tests
dateparser~=0.7
dateparser~=1.1
boto3>=1.23,<2
tenacity~=7.0.0
tenacity~=8.0

# Requirements for examples
requests~=2.25.0
requests~=2.28

# formatter
black==23.1.0
Expand All @@ -27,5 +27,5 @@ mypy~=1.0.0

# types
boto3-stubs[appconfig,serverlessrepo]>=1.19.5,==1.*
types-PyYAML~=5.4
types-PyYAML~=6.0
types-jsonschema~=3.2
3 changes: 1 addition & 2 deletions samtranslator/model/api/api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,14 @@ def _construct_api_domain( # noqa: too-many-branches
# Remove possible leading and trailing '/' because a base path may only
# contain letters, numbers, and one of "$-_.+!*'()"
path = "".join(e for e in basepath if e.isalnum())
basepath = path if normalize_basepath else basepath
logical_id = "{}{}{}".format(self.logical_id, path, "BasePathMapping")
basepath_mapping = ApiGatewayBasePathMapping(
logical_id, attributes=self.passthrough_resource_attributes
)
basepath_mapping.DomainName = ref(api_domain_name)
basepath_mapping.RestApiId = ref(rest_api.logical_id)
basepath_mapping.Stage = ref(rest_api.logical_id + ".Stage")
basepath_mapping.BasePath = basepath
basepath_mapping.BasePath = path if normalize_basepath else basepath
basepath_resource_list.extend([basepath_mapping])

# Create the Route53 RecordSetGroup resource
Expand Down
6 changes: 2 additions & 4 deletions samtranslator/model/api/http_api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,13 @@ def _construct_basepath_mappings(
if re.search(invalid_regex, path) is not None:
raise InvalidResourceException(self.logical_id, "Invalid Basepath name provided.")

# ignore leading and trailing `/` in the path name
path = path.strip("/")

logical_id = "{}{}{}".format(self.logical_id, re.sub(r"[\-_/]+", "", path), "ApiMapping")
basepath_mapping = ApiGatewayV2ApiMapping(logical_id, attributes=self.passthrough_resource_attributes)
basepath_mapping.DomainName = ref(api_domain_name)
basepath_mapping.ApiId = ref(http_api.logical_id)
basepath_mapping.Stage = ref(http_api.logical_id + ".Stage")
basepath_mapping.ApiMappingKey = path
# ignore leading and trailing `/` in the path name
basepath_mapping.ApiMappingKey = path.strip("/")
basepath_resource_list.extend([basepath_mapping])
return basepath_resource_list

Expand Down
3 changes: 1 addition & 2 deletions samtranslator/open_api/open_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ def add_path_parameters_to_method(self, api, path, method_name, path_parameters)
else:
# create as Py27Dict and insert keys one by one to preserve input order
parameter = Py27Dict()
param = Py27UniStr(param) if isinstance(param, str) else param
parameter["name"] = param
parameter["name"] = Py27UniStr(param) if isinstance(param, str) else param
parameter["in"] = "path"
parameter["required"] = True
parameters.append(parameter)
Expand Down
3 changes: 1 addition & 2 deletions samtranslator/third_party/py27hash/hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def thash(value): # type: ignore[no-untyped-def]
for y in value:
length -= 1

y = Hash.hash(y)
x = (x ^ y) * mult
x = (x ^ Hash.hash(y)) * mult
mult += 82520 + length + length

x += 97531
Expand Down
9 changes: 5 additions & 4 deletions samtranslator/translator/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,22 +328,23 @@ def _get_embedded_connectors(self, resources: Dict[str, Any]) -> List[Resource]:

for connector_logical_id, connector_dict in resource["Connectors"].items():
try:
connector_logical_id = source_logical_id + connector_logical_id
full_connector_logical_id = source_logical_id + connector_logical_id
# can't use sam_expect since this is neither a property nor a resource attribute
if not isinstance(connector_dict, dict):
raise InvalidResourceException(
connector_logical_id, f"{source_logical_id}.{connector_logical_id} should be a map."
full_connector_logical_id,
f"{source_logical_id}.{full_connector_logical_id} should be a map.",
)

generated_connector = self._get_generated_connector(
source_logical_id,
connector_logical_id,
full_connector_logical_id,
connector_dict,
)

if not verify_unique_logical_id(generated_connector, resources):
raise DuplicateLogicalIdException(
source_logical_id, connector_logical_id, generated_connector.resource_type
source_logical_id, full_connector_logical_id, generated_connector.resource_type
)
connectors.append(generated_connector)
except (InvalidResourceException, DuplicateLogicalIdException) as e:
Expand Down
5 changes: 3 additions & 2 deletions samtranslator/utils/py27hash_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,13 @@ def update(self, *args, **kwargs): # type: ignore[no-untyped-def]
"""
for arg in args:
# Cast to dict if applicable. Otherwise, assume it's an iterable of (key, value) pairs
_arg = arg
if isinstance(arg, dict):
# Merge incoming keys into keylist
self.keylist.merge(arg.keys()) # type: ignore[no-untyped-call]
arg = arg.items()
_arg = arg.items()

for k, v in arg:
for k, v in _arg:
self[k] = v

for k, v in dict(**kwargs).items():
Expand Down

0 comments on commit a1aee5d

Please sign in to comment.