black reformatting changes

This commit is contained in:
Matthew Gladney 2020-04-24 14:20:58 -04:00
parent 908468edb6
commit 59c1f0e131
2 changed files with 20 additions and 9 deletions

View File

@ -1504,21 +1504,30 @@ class Zone(object):
class RegionsAndZonesBackend(object): class RegionsAndZonesBackend(object):
regions_not_enabled_by_default = [ regions_not_enabled_by_default = ["ap-east-1", "me-south-1"]
'ap-east-1',
'me-south-1'
]
regions = [] regions = []
for region in Session().get_available_regions("ec2"): for region in Session().get_available_regions("ec2"):
if region in regions_not_enabled_by_default: if region in regions_not_enabled_by_default:
regions.append(Region(region, "ec2.{}.amazonaws.com".format(region), "not-opted-in")) regions.append(
Region(region, "ec2.{}.amazonaws.com".format(region), "not-opted-in")
)
else: else:
regions.append(Region(region, "ec2.{}.amazonaws.com".format(region), "opt-in-not-required")) regions.append(
Region(
region, "ec2.{}.amazonaws.com".format(region), "opt-in-not-required"
)
)
for region in Session().get_available_regions("ec2", partition_name="aws-us-gov"): for region in Session().get_available_regions("ec2", partition_name="aws-us-gov"):
regions.append(Region(region, "ec2.{}.amazonaws.com".format(region), "opt-in-not-required")) regions.append(
Region(region, "ec2.{}.amazonaws.com".format(region), "opt-in-not-required")
)
for region in Session().get_available_regions("ec2", partition_name="aws-cn"): for region in Session().get_available_regions("ec2", partition_name="aws-cn"):
regions.append(Region(region, "ec2.{}.amazonaws.com.cn".format(region), "opt-in-not-required")) regions.append(
Region(
region, "ec2.{}.amazonaws.com.cn".format(region), "opt-in-not-required"
)
)
zones = { zones = {
"af-south-1": [ "af-south-1": [

View File

@ -40,7 +40,9 @@ def test_boto3_describe_regions():
resp = ec2.describe_regions(RegionNames=[test_region]) resp = ec2.describe_regions(RegionNames=[test_region])
resp["Regions"].should.have.length_of(1) resp["Regions"].should.have.length_of(1)
resp["Regions"][0].should.have.key("RegionName").which.should.equal(test_region) resp["Regions"][0].should.have.key("RegionName").which.should.equal(test_region)
resp["Regions"][0].should.have.key("OptInStatus").which.should.equal("opt-in-not-required") resp["Regions"][0].should.have.key("OptInStatus").which.should.equal(
"opt-in-not-required"
)
test_region = "ap-east-1" test_region = "ap-east-1"
resp = ec2.describe_regions(RegionNames=[test_region]) resp = ec2.describe_regions(RegionNames=[test_region])