Skip to content

Commit

Permalink
chore: ruff add flake8-future-annotations + perflint (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
tekumara committed Jul 9, 2023
1 parent 700f114 commit 4c60e97
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dev = [
"pyfakefs~=5.1",
"pytest~=7.4",
"pytest-mock~=3.11",
"ruff~=0.0.270",
"ruff~=0.0.277",
"twine~=4.0",
]

Expand Down Expand Up @@ -83,6 +83,10 @@ select = [
"UP",
# flake8-self
"SLF",
# flake8-future-annotations (for python 3.7/8/9)
"FA",
# perflint
"PERF",
# ruff-specific
"RUF",
]
Expand Down
4 changes: 1 addition & 3 deletions src/aec/command/ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ def fetch_instance_ids(config: Config, idents: list[str]) -> list[str]:
response = ec2_client.describe_instances(Filters=[{"Name": "tag:Name", "Values": names}])

try:
for r in response["Reservations"]:
for i in r["Instances"]:
ids.append(i["InstanceId"])
ids.extend(i["InstanceId"] for r in response["Reservations"] for i in r["Instances"])
except IndexError:
raise ValueError(f"No instances with ids or names {','.join(names)}") from None
return ids
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ami.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List
from __future__ import annotations

import boto3
import pytest
Expand Down Expand Up @@ -70,7 +70,7 @@ def test_tags_image(mock_aws_config: Config):
response = ec2_client.run_instances(MaxCount=1, MinCount=1)
instance_id = response["Instances"][0]["InstanceId"]

tags: List[TagTypeDef] = [{"Key": "Team", "Value": "Engineering"}, {"Key": "Source AMI", "Value": "ami-12345"}]
tags: list[TagTypeDef] = [{"Key": "Team", "Value": "Engineering"}, {"Key": "Source AMI", "Value": "ami-12345"}]

ec2_client.create_image(
InstanceId=instance_id, Name="Beautiful Image", TagSpecifications=[{"ResourceType": "image", "Tags": tags}]
Expand Down
5 changes: 3 additions & 2 deletions tests/test_ec2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
from pathlib import Path
from typing import List

import boto3
import pytest
Expand Down Expand Up @@ -309,7 +310,7 @@ def test_tags(mock_aws_config: Config):
def test_tags_volume(mock_aws_config: Config):
ec2_client = boto3.client("ec2", region_name=mock_aws_config["region"])

tags: List[TagTypeDef] = [{"Key": "Name", "Value": "Mr Snuffleupagus"}, {"Key": "Best Friend", "Value": "Big Bird"}]
tags: list[TagTypeDef] = [{"Key": "Name", "Value": "Mr Snuffleupagus"}, {"Key": "Best Friend", "Value": "Big Bird"}]
ec2_client.create_volume(
AvailabilityZone="us-east-1a", Size=10, TagSpecifications=[{"ResourceType": "volume", "Tags": tags}]
)
Expand Down

0 comments on commit 4c60e97

Please sign in to comment.