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