Skip to content

Commit

Permalink
refactor to new module
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasht86 committed Sep 24, 2024
1 parent 2321470 commit 5e75a5e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions vespa/configuration/services.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from vespa.configuration.vt import VT, create_tag_function, voids
from lxml import etree
from vespa.configuration.relaxng import RELAXNG

# List of XML tags (customized for Vespa configuration)
services_tags = [
Expand Down Expand Up @@ -164,9 +164,6 @@
sanitized_name = VT.sanitize_tag_name(tag)
_g[sanitized_name] = create_tag_function(tag, tag in voids)

with open("tests/testfiles/relaxng/services.rng", "rb") as schema_file:
relaxng = etree.RelaxNG(etree.parse(schema_file))


def validate_services(xml_schema: str) -> bool:
"""
Expand All @@ -178,4 +175,4 @@ def validate_services(xml_schema: str) -> bool:
Returns:
bool: True if the XML schema is valid, False otherwise
"""
return relaxng.validate(xml_schema)
return RELAXNG["services"].validate(xml_schema)

0 comments on commit 5e75a5e

Please sign in to comment.