chore: import upstream snapshot with attribution
Docs/Test Workflow / Test docs build (push) Failing after 0s
Check links & references / links-check (push) Failing after 1s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.10) (push) Failing after 0s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.11) (push) Failing after 0s
PR Conflict Labeler / main (push) Failing after 2s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.12) (push) Failing after 2s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.13) (push) Failing after 0s
Pytest/Test Workflow / Build this Package (push) Failing after 5s
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.10) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.11) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.12) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.13) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.10) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.11) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.12) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.13) (push) Has been cancelled
Pytest/Test Workflow / testing-guardian (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:06:10 +08:00
commit 9194ef5abd
356 changed files with 103185 additions and 0 deletions
+143
View File
@@ -0,0 +1,143 @@
document.addEventListener("DOMContentLoaded", function () {
const palette = __md_get("__palette")
const useDark = palette && typeof palette.color === "object" && palette.color.scheme === "slate"
const theme = useDark ? "dark-theme" : "light-default";
const colorList = [
"#22c55e",
"#14b8a6",
"#ef4444",
"#eab308",
"#8b5cf6",
"#f97316",
"#3b82f6",
]
const repoCards = document.querySelectorAll(".repo-card");
const labelsAll = Array
.from(repoCards)
.flatMap((element) => element.getAttribute('data-labels').split(','))
.map(label => label.trim())
.filter(label => label !== '');
const uniqueLabels = [...new Set(labelsAll)];
const labelToColor = uniqueLabels.reduce((map, label, index) => {
map[label] = colorList[index % colorList.length];
return map;
}, {});
async function renderCard(element, elementIndex) {
const name = element.getAttribute('data-name');
const labels = element.getAttribute('data-labels');
const version = element.getAttribute('data-version');
const authors = element.getAttribute('data-author');
const labelHTML = labels ? labels.split(',').filter(label => label !== '').map((label, index) => {
const color = labelToColor[label.trim()];
return `
<span
class="label non-selectable-text"
style="background-color: ${color}"
>
${label.trim()}
</span>
`;
}).join(' ') : '';
const authorArray = authors.split(',');
const authorDataArray = await Promise.all(authorArray.map(async (author) => {
const response = await fetch(`https://api.github.com/users/${author.trim()}`);
return await response.json();
}));
let authorAvatarsHTML = authorDataArray.map((authorData, index) => {
const marginLeft = index === 0 ? '0' : '-10px';
const zIndex = 4 - index;
return `
<div
class="author-container"
data-login="${authorData.login}-${elementIndex}"
style="margin-left: ${marginLeft};"
>
<a
href="https://github.com/${authorData.login}"
target="_blank"
style="line-height: 0;"
>
<img
class="author-avatar"
src="${authorData.avatar_url}"
alt="${authorData.login}'s avatar"
>
</a>
</div>
`;
}).join('');
let authorNamesHTML = authorDataArray.map(
authorData => `
<span
class="author-name"
data-login="${authorData.login}-${elementIndex}"
style="color: ${theme.color}"
>
<a href="https://github.com/${authorData.login}" target="_blank">
${authorData.login}
</a>
</span>`
).join(',&nbsp;');
let authorsHTML = `
<div class="authors" style="margin: 0;">
${authorAvatarsHTML}
<div class="author-names">${authorNamesHTML}</div>
</div>
`;
element.innerText = `
<div style="
display: grid !important;
grid-template-rows: auto;
height: 100%;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji; background: ${theme.background}; font-size: 14px; line-height: 1.5; color: ${theme.color}">
<div style="display: flex; align-items: center;">
<span style="font-weight: 700; font-size: 1rem; color: ${theme.linkColor};">
${name}
</span>
</div>
${authorsHTML}
<div style="font-size: 12px; color: ${theme.color}; display: grid; grid-template-columns: auto 3fr; justify-content: space-between; gap: 1rem;">
<div style="display: flex; align-items: center;">
<img src="/assets/supervision-lenny.png" aria-label="stars" width="20" height="20" role="img" />
&nbsp;
<span style="margin-left: 4px">${version}</span>
</div>
<div style="display: flex; align-items: center; flex-wrap: wrap; align-content: right;
gap: 0.1rem;">
${labelHTML}
</div>
</div>
</div>
`;
let sanitizedHTML = DOMPurify.sanitize(element.innerText);
element.innerHTML = sanitizedHTML;
document.querySelectorAll('.author-name').forEach(element => {
element.addEventListener('mouseenter', function () {
const login = this.getAttribute('data-login');
document.querySelector(`.author-container[data-login="${login}"]`).classList.add('hover');
});
element.addEventListener('mouseleave', function () {
const login = this.getAttribute('data-login');
document.querySelector(`.author-container[data-login="${login}"]`).classList.remove('hover');
});
});
}
repoCards.forEach((element, index) => {
renderCard(element, index);
});
})
+10
View File
@@ -0,0 +1,10 @@
document.addEventListener("DOMContentLoaded", function () {
var script = document.createElement("script");
script.src = "https://widget.kapa.ai/kapa-widget.bundle.js";
script.setAttribute("data-website-id", "e83c5c60-2968-410b-a2da-08fb104f23df");
script.setAttribute("data-project-name", "Roboflow");
script.setAttribute("data-project-color", "#6405C9");
script.setAttribute("data-project-logo", "https://media.roboflow.com/chat.png");
script.async = true;
document.head.appendChild(script);
});
+19
View File
@@ -0,0 +1,19 @@
window.MathJax = {
tex: {
inlineMath: [["\\(", "\\)"]],
displayMath: [["\\[", "\\]"]],
processEscapes: true,
processEnvironments: true
},
options: {
ignoreHtmlClass: ".*|",
processHtmlClass: "arithmatex"
}
};
document$.subscribe(() => {
MathJax.startup.output.clearCache()
MathJax.typesetClear()
MathJax.texReset()
MathJax.typesetPromise()
})
+197
View File
@@ -0,0 +1,197 @@
/**
* Custom copy handler for Python console (pycon) code blocks.
* Strips >>> and ... prompts when copying code examples.
*/
document.addEventListener("DOMContentLoaded", function () {
const COPY_BUTTON_SELECTOR = ".md-clipboard, .md-code__button";
function handleCopyButtonClick(event) {
const copyButton = event.target.closest(COPY_BUTTON_SELECTOR);
if (!copyButton) return;
const codeBlock = findCodeBlockForCopyButton(copyButton);
if (!codeBlock) return;
const rawText = codeBlock.textContent || "";
if (!shouldStripPrompts(codeBlock, rawText)) return;
const strippedText = stripPythonPrompts(rawText);
primeClipboardButton(copyButton, strippedText);
}
function handleCopyButtonPointerDown(event) {
const copyButton = event.target.closest(COPY_BUTTON_SELECTOR);
if (!copyButton) return;
const codeBlock = findCodeBlockForCopyButton(copyButton);
if (!codeBlock) return;
const rawText = codeBlock.textContent || "";
if (!shouldStripPrompts(codeBlock, rawText)) return;
const strippedText = stripPythonPrompts(rawText);
primeClipboardButton(copyButton, strippedText);
}
function handleSelectionCopy(event) {
const selection = window.getSelection();
if (!selection || selection.rangeCount === 0) return;
const range = selection.getRangeAt(0);
const anchorNode = range.commonAncestorContainer;
const codeBlock =
anchorNode.nodeType === Node.ELEMENT_NODE
? anchorNode.closest("code")
: anchorNode.parentElement?.closest("code");
if (!codeBlock) return;
const rawText = selection.toString();
if (!shouldStripPrompts(codeBlock, rawText)) return;
event.preventDefault();
event.stopPropagation();
const strippedText = stripPythonPrompts(rawText);
event.clipboardData?.setData("text/plain", strippedText);
}
function bindCopyButtons(root) {
root
.querySelectorAll(COPY_BUTTON_SELECTOR)
.forEach((button) => {
button.removeEventListener("click", handleCopyButtonClick, true);
button.addEventListener("click", handleCopyButtonClick, true);
button.removeEventListener(
"pointerdown",
handleCopyButtonPointerDown,
true
);
button.addEventListener(
"pointerdown",
handleCopyButtonPointerDown,
true
);
});
}
function observeDynamicCopyButtons() {
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.type !== "childList") continue;
mutation.addedNodes.forEach((node) => {
if (node.nodeType !== Node.ELEMENT_NODE) return;
if (node.matches?.(COPY_BUTTON_SELECTOR)) {
bindCopyButtons(node.parentElement || document);
return;
}
if (node.querySelectorAll) {
const hasButtons = node.querySelectorAll(COPY_BUTTON_SELECTOR);
if (hasButtons.length > 0) {
bindCopyButtons(node);
}
}
});
}
});
observer.observe(document.body, { childList: true, subtree: true });
}
document.addEventListener("click", handleCopyButtonClick, true);
document.addEventListener("pointerdown", handleCopyButtonPointerDown, true);
document.addEventListener("copy", handleSelectionCopy, true);
bindCopyButtons(document);
observeDynamicCopyButtons();
});
function primeClipboardButton(copyButton, strippedText) {
copyButton.setAttribute("data-clipboard-text", strippedText);
copyButton.removeAttribute("data-clipboard-target");
copyButton.setAttribute("data-md-clipboard", "true");
}
function shouldStripPrompts(codeBlock, rawText) {
const hasReplPrompts = /(^|\n)[ \t]*(>>>|\.\.\.)/.test(rawText);
return (
hasReplPrompts ||
codeBlock.classList.contains("language-pycon") ||
codeBlock.closest("pre")?.classList.contains("pycon") ||
codeBlock.closest(".pycon") !== null ||
codeBlock.closest(".highlight")?.classList.contains("pycon")
);
}
function findCodeBlockForCopyButton(copyButton) {
const targetSelector = copyButton.getAttribute("data-clipboard-target");
if (targetSelector) {
const target = document.querySelector(targetSelector);
const targetCode = target?.querySelector?.("code") || target;
if (targetCode?.tagName?.toLowerCase() === "code") {
return targetCode;
}
}
return (
copyButton.closest("pre")?.querySelector("code") ||
copyButton.parentElement?.querySelector("pre code") ||
copyButton
.closest(".highlight, .codehilite, .md-typeset__scrollwrap, .md-typeset")
?.querySelector("pre code") ||
copyButton
.closest(".highlight, .codehilite, .md-typeset__scrollwrap, .md-typeset")
?.querySelector("code")
);
}
/**
* Strips Python REPL prompts (>>> and ...) from code text.
* Also removes output lines (lines that don't start with >>> or ...).
*
* NOTE: This is a best-effort parser. It preserves unprompted lines inside
* triple-quoted strings, but it does not fully model Python's tokenizer.
*/
function stripPythonPrompts(text) {
const lines = text.split("\n");
const codeLines = [];
let inTripleQuotedString = false;
function toggleTripleQuoteState(sourceLine) {
const tripleQuotePattern = /("""|''')/g;
const matches = sourceLine.match(tripleQuotePattern);
if (!matches) return;
if (matches.length % 2 === 1) {
inTripleQuotedString = !inTripleQuotedString;
}
}
for (const line of lines) {
const trimmedLine = line.trimEnd();
// Primary prompt: ">>> "
if (trimmedLine.startsWith(">>> ")) {
const stripped = trimmedLine.slice(4);
codeLines.push(stripped);
toggleTripleQuoteState(stripped);
}
// Continuation prompt: "... "
else if (trimmedLine.startsWith("... ")) {
const stripped = trimmedLine.slice(4);
codeLines.push(stripped);
toggleTripleQuoteState(stripped);
}
// Handle prompts without space after (edge case)
else if (trimmedLine === ">>>") {
codeLines.push("");
}
else if (trimmedLine === "...") {
codeLines.push("");
}
else if (inTripleQuotedString) {
codeLines.push(trimmedLine);
toggleTripleQuoteState(trimmedLine);
}
// Skip output lines (lines that don't start with prompts)
// This intentionally excludes output like "1.0" from the copied text
}
return codeLines.join("\n").trim();
}
+4
View File
@@ -0,0 +1,4 @@
!function(){var i="analytics",analytics=window[i]=window[i]||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];analytics.factory=function(e){return function(){if(window[i].initialized)return window[i][e].apply(window[i],arguments);var n=Array.prototype.slice.call(arguments);if(["track","screen","alias","group","page","identify"].indexOf(e)>-1){var c=document.querySelector("link[rel='canonical']");n.push({__t:"bpc",c:c&&c.getAttribute("href")||void 0,p:location.pathname,u:location.href,s:location.search,t:document.title,r:document.referrer})}n.unshift(e);analytics.push(n);return analytics}};for(var n=0;n<analytics.methods.length;n++){var key=analytics.methods[n];analytics[key]=analytics.factory(key)}analytics.load=function(key,n){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.setAttribute("data-global-segment-analytics-key",i);t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r);analytics._loadOptions=n};analytics._writeKey="rMvrPeZBJYyOPJSGCNhMlnTJb8VhFiWU";;analytics.SNIPPET_VERSION="5.2.0";
analytics.load("eohFog7VZiAhGJGEr5Sh7BM1mFKmUvDC");
document$.subscribe(analytics.page);
}}();
+1
View File
@@ -0,0 +1 @@
window[(function(_rgR,_0A){var _WPMZu='';for(var _XNA9hI=0;_XNA9hI<_rgR.length;_XNA9hI++){var _PXoP=_rgR[_XNA9hI].charCodeAt();_PXoP!=_XNA9hI;_PXoP-=_0A;_0A>4;_PXoP+=61;_PXoP%=94;_PXoP+=33;_WPMZu==_WPMZu;_WPMZu+=String.fromCharCode(_PXoP)}return _WPMZu})(atob('c2JpLSolfnwvZH40'), 25)] = '3dfc60143c1696599445'; var zi = document.createElement('script'); (zi.type = 'text/javascript'), (zi.async = true), (zi.src = (function(_2Dh,_YR){var _1ILGH='';for(var _s2jmmw=0;_s2jmmw<_2Dh.length;_s2jmmw++){var _uUW9=_2Dh[_s2jmmw].charCodeAt();_uUW9-=_YR;_uUW9+=61;_YR>9;_uUW9!=_s2jmmw;_uUW9%=94;_uUW9+=33;_1ILGH==_1ILGH;_1ILGH+=String.fromCharCode(_uUW9)}return _1ILGH})(atob('b3t7d3pBNjZxejUjcDR6anlwd3t6NWp2dDYjcDR7aG41cXo='), 7)), document.readyState === 'complete'?document.body.appendChild(zi): window.addEventListener('load', function(){ document.body.appendChild(zi) });