Fix deprecation warnings due to invalid escape sequences. (#3273)
* Fix deprecation warnings due to invalid escape sequences. * Fix linter error.
This commit is contained in:
parent
c321ad46b0
commit
7054143701
@ -15,9 +15,9 @@ url_paths = {
|
|||||||
"{0}/restapis/(?P<function_id>[^/]+)/deployments/(?P<deployment_id>[^/]+)/?$": APIGatewayResponse().individual_deployment,
|
"{0}/restapis/(?P<function_id>[^/]+)/deployments/(?P<deployment_id>[^/]+)/?$": APIGatewayResponse().individual_deployment,
|
||||||
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/?$": APIGatewayResponse().resource_individual,
|
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/?$": APIGatewayResponse().resource_individual,
|
||||||
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/?$": APIGatewayResponse().resource_methods,
|
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/?$": APIGatewayResponse().resource_methods,
|
||||||
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/responses/(?P<status_code>\d+)$": APIGatewayResponse().resource_method_responses,
|
r"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/responses/(?P<status_code>\d+)$": APIGatewayResponse().resource_method_responses,
|
||||||
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/integration/?$": APIGatewayResponse().integrations,
|
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/integration/?$": APIGatewayResponse().integrations,
|
||||||
"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/integration/responses/(?P<status_code>\d+)/?$": APIGatewayResponse().integration_responses,
|
r"{0}/restapis/(?P<function_id>[^/]+)/resources/(?P<resource_id>[^/]+)/methods/(?P<method_name>[^/]+)/integration/responses/(?P<status_code>\d+)/?$": APIGatewayResponse().integration_responses,
|
||||||
"{0}/apikeys$": APIGatewayResponse().apikeys,
|
"{0}/apikeys$": APIGatewayResponse().apikeys,
|
||||||
"{0}/apikeys/(?P<apikey>[^/]+)": APIGatewayResponse().apikey_individual,
|
"{0}/apikeys/(?P<apikey>[^/]+)": APIGatewayResponse().apikey_individual,
|
||||||
"{0}/usageplans$": APIGatewayResponse().usage_plans,
|
"{0}/usageplans$": APIGatewayResponse().usage_plans,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from .responses import Ec2InstanceConnectResponse
|
from .responses import Ec2InstanceConnectResponse
|
||||||
|
|
||||||
url_bases = ["https?://ec2-instance-connect\.(.+)\.amazonaws\.com"]
|
url_bases = [r"https?://ec2-instance-connect\.(.+)\.amazonaws\.com"]
|
||||||
|
|
||||||
url_paths = {"{0}/$": Ec2InstanceConnectResponse.dispatch}
|
url_paths = {"{0}/$": Ec2InstanceConnectResponse.dispatch}
|
||||||
|
@ -183,9 +183,9 @@ class EventsHandler(BaseResponse):
|
|||||||
|
|
||||||
if sched_exp:
|
if sched_exp:
|
||||||
if not (
|
if not (
|
||||||
re.match("^cron\(.*\)", sched_exp)
|
re.match(r"^cron\(.*\)", sched_exp)
|
||||||
or re.match(
|
or re.match(
|
||||||
"^rate\(\d*\s(minute|minutes|hour|hours|day|days)\)", sched_exp
|
r"^rate\(\d*\s(minute|minutes|hour|hours|day|days)\)", sched_exp
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
return self.error(
|
return self.error(
|
||||||
|
@ -14,7 +14,7 @@ def region_from_managedblckchain_url(url):
|
|||||||
|
|
||||||
|
|
||||||
def networkid_from_managedblockchain_url(full_url):
|
def networkid_from_managedblockchain_url(full_url):
|
||||||
id_search = re.search("\/n-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
id_search = re.search(r"\/n-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
||||||
return_id = None
|
return_id = None
|
||||||
if id_search:
|
if id_search:
|
||||||
return_id = id_search.group(0).replace("/", "")
|
return_id = id_search.group(0).replace("/", "")
|
||||||
@ -28,7 +28,7 @@ def get_network_id():
|
|||||||
|
|
||||||
|
|
||||||
def memberid_from_managedblockchain_url(full_url):
|
def memberid_from_managedblockchain_url(full_url):
|
||||||
id_search = re.search("\/m-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
id_search = re.search(r"\/m-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
||||||
return_id = None
|
return_id = None
|
||||||
if id_search:
|
if id_search:
|
||||||
return_id = id_search.group(0).replace("/", "")
|
return_id = id_search.group(0).replace("/", "")
|
||||||
@ -42,7 +42,7 @@ def get_member_id():
|
|||||||
|
|
||||||
|
|
||||||
def proposalid_from_managedblockchain_url(full_url):
|
def proposalid_from_managedblockchain_url(full_url):
|
||||||
id_search = re.search("\/p-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
id_search = re.search(r"\/p-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
||||||
return_id = None
|
return_id = None
|
||||||
if id_search:
|
if id_search:
|
||||||
return_id = id_search.group(0).replace("/", "")
|
return_id = id_search.group(0).replace("/", "")
|
||||||
@ -56,7 +56,7 @@ def get_proposal_id():
|
|||||||
|
|
||||||
|
|
||||||
def invitationid_from_managedblockchain_url(full_url):
|
def invitationid_from_managedblockchain_url(full_url):
|
||||||
id_search = re.search("\/in-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
id_search = re.search(r"\/in-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
||||||
return_id = None
|
return_id = None
|
||||||
if id_search:
|
if id_search:
|
||||||
return_id = id_search.group(0).replace("/", "")
|
return_id = id_search.group(0).replace("/", "")
|
||||||
@ -107,7 +107,7 @@ def admin_password_ok(password):
|
|||||||
|
|
||||||
|
|
||||||
def nodeid_from_managedblockchain_url(full_url):
|
def nodeid_from_managedblockchain_url(full_url):
|
||||||
id_search = re.search("\/nd-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
id_search = re.search(r"\/nd-[A-Z0-9]{26}", full_url, re.IGNORECASE)
|
||||||
return_id = None
|
return_id = None
|
||||||
if id_search:
|
if id_search:
|
||||||
return_id = id_search.group(0).replace("/", "")
|
return_id = id_search.group(0).replace("/", "")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from .responses import RDSResponse
|
from .responses import RDSResponse
|
||||||
|
|
||||||
url_bases = ["https?://rds(\..+)?.amazonaws.com"]
|
url_bases = [r"https?://rds(\..+)?.amazonaws.com"]
|
||||||
|
|
||||||
url_paths = {"{0}/$": RDSResponse.dispatch}
|
url_paths = {"{0}/$": RDSResponse.dispatch}
|
||||||
|
@ -13,12 +13,12 @@ def tag_response2(*args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
url_paths = {
|
url_paths = {
|
||||||
"{0}/(?P<api_version>[\d_-]+)/hostedzone$": Route53().list_or_create_hostzone_response,
|
r"{0}/(?P<api_version>[\d_-]+)/hostedzone$": Route53().list_or_create_hostzone_response,
|
||||||
"{0}/(?P<api_version>[\d_-]+)/hostedzone/(?P<zone_id>[^/]+)$": Route53().get_or_delete_hostzone_response,
|
r"{0}/(?P<api_version>[\d_-]+)/hostedzone/(?P<zone_id>[^/]+)$": Route53().get_or_delete_hostzone_response,
|
||||||
"{0}/(?P<api_version>[\d_-]+)/hostedzone/(?P<zone_id>[^/]+)/rrset/?$": Route53().rrset_response,
|
r"{0}/(?P<api_version>[\d_-]+)/hostedzone/(?P<zone_id>[^/]+)/rrset/?$": Route53().rrset_response,
|
||||||
"{0}/(?P<api_version>[\d_-]+)/hostedzonesbyname": Route53().list_hosted_zones_by_name_response,
|
r"{0}/(?P<api_version>[\d_-]+)/hostedzonesbyname": Route53().list_hosted_zones_by_name_response,
|
||||||
"{0}/(?P<api_version>[\d_-]+)/healthcheck": Route53().health_check_response,
|
r"{0}/(?P<api_version>[\d_-]+)/healthcheck": Route53().health_check_response,
|
||||||
"{0}/(?P<api_version>[\d_-]+)/tags/healthcheck/(?P<zone_id>[^/]+)$": tag_response1,
|
r"{0}/(?P<api_version>[\d_-]+)/tags/healthcheck/(?P<zone_id>[^/]+)$": tag_response1,
|
||||||
"{0}/(?P<api_version>[\d_-]+)/tags/hostedzone/(?P<zone_id>[^/]+)$": tag_response2,
|
r"{0}/(?P<api_version>[\d_-]+)/tags/hostedzone/(?P<zone_id>[^/]+)$": tag_response2,
|
||||||
"{0}/(?P<api_version>[\d_-]+)/trafficpolicyinstances/*": Route53().not_implemented_response,
|
r"{0}/(?P<api_version>[\d_-]+)/trafficpolicyinstances/*": Route53().not_implemented_response,
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,5 @@ dispatch = SQSResponse().dispatch
|
|||||||
|
|
||||||
url_paths = {
|
url_paths = {
|
||||||
"{0}/$": dispatch,
|
"{0}/$": dispatch,
|
||||||
"{0}/(?P<account_id>\d+)/(?P<queue_name>[a-zA-Z0-9\-_\.]+)": dispatch,
|
r"{0}/(?P<account_id>\d+)/(?P<queue_name>[a-zA-Z0-9\-_\.]+)": dispatch,
|
||||||
}
|
}
|
||||||
|
@ -1663,7 +1663,7 @@ def test_update_function_s3():
|
|||||||
def test_create_function_with_invalid_arn():
|
def test_create_function_with_invalid_arn():
|
||||||
err = create_invalid_lambda("test-iam-role")
|
err = create_invalid_lambda("test-iam-role")
|
||||||
err.exception.response["Error"]["Message"].should.equal(
|
err.exception.response["Error"]["Message"].should.equal(
|
||||||
"1 validation error detected: Value 'test-iam-role' at 'role' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:(aws[a-zA-Z-]*)?:iam::(\d{12}):role/?[a-zA-Z_0-9+=,.@\-_/]+"
|
r"1 validation error detected: Value 'test-iam-role' at 'role' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:(aws[a-zA-Z-]*)?:iam::(\d{12}):role/?[a-zA-Z_0-9+=,.@\-_/]+"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@ def test_flask_path_converting_simple():
|
|||||||
|
|
||||||
|
|
||||||
def test_flask_path_converting_regex():
|
def test_flask_path_converting_regex():
|
||||||
convert_regex_to_flask_path("/(?P<key_name>[a-zA-Z0-9\-_]+)").should.equal(
|
convert_regex_to_flask_path(r"/(?P<key_name>[a-zA-Z0-9\-_]+)").should.equal(
|
||||||
'/<regex("[a-zA-Z0-9\-_]+"):key_name>'
|
r'/<regex("[a-zA-Z0-9\-_]+"):key_name>'
|
||||||
)
|
)
|
||||||
|
|
||||||
convert_regex_to_flask_path("(?P<account_id>\d+)/(?P<queue_name>.*)$").should.equal(
|
convert_regex_to_flask_path(
|
||||||
'<regex("\d+"):account_id>/<regex(".*"):queue_name>'
|
r"(?P<account_id>\d+)/(?P<queue_name>.*)$"
|
||||||
)
|
).should.equal(r'<regex("\d+"):account_id>/<regex(".*"):queue_name>')
|
||||||
|
@ -16,7 +16,7 @@ from .helpers import rsa_check_private_key
|
|||||||
RSA_PUBLIC_KEY_OPENSSH = b"""\
|
RSA_PUBLIC_KEY_OPENSSH = b"""\
|
||||||
ssh-rsa \
|
ssh-rsa \
|
||||||
AAAAB3NzaC1yc2EAAAADAQABAAABAQDusXfgTE4eBP50NglSzCSEGnIL6+cr6m3H\
|
AAAAB3NzaC1yc2EAAAADAQABAAABAQDusXfgTE4eBP50NglSzCSEGnIL6+cr6m3H\
|
||||||
6cZANOQ+P1o/W4BdtcAL3sor4iGi7SOeJgo\8kweyMQrhrt6HaKGgromRiz37LQx\
|
6cZANOQ+P1o/W4BdtcAL3sor4iGi7SOeJgo\\8kweyMQrhrt6HaKGgromRiz37LQx\
|
||||||
4YIAcBi4Zd023mO/V7Rc2Chh18mWgLSmA6ng+j37ip6452zxtv0jHAz9pJolbKBp\
|
4YIAcBi4Zd023mO/V7Rc2Chh18mWgLSmA6ng+j37ip6452zxtv0jHAz9pJolbKBp\
|
||||||
JzbZlPN45ZCTk9ck0fSVHRl6VRSSPQcpqi65XpRf+35zNOCGCc1mAOOTmw59Q2a6\
|
JzbZlPN45ZCTk9ck0fSVHRl6VRSSPQcpqi65XpRf+35zNOCGCc1mAOOTmw59Q2a6\
|
||||||
A3t8mL7r91aM5q6QOQm219lctFM8O7HRJnDgmhGpnjRwE1LyKktWTbgFZ4SNWU2X\
|
A3t8mL7r91aM5q6QOQm219lctFM8O7HRJnDgmhGpnjRwE1LyKktWTbgFZ4SNWU2X\
|
||||||
|
@ -287,13 +287,13 @@ def test_get_all_tags_value_filter():
|
|||||||
tags = conn.get_all_tags(filters={"value": "*some*value*"})
|
tags = conn.get_all_tags(filters={"value": "*some*value*"})
|
||||||
tags.should.have.length_of(3)
|
tags.should.have.length_of(3)
|
||||||
|
|
||||||
tags = conn.get_all_tags(filters={"value": "*value\*"})
|
tags = conn.get_all_tags(filters={"value": r"*value\*"})
|
||||||
tags.should.have.length_of(1)
|
tags.should.have.length_of(1)
|
||||||
|
|
||||||
tags = conn.get_all_tags(filters={"value": "*value\*\*"})
|
tags = conn.get_all_tags(filters={"value": r"*value\*\*"})
|
||||||
tags.should.have.length_of(1)
|
tags.should.have.length_of(1)
|
||||||
|
|
||||||
tags = conn.get_all_tags(filters={"value": "*value\*\?"})
|
tags = conn.get_all_tags(filters={"value": r"*value\*\?"})
|
||||||
tags.should.have.length_of(1)
|
tags.should.have.length_of(1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ def test_publish_to_sqs():
|
|||||||
"us-east-1",
|
"us-east-1",
|
||||||
)
|
)
|
||||||
acquired_message = re.sub(
|
acquired_message = re.sub(
|
||||||
"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
||||||
"2015-01-01T12:00:00.000Z",
|
"2015-01-01T12:00:00.000Z",
|
||||||
message.get_body(),
|
message.get_body(),
|
||||||
)
|
)
|
||||||
@ -98,7 +98,7 @@ def test_publish_to_sqs_in_different_region():
|
|||||||
)
|
)
|
||||||
|
|
||||||
acquired_message = re.sub(
|
acquired_message = re.sub(
|
||||||
"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
||||||
"2015-01-01T12:00:00.000Z",
|
"2015-01-01T12:00:00.000Z",
|
||||||
message.get_body(),
|
message.get_body(),
|
||||||
)
|
)
|
||||||
|
@ -49,7 +49,7 @@ def test_publish_to_sqs():
|
|||||||
messages = queue.receive_messages(MaxNumberOfMessages=1)
|
messages = queue.receive_messages(MaxNumberOfMessages=1)
|
||||||
expected = MESSAGE_FROM_SQS_TEMPLATE % (message, published_message_id, "us-east-1")
|
expected = MESSAGE_FROM_SQS_TEMPLATE % (message, published_message_id, "us-east-1")
|
||||||
acquired_message = re.sub(
|
acquired_message = re.sub(
|
||||||
"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
||||||
"2015-01-01T12:00:00.000Z",
|
"2015-01-01T12:00:00.000Z",
|
||||||
messages[0].body,
|
messages[0].body,
|
||||||
)
|
)
|
||||||
@ -290,7 +290,7 @@ def test_publish_to_sqs_dump_json():
|
|||||||
escaped = message.replace('"', '\\"')
|
escaped = message.replace('"', '\\"')
|
||||||
expected = MESSAGE_FROM_SQS_TEMPLATE % (escaped, published_message_id, "us-east-1")
|
expected = MESSAGE_FROM_SQS_TEMPLATE % (escaped, published_message_id, "us-east-1")
|
||||||
acquired_message = re.sub(
|
acquired_message = re.sub(
|
||||||
"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
||||||
"2015-01-01T12:00:00.000Z",
|
"2015-01-01T12:00:00.000Z",
|
||||||
messages[0].body,
|
messages[0].body,
|
||||||
)
|
)
|
||||||
@ -323,7 +323,7 @@ def test_publish_to_sqs_in_different_region():
|
|||||||
messages = queue.receive_messages(MaxNumberOfMessages=1)
|
messages = queue.receive_messages(MaxNumberOfMessages=1)
|
||||||
expected = MESSAGE_FROM_SQS_TEMPLATE % (message, published_message_id, "us-west-1")
|
expected = MESSAGE_FROM_SQS_TEMPLATE % (message, published_message_id, "us-west-1")
|
||||||
acquired_message = re.sub(
|
acquired_message = re.sub(
|
||||||
"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z",
|
||||||
"2015-01-01T12:00:00.000Z",
|
"2015-01-01T12:00:00.000Z",
|
||||||
messages[0].body,
|
messages[0].body,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user