Fix for python 3.8
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
bs4
|
||||||
docker
|
docker
|
||||||
torch
|
torch
|
||||||
transformers
|
transformers
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from bs4 import BeautifulSoup
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
@@ -12,8 +13,7 @@ def generate_context(containers: List[Dict[str, any]]) -> str:
|
|||||||
"""
|
"""
|
||||||
context_elem = ET.Element("context")
|
context_elem = ET.Element("context")
|
||||||
context_elem.append(format_containers_xml(containers))
|
context_elem.append(format_containers_xml(containers))
|
||||||
ET.indent(context_elem, space="\t")
|
return BeautifulSoup(ET.tostring(context_elem, encoding='unicode'), "xml").prettify()
|
||||||
return ET.tostring(context_elem, encoding='unicode')
|
|
||||||
|
|
||||||
def format_containers_xml(containers: List[Dict[str, any]]) -> ET.Element:
|
def format_containers_xml(containers: List[Dict[str, any]]) -> ET.Element:
|
||||||
"""Format container statuses as XML string.
|
"""Format container statuses as XML string.
|
||||||
|
|||||||
1
test.sh
1
test.sh
@@ -22,6 +22,5 @@ docker run \
|
|||||||
-v /$(pwd)/model/:/root/model/ \
|
-v /$(pwd)/model/:/root/model/ \
|
||||||
$TAG
|
$TAG
|
||||||
|
|
||||||
|
|
||||||
# Clean up image
|
# Clean up image
|
||||||
[ ! -z "$TAG" ] && docker rmi $TAG
|
[ ! -z "$TAG" ] && docker rmi $TAG
|
||||||
@@ -7,7 +7,7 @@ class TestContextTemplate(unittest.TestCase):
|
|||||||
"""Test context generation with no containers."""
|
"""Test context generation with no containers."""
|
||||||
context = generate_context([])
|
context = generate_context([])
|
||||||
self.assertIn("<context>", context)
|
self.assertIn("<context>", context)
|
||||||
self.assertIn("<containers />", context)
|
self.assertIn("<containers/>", context)
|
||||||
self.assertIn("</context>", context)
|
self.assertIn("</context>", context)
|
||||||
|
|
||||||
def test_single_container(self):
|
def test_single_container(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user