Skip to content

Commit 04fcfe0

Browse files
authored
chore: Get rid of py2 import stuff (#3018)
1 parent a584f0e commit 04fcfe0

File tree

6 files changed

+17
-40
lines changed

6 files changed

+17
-40
lines changed

integration/combination/test_api_settings.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import hashlib
2+
from pathlib import Path
23
from unittest.case import skipIf
34

4-
from integration.config.service_names import REST_API
5-
from integration.helpers.resource import current_region_does_not_support
6-
7-
try:
8-
from pathlib import Path
9-
except ImportError:
10-
from pathlib2 import Path
11-
125
from parameterized import parameterized
136

7+
from integration.config.service_names import REST_API
148
from integration.helpers.base_test import BaseTest
9+
from integration.helpers.resource import current_region_does_not_support
1510

1611

1712
@skipIf(current_region_does_not_support([REST_API]), "Rest API is not supported in this testing region")

integration/conftest.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import time
3+
from pathlib import Path
34

45
import boto3
56
import botocore
@@ -18,11 +19,6 @@
1819
from integration.helpers.stack import Stack
1920
from integration.helpers.yaml_utils import load_yaml
2021

21-
try:
22-
from pathlib import Path
23-
except ImportError:
24-
from pathlib2 import Path
25-
2622
LOG = logging.getLogger(__name__)
2723

2824
COMPANION_STACK_NAME = "sam-integ-stack-companion"

integration/helpers/base_test.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
import logging
33
import os
44
import shutil
5+
from pathlib import Path
6+
from unittest.case import TestCase
57

8+
import boto3
69
import botocore
710
import pytest
811
import requests
@@ -20,6 +23,7 @@
2023

2124
from integration.config.logger_configurations import LoggingConfiguration
2225
from integration.helpers.client_provider import ClientProvider
26+
from integration.helpers.deployer.deployer import Deployer
2327
from integration.helpers.deployer.exceptions.exceptions import ThrottlingError
2428
from integration.helpers.deployer.utils.retry import retry_with_exponential_backoff_and_jitter
2529
from integration.helpers.exception import StatusCodeError
@@ -32,18 +36,8 @@
3236
verify_stack_resources,
3337
)
3438
from integration.helpers.s3_uploader import S3Uploader
35-
from integration.helpers.yaml_utils import dump_yaml, load_yaml
36-
37-
try:
38-
from pathlib import Path
39-
except ImportError:
40-
from pathlib2 import Path
41-
from unittest.case import TestCase
42-
43-
import boto3
44-
45-
from integration.helpers.deployer.deployer import Deployer
4639
from integration.helpers.template import transform_template
40+
from integration.helpers.yaml_utils import dump_yaml, load_yaml
4741

4842
LOG = logging.getLogger(__name__)
4943

integration/helpers/deployer/utils/artifact_exporter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Logic for uploading to S3 per Cloudformation Specific Resource
33
This was ported over from the sam-cli repo
44
"""
5-
# pylint: disable=no-member
65

76
# Copyright 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
87
#

integration/helpers/resource.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import json
22
import random
33
import re
4-
import string # pylint: disable=deprecated-module
4+
import string
5+
from pathlib import Path
56
from typing import Any, Callable, Dict, Iterator, Set
67

8+
import boto3
9+
from botocore.exceptions import NoRegionError
10+
from samtranslator.translator.logical_id_generator import LogicalIdGenerator
11+
712
from integration.config.service_names import (
813
APP_SYNC,
914
DYNAMO_DB,
@@ -18,15 +23,6 @@
1823
)
1924
from integration.helpers.yaml_utils import load_yaml
2025

21-
try:
22-
from pathlib import Path
23-
except ImportError:
24-
from pathlib2 import Path
25-
26-
import boto3
27-
from botocore.exceptions import NoRegionError
28-
from samtranslator.translator.logical_id_generator import LogicalIdGenerator
29-
3026
# Length of the random suffix added at the end of the resources we create
3127
# to avoid collisions between tests
3228
RANDOM_SUFFIX_LENGTH = 12

integration/helpers/stack.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from pathlib import Path
2+
13
import botocore
24

35
from integration.helpers.deployer.deployer import Deployer
@@ -6,11 +8,6 @@
68
from integration.helpers.resource import generate_suffix
79
from integration.helpers.template import transform_template
810

9-
try:
10-
from pathlib import Path
11-
except ImportError:
12-
from pathlib2 import Path
13-
1411

1512
class Stack:
1613
def __init__(self, stack_name, template_path, cfn_client, output_dir):

0 commit comments

Comments
 (0)