From ca1f2b0ca1f4a53254aa4d5a4b02ec1cf0092e2d Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Fri, 13 Aug 2021 15:40:18 -0700 Subject: [PATCH] Renames `hex_digest` to `requirements_hex_digest` # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels] --- src/python/pants/backend/awslambda/python/rules.py | 2 +- .../pants/backend/experimental/python/lockfile.py | 10 +++------- .../backend/experimental/python/lockfile_metadata.py | 10 +++++++--- src/python/pants/backend/python/goals/coverage_py.py | 2 +- src/python/pants/backend/python/goals/setup_py.py | 2 +- src/python/pants/backend/python/lint/bandit/rules.py | 2 +- src/python/pants/backend/python/lint/black/rules.py | 2 +- .../pants/backend/python/lint/docformatter/rules.py | 2 +- src/python/pants/backend/python/lint/flake8/rules.py | 2 +- src/python/pants/backend/python/lint/isort/rules.py | 2 +- src/python/pants/backend/python/lint/yapf/rules.py | 2 +- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/python/pants/backend/awslambda/python/rules.py b/src/python/pants/backend/awslambda/python/rules.py index 3f796b3c9df5..9bba08d1fae5 100644 --- a/src/python/pants/backend/awslambda/python/rules.py +++ b/src/python/pants/backend/awslambda/python/rules.py @@ -90,7 +90,7 @@ async def package_python_awslambda( lockfile_hex_digest = None if lambdex.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, LambdexLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest lambdex_request = PexRequest( output_filename="lambdex.pex", diff --git a/src/python/pants/backend/experimental/python/lockfile.py b/src/python/pants/backend/experimental/python/lockfile.py index 5c42666b65aa..abc708feae1f 100644 --- a/src/python/pants/backend/experimental/python/lockfile.py +++ b/src/python/pants/backend/experimental/python/lockfile.py @@ -112,12 +112,8 @@ def from_tool( ) @property - def hex_digest(self) -> str: - """Produces a hex digest of this lockfile's inputs, which should uniquely specify the - resolution of this lockfile request. - - Inputs are defined as requirements. - """ + def requirements_hex_digest(self) -> str: + """Produces a hex digest of the requirements input for this lockfile.""" return calculate_invalidation_digest(self.requirements) @@ -170,7 +166,7 @@ async def generate_lockfile( lockfile_digest_contents = await Get(DigestContents, Digest, poetry_export_result.output_digest) lockfile_with_header = lockfile_content_with_header( python_setup.lockfile_custom_regeneration_command or req.regenerate_command, - req.hex_digest, + req.requirements_hex_digest, req.interpreter_constraints, lockfile_digest_contents[0].content, ) diff --git a/src/python/pants/backend/experimental/python/lockfile_metadata.py b/src/python/pants/backend/experimental/python/lockfile_metadata.py index fe1bbf850667..1edf9232e2ba 100644 --- a/src/python/pants/backend/experimental/python/lockfile_metadata.py +++ b/src/python/pants/backend/experimental/python/lockfile_metadata.py @@ -41,7 +41,9 @@ def is_valid_for( # This lockfile matches all interpreter constraints (TODO: check this) return True - return self.valid_interpreter_constraints.contains(user_interpreter_constraints, interpreter_universe) + return self.valid_interpreter_constraints.contains( + user_interpreter_constraints, interpreter_universe + ) def calculate_invalidation_digest( @@ -132,7 +134,7 @@ def yield_metadata_lines() -> Iterable[bytes]: T = TypeVar("T") def coerce(t: Callable[[Any], T], key: str) -> T | None: - """ Gets a value from `metadata`, coercing it to type `t` if not `None`.""" + """Gets a value from `metadata`, coercing it to type `t` if not `None`.""" v = metadata.get(key, None) try: return t(v) if v is not None else None @@ -142,5 +144,7 @@ def coerce(t: Callable[[Any], T], key: str) -> T | None: return LockfileMetadata( invalidation_digest=coerce(str, "invalidation_digest"), - valid_interpreter_constraints=coerce(InterpreterConstraints, "valid_interpreter_constraints"), + valid_interpreter_constraints=coerce( + InterpreterConstraints, "valid_interpreter_constraints" + ), ) diff --git a/src/python/pants/backend/python/goals/coverage_py.py b/src/python/pants/backend/python/goals/coverage_py.py index ee1ef6006fff..fc602de8d8f6 100644 --- a/src/python/pants/backend/python/goals/coverage_py.py +++ b/src/python/pants/backend/python/goals/coverage_py.py @@ -337,7 +337,7 @@ async def setup_coverage(coverage: CoverageSubsystem) -> CoverageSetup: lockfile_hex_digest = None if coverage.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, CoveragePyLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest pex = await Get( VenvPex, diff --git a/src/python/pants/backend/python/goals/setup_py.py b/src/python/pants/backend/python/goals/setup_py.py index 77d17e03d1fa..f5be1d7ffe6d 100644 --- a/src/python/pants/backend/python/goals/setup_py.py +++ b/src/python/pants/backend/python/goals/setup_py.py @@ -423,7 +423,7 @@ async def run_setup_py(req: RunSetupPyRequest, setuptools: Setuptools) -> RunSet lockfile_hex_digest = None if setuptools.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, SetuptoolsLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest setuptools_pex = await Get( VenvPex, diff --git a/src/python/pants/backend/python/lint/bandit/rules.py b/src/python/pants/backend/python/lint/bandit/rules.py index 25ee83628e2a..1d57eef48e22 100644 --- a/src/python/pants/backend/python/lint/bandit/rules.py +++ b/src/python/pants/backend/python/lint/bandit/rules.py @@ -49,7 +49,7 @@ async def bandit_lint_partition(partition: BanditPartition, bandit: Bandit) -> L lockfile_hex_digest = None if bandit.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, BanditLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest bandit_pex_get = Get( VenvPex, diff --git a/src/python/pants/backend/python/lint/black/rules.py b/src/python/pants/backend/python/lint/black/rules.py index adba260b8778..a1b26a1ae474 100644 --- a/src/python/pants/backend/python/lint/black/rules.py +++ b/src/python/pants/backend/python/lint/black/rules.py @@ -92,7 +92,7 @@ async def setup_black( lockfile_hex_digest = None if black.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, BlackLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest black_pex_get = Get( VenvPex, diff --git a/src/python/pants/backend/python/lint/docformatter/rules.py b/src/python/pants/backend/python/lint/docformatter/rules.py index 43d4fff93cba..8a1078ce6f1c 100644 --- a/src/python/pants/backend/python/lint/docformatter/rules.py +++ b/src/python/pants/backend/python/lint/docformatter/rules.py @@ -64,7 +64,7 @@ async def setup_docformatter(setup_request: SetupRequest, docformatter: Docforma lockfile_hex_digest = None if docformatter.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, DocformatterLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest docformatter_pex_get = Get( VenvPex, diff --git a/src/python/pants/backend/python/lint/flake8/rules.py b/src/python/pants/backend/python/lint/flake8/rules.py index eff76baf8219..a6be62cdd1fe 100644 --- a/src/python/pants/backend/python/lint/flake8/rules.py +++ b/src/python/pants/backend/python/lint/flake8/rules.py @@ -49,7 +49,7 @@ async def flake8_lint_partition(partition: Flake8Partition, flake8: Flake8) -> L lockfile_hex_digest = None if flake8.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, Flake8LockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest flake8_pex_get = Get( VenvPex, diff --git a/src/python/pants/backend/python/lint/isort/rules.py b/src/python/pants/backend/python/lint/isort/rules.py index 5460616e5ed8..1adbaed4670e 100644 --- a/src/python/pants/backend/python/lint/isort/rules.py +++ b/src/python/pants/backend/python/lint/isort/rules.py @@ -81,7 +81,7 @@ async def setup_isort(setup_request: SetupRequest, isort: Isort) -> Setup: lockfile_hex_digest = None if isort.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, IsortLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest isort_pex_get = Get( VenvPex, diff --git a/src/python/pants/backend/python/lint/yapf/rules.py b/src/python/pants/backend/python/lint/yapf/rules.py index cd12e815d958..afc9e6541e9f 100644 --- a/src/python/pants/backend/python/lint/yapf/rules.py +++ b/src/python/pants/backend/python/lint/yapf/rules.py @@ -71,7 +71,7 @@ async def setup_yapf(setup_request: SetupRequest, yapf: Yapf) -> Setup: lockfile_hex_digest = None if yapf.lockfile != "": lockfile_request = await Get(PythonLockfileRequest, YapfLockfileSentinel()) - lockfile_hex_digest = lockfile_request.hex_digest + lockfile_hex_digest = lockfile_request.requirements_hex_digest yapf_pex_get = Get( VenvPex,