{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'PDF TO Markdown' && linkText !== 'PDF TO Markdown' ) { link.textContent = 'PDF TO Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== 'Voice Cloning' ) { link.textContent = 'Voice Cloning'; link.href = 'https://vibevoice.info/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'PDF TO Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \", \"html.parser\"\n )\n soup_str = html.SoupString(soup)\n assert isinstance(soup_str, str)\n assert isinstance(soup_str, html.SoupString)\n assert soup_str == \"

foo

\"\n assert soup_str.soup is soup"}}},{"rowIdx":3438,"cells":{"response":{"kind":"string","value":"Test to make sure the class ListWriter behaves properly."},"instruction":{"kind":"string","value":"def test_listwriter():\n \"\"\"\n Test to make sure the class ListWriter behaves properly.\n \"\"\"\n\n lst = []\n writer = html.ListWriter(lst)\n\n for i in range(5):\n writer.write(i)\n\t for ch in \"abcde\":\n writer.write(ch)\n\n assert lst == [0, 1, 2, 3, 4, \"a\", \"b\", \"c\", \"d\", \"e\"]"}}},{"rowIdx":3439,"cells":{"response":{"kind":"string","value":"Test to make sure that identify_table() returns whether the\ngiven BeautifulSoup tag is the correct table to process."},"instruction":{"kind":"string","value":"def test_identify_table():\n \"\"\"\n Test to make sure that identify_table() returns whether the\n given BeautifulSoup tag is the correct table to process.\n \"\"\"\n\n # Should return False on non- tags and None\n soup = BeautifulSoup(\"\", \"html.parser\")\n assert html.identify_table(soup, {}, 0) is False\n assert html.identify_table(None, {}, 0) is False\n\n soup = BeautifulSoup(\n '
A
B
',\n \"html.parser\",\n ).table\n assert html.identify_table(soup, {}, 2) is False\n assert html.identify_table(soup, {}, 1) is True # Default index of 1\n\n # Same tests, but with explicit parameter\n assert html.identify_table(soup, {\"table_id\": 2}, 1) is False\n assert html.identify_table(soup, {\"table_id\": 1}, 1) is True\n\n # Test identification by string ID\n assert html.identify_table(soup, {\"table_id\": \"bar\"}, 1) is False\n assert html.identify_table(soup, {\"table_id\": \"foo\"}, 1) is True"}}},{"rowIdx":3440,"cells":{"response":{"kind":"string","value":"Test reading a table with missing data"},"instruction":{"kind":"string","value":"def test_missing_data():\n \"\"\"\n Test reading a table with missing data\n \"\"\"\n # First with default where blank => '0'\n table_in = [\n \"\",\n \"\",\n \"\",\n \"\",\n \"
A
1
\",\n ]\n dat = Table.read(table_in, format=\"ascii.html\")\n assert dat.masked is False\n assert np.all(dat[\"A\"].mask == [True, False])\n assert dat[\"A\"].dtype.kind == \"i\"\n\n # Now with a specific value '...' => missing\n table_in = [\n \"\",\n \"\",\n \"\",\n \"\",\n \"
A
...
1
\",\n ]\n dat = Table.read(table_in, format=\"ascii.html\", fill_values=[(\"...\", \"0\")])\n assert dat.masked is False\n assert np.all(dat[\"A\"].mask == [True, False])\n assert dat[\"A\"].dtype.kind == \"i\""}}},{"rowIdx":3441,"cells":{"response":{"kind":"string","value":"Test reading a table and renaming cols"},"instruction":{"kind":"string","value":"def test_rename_cols():\n \"\"\"\n Test reading a table and renaming cols\n \"\"\"\n table_in = [\n \"\",\n \"\",\n \"\",\n \"
A B
12
\",\n ]\n\n # Swap column names\n dat = Table.read(table_in, format=\"ascii.html\", names=[\"B\", \"A\"])\n assert dat.colnames == [\"B\", \"A\"]\n assert len(dat) == 1\n\n # Swap column names and only include A (the renamed version)\n dat = Table.read(\n table_in, format=\"ascii.html\", names=[\"B\", \"A\"], include_names=[\"A\"]\n )\n assert dat.colnames == [\"A\"]\n assert len(dat) == 1\n assert np.all(dat[\"A\"] == 2)"}}},{"rowIdx":3442,"cells":{"response":{"kind":"string","value":"Test reading a table with no column header"},"instruction":{"kind":"string","value":"def test_no_names():\n \"\"\"\n Test reading a table with no column header\n \"\"\"\n table_in = [\"\", \"\", \"\", \"
1
2
\"]\n dat = Table.read(table_in, format=\"ascii.html\")\n assert dat.colnames == [\"col1\"]\n assert len(dat) == 2\n\n dat = Table.read(table_in, format=\"ascii.html\", names=[\"a\"])\n assert dat.colnames == [\"a\"]\n assert len(dat) == 2"}}},{"rowIdx":3443,"cells":{"response":{"kind":"string","value":"Raise an exception with an informative error message if table_id\nis not found."},"instruction":{"kind":"string","value":"def test_identify_table_fail():\n \"\"\"\n Raise an exception with an informative error message if table_id\n is not found.\n \"\"\"\n table_in = ['', \"
A
B
\"]\n\n with pytest.raises(core.InconsistentTableError) as err:\n Table.read(\n table_in, format=\"ascii.html\", htmldict={\"table_id\": \"bad_id\"}, guess=False\n )\n assert err.match(\"ERROR: HTML table id 'bad_id' not found$\")\n\n with pytest.raises(core.InconsistentTableError) as err:\n Table.read(table_in, format=\"ascii.html\", htmldict={\"table_id\": 3}, guess=False)\n assert err.match(\"ERROR: HTML table number 3 not found$\")"}}},{"rowIdx":3444,"cells":{"response":{"kind":"string","value":"Make sure the user can specify which back-end parser to use\nand that an error is raised if the parser is invalid."},"instruction":{"kind":"string","value":"def test_backend_parsers():\n \"\"\"\n Make sure the user can specify which back-end parser to use\n and that an error is raised if the parser is invalid.\n \"\"\"\n for parser in (\"lxml\", \"xml\", \"html.parser\", \"html5lib\"):\n try:\n Table.read(\n \"data/html2.html\",\n format=\"ascii.html\",\n htmldict={\"parser\": parser},\n guess=False,\n )\n except FeatureNotFound:\n\t if parser == \"html.parser\":\n raise\n # otherwise ignore if the dependency isn't present\n\n # reading should fail if the parser is invalid\n with pytest.raises(FeatureNotFound):\n Table.read(\n \"data/html2.html\",\n format=\"ascii.html\",\n htmldict={\"parser\": \"foo\"},\n guess=False,\n )"}}},{"rowIdx":3445,"cells":{"response":{"kind":"string","value":"This should return an OptionalTableImportError if BeautifulSoup\nis not installed."},"instruction":{"kind":"string","value":"def test_htmlinputter_no_bs4():\n \"\"\"\n This should return an OptionalTableImportError if BeautifulSoup\n is not installed.\n \"\"\"\n\n inputter = html.HTMLInputter()\n with pytest.raises(core.OptionalTableImportError):\n inputter.process_lines([])"}}},{"rowIdx":3446,"cells":{"response":{"kind":"string","value":"Test to ensure that HTMLInputter correctly converts input\ninto a list of SoupStrings representing table elements."},"instruction":{"kind":"string","value":"def test_htmlinputter():\n \"\"\"\n Test to ensure that HTMLInputter correctly converts input\n into a list of SoupStrings representing table elements.\n \"\"\"\n\n f = \"data/html.html\"\n with open(f) as fd:\n table = fd.read()\n\n inputter = html.HTMLInputter()\n inputter.html = {}\n\n # In absence of table_id, defaults to the first table\n expected = [\n \"Column 1Column 2Column 3\",\n \"1a1.05\",\n \"2b2.75\",\n \"3c-1.25\",\n ]\n assert [str(x) for x in inputter.get_lines(table)] == expected\n\n # Should raise an InconsistentTableError if the table is not found\n inputter.html = {\"table_id\": 4}\n with pytest.raises(core.InconsistentTableError):\n inputter.get_lines(table)\n\n # Identification by string ID\n inputter.html[\"table_id\"] = \"second\"\n expected = [\n \"Column AColumn BColumn C\",\n \"4d10.5\",\n \"5e27.5\",\n \"6f-12.5\",\n ]\n assert [str(x) for x in inputter.get_lines(table)] == expected\n\n # Identification by integer index\n inputter.html[\"table_id\"] = 3\n expected = [\n \"C1C2C3\",\n \"7g105.0\",\n \"8h275.0\",\n \"9i-125.0\",\n ]\n assert [str(x) for x in inputter.get_lines(table)] == expected"}}},{"rowIdx":3447,"cells":{"response":{"kind":"string","value":"Test to make sure that HTMLSplitter correctly inputs lines\nof type SoupString to return a generator that gives all\nheader and data elements."},"instruction":{"kind":"string","value":"def test_htmlsplitter():\n \"\"\"\n Test to make sure that HTMLSplitter correctly inputs lines\n of type SoupString to return a generator that gives all\n header and data elements.\n \"\"\"\n\n splitter = html.HTMLSplitter()\n\n lines = [\n html.SoupString(\n BeautifulSoup(\n \"
Col 1Col 2
\", \"html.parser\"\n ).tr\n ),\n html.SoupString(\n BeautifulSoup(\n \"
Data 1Data 2
\", \"html.parser\"\n ).tr\n ),\n ]\n expected_data = [[\"Col 1\", \"Col 2\"], [\"Data 1\", \"Data 2\"]]\n assert list(splitter(lines)) == expected_data\n\n # Make sure the presence of a non-SoupString triggers a TypeError\n lines.append(\"Data 3Data 4\")\n with pytest.raises(TypeError):\n list(splitter(lines))\n\n # Make sure that passing an empty list triggers an error\n with pytest.raises(core.InconsistentTableError):\n list(splitter([]))"}}},{"rowIdx":3448,"cells":{"response":{"kind":"string","value":"Test to ensure that the start_line method of HTMLHeader\nreturns the first line of header data. Uses t/html.html\nfor sample input."},"instruction":{"kind":"string","value":"def test_htmlheader_start():\n \"\"\"\n Test to ensure that the start_line method of HTMLHeader\n returns the first line of header data. Uses t/html.html\n for sample input.\n \"\"\"\n\n f = \"data/html.html\"\n with open(f) as fd:\n table = fd.read()\n\n inputter = html.HTMLInputter()\n inputter.html = {}\n header = html.HTMLHeader()\n\n lines = inputter.get_lines(table)\n assert (\n str(lines[header.start_line(lines)])\n == \"Column 1Column 2Column 3\"\n )\n inputter.html[\"table_id\"] = \"second\"\n lines = inputter.get_lines(table)\n assert (\n str(lines[header.start_line(lines)])\n == \"Column AColumn BColumn C\"\n )\n inputter.html[\"table_id\"] = 3\n lines = inputter.get_lines(table)\n assert (\n str(lines[header.start_line(lines)])\n == \"C1C2C3\"\n )\n\n # start_line should return None if no valid header is found\n lines = [\n html.SoupString(\n BeautifulSoup(\"
Data
\", \"html.parser\").tr\n ),\n html.SoupString(BeautifulSoup(\"

Text

\", \"html.parser\").p),\n ]\n assert header.start_line(lines) is None\n\n # Should raise an error if a non-SoupString is present\n lines.append(\"Header\")\n with pytest.raises(TypeError):\n header.start_line(lines)"}}},{"rowIdx":3449,"cells":{"response":{"kind":"string","value":"Test to ensure that the start_line and end_lines methods\nof HTMLData returns the first line of table data. Uses\nt/html.html for sample input."},"instruction":{"kind":"string","value":"def test_htmldata():\n \"\"\"\n Test to ensure that the start_line and end_lines methods\n of HTMLData returns the first line of table data. Uses\n t/html.html for sample input.\n \"\"\"\n\n f = \"data/html.html\"\n with open(f) as fd:\n table = fd.read()\n\n inputter = html.HTMLInputter()\n inputter.html = {}\n data = html.HTMLData()\n\n lines = inputter.get_lines(table)\n assert (\n str(lines[data.start_line(lines)])\n == \"1a1.05\"\n )\n # end_line returns the index of the last data element + 1\n assert (\n str(lines[data.end_line(lines) - 1])\n == \"3c-1.25\"\n )\n\n inputter.html[\"table_id\"] = \"second\"\n lines = inputter.get_lines(table)\n assert (\n str(lines[data.start_line(lines)])\n == \"4d10.5\"\n )\n assert (\n str(lines[data.end_line(lines) - 1])\n == \"6f-12.5\"\n )\n\n inputter.html[\"table_id\"] = 3\n lines = inputter.get_lines(table)\n assert (\n str(lines[data.start_line(lines)])\n == \"7g105.0\"\n )\n assert (\n str(lines[data.end_line(lines) - 1])\n == \"9i-125.0\"\n )\n\n # start_line should raise an error if no table data exists\n lines = [\n html.SoupString(BeautifulSoup(\"
\", \"html.parser\").div),\n html.SoupString(BeautifulSoup(\"

Text

\", \"html.parser\").p),\n ]\n with pytest.raises(core.InconsistentTableError):\n data.start_line(lines)\n\n # end_line should return None if no table data exists\n assert data.end_line(lines) is None\n\n # Should raise an error if a non-SoupString is present\n lines.append(\"Data\")\n with pytest.raises(TypeError):\n data.start_line(lines)\n with pytest.raises(TypeError):\n data.end_line(lines)"}}},{"rowIdx":3450,"cells":{"response":{"kind":"string","value":"Test to make sure that the HTML writer writes multidimensional\ncolumns (those with iterable elements) using the colspan\nattribute of ."},"instruction":{"kind":"string","value":"def test_multicolumn_write():\n \"\"\"\n Test to make sure that the HTML writer writes multidimensional\n columns (those with iterable elements) using the colspan\n attribute of .\n \"\"\"\n\n col1 = [1, 2, 3]\n col2 = [(1.0, 1.0), (2.0, 2.0), (3.0, 3.0)]\n col3 = [(\"a\", \"a\", \"a\"), (\"b\", \"b\", \"b\"), (\"c\", \"c\", \"c\")]\n table = Table([col1, col2, col3], names=(\"C1\", \"C2\", \"C3\"))\n expected = \"\"\"\\\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
C1C2C3
11.01.0aaa
22.02.0bbb
33.03.0ccc
\n \n\n \"\"\"\n out = html.HTML().write(table)[0].strip()\n assert out == expected.strip()"}}},{"rowIdx":3451,"cells":{"response":{"kind":"string","value":"Test to make sure that the HTML writer writes multidimensional\ncolumns (those with iterable elements) using the colspan\nattribute of ."},"instruction":{"kind":"string","value":"def test_multicolumn_write_escape():\n \"\"\"\n Test to make sure that the HTML writer writes multidimensional\n columns (those with iterable elements) using the colspan\n attribute of .\n \"\"\"\n\n col1 = [1, 2, 3]\n col2 = [(1.0, 1.0), (2.0, 2.0), (3.0, 3.0)]\n col3 = [(\"\", \"\", \"a\"), (\"\", \"b\", \"b\"), (\"c\", \"c\", \"c\")]\n table = Table([col1, col2, col3], names=(\"C1\", \"C2\", \"C3\"))\n expected = \"\"\"\\\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
C1C2C3
11.01.0a
22.02.0bb
33.03.0ccc
\n \n\n \"\"\"\n out = html.HTML(htmldict={\"raw_html_cols\": \"C3\"}).write(table)[0].strip()\n assert out == expected.strip()"}}},{"rowIdx":3452,"cells":{"response":{"kind":"string","value":"Test to make sure that the HTML writer will not use\nmulti-dimensional columns if the multicol parameter\nis False."},"instruction":{"kind":"string","value":"def test_write_no_multicols():\n \"\"\"\n Test to make sure that the HTML writer will not use\n multi-dimensional columns if the multicol parameter\n is False.\n \"\"\"\n\n col1 = [1, 2, 3]\n col2 = [(1.0, 1.0), (2.0, 2.0), (3.0, 3.0)]\n col3 = [(\"a\", \"a\", \"a\"), (\"b\", \"b\", \"b\"), (\"c\", \"c\", \"c\")]\n table = Table([col1, col2, col3], names=(\"C1\", \"C2\", \"C3\"))\n expected = \"\"\"\\\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
C1C2C3
11.0 .. 1.0a .. a
22.0 .. 2.0b .. b
33.0 .. 3.0c .. c
\n \n\n \"\"\"\n assert html.HTML({\"multicol\": False}).write(table)[0].strip() == expected.strip()"}}},{"rowIdx":3453,"cells":{"response":{"kind":"string","value":"Test to make sure that the HTML reader inputs multidimensional\ncolumns (those with iterable elements) using the colspan\nattribute of .\n\nEnsure that any string element within a multidimensional column\ncasts all elements to string prior to type conversion operations."},"instruction":{"kind":"string","value":"def test_multicolumn_read():\n \"\"\"\n Test to make sure that the HTML reader inputs multidimensional\n columns (those with iterable elements) using the colspan\n attribute of .\n\n Ensure that any string element within a multidimensional column\n casts all elements to string prior to type conversion operations.\n \"\"\"\n\n table = Table.read(\"data/html2.html\", format=\"ascii.html\")\n str_type = np.dtype((str, 21))\n expected = Table(\n np.array(\n [([\"1\", \"2.5000000000000000001\"], 3), ([\"1a\", \"1\"], 3.5)],\n dtype=[(\"A\", str_type, (2,)), (\"B\", \"x\"], [\"y\"]], names=[\"a\", \"b\"])\n\n # One column contains raw HTML (string input)\n out = StringIO()\n t.write(out, format=\"ascii.html\", htmldict={\"raw_html_cols\": \"a\"})\n expected = \"\"\"\\\n \n x\n <em>y</em>\n \"\"\"\n assert expected in out.getvalue()\n\n # One column contains raw HTML (list input)\n out = StringIO()\n t.write(out, format=\"ascii.html\", htmldict={\"raw_html_cols\": [\"a\"]})\n assert expected in out.getvalue()\n\n # Two columns contains raw HTML (list input)\n out = StringIO()\n t.write(out, format=\"ascii.html\", htmldict={\"raw_html_cols\": [\"a\", \"b\"]})\n expected = \"\"\"\\\n \n x\n y\n \"\"\"\n assert expected in out.getvalue()"}}},{"rowIdx":3455,"cells":{"response":{"kind":"string","value":"Test that columns can contain raw HTML which is not escaped."},"instruction":{"kind":"string","value":"def test_raw_html_write_clean():\n \"\"\"\n Test that columns can contain raw HTML which is not escaped.\n \"\"\"\n import bleach\n\n t = Table(\n [[\"\"], [\"

y

\"], [\"y\"]], names=[\"a\", \"b\", \"c\"]\n )\n\n # Confirm that