Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ addopts = --cov samtranslator --cov-report term-missing --cov-fail-under 95
testpaths = tests
env =
AWS_DEFAULT_REGION = ap-southeast-1
markers =
slow: marks tests as slow (deselect with '-m "not slow"')

1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ flake8~=3.8.4
tox~=3.24
pytest-cov~=2.10.1
pytest-xdist~=2.5
pytest-env~=0.6.2
pylint>=1.7.2,<2.0
pyyaml~=5.4

Expand Down
4 changes: 2 additions & 2 deletions samtranslator/intrinsics/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ def handler_method(full_ref, ref_value):
"""

# RegExp to find pattern "${logicalId.property}" and return the word inside bracket
logical_id_regex = "[A-Za-z0-9\.]+|AWS::[A-Z][A-Za-z]*"
ref_pattern = re.compile(r"\$\{(" + logical_id_regex + ")\}")
logical_id_regex = r"[A-Za-z0-9\.]+|AWS::[A-Z][A-Za-z]*"
ref_pattern = re.compile(r"\$\{(" + logical_id_regex + r")\}")

# Find all the pattern, and call the handler to decide how to substitute them.
# Do the substitution and return the final text
Expand Down
4 changes: 3 additions & 1 deletion samtranslator/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def __init__(self, namespace="ServerlessTransform", metrics_publisher=None):
def __del__(self):
if len(self.metrics_cache) > 0:
# attempting to publish if user forgot to call publish in code
LOG.warn("There are unpublished metrics. Please make sure you call publish after you record all metrics.")
LOG.warning(
"There are unpublished metrics. Please make sure you call publish after you record all metrics."
)
self.publish()

def _record_metric(self, name, value, unit, dimensions=None):
Expand Down
4 changes: 2 additions & 2 deletions samtranslator/model/eventsources/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def _add_swagger_integration(self, api, function, intrinsics_resolver):

parameter_name, parameter_value = next(iter(parameter.items()))

if not re.match("method\.request\.(querystring|path|header)\.", parameter_name):
if not re.match(r"method\.request\.(querystring|path|header)\.", parameter_name):
raise InvalidEventException(
self.relative_id,
"Invalid value for 'RequestParameters' property. Keys must be in the format "
Expand All @@ -855,7 +855,7 @@ def _add_swagger_integration(self, api, function, intrinsics_resolver):
parameters.append(settings)

elif isinstance(parameter, str):
if not re.match("method\.request\.(querystring|path|header)\.", parameter):
if not re.match(r"method\.request\.(querystring|path|header)\.", parameter):
raise InvalidEventException(
self.relative_id,
"Invalid value for 'RequestParameters' property. Keys must be in the format "
Expand Down
2 changes: 1 addition & 1 deletion samtranslator/open_api/open_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_integration_function_logical_id(self, path_name, method_name):
arn = uri.get("Fn::Sub", "")

# Extract lambda integration (${LambdaName.Arn}) and split ".Arn" off from it
regex = "([A-Za-z0-9]+\.Arn)"
regex = r"([A-Za-z0-9]+\.Arn)"
matches = re.findall(regex, arn)
# Prevent IndexError when integration URI doesn't contain .Arn (e.g. a Function with
# AutoPublishAlias translates to AWS::Lambda::Alias, which make_shorthand represents
Expand Down