Skip to content

Commit bf15ec0

Browse files
ckhordiasmaclaude
andcommitted
Fix lint: add license header, remove unused import, fix formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 77ac912 commit bf15ec0

2 files changed

Lines changed: 31 additions & 15 deletions

File tree

.tekton/odh-trustyai-nemo-guardrails-server-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ spec:
8181
- name: git-auth
8282
secret:
8383
secretName: '{{ git_auth_secret }}'
84-
status: {}
84+
status: {}

scripts/generate_model_lockfile.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
#!/usr/bin/env python3
2+
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
217
"""
318
Generate artifacts.lock.yaml for hermetic model prefetching.
419
@@ -14,7 +29,6 @@
1429
import logging
1530
import os
1631
import sys
17-
import tempfile
1832
import urllib.request
1933
from pathlib import Path
2034
from typing import Any
@@ -136,9 +150,7 @@ def build_hf_artifacts(
136150
) -> tuple[str, list[dict]]:
137151
org, repo = model_id.split("/", 1)
138152
commit = get_hf_model_commit(model_id)
139-
files = collect_hf_files(
140-
model_id, skip_files, skip_extensions, skip_prefixes
141-
)
153+
files = collect_hf_files(model_id, skip_files, skip_extensions, skip_prefixes)
142154

143155
artifacts = []
144156
for f in files:
@@ -155,11 +167,13 @@ def build_hf_artifacts(
155167
sha = download_and_hash(download_url)
156168
checksum = f"sha256:{sha}"
157169

158-
artifacts.append({
159-
"download_url": download_url,
160-
"filename": filename,
161-
"checksum": checksum,
162-
})
170+
artifacts.append(
171+
{
172+
"download_url": download_url,
173+
"filename": filename,
174+
"checksum": checksum,
175+
}
176+
)
163177

164178
return commit, artifacts
165179

@@ -170,11 +184,13 @@ def build_nltk_artifacts(resources: set[str]) -> list[dict]:
170184
url = f"{NLTK_DATA_BASE}/packages/tokenizers/{resource}.zip"
171185
logging.info(f" {resource} (downloading to compute checksum...)")
172186
sha = download_and_hash(url)
173-
artifacts.append({
174-
"download_url": url,
175-
"filename": f"nltk--{resource}.zip",
176-
"checksum": f"sha256:{sha}",
177-
})
187+
artifacts.append(
188+
{
189+
"download_url": url,
190+
"filename": f"nltk--{resource}.zip",
191+
"checksum": f"sha256:{sha}",
192+
}
193+
)
178194
return artifacts
179195

180196

0 commit comments

Comments
 (0)