Skip to content

Commit f8406bf

Browse files
authored
chore(main): pin opentdf dependencies & fix new ruff issues (#128)
* fix formatting * replacing ternary if expressions with the or operator Fixes 9 FURB10 errors across 4 files * update ruff-pre-commit version to v0.15.0 * pin otdfctl and platform - pins otdfctl to v0.28.0 - pins platform to service/v0.8.2
1 parent 180f063 commit f8406bf

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

.github/workflows/platform-integration-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
3434
with:
3535
repository: opentdf/platform
36-
ref: main
36+
ref: service/v0.8.2
3737
path: platform
3838
- name: Set up go
3939
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
@@ -132,7 +132,7 @@ jobs:
132132
grpcurl -plaintext localhost:8080 kas.AccessService/PublicKey
133133
134134
- name: Install otdfctl
135-
run: go install github.com/opentdf/otdfctl@latest
135+
run: go install github.com/opentdf/otdfctl@v0.28.0
136136
shell: bash
137137

138138
- name: Create creds.json for otdfctl

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repos:
3434

3535
- repo: https://github.com/astral-sh/ruff-pre-commit
3636
# Ruff version.
37-
rev: v0.14.8
37+
rev: v0.15.0
3838
hooks:
3939
# Run the linter.
4040
- id: ruff-check

src/otdf_python/kas_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _handle_existing_scheme(self, parsed) -> str:
154154
# Reconstruct URL preserving the path (especially /kas prefix)
155155
try:
156156
# Create URL preserving the path component for proper endpoint routing
157-
path = parsed.path if parsed.path else ""
157+
path = parsed.path or ""
158158
normalized_url = f"{scheme}://{parsed.hostname}:{port}{path}"
159159
logging.debug(f"normalized url [{parsed.geturl()}] to [{normalized_url}]")
160160
return normalized_url

src/otdf_python/nanotdf.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def _serialize_policy_object(self, obj):
7070
if isinstance(obj, PolicyBody):
7171
# Convert data_attributes to dataAttributes and use null instead of empty array
7272
result = {
73-
"dataAttributes": obj.data_attributes if obj.data_attributes else None,
74-
"dissem": obj.dissem if obj.dissem else None,
73+
"dataAttributes": obj.data_attributes or None,
74+
"dissem": obj.dissem or None,
7575
}
7676
return result
7777
elif isinstance(obj, AttributeObject):
@@ -115,14 +115,12 @@ def _prepare_policy_data(self, config: NanoTDFConfig) -> tuple[bytes, str]:
115115
tuple: (policy_body, policy_type)
116116
117117
"""
118-
attributes = config.attributes if config.attributes else []
118+
attributes = config.attributes or []
119119
policy_object = self._create_policy_object(attributes)
120120
policy_json = json.dumps(
121121
policy_object, default=self._serialize_policy_object
122122
).encode("utf-8")
123-
policy_type = (
124-
config.policy_type if config.policy_type else "EMBEDDED_POLICY_PLAIN_TEXT"
125-
)
123+
policy_type = config.policy_type or "EMBEDDED_POLICY_PLAIN_TEXT"
126124

127125
if policy_type == "EMBEDDED_POLICY_PLAIN_TEXT":
128126
policy_body = policy_json

src/otdf_python/tdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ def _serialize_policy_object(self, obj):
183183
if isinstance(obj, PolicyBody):
184184
# Convert data_attributes to dataAttributes and use null instead of empty array
185185
result = {
186-
"dataAttributes": obj.data_attributes if obj.data_attributes else None,
187-
"dissem": obj.dissem if obj.dissem else None,
186+
"dataAttributes": obj.data_attributes or None,
187+
"dissem": obj.dissem or None,
188188
}
189189
return result
190190
elif isinstance(obj, AttributeObject):

tests/config_pydantic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ class ConfigureTdf(BaseSettings):
5454
)
5555

5656
OIDC_OP_TOKEN_ENDPOINT: str = Field(
57-
default_factory=lambda data: f"{data['KEYCLOAK_URL']}realms/opentdf/protocol/openid-connect/token"
57+
default_factory=lambda data: (
58+
f"{data['KEYCLOAK_URL']}realms/opentdf/protocol/openid-connect/token"
59+
)
5860
)
5961

6062
# NOTE: The following variableis used for OIDC, NPE encryption/decryption, as

tests/support_otdfctl_args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ def _generate_target_mode_tdf(
183183
creds_file=creds_file,
184184
input_file=input_file,
185185
output_file=output_file,
186-
mime_type=mime_type if mime_type else "text/plain",
187-
attributes=attributes if attributes else None,
186+
mime_type=mime_type or "text/plain",
187+
attributes=attributes or None,
188188
tdf_type="tdf3",
189189
target_mode=target_mode,
190190
)

0 commit comments

Comments
 (0)