sample_id stringlengths 21 196 | text stringlengths 105 936k | metadata dict | category stringclasses 6
values |
|---|---|---|---|
locustio/locust:examples/markov_taskset.py | from locust import MarkovTaskSet, User, constant, transition, transitions
"""
This example demonstrates the different ways to specify transitions in a MarkovTaskSet.
The MarkovTaskSet class supports several ways to define transitions between tasks:
1. Using @transition decorator for a single transition
2. Stacking mu... | {
"repo_id": "locustio/locust",
"file_path": "examples/markov_taskset.py",
"license": "MIT License",
"lines": 46,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
locustio/locust:locust/test/test_markov_taskset.py | from locust import User, tag
from locust.exception import RescheduleTask
from locust.user.markov_taskset import (
InvalidTransitionError,
MarkovTaskSet,
MarkovTaskTagError,
NoMarkovTasksError,
NonMarkovTaskTransitionError,
transition,
transitions,
)
import random
from .testcases import Loc... | {
"repo_id": "locustio/locust",
"file_path": "locust/test/test_markov_taskset.py",
"license": "MIT License",
"lines": 172,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
locustio/locust:locust/user/markov_taskset.py | from locust.exception import LocustError
from locust.user.task import TaskSetMeta
from locust.user.users import TaskSet
import logging
import random
from collections.abc import Callable
MarkovTaskT = Callable[..., None]
class NoMarkovTasksError(LocustError):
"""Raised when a MarkovTaskSet class doesn't define a... | {
"repo_id": "locustio/locust",
"file_path": "locust/user/markov_taskset.py",
"license": "MIT License",
"lines": 236,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
m-bain/whisperX:whisperx/log_utils.py | import logging
import sys
from typing import Optional
_LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
def setup_logging(
level: str = "info",
log_file: Optional[str] = None,
) -> None:
"""
Configure logging for WhisperX.
Args:
level... | {
"repo_id": "m-bain/whisperX",
"file_path": "whisperx/log_utils.py",
"license": "BSD 2-Clause \"Simplified\" License",
"lines": 51,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_server/export/_session_cache.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import json
from collections import Counter
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
from marimo._server.file_router import AppFileRouter
from marimo._session.state.serialize import (
get_session_cache_fil... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/export/_session_cache.py",
"license": "Apache License 2.0",
"lines": 124,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_server/export/test_session_cache.py | from __future__ import annotations
import json
from typing import Any, cast
from unittest.mock import patch
from marimo._server.export import _session_cache
from marimo._session.state.session_view import SessionView
from marimo._utils.marimo_path import MarimoPath
from marimo._version import __version__
def _write_... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/export/test_session_cache.py",
"license": "Apache License 2.0",
"lines": 238,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_cli/export/_common.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import json
import subprocess
from pathlib import Path
from typing import TYPE_CHECKING, Any
import click
from marimo._server.file_router import flatten_files
from marimo._server.files.directory_scanner import DirectoryScanner
from mari... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/export/_common.py",
"license": "Apache License 2.0",
"lines": 75,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_cli/export/session.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import asyncio
import json
import sys
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional, cast
import click
from marimo._cli.errors import MarimoCLIMissingDependencyError
from marimo._cli.export._common import (
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/export/session.py",
"license": "Apache License 2.0",
"lines": 301,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_cli/test_cli_export_session.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, patch
import click
import pytest
from click.testing import CliRunner
import marimo._cli.export.session as session_module
from marimo._cli.sandbox import SandboxMode
f... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_cli/test_cli_export_session.py",
"license": "Apache License 2.0",
"lines": 233,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/issues/8527-holoviews-dynamicmap.py | # /// script
# dependencies = [
# "holoviews==1.22.1",
# "marimo",
# "numpy",
# ]
# requires-python = ">=3.12"
# ///
import marimo
__generated_with = "0.20.2"
app = marimo.App(width="medium")
@app.cell
def _():
# Taken directly from https://holoviews.org/reference/streams/bokeh/Selection1D_points.ht... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/issues/8527-holoviews-dynamicmap.py",
"license": "Apache License 2.0",
"lines": 41,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_mcp/code_server/lifespan.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import contextlib
from typing import TYPE_CHECKING
from marimo._loggers import marimo_logger
LOGGER = marimo_logger()
if TYPE_CHECKING:
from collections.abc import AsyncIterator
from starlette.applications import Starlette
@... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_mcp/code_server/lifespan.py",
"license": "Apache License 2.0",
"lines": 29,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_mcp/code_server/main.py | # Copyright 2026 Marimo. All rights reserved.
"""
Code Mode MCP Server for Marimo
A minimal MCP server that lets external AI agents execute Python code
in a running marimo kernel via the scratchpad.
"""
from __future__ import annotations
import asyncio
import os
from typing import TYPE_CHECKING, Any
from marimo._ai... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_mcp/code_server/main.py",
"license": "Apache License 2.0",
"lines": 227,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_mcp/code_server/test_code_server.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from unittest.mock import MagicMock
import pytest
from marimo._mcp.code_server.lifespan import code_mcp_server_lifespan
pytest.importorskip("mcp", reason="MCP requires Python 3.10+")
from typing import TYPE_CHECKING
from starlette.ap... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_mcp/code_server/test_code_server.py",
"license": "Apache License 2.0",
"lines": 232,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/markdown/latex_outline.py | import marimo
__generated_with = "0.20.2"
app = marimo.App()
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
# Introduction
This notebook tests that LaTeX renders correctly in the outline panel.
""")
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
## The equation $E = mc^2$
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/markdown/latex_outline.py",
"license": "Apache License 2.0",
"lines": 51,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:tests/_save/test_cache_invalidation.py | # Copyright 2026 Marimo. All rights reserved.
"""Tests for cache invalidation when function body changes."""
from __future__ import annotations
import textwrap
from marimo._runtime.runtime import Kernel
from tests.conftest import ExecReqProvider
class TestCacheInvalidation:
async def test_numeric_return_invali... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_save/test_cache_invalidation.py",
"license": "Apache License 2.0",
"lines": 135,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:examples/outputs/live_raster.py | # /// script
# requires-python = ">=3.13"
# dependencies = [
# "anywidget==0.9.21",
# "marimo>=0.20.2",
# "traitlets==5.14.3",
# ]
# ///
import marimo
__generated_with = "unknown"
app = marimo.App(width="medium")
@app.cell(hide_code=True)
def _(CounterWidget):
CounterWidget(count=42)
return
@ap... | {
"repo_id": "marimo-team/marimo",
"file_path": "examples/outputs/live_raster.py",
"license": "Apache License 2.0",
"lines": 76,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_server/export/_html_asset_server.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import threading
from contextlib import AbstractContextManager
from functools import partial
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
from typing import TYPE_CHECKING, Any, cast
if TYPE_CHECKING:
from pat... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/export/_html_asset_server.py",
"license": "Apache License 2.0",
"lines": 85,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_server/export/_live_notebook_server.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import subprocess
import sys
import tempfile
import time
from contextlib import AbstractContextManager
from pathlib import Path
from urllib.error import URLError
from urllib.request import urlopen
from marimo import _loggers
from marimo.... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/export/_live_notebook_server.py",
"license": "Apache License 2.0",
"lines": 142,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_server/export/_nbformat_png_fallbacks.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING, Any, cast
from marimo._server.export._raster_mime import MIME_TYPES_REPLACED_BY_PNG
from marimo._types.ids import CellId_t
if TYPE_CHECKING:
from collections.abc import Mapping
from nbformat.no... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/export/_nbformat_png_fallbacks.py",
"license": "Apache License 2.0",
"lines": 67,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_server/export/_pdf_raster.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import base64
import json
from copy import deepcopy
from dataclasses import dataclass
from html import unescape
from typing import TYPE_CHECKING, Any, Literal, cast
from marimo import _loggers
from marimo._config.config import DisplayCon... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/export/_pdf_raster.py",
"license": "Apache License 2.0",
"lines": 584,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_server/export/_raster_mime.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Final
from marimo._messaging.mimetypes import KnownMimeType
TEXT_HTML: Final[KnownMimeType] = "text/html"
TEXT_PLAIN: Final[KnownMimeType] = "text/plain"
TEXT_MARKDOWN: Final[KnownMimeType] = "text/markdown"
VEGA_MIM... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/export/_raster_mime.py",
"license": "Apache License 2.0",
"lines": 19,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_server/export/test_nbformat_png_fallbacks.py | from __future__ import annotations
import pytest
from marimo._server.export._nbformat_png_fallbacks import (
inject_png_fallbacks_into_notebook,
)
nbformat = pytest.importorskip("nbformat")
def test_inject_png_fallbacks_replaces_rasterized_mimetypes() -> None:
notebook = nbformat.v4.new_notebook()
cell... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/export/test_nbformat_png_fallbacks.py",
"license": "Apache License 2.0",
"lines": 58,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_server/export/test_pdf_raster.py | from __future__ import annotations
import asyncio
from typing import Any
from unittest.mock import AsyncMock, patch
from marimo._ast.app import App, InternalApp
from marimo._messaging.cell_output import CellChannel, CellOutput
from marimo._messaging.notification import (
CellNotification,
UpdateCellIdsNotific... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/export/test_pdf_raster.py",
"license": "Apache License 2.0",
"lines": 331,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_snippets/data/multi_markdown.py | # Copyright 2026 Marimo. All rights reserved.
import marimo
__generated_with = "0.3.9"
app = marimo.App()
@app.cell
def __(mo):
mo.md(
r"""
# Multi Markdown Snippet
This is the title cell with a description.
"""
)
return
@app.cell
def __(mo):
mo.md(
r"""
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_snippets/data/multi_markdown.py",
"license": "Apache License 2.0",
"lines": 31,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:examples/frameworks/fastapi-auth/main.py | # /// script
# requires-python = ">=3.12"
# dependencies = [
# "fastapi",
# "marimo",
# "starlette",
# "uvicorn",
# "itsdangerous",
# "python-multipart",
# ]
# ///
"""Example: Authentication middleware that passes user info into marimo notebooks.
This shows the recommended pattern for authentic... | {
"repo_id": "marimo-team/marimo",
"file_path": "examples/frameworks/fastapi-auth/main.py",
"license": "Apache License 2.0",
"lines": 148,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:examples/frameworks/fastapi-auth/notebook.py | import marimo
__generated_with = "0.20.0"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
req = mo.app_meta().request
user = req.user if req else None
meta = req.meta if req else None
mo.md(f"""
## User info from `mo.app_meta()... | {
"repo_id": "marimo-team/marimo",
"file_path": "examples/frameworks/fastapi-auth/notebook.py",
"license": "Apache License 2.0",
"lines": 21,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_smoke_tests/sql/explain.py | import marimo
__generated_with = "0.20.2"
app = marimo.App(width="medium", auto_download=["html"], sql_output="native")
@app.cell
def _():
import marimo as mo
import duckdb as db
return db, mo
@app.cell
def _(db):
connection = db.connect(":memory:")
connection.sql(f"""
CREATE OR REPLACE TA... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/sql/explain.py",
"license": "Apache License 2.0",
"lines": 67,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_cli/errors.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Any
import click
from marimo._cli.install_hints import get_install_commands
from marimo._cli.print import bold, green, muted, red
class MarimoCLIError(click.ClickException):
"""Base class for marimo CLI errors."... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/errors.py",
"license": "Apache License 2.0",
"lines": 94,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_cli/install_hints.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Final
from marimo._config.packages import PackageManagerKind, infer_package_manager
from marimo._utils.platform import is_windows
@dataclass(frozen... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/install_hints.py",
"license": "Apache License 2.0",
"lines": 147,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_cli/parser_ux.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Any
import click
from marimo._cli.print import red
def _normalize_usage_message(message: str) -> str:
"""Normalize usage text for concise lowercase error output."""
message = message.strip()
if message.e... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/parser_ux.py",
"license": "Apache License 2.0",
"lines": 54,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_cli/suggestions.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from difflib import get_close_matches
from typing import TYPE_CHECKING
from marimo._utils.edit_distance import edit_distance
if TYPE_CHECKING:
from collections.abc import Iterable
def _dedupe(items: Iterable[str]) -> list[str]:
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/suggestions.py",
"license": "Apache License 2.0",
"lines": 76,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_utils/edit_distance.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
def edit_distance(left: str, right: str) -> int:
"""Return the Levenshtein edit distance between two strings."""
if left == right:
return 0
if not left:
return len(right)
if not right:
return len(l... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/edit_distance.py",
"license": "Apache License 2.0",
"lines": 27,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_cli/test_cli_errors.py | # Copyright 2026 Marimo. All rights reserved.
# NB. test_cli_errors.py because test_errors.py name causes pycache errors
# with pytest.
from __future__ import annotations
from io import StringIO
from pathlib import Path
from unittest.mock import patch
from marimo._cli.errors import MarimoCLIError, MarimoCLIMissingDep... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_cli/test_cli_errors.py",
"license": "Apache License 2.0",
"lines": 62,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_cli/test_install_hints.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from unittest.mock import patch
from marimo._cli.install_hints import (
get_install_commands,
get_playwright_chromium_setup_commands,
get_post_install_commands,
get_upgrade_commands,
)
def test_install_commands_uv_proje... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_cli/test_install_hints.py",
"license": "Apache License 2.0",
"lines": 188,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_cli/test_suggestions.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from marimo._cli.suggestions import suggest_commands, suggest_short_options
def test_suggest_commands_close_match() -> None:
candidates = ["edit", "export", "run", "tutorial"]
assert suggest_commands("xport", candidates) == ["ex... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_cli/test_suggestions.py",
"license": "Apache License 2.0",
"lines": 15,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_utils/test_edit_distance.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from marimo._utils.edit_distance import edit_distance
def test_edit_distance() -> None:
assert edit_distance("kitten", "sitting") == 3
assert edit_distance("export", "export") == 0
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_edit_distance.py",
"license": "Apache License 2.0",
"lines": 6,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_ai/_tools/tools/dependency_graph.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from collections import deque
from dataclasses import dataclass, field
from typing import Optional
from marimo._ai._tools.base import ToolBase
from marimo._ai._tools.types import SuccessResult, ToolGuidelines
from marimo._ai._tools.utils... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/tools/dependency_graph.py",
"license": "Apache License 2.0",
"lines": 235,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_ai/tools/tools/test_dependency_graph.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from unittest.mock import Mock
import pytest
from marimo._ai._tools.base import ToolContext
from marimo._ai._tools.tools.dependency_graph import (
GetCellDependencyGraph,
GetCellDependencyGraphArgs,
VariableInfo,
)
from mari... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ai/tools/tools/test_dependency_graph.py",
"license": "Apache License 2.0",
"lines": 292,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_sql/sql_quoting.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import re
def quote_sql_identifier(identifier: str, *, dialect: str = "duckdb") -> str:
"""
Quote a SQL identifier for the given dialect, escaping special characters.
Args:
identifier: The raw identifier string (dat... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_sql/sql_quoting.py",
"license": "Apache License 2.0",
"lines": 74,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_sql/test_sql_quoting.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._sql.sql_quoting import (
parse_fully_qualified_table_name,
quote_qualified_name,
quote_sql_identifier,
)
class TestQuoteSqlIdentifier:
@pytest.mark.parametrize(
("identifier", "dialect... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_sql/test_sql_quoting.py",
"license": "Apache License 2.0",
"lines": 205,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:examples/storage/general.py | # /// script
# requires-python = ">=3.13"
# dependencies = [
# "fsspec==2026.2.0",
# "marimo>=0.19.9",
# "obstore==0.8.2",
# "python-dotenv==1.2.1",
# "requests==2.32.5",
# "s3fs==2026.2.0",
# ]
# ///
import marimo
__generated_with = "0.19.11"
app = marimo.App(width="medium")
@app.cell
def _... | {
"repo_id": "marimo-team/marimo",
"file_path": "examples/storage/general.py",
"license": "Apache License 2.0",
"lines": 59,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_server/api/endpoints/storage.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from starlette.authentication import requires
from marimo import _loggers
from marimo._server.api.utils import dispatch_control_request
from marimo._server.models.models import (
BaseResponse,
St... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/api/endpoints/storage.py",
"license": "Apache License 2.0",
"lines": 64,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:tests/_runtime/test_runtime_external_storage.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import threading
from unittest.mock import AsyncMock, MagicMock
import pytest
from dirty_equals import IsPositiveFloat, IsStr
from marimo._data._external_storage.models import StorageEntry
from marimo._data._external_storage.storage im... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_runtime/test_runtime_external_storage.py",
"license": "Apache License 2.0",
"lines": 806,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_server/api/endpoints/test_storage_endpoints.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from tests._server.mocks import token_header, with_read_session, with_session
if TYPE_CHECKING:
from starlette.testclient import TestClient
SESSION_ID = "session-123"
HEADERS = {
"Marimo-Session... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/api/endpoints/test_storage_endpoints.py",
"license": "Apache License 2.0",
"lines": 75,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_session/state/test_session_external_storage.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from inline_snapshot import snapshot
from marimo._data._external_storage.models import StorageNamespace
from marimo._messaging.notification import (
StorageNamespacesNotification,
VariableDeclarationNotification,
VariablesNot... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_session/state/test_session_external_storage.py",
"license": "Apache License 2.0",
"lines": 227,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_runtime/cell_output_list.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import threading
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from marimo._output.hypertext import Html
class CellOutputList:
"""Thread-safe container for a cell's imperatively constructed output."""
def __init__(sel... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_runtime/cell_output_list.py",
"license": "Apache License 2.0",
"lines": 48,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_smoke_tests/threads/multiple_appends.py | import marimo
__generated_with = "0.20.1"
app = marimo.App()
@app.cell
def _():
import marimo as mo
import time
import threading
return mo, threading, time
@app.cell
def _(mo, threading, time):
def append():
for i in range(3):
mo.output.append(f"{i}: Hello from {threading.g... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/threads/multiple_appends.py",
"license": "Apache License 2.0",
"lines": 42,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_smoke_tests/threads/progress_bar_threads.py | import marimo
__generated_with = "0.20.1"
app = marimo.App()
@app.cell
def _():
import marimo as mo
import random
import time
import threading
return mo, random, threading, time
@app.cell
def _(mo, random, threading, time):
def step(pbar: mo.status.progress_bar, work: int):
for _ i... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/threads/progress_bar_threads.py",
"license": "Apache License 2.0",
"lines": 41,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_runtime/test_cell_output_list.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from unittest.mock import MagicMock
import pytest
from marimo._runtime.cell_output_list import CellOutputList
def _html(text: str) -> MagicMock:
m = MagicMock()
m.__repr__ = lambda _: text
return m
class TestCellOutputLi... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_runtime/test_cell_output_list.py",
"license": "Apache License 2.0",
"lines": 57,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_plugins/ui/_impl/mpl.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import base64
import io
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Final,
Protocol,
cast,
)
from marimo._dependencies.dependencies import DependencyManager
from marimo._output.rich_help import m... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_plugins/ui/_impl/mpl.py",
"license": "Apache License 2.0",
"lines": 224,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_smoke_tests/ui_matplotlib.py | import marimo
__generated_with = "0.20.1"
app = marimo.App()
@app.cell
def _():
import marimo as mo
import matplotlib.pyplot as plt
import pymde
import numpy as np
return mo, np, plt, pymde
@app.cell
def _(pymde):
mnist = pymde.datasets.MNIST()
return (mnist,)
@app.cell
def _(mnist... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/ui_matplotlib.py",
"license": "Apache License 2.0",
"lines": 136,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_plugins/ui/_impl/test_ui_mpl.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import io
from typing import Any
import matplotlib.pyplot as plt # noqa: E402
import pytest
from marimo._plugins.ui._impl.mpl import ( # noqa: E402
BoxSelection,
EmptySelection,
LassoSelection,
_figure_pixel_size,
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_plugins/ui/_impl/test_ui_mpl.py",
"license": "Apache License 2.0",
"lines": 257,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:examples/ui/matrix.py | import marimo
__generated_with = "0.19.11"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
import numpy as np
return mo, np
@app.cell
def _(mo):
matrix = mo.ui.matrix(
[[1, 0, 0], [0, 1, 0], [0, 0, 1]],
min_value=-5,
max_value=10,
step=0.001,... | {
"repo_id": "marimo-team/marimo",
"file_path": "examples/ui/matrix.py",
"license": "Apache License 2.0",
"lines": 35,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_plugins/ui/_impl/matrix.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
Final,
)
from marimo._output.rich_help import mddoc
from marimo._plugins.ui._core.ui_element import UIElement
if TYPE_CHECKING:
from numpy.typing import ArrayLike
Numeric = int ... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_plugins/ui/_impl/matrix.py",
"license": "Apache License 2.0",
"lines": 448,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_smoke_tests/matrix.py | # Copyright 2026 Marimo. All rights reserved.
import marimo
__generated_with = "0.19.11"
app = marimo.App()
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell(hide_code=True)
def _(mo):
mo.md("""
## Basic matrix (2x2 identity)
""")
return
@app.cell
def _(mo):
identity = m... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/matrix.py",
"license": "Apache License 2.0",
"lines": 313,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_smoke_tests/vector.py | # Copyright 2026 Marimo. All rights reserved.
import marimo
__generated_with = "0.19.11"
app = marimo.App()
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell(hide_code=True)
def _(mo):
mo.md("""
## Basic column vector (1D matrix)
""")
return
@app.cell
def _(mo):
col = mo... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/vector.py",
"license": "Apache License 2.0",
"lines": 130,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_plugins/ui/_impl/test_matrix.py | from __future__ import annotations
import pytest
from marimo._plugins import ui
# =========================================================================
# 2D matrix tests (original)
# =========================================================================
def test_matrix_basic():
m = ui.matrix([[1, 2], [3... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_plugins/ui/_impl/test_matrix.py",
"license": "Apache License 2.0",
"lines": 290,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_cli/test_cli_export_thumbnail.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import os
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, patch
from click.testing import CliRunner
import marimo._cli.export.thumbnail as thumbnail_module
from marimo._cli.sandbox import SandboxMode
if TYPE_CHECK... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_cli/test_cli_export_thumbnail.py",
"license": "Apache License 2.0",
"lines": 195,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_messaging/thread_local_streams.py | # Copyright 2026 Marimo. All rights reserved.
"""Thread-local stream proxy for run mode.
In run mode, multiple sessions share the same process. Each session runs in its
own thread and needs sys.stdout / sys.stderr to route output to that session's
frontend connection.
ThreadLocalStreamProxy wraps the real sys.stdout ... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_messaging/thread_local_streams.py",
"license": "Apache License 2.0",
"lines": 112,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_messaging/test_thread_local_proxy.py | # Copyright 2026 Marimo. All rights reserved.
"""Tests for ThreadLocalStreamProxy and thread-local stream helpers."""
from __future__ import annotations
import io
import sys
import threading
from unittest.mock import MagicMock
from marimo._messaging.thread_local_streams import (
ThreadLocalStreamProxy,
clear... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_messaging/test_thread_local_proxy.py",
"license": "Apache License 2.0",
"lines": 304,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/test_project_dependencies.py | from __future__ import annotations
from pathlib import Path
import pytest
from tests.mocks import snapshotter
snapshot = snapshotter(__file__)
def _load_pyproject():
import tomlkit
pyproject_path = Path(__file__).parent.parent / "pyproject.toml"
return tomlkit.loads(pyproject_path.read_text())
def ... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/test_project_dependencies.py",
"license": "Apache License 2.0",
"lines": 21,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/markdown/latex_display_math.py | import marimo
__generated_with = "0.19.10"
app = marimo.App()
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
hello $$f(x) = y$$ world
""")
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
hello
$$f(x) = y$$
world
""")
return
@app.cell(hide_code=True)
def _(mo):
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/markdown/latex_display_math.py",
"license": "Apache License 2.0",
"lines": 30,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_output/formatters/pytorch_formatters.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import dataclasses
import html
import re
import typing
from marimo._output.formatters.formatter_factory import FormatterFactory
from marimo._output.hypertext import Html
if typing.TYPE_CHECKING:
import torch # type: ignore[import-n... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_output/formatters/pytorch_formatters.py",
"license": "Apache License 2.0",
"lines": 608,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_smoke_tests/formatters/pytorch_formatters.py | # /// script
# dependencies = [
# "marimo",
# "torch==2.10.0",
# ]
# requires-python = ">=3.13"
# ///
import marimo
__generated_with = "0.19.11"
app = marimo.App()
with app.setup:
import torch.nn as nn
import numpy
import torch
torch.device("mps")
@app.cell
def _():
# Simple MLP
ml... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/formatters/pytorch_formatters.py",
"license": "Apache License 2.0",
"lines": 212,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_output/formatters/test_pytorch_formatters.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._dependencies.dependencies import DependencyManager
from marimo._output.formatters.formatters import register_formatters
HAS_DEPS = DependencyManager.torch.has()
@pytest.mark.skipif(not HAS_DEPS, reason="torc... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_output/formatters/test_pytorch_formatters.py",
"license": "Apache License 2.0",
"lines": 230,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_cli/files/cloudflare.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import os
import shutil
import subprocess
from pathlib import Path
from typing import TYPE_CHECKING, Optional
import click
from marimo._cli.files.file_path import FileHandler
if TYPE_CHECKING:
from tempfile import TemporaryDirector... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/files/cloudflare.py",
"license": "Apache License 2.0",
"lines": 74,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_cli/test_cloudflare.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import subprocess
import tempfile
from unittest.mock import patch
import click
import pytest
from marimo._cli.files.cloudflare import (
R2FileHandler,
_download_r2_object,
parse_r2_path,
)
from marimo._cli.files.file_path im... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_cli/test_cloudflare.py",
"license": "Apache License 2.0",
"lines": 112,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/issues/5129.py | # Regression test for https://github.com/marimo-team/marimo/issues/5129
# mo.lazy inside mo.ui.tabs should only execute the function once.
# Previously, the shadow DOM created a duplicate marimo-lazy element
# which fired a second load() request.
import marimo
__generated_with = "0.13.14"
app = marimo.App(width="medi... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/issues/5129.py",
"license": "Apache License 2.0",
"lines": 25,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_smoke_tests/nested.py | # Smoke tests for nested marimo custom elements.
# Verifies that interactive widgets, lazy loading, and layout components
# work correctly when nested inside each other (especially inside shadow DOM).
# Related: https://github.com/marimo-team/marimo/issues/5129
import marimo
__generated_with = "0.19.11"
app = marimo.... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/nested.py",
"license": "Apache License 2.0",
"lines": 318,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_data/_external_storage/get_storage.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Any
from marimo._data._external_storage.models import (
StorageBackend,
StorageNamespace,
)
from marimo._data._external_storage.storage import FsspecFilesystem, Obstore
from marimo._types.ids import VariableNam... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_data/_external_storage/get_storage.py",
"license": "Apache License 2.0",
"lines": 37,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_data/_external_storage/models.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import abc
from dataclasses import dataclass
from typing import Any, Generic, Literal, TypeVar, cast, get_args
import msgspec
from marimo._types.ids import VariableName
from marimo._utils.assert_never import log_never
CLOUD_STORAGE_TYP... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_data/_external_storage/models.py",
"license": "Apache License 2.0",
"lines": 138,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_data/_external_storage/storage.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import asyncio
import mimetypes
from datetime import timedelta
from typing import TYPE_CHECKING, Any, Literal, cast
from marimo import _loggers
from marimo._data._external_storage.models import (
CLOUD_STORAGE_TYPES,
DEFAULT_FETC... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_data/_external_storage/storage.py",
"license": "Apache License 2.0",
"lines": 356,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_data/_external_storage/test_get_storage.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Any
from unittest.mock import MagicMock
import pytest
from inline_snapshot import snapshot
from marimo._data._external_storage.get_storage import (
get_storage_backends_from_variables,
storage_backend_to_stora... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_data/_external_storage/test_get_storage.py",
"license": "Apache License 2.0",
"lines": 147,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_data/_external_storage/test_storage_models.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import tempfile
from datetime import datetime, timedelta, timezone
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from dirty_equals import IsDatetime, IsPositiveFloat
from inline_snapshot impor... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_data/_external_storage/test_storage_models.py",
"license": "Apache License 2.0",
"lines": 1034,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/issues/8184_mpl_interactive_large_plot.py | import marimo
__generated_with = "0.19.11"
app = marimo.App()
@app.cell
def _():
import marimo as mo
import matplotlib.pyplot as plt
import numpy as np
return mo, np, plt
@app.cell
def _(mo, np, plt):
# n=200 should work
plt.figure()
plt.imshow(np.random.random([200, 200]))
mo.mpl.... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/issues/8184_mpl_interactive_large_plot.py",
"license": "Apache License 2.0",
"lines": 32,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_utils/test_format_signature.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._utils.format_signature import format_signature
class TestFormatSignature:
@pytest.mark.parametrize(
("sig", "expected_return"),
[
# Short (fits on 1 line)
("f() -> ... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_format_signature.py",
"license": "Apache License 2.0",
"lines": 48,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_runtime/runner/test_cancelled_cells.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._runtime.runner.hook_context import CancelledCells
from marimo._types.ids import CellId_t
class TestCancelledCells:
def test_empty(self) -> None:
cc = CancelledCells()
assert not cc
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_runtime/runner/test_cancelled_cells.py",
"license": "Apache License 2.0",
"lines": 67,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_utils/variable_name.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import inspect
from typing import Any
from marimo import _loggers
LOGGER = _loggers.marimo_logger()
def infer_variable_name(value: Any, fallback: str) -> str:
"""Infer the variable name that holds ``value`` in the caller's caller.... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/variable_name.py",
"license": "Apache License 2.0",
"lines": 32,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_runtime/runner/hook_context.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Callable, TypeAlias, Union
from marimo._config.config import OnCellChangeType
from marimo._messaging.errors import Error
from marimo._types.ids import CellId_t
if ... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_runtime/runner/hook_context.py",
"license": "Apache License 2.0",
"lines": 71,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_runtime/runner/test_hooks.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._runtime.runner.hooks import (
NotebookCellHooks,
Priority,
create_default_hooks,
)
@pytest.fixture
def hooks() -> NotebookCellHooks:
return NotebookCellHooks()
class TestNotebookCellHooks:
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_runtime/runner/test_hooks.py",
"license": "Apache License 2.0",
"lines": 56,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_utils/subprocess.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import subprocess
from collections.abc import Callable, Mapping, Sequence
from typing import (
IO,
Any,
Literal,
overload,
)
from marimo import _loggers
LOGGER = _loggers.marimo_logger()
# Type aliases matching typeshed... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/subprocess.py",
"license": "Apache License 2.0",
"lines": 254,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_utils/test_subprocess.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import subprocess
from unittest.mock import patch
from marimo._utils.subprocess import safe_popen
class TestSafePopen:
def test_successful_popen(self):
proc = safe_popen(
["echo", "hello"],
stdout=su... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_subprocess.py",
"license": "Apache License 2.0",
"lines": 56,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_cli/help_formatter.py | # Copyright 2026 Marimo. All rights reserved.
#
# Colored Click classes for CLI help formatting.
#
# These follow cargo's color conventions:
# - Bold bright green for section headers (Usage:, Options:, Commands:)
# - Bold bright cyan for command/option names
from __future__ import annotations
import click
from click.... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_cli/help_formatter.py",
"license": "Apache License 2.0",
"lines": 164,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_smoke_tests/latex/704.py | import marimo
__generated_with = "0.19.6"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
# Incrementing functions
Bug from [#704](https://github.com/marimo-team/marimo/discussions/704)
""")
return
@a... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/latex/704.py",
"license": "Apache License 2.0",
"lines": 26,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_metadata/opengraph.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import ast
import asyncio
import importlib
import inspect
import re
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable, Literal, cast
from urllib.parse import urlparse
import msgspec
from marimo ... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_metadata/opengraph.py",
"license": "Apache License 2.0",
"lines": 502,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_metadata/test_opengraph.py | from __future__ import annotations
import textwrap
from marimo._metadata.opengraph import (
DEFAULT_OPENGRAPH_PLACEHOLDER_IMAGE_GENERATOR,
OpenGraphConfig,
default_opengraph_image,
read_opengraph_from_file,
read_opengraph_from_pyproject,
resolve_opengraph_metadata,
)
def test_read_opengraph_... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_metadata/test_opengraph.py",
"license": "Apache License 2.0",
"lines": 179,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_utils/test_methods.py | # Copyright 2026 Marimo. All rights reserved.
from marimo._utils.methods import getcallable, is_callable_method
def test_getcallable() -> None:
"""Test the getcallable utility function."""
class WithCallable:
def my_method(self) -> str:
return "called"
class WithNonCallable:
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_methods.py",
"license": "Apache License 2.0",
"lines": 52,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/issues/8023_stale_table.py | import marimo
app = marimo.App()
@app.cell
def _():
import marimo as mo
import pandas as pd
return mo, pd
@app.cell
def _(mo):
data_version, set_data_version = mo.state(0)
return data_version, set_data_version
@app.cell
def _():
data = [
{"id": 1, "status": "pending", "value": 10},
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/issues/8023_stale_table.py",
"license": "Apache License 2.0",
"lines": 47,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_server/api/endpoints/lsp.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from starlette.authentication import requires
from marimo._server.api.deps import AppState
from marimo._server.api.utils import parse_request
from marimo._server.models.lsp import (
LspHealthResponse... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/api/endpoints/lsp.py",
"license": "Apache License 2.0",
"lines": 52,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_server/models/lsp.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Literal, NewType, Optional
import msgspec
# Type-safe server identifier
LspServerId = NewType("LspServerId", str)
# Status enum for LSP server health
LspServerStatus = Literal[
"starting", # process launched, in... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/models/lsp.py",
"license": "Apache License 2.0",
"lines": 43,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_server/api/endpoints/test_lsp_endpoints.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
import uvicorn
from starlette.testclient import TestClient
from marimo._server.lsp import (
BaseLspServer,
CompositeLspSer... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/api/endpoints/test_lsp_endpoints.py",
"license": "Apache License 2.0",
"lines": 261,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/plotly/scattermap_selection.py | import marimo
__generated_with = "0.19.5"
app = marimo.App(width="medium", auto_download=["html"])
with app.setup:
import marimo as mo
import pandas as pd
import plotly.graph_objects as go
@app.cell
def _():
df_mock = pd.DataFrame(
{
"id": ["WC_0001", "WC_0002", "WC_0003", "WC_00... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/plotly/scattermap_selection.py",
"license": "Apache License 2.0",
"lines": 52,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_runtime/runner/test_kernel_runner.py | from typing import cast
import pytest
from marimo._runtime.app.kernel_runner import AppKernelRunner
from marimo._types.ids import CellId_t
def _make_runner():
# Bypass __init__ since we only test caching logic
runner = AppKernelRunner.__new__(AppKernelRunner)
runner._previously_seen_defs = None
runn... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_runtime/runner/test_kernel_runner.py",
"license": "Apache License 2.0",
"lines": 30,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/plotly/shapes.py | import marimo
__generated_with = "0.19.5"
app = marimo.App(width="medium", auto_download=["html"])
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _():
import plotly.express as px
import numpy as np
return np, px
@app.cell
def _(mo):
plot_boxes = mo.ui.checkbox(label="Pl... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/plotly/shapes.py",
"license": "Apache License 2.0",
"lines": 47,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_utils/test_platform.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from unittest.mock import patch
from click.testing import CliRunner
from marimo._cli.cli import main
from marimo._utils.platform import (
check_shared_memory_available,
is_pyodide,
is_windows,
)
class TestIsWindows:
de... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_platform.py",
"license": "Apache License 2.0",
"lines": 79,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_internal/commands.py | # Copyright 2026 Marimo. All rights reserved.
"""Internal API for commands."""
from marimo._runtime.commands import (
AppMetadata,
ClearCacheCommand,
CodeCompletionCommand,
Command,
CommandMessage,
CreateNotebookCommand,
DebugCellCommand,
DeleteCellCommand,
ExecuteCellCommand,
E... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_internal/commands.py",
"license": "Apache License 2.0",
"lines": 78,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_internal/config.py | # Copyright 2026 Marimo. All rights reserved.
"""Internal API for configuration management."""
from marimo._config.config import (
DisplayConfig,
MarimoConfig,
PartialMarimoConfig,
)
from marimo._config.manager import (
MarimoConfigManager,
get_default_config_manager,
)
__all__ = [
"DisplayCon... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_internal/config.py",
"license": "Apache License 2.0",
"lines": 18,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_internal/converters.py | # Copyright 2026 Marimo. All rights reserved.
"""Internal API for notebook converters."""
from marimo._convert.converters import MarimoConvert
__all__ = [
"MarimoConvert",
]
| {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_internal/converters.py",
"license": "Apache License 2.0",
"lines": 6,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_internal/ids.py | # Copyright 2026 Marimo. All rights reserved.
"""Internal API for ID types."""
from marimo._types.ids import (
CellId_t,
ConsumerId,
SessionId,
UIElementId,
VariableName,
)
__all__ = [
"CellId_t",
"ConsumerId",
"SessionId",
"UIElementId",
"VariableName",
]
| {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_internal/ids.py",
"license": "Apache License 2.0",
"lines": 16,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_internal/ipc.py | # Copyright 2026 Marimo. All rights reserved.
"""Internal API for inter-process communication (IPC)."""
from marimo._ipc.connection import Channel, Connection
from marimo._ipc.queue_manager import QueueManager
from marimo._ipc.types import ConnectionInfo, KernelArgs
__all__ = [
"Channel",
"Connection",
"C... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_internal/ipc.py",
"license": "Apache License 2.0",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.