Skip to content

Commit

Permalink
lint: check for f-strings without placeholders
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Larsson <who+github@cnackers.org>
  • Loading branch information
whooo committed Oct 14, 2024
1 parent e0d4a81 commit 7200a85
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ exclude = '''
'''

[tool.ruff.lint]
select = ["F401"]
select = ["F401", "F541"]
2 changes: 1 addition & 1 deletion src/tpm2_pytss/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ def to_tools(self, session_type: TPM2_SE = None, auth_hash: TPM2_ALG = None):
session_type is None or auth_hash is None
):
raise TypeError(
f"session_type and auth_hash most be defined for session contexts"
"session_type and auth_hash most be defined for session contexts"
)

version = 1
Expand Down
2 changes: 1 addition & 1 deletion test/test_fapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ def test_policy_action(self):
}}
]
}}
"""
""" # noqa: F541 ruff is wrong here
policy_path = f"/policy/policy_{random_uid()}"
self.fapi.import_object(path=policy_path, import_data=policy)

Expand Down
4 changes: 2 additions & 2 deletions test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def test_TPMT_PUBLIC_parse_ecc_ecdaa4_sha256(self):

# scheme is set, so we need to be smarter about the attributes we use
templ = TPMT_PUBLIC.parse(
f"ecc:ecdaa4-sha256",
"ecc:ecdaa4-sha256",
objectAttributes=TPMA_OBJECT.DEFAULT_TPM2_TOOLS_CREATEPRIMARY_ATTRS,
)
self.assertEqual(templ.nameAlg, TPM2_ALG.SHA256)
Expand Down Expand Up @@ -840,7 +840,7 @@ def test_TPMT_PUBLIC_parse_ecc_ecdaa4(self):

# scheme is set, so we need to be smarter about the attributes we use
templ = TPMT_PUBLIC.parse(
f"ecc:ecdaa4",
"ecc:ecdaa4",
objectAttributes=TPMA_OBJECT.DEFAULT_TPM2_TOOLS_CREATEPRIMARY_ATTRS,
)
self.assertEqual(templ.nameAlg, TPM2_ALG.SHA256)
Expand Down

0 comments on commit 7200a85

Please sign in to comment.