Skip to content

Commit

Permalink
added .pre-commit hook for black-check and isort-check
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborschulz committed Dec 23, 2022
1 parent 7b2e0d7 commit 8f00757
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: local
hooks:
- id: black-check
name: black-check
entry: make black-check
language: system
always_run: true
pass_filenames: false
- id: isort-check
name: isort-check
entry: make isort-check
language: system
always_run: true
pass_filenames: false
10 changes: 5 additions & 5 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,13 +1111,13 @@ def test_load_extended_settings(self):
zappa_cli.load_settings("test_settings.json")
self.assertEqual("lmbda", zappa_cli.stage_config["s3_bucket"])
self.assertEqual(True, zappa_cli.stage_config["touch"])
self.assertIn('x86_64', zappa_cli.architecture)
self.assertIn("x86_64", zappa_cli.architecture)

zappa_cli = ZappaCLI()
zappa_cli.api_stage = "arch_arm64"
zappa_cli.load_settings("test_settings.json")
self.assertIn('arm64', zappa_cli.stage_config["architecture"])
self.assertIn('arm64', zappa_cli.architecture)
self.assertIn("arm64", zappa_cli.stage_config["architecture"])
self.assertIn("arm64", zappa_cli.architecture)

zappa_cli = ZappaCLI()
zappa_cli.api_stage = "extendofail"
Expand All @@ -1135,7 +1135,7 @@ def test_load_extended_settings(self):
self.assertEqual("lmbda2", zappa_cli.stage_config["s3_bucket"]) # Second Extension
self.assertTrue(zappa_cli.stage_config["touch"]) # First Extension
self.assertTrue(zappa_cli.stage_config["delete_local_zip"]) # The base

zappa_cli = ZappaCLI()
zappa_cli.api_stage = "archfail"
with self.assertRaises(ValueError):
Expand Down
10 changes: 5 additions & 5 deletions zappa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ def __init__(
self.manylinux_suffix_start = "cp39"

if not architecture:
architecture = ['x86_64']
architecture = ["x86_64"]
if not set(architecture).issubset({"x86_64", "arm64"}):
raise ValueError("Invalid architecture. Please, use x86_64 or arm64.")
if sys.version_info.major == 3 and sys.version_info.minor < 8 and 'arm64' in architecture:
if sys.version_info.major == 3 and sys.version_info.minor < 8 and "arm64" in architecture:
raise ValueError("arm64 support requires Python 3.8 or newer.")

self.architecture = architecture

# AWS Lambda supports manylinux1/2010, manylinux2014, and manylinux_2_24
manylinux_suffixes = ("_2_24", "2014", "2010", "1")
self.arch_suffixes = ("x86_64", "arm64", "aarch64")
Expand Down Expand Up @@ -930,7 +930,7 @@ def get_cached_manylinux_wheel(self, package_name, package_version, disable_prog
else:
# Check if we already have a cached copy
wheel_name = re.sub(r"[^\w\d.]+", "_", package_name, re.UNICODE)
wheel_file = f'{wheel_name}-{package_version}-*_{self.architecture[0]}.whl'
wheel_file = f"{wheel_name}-{package_version}-*_{self.architecture[0]}.whl"
wheel_path = os.path.join(cached_wheels_dir, wheel_file)

for pathname in glob.iglob(wheel_path):
Expand Down

0 comments on commit 8f00757

Please sign in to comment.