Skip to content

Commit 86d536d

Browse files
committed
resolve flake8 issues
1 parent 34127c1 commit 86d536d

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

code_generator_TopCPToolkit/tests/test_custom_image_tag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ def test_generated_files_created_with_image_tag(self):
8888

8989

9090
if __name__ == '__main__':
91-
unittest.main()
91+
unittest.main()

servicex_app/servicex_app/resources/transformation/submit.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,15 @@ def validate_custom_image_tag(image_tag: str, config: dict, codegen_name: str) -
5858
return None, None
5959

6060
# Get validation configuration (with defaults)
61-
allowed_repos = config.get('TOPCP_ALLOWED_REPOSITORIES', [
62-
'sslhep/servicex_science_image_topcp',
63-
'registry.gitlab.com/topcp-project/toolkit'
64-
])
65-
tag_pattern = config.get('TOPCP_IMAGE_TAG_PATTERN', r'^v?\d+\.\d+\.\d+[-_]v?\d+\.\d+$')
66-
default_base_image = config.get('TOPCP_DEFAULT_BASE_IMAGE', 'sslhep/servicex_science_image_topcp')
61+
tag_pattern = config.get('TOPCP_IMAGE_TAG_PATTERN',
62+
r'^v?\d+\.\d+\.\d+[-_]v?\d+\.\d+$')
63+
default_base_image = config.get('TOPCP_DEFAULT_BASE_IMAGE',
64+
'sslhep/servicex_science_image_topcp')
6765

6866
# Validate tag format
6967
if not re.match(tag_pattern, image_tag):
70-
raise BadRequest(f"Invalid TopCP image tag format: {image_tag}. Expected format: v2.20.0_v0.2")
68+
raise BadRequest(f"Invalid TopCP image tag format: {image_tag}. "
69+
f"Expected format: v2.20.0_v0.2")
7170

7271
# For now, use the default base image with the custom tag
7372
# In the future, this could be extended to allow custom repositories
@@ -97,6 +96,7 @@ def _extract_custom_image_tag(self, selection: str, codegen_name: str) -> Option
9796
except (json.JSONDecodeError, AttributeError):
9897
# Invalid JSON or non-dict selection
9998
return None
99+
100100
@classmethod
101101
def make_api(
102102
cls,
@@ -270,7 +270,8 @@ def post(self):
270270
)
271271

272272
# Extract custom image tag from TopCP queries before code generation
273-
custom_image_tag = self._extract_custom_image_tag(request_rec.selection, user_codegen_name)
273+
custom_image_tag = self._extract_custom_image_tag(
274+
request_rec.selection, user_codegen_name)
274275

275276
# The first thing to do is make sure the requested selection is correct,
276277
# and can generate the requested code

servicex_app/servicex_app_test/test_custom_image_validation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import unittest
55
from werkzeug.exceptions import BadRequest
66

7-
from servicex_app.resources.transformation.submit import validate_custom_image_tag, SubmitTransformationRequest
7+
from servicex_app.resources.transformation.submit import (
8+
validate_custom_image_tag, SubmitTransformationRequest
9+
)
810

911

1012
class TestCustomImageValidation(unittest.TestCase):
@@ -138,4 +140,4 @@ def test_extract_image_tag_none_value(self):
138140

139141

140142
if __name__ == '__main__':
141-
unittest.main()
143+
unittest.main()

0 commit comments

Comments
 (0)