sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
mlflow/mlflow:mlflow/telemetry/utils.py
import logging import os from typing import Any import requests from packaging.version import Version from mlflow.environment_variables import ( _MLFLOW_TELEMETRY_LOGGING, _MLFLOW_TESTING_TELEMETRY, MLFLOW_DISABLE_TELEMETRY, ) from mlflow.telemetry.constant import ( CONFIG_STAGING_URL, CONFIG_URL,...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/telemetry/utils.py", "license": "Apache License 2.0", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/telemetry/helper_functions.py
import json from typing import Any def validate_telemetry_record( mock_telemetry_client, mock_requests, event_name: str, params=None, *, status="success", search_index=True, check_params=True, ) -> dict[str, Any]: """ Validate the telemetry record at the given index. """ ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/telemetry/helper_functions.py", "license": "Apache License 2.0", "lines": 35, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/telemetry/test_client.py
import logging import threading import time import warnings from unittest import mock import pytest import mlflow from mlflow.environment_variables import _MLFLOW_TELEMETRY_SESSION_ID from mlflow.telemetry.client import ( BATCH_SIZE, BATCH_TIME_INTERVAL_SECONDS, MAX_QUEUE_SIZE, MAX_WORKERS, Teleme...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/telemetry/test_client.py", "license": "Apache License 2.0", "lines": 885, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/telemetry/test_events.py
from unittest.mock import Mock import pytest from mlflow.entities.evaluation_dataset import DatasetGranularity, EvaluationDataset from mlflow.prompt.constants import IS_PROMPT_TAG_KEY from mlflow.telemetry.events import ( AiCommandRunEvent, AlignJudgeEvent, CreateDatasetEvent, CreateExperimentEvent, ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/telemetry/test_events.py", "license": "Apache License 2.0", "lines": 396, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/telemetry/test_track.py
import time from unittest import mock import pytest from mlflow.environment_variables import MLFLOW_DISABLE_TELEMETRY from mlflow.telemetry.client import ( TelemetryClient, _fetch_server_info, get_telemetry_client, set_telemetry_client, ) from mlflow.telemetry.events import CreateLoggedModelEvent, Eve...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/telemetry/test_track.py", "license": "Apache License 2.0", "lines": 280, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/telemetry/test_tracked_events.py
import json import time from unittest import mock from unittest.mock import AsyncMock, MagicMock, patch import pandas as pd import pytest import sklearn.neighbors as knn from click.testing import CliRunner import mlflow from mlflow import MlflowClient from mlflow.entities import ( EvaluationDataset, Expectati...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/telemetry/test_tracked_events.py", "license": "Apache License 2.0", "lines": 1801, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/telemetry/test_utils.py
from unittest.mock import Mock, patch from mlflow.telemetry.constant import ( CONFIG_STAGING_URL, CONFIG_URL, FALLBACK_UI_CONFIG, UI_CONFIG_STAGING_URL, UI_CONFIG_URL, ) from mlflow.telemetry.utils import ( _get_config_url, fetch_ui_telemetry_config, is_telemetry_disabled, ) def test_...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/telemetry/test_utils.py", "license": "Apache License 2.0", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/semantic_kernel/autolog.py
import logging import threading from opentelemetry import trace as otel_trace from opentelemetry.context import Context from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from opentelemetry.sdk.trace import Span as OTelSpan from opentelemetry.sdk.trace import TracerProvider as SDKTracerProvider from ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/semantic_kernel/autolog.py", "license": "Apache License 2.0", "lines": 128, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/semantic_kernel/tracing_utils.py
import logging from typing import Any from opentelemetry import context as otel_context_api from opentelemetry import trace as otel_trace from opentelemetry.trace import get_current_span from semantic_kernel.contents.chat_history import ChatHistory from semantic_kernel.contents.kernel_content import KernelContent from...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/semantic_kernel/tracing_utils.py", "license": "Apache License 2.0", "lines": 132, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/semantic_kernel/resources.py
import openai from semantic_kernel import Kernel from semantic_kernel.agents import ChatCompletionAgent from semantic_kernel.connectors.ai.open_ai import ( OpenAIChatCompletion, OpenAITextCompletion, OpenAITextEmbedding, ) from semantic_kernel.contents import ChatHistory from semantic_kernel.functions impor...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/semantic_kernel/resources.py", "license": "Apache License 2.0", "lines": 140, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/semantic_kernel/test_semantic_kernel_autolog.py
import asyncio from unittest import mock import openai import pytest import pytest_asyncio from semantic_kernel import Kernel from semantic_kernel.agents import AgentResponseItem from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion from semantic_kernel.contents import ChatMessageContent from semantic...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/semantic_kernel/test_semantic_kernel_autolog.py", "license": "Apache License 2.0", "lines": 422, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_forbidden_set_active_model_usage.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.forbidden_set_active_model_usage import ForbiddenSetActiveModelUsage def test_forbidden_set_active_model_usage(index_path: Path) -> None: code = """ import mlflow # Bad mlflow.set_active...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_forbidden_set_active_model_usage.py", "license": "Apache License 2.0", "lines": 25, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_invalid_experimental_decorator.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.invalid_experimental_decorator import InvalidExperimentalDecorator def test_invalid_experimental_decorator(index_path: Path) -> None: code = """ from mlflow.utils.annotations import exper...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_invalid_experimental_decorator.py", "license": "Apache License 2.0", "lines": 45, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_lazy_module.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.lazy_module import LazyModule def test_lazy_module(index_path: Path) -> None: # Create a file that looks like mlflow/__init__.py for the rule to apply code = """ from mlflow.utils.laz...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_lazy_module.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_mlflow_class_name.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.mlflow_class_name import MlflowClassName def test_mlflow_class_name(index_path: Path) -> None: code = """ # Bad - using MLflow class MLflowClient: pass # Bad - using MLFlow class MLF...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_mlflow_class_name.py", "license": "Apache License 2.0", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_unparameterized_generic_type.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.unparameterized_generic_type import UnparameterizedGenericType def test_unparameterized_generic_type(index_path: Path) -> None: code = """ from typing import Callable, Sequence # Bad - u...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_unparameterized_generic_type.py", "license": "Apache License 2.0", "lines": 35, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/datasets/databricks_evaluation_dataset_source.py
from typing import Any from mlflow.data.dataset_source import DatasetSource class DatabricksEvaluationDatasetSource(DatasetSource): """ Represents a Databricks Evaluation Dataset source. This source is used for datasets managed by the Databricks agents SDK. """ def __init__(self, table_name: st...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/datasets/databricks_evaluation_dataset_source.py", "license": "Apache License 2.0", "lines": 67, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/genai/datasets/test_databricks_evaluation_dataset_source.py
import json import pytest from mlflow.genai.datasets.databricks_evaluation_dataset_source import ( DatabricksEvaluationDatasetSource, ) def test_databricks_evaluation_dataset_source_init(): source = DatabricksEvaluationDatasetSource( table_name="catalog.schema.table", dataset_id="12345" ) as...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/datasets/test_databricks_evaluation_dataset_source.py", "license": "Apache License 2.0", "lines": 56, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/datasets/test_evaluation_dataset.py
import json from typing import Any from unittest.mock import Mock import pandas as pd import pytest from mlflow.data.dataset_source_registry import ( get_dataset_source_from_json, register_dataset_source, ) from mlflow.data.spark_dataset_source import SparkDatasetSource from mlflow.entities.evaluation_dataset...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/datasets/test_evaluation_dataset.py", "license": "Apache License 2.0", "lines": 193, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_example_syntax_error.py
from pathlib import Path import pytest from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.example_syntax_error import ExampleSyntaxError def test_example_syntax_error(index_path: Path) -> None: code = ''' def bad(): """ .. code-block:: python def...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_example_syntax_error.py", "license": "Apache License 2.0", "lines": 36, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_os_environ_set_in_test.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.os_environ_set_in_test import OsEnvironSetInTest def test_os_environ_set_in_test(index_path: Path) -> None: code = """ import os # Bad def test_func(): os.environ["MY_VAR"] = "value"...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_os_environ_set_in_test.py", "license": "Apache License 2.0", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_pytest_mark_repeat.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.pytest_mark_repeat import PytestMarkRepeat def test_pytest_mark_repeat(index_path: Path) -> None: code = """ import pytest @pytest.mark.repeat(10) def test_flaky_function(): ... """ ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_pytest_mark_repeat.py", "license": "Apache License 2.0", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_unknown_mlflow_arguments.py
from pathlib import Path import pytest from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.unknown_mlflow_arguments import UnknownMlflowArguments def test_unknown_mlflow_arguments(index_path: Path) -> None: code = ''' def bad(): """ .. code-block:: python ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_unknown_mlflow_arguments.py", "license": "Apache License 2.0", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_unknown_mlflow_function.py
from pathlib import Path import pytest from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.unknown_mlflow_function import UnknownMlflowFunction def test_unknown_mlflow_function(index_path: Path) -> None: code = ''' def bad(): """ .. code-block:: python ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_unknown_mlflow_function.py", "license": "Apache License 2.0", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_extraneous_docstring_param.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.extraneous_docstring_param import ExtraneousDocstringParam def test_extraneous_docstring_param(index_path: Path) -> None: code = ''' def bad_function(param1: str) -> None: """ Exa...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_extraneous_docstring_param.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_forbidden_trace_ui_in_notebook.py
from pathlib import Path from clint.config import Config from clint.linter import lint_file from clint.rules.forbidden_trace_ui_in_notebook import ForbiddenTraceUIInNotebook def test_forbidden_trace_ui_in_notebook(index_path: Path) -> None: notebook_content = """ { "cells": [ { "cell_type": "markdown", ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_forbidden_trace_ui_in_notebook.py", "license": "Apache License 2.0", "lines": 63, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_incorrect_type_annotation.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.incorrect_type_annotation import IncorrectTypeAnnotation def test_incorrect_type_annotation(index_path: Path) -> None: code = """ def bad_function_callable(param: callable) -> callable: ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_incorrect_type_annotation.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_invalid_abstract_method.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.invalid_abstract_method import InvalidAbstractMethod def test_invalid_abstract_method(index_path: Path) -> None: code = """ import abc class AbstractExample(abc.ABC): @abc.abstractme...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_invalid_abstract_method.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_missing_docstring_param.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.missing_docstring_param import MissingDocstringParam def test_missing_docstring_param(index_path: Path) -> None: code = ''' def bad_function(param1: str, param2: int, param3: bool) -> Non...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_missing_docstring_param.py", "license": "Apache License 2.0", "lines": 73, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_empty_notebook_cell.py
import json from pathlib import Path from clint.config import Config from clint.linter import lint_file from clint.rules.empty_notebook_cell import EmptyNotebookCell def test_empty_notebook_cell(index_path: Path) -> None: notebook_content = { "cells": [ { "cell_type": "code", ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_empty_notebook_cell.py", "license": "Apache License 2.0", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_log_model_artifact_path.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.log_model_artifact_path import LogModelArtifactPath def test_log_model_artifact_path(index_path: Path) -> None: code = """ import mlflow # Bad - using deprecated artifact_path positional...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_log_model_artifact_path.py", "license": "Apache License 2.0", "lines": 25, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_markdown_link.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.markdown_link import MarkdownLink def test_markdown_link(index_path: Path) -> None: code = ''' # Bad def function_with_markdown_link(): """ This function has a [markdown link](htt...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_markdown_link.py", "license": "Apache License 2.0", "lines": 85, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_os_environ_delete_in_test.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.os_environ_delete_in_test import OsEnvironDeleteInTest def test_os_environ_delete_in_test(index_path: Path) -> None: code = """ import os def test_something(): # Bad del os.envir...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_os_environ_delete_in_test.py", "license": "Apache License 2.0", "lines": 74, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_test_name_typo.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.test_name_typo import TestNameTypo def test_test_name_typo(index_path: Path) -> None: code = """import pytest # Bad - starts with 'test' but missing underscore def testSomething(): a...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_test_name_typo.py", "license": "Apache License 2.0", "lines": 28, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/check_function_signatures.py
from __future__ import annotations import argparse import ast import os import subprocess import sys from dataclasses import dataclass from pathlib import Path def is_github_actions() -> bool: return os.environ.get("GITHUB_ACTIONS") == "true" @dataclass class Error: file_path: Path line: int column...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/check_function_signatures.py", "license": "Apache License 2.0", "lines": 316, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/dev/test_check_function_signatures.py
import ast from dev.check_function_signatures import check_signature_compatibility def test_no_changes(): old_code = "def func(a, b=1): pass" new_code = "def func(a, b=1): pass" old_tree = ast.parse(old_code) new_tree = ast.parse(new_code) errors = check_signature_compatibility(old_tree.body[0],...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/dev/test_check_function_signatures.py", "license": "Apache License 2.0", "lines": 157, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_do_not_disable.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.do_not_disable import DoNotDisable def test_do_not_disable(index_path: Path) -> None: code = """ # Bad B006 # noqa: B006 # Bad F821 # noqa: F821 # Good # noqa: B004 """ config = Con...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_do_not_disable.py", "license": "Apache License 2.0", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_docstring_param_order.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.docstring_param_order import DocstringParamOrder def test_docstring_param_order(index_path: Path) -> None: code = """ # Bad def f(x: int, y: str) -> None: ''' Args: y: Sec...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_docstring_param_order.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_forbidden_top_level_import.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.forbidden_top_level_import import ForbiddenTopLevelImport def test_forbidden_top_level_import(index_path: Path) -> None: code = """ # Bad import foo from foo import bar # Good import baz...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_forbidden_top_level_import.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_no_rst.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.no_rst import NoRst def test_no_rst(index_path: Path) -> None: code = """ def bad(y: int) -> str: ''' :param y: The parameter :returns: The result ''' def good(x: int) -...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_no_rst.py", "license": "Apache License 2.0", "lines": 24, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_typing_extensions.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules.typing_extensions import TypingExtensions def test_typing_extensions(index_path: Path) -> None: code = """ # Bad from typing_extensions import ParamSpec # Good from typing_extensions imp...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_typing_extensions.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_implicit_optional.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import ImplicitOptional def test_implicit_optional(index_path: Path) -> None: code = """ from typing import Optional # Bad bad: int = None class Bad: x: str = None # Good good: Opti...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_implicit_optional.py", "license": "Apache License 2.0", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_multi_assign.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import MultiAssign def test_multi_assign(index_path: Path) -> None: code = """ # Bad - non-constant values x, y = func1(), func2() # Good - unpacking from function a, b = func() # Good ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_multi_assign.py", "license": "Apache License 2.0", "lines": 20, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_unnamed_thread.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import UnnamedThread def test_unnamed_thread(index_path: Path) -> None: code = """ import threading # Bad threading.Thread(target=lambda: None) # Good # threading.Thread(target=lambda: ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_unnamed_thread.py", "license": "Apache License 2.0", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_use_sys_executable.py
from pathlib import Path from clint.config import Config from clint.linter import Position, Range, lint_file from clint.rules import UseSysExecutable def test_use_sys_executable(index_path: Path) -> None: code = """ import subprocess import sys # Bad subprocess.run(["mlflow", "ui"]) subprocess.check_call(["mlfl...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_use_sys_executable.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/tests/rules/test_missing_notebook_h1_header.py
import json from pathlib import Path from clint.config import Config from clint.linter import lint_file from clint.rules import MissingNotebookH1Header def test_missing_notebook_h1_header(index_path: Path) -> None: notebook = { "cells": [ { "cell_type": "markdown", ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/tests/rules/test_missing_notebook_h1_header.py", "license": "Apache License 2.0", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/data/polars_dataset.py
import json import logging from functools import cached_property from inspect import isclass from typing import Any, Final, TypedDict import polars as pl from polars.datatypes.classes import DataType as PolarsDataType from polars.datatypes.classes import DataTypeClass as PolarsDataTypeClass from mlflow.data.dataset i...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/data/polars_dataset.py", "license": "Apache License 2.0", "lines": 300, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/data/test_polars_dataset.py
from __future__ import annotations import json import re from datetime import date, datetime from pathlib import Path import pandas as pd import polars as pl import pytest from mlflow.data.code_dataset_source import CodeDatasetSource from mlflow.data.evaluation_dataset import EvaluationDataset from mlflow.data.files...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/data/test_polars_dataset.py", "license": "Apache License 2.0", "lines": 206, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/tracing/utils/copy.py
from typing import Any from mlflow.entities.span import LiveSpan, Span from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_STATE from mlflow.tracing.trace_manager import InMemoryTraceManager def copy_trace_to_experiment(trace_dict: dict[str, Any], experiment_id: str | None ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/utils/copy.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/clint/src/clint/rules/multi_assign.py
import ast from clint.rules.base import Rule class MultiAssign(Rule): def _message(self) -> str: return ( "Avoid multiple assignment (e.g., `x, y = func()`). Use separate assignments " "instead for better readability and easier debugging." ) @staticmethod def chec...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/multi_assign.py", "license": "Apache License 2.0", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/base.py
import inspect import itertools import re from abc import ABC, abstractmethod from typing import Any _id_counter = itertools.count(start=1) _CLASS_NAME_TO_RULE_NAME_REGEX = re.compile(r"(?<!^)(?=[A-Z])") class Rule(ABC): id: str name: str def __init_subclass__(cls, **kwargs: Any) -> None: super(...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/base.py", "license": "Apache License 2.0", "lines": 25, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/do_not_disable.py
from typing_extensions import Self from clint.rules.base import Rule class DoNotDisable(Rule): RULES = { "B006": "Use None as default and set value in function body instead of mutable defaults", "F821": "Use typing.TYPE_CHECKING for forward references to optional dependencies", } def __i...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/do_not_disable.py", "license": "Apache License 2.0", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/docstring_param_order.py
from clint.rules.base import Rule class DocstringParamOrder(Rule): def __init__(self, params: list[str]) -> None: self.params = params def _message(self) -> str: return f"Unordered parameters in docstring: {self.params}"
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/docstring_param_order.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/extraneous_docstring_param.py
from clint.rules.base import Rule class ExtraneousDocstringParam(Rule): def __init__(self, params: set[str]) -> None: self.params = params def _message(self) -> str: return f"Extraneous parameters in docstring: {self.params}"
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/extraneous_docstring_param.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/forbidden_set_active_model_usage.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class ForbiddenSetActiveModelUsage(Rule): def _message(self) -> str: return ( "Usage of `set_active_model` is not allowed in mlflow, use `_set_active_model` instead." ) @staticmethod def check(no...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/forbidden_set_active_model_usage.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/forbidden_top_level_import.py
from clint.rules.base import Rule class ForbiddenTopLevelImport(Rule): def __init__(self, module: str) -> None: self.module = module def _message(self) -> str: return ( f"Importing module `{self.module}` at the top level is not allowed " "in this file. Use lazy import ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/forbidden_top_level_import.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/forbidden_trace_ui_in_notebook.py
from clint.rules.base import Rule class ForbiddenTraceUIInNotebook(Rule): def _message(self) -> str: return ( "Found the MLflow Trace UI iframe in the notebook. " "The trace UI in cell outputs will not render correctly in previews or the website. " "Please run `mlflow.t...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/forbidden_trace_ui_in_notebook.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/implicit_optional.py
import ast from clint.rules.base import Rule class ImplicitOptional(Rule): def _message(self) -> str: return "Use `Optional` if default value is `None`" @staticmethod def check(node: ast.AnnAssign) -> bool: """ Returns True if the value to assign is `None` but the type annotation...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/implicit_optional.py", "license": "Apache License 2.0", "lines": 51, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/incorrect_type_annotation.py
import ast from clint.rules.base import Rule class IncorrectTypeAnnotation(Rule): MAPPING = { "callable": "Callable", "any": "Any", } def __init__(self, type_hint: str) -> None: self.type_hint = type_hint @staticmethod def check(node: ast.Name) -> bool: return no...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/incorrect_type_annotation.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/invalid_abstract_method.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class InvalidAbstractMethod(Rule): def _message(self) -> str: return ( "Abstract method should only contain a single statement/expression, " "and it must be `pass`, `...`, or a docstring." ) ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/invalid_abstract_method.py", "license": "Apache License 2.0", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/invalid_experimental_decorator.py
import ast from packaging.version import InvalidVersion, Version from clint.resolver import Resolver from clint.rules.base import Rule def _is_valid_version(version: str) -> bool: try: v = Version(version) return not (v.is_devrelease or v.is_prerelease or v.is_postrelease) except InvalidVers...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/invalid_experimental_decorator.py", "license": "Apache License 2.0", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/log_model_artifact_path.py
import ast from typing import TYPE_CHECKING from clint.rules.base import Rule from clint.utils import resolve_expr if TYPE_CHECKING: from clint.index import SymbolIndex class LogModelArtifactPath(Rule): def _message(self) -> str: return "`artifact_path` parameter of `log_model` is deprecated. Use `n...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/log_model_artifact_path.py", "license": "Apache License 2.0", "lines": 44, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/markdown_link.py
from clint.rules.base import Rule class MarkdownLink(Rule): def _message(self) -> str: return ( "Markdown link is not supported in docstring. " "Use reST link instead (e.g., `Link text <link URL>`_)." )
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/markdown_link.py", "license": "Apache License 2.0", "lines": 7, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/missing_docstring_param.py
from clint.rules.base import Rule class MissingDocstringParam(Rule): def __init__(self, params: set[str]) -> None: self.params = params def _message(self) -> str: return f"Missing parameters in docstring: {self.params}"
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/missing_docstring_param.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/os_environ_delete_in_test.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class OsEnvironDeleteInTest(Rule): def _message(self) -> str: return ( "Do not delete `os.environ` in test directly (del os.environ[...] or " "os.environ.pop(...)). Use `monkeypatch.delenv` " ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/os_environ_delete_in_test.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/os_environ_set_in_test.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class OsEnvironSetInTest(Rule): def _message(self) -> str: return "Do not set `os.environ` in test directly. Use `monkeypatch.setenv` (https://docs.pytest.org/en/stable/reference/reference.html#pytest.MonkeyPatch.setenv)." ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/os_environ_set_in_test.py", "license": "Apache License 2.0", "lines": 15, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/rules/pytest_mark_repeat.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class PytestMarkRepeat(Rule): def _message(self) -> str: return ( "@pytest.mark.repeat decorator should not be committed. " "This decorator is meant for local testing only to check for flaky tests." ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/pytest_mark_repeat.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/typing_extensions.py
from clint.rules.base import Rule class TypingExtensions(Rule): def __init__(self, *, full_name: str, allowlist: list[str]) -> None: self.full_name = full_name self.allowlist = allowlist def _message(self) -> str: return ( f"`{self.full_name}` is not allowed to use. Only {...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/typing_extensions.py", "license": "Apache License 2.0", "lines": 12, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/unknown_mlflow_arguments.py
from clint.rules.base import Rule class UnknownMlflowArguments(Rule): def __init__(self, function_name: str, unknown_args: set[str]) -> None: self.function_name = function_name self.unknown_args = unknown_args def _message(self) -> str: args_str = ", ".join(f"`{arg}`" for arg in sorte...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/unknown_mlflow_arguments.py", "license": "Apache License 2.0", "lines": 11, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/unknown_mlflow_function.py
from clint.rules.base import Rule class UnknownMlflowFunction(Rule): def __init__(self, function_name: str) -> None: self.function_name = function_name def _message(self) -> str: return ( f"Unknown MLflow function: `{self.function_name}`. " "This function may not exist...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/unknown_mlflow_function.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/unnamed_thread.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class UnnamedThread(Rule): def _message(self) -> str: return ( "`threading.Thread()` must be called with a `name` argument to improve debugging " "and traceability of thread-related issues." )...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/unnamed_thread.py", "license": "Apache License 2.0", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/unparameterized_generic_type.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class UnparameterizedGenericType(Rule): def __init__(self, type_hint: str) -> None: self.type_hint = type_hint @staticmethod def is_generic_type(node: ast.Name | ast.Attribute, resolver: Resolver) -> bool: i...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/unparameterized_generic_type.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/rules/use_sys_executable.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class UseSysExecutable(Rule): def _message(self) -> str: return ( "Use `[sys.executable, '-m', 'mlflow', ...]` when running mlflow CLI in a subprocess." ) @staticmethod def check(node: ast.Call, ...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/rules/use_sys_executable.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:dev/clint/src/clint/utils.py
from __future__ import annotations import ast import re import subprocess from functools import lru_cache from pathlib import Path @lru_cache(maxsize=1) def get_repo_root() -> Path: """Find the git repository root directory with caching.""" try: result = subprocess.check_output(["git", "rev-parse", "...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/utils.py", "license": "Apache License 2.0", "lines": 69, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/clint/src/clint/index.py
"""Symbol indexing for MLflow codebase. This module provides efficient indexing and lookup of Python symbols (functions, classes) across the MLflow codebase using AST parsing and parallel processing. Key components: - FunctionInfo: Lightweight function signature information - ModuleSymbolExtractor: AST visitor for ex...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/index.py", "license": "Apache License 2.0", "lines": 179, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/tracing/config.py
from dataclasses import dataclass, field, replace from typing import TYPE_CHECKING, Any, Callable from mlflow.tracing.utils.processor import validate_span_processors if TYPE_CHECKING: from mlflow.entities.span import LiveSpan @dataclass class TracingConfig: """Configuration for MLflow tracing behavior.""" ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/config.py", "license": "Apache License 2.0", "lines": 91, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/tracing/utils/processor.py
import logging from mlflow.exceptions import MlflowException _logger = logging.getLogger(__name__) def apply_span_processors(span): """Apply configured span processors sequentially to the span.""" from mlflow.tracing.config import get_config config = get_config() if not config.span_processors: ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/utils/processor.py", "license": "Apache License 2.0", "lines": 41, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/tracing/utils/test_config.py
import pytest import mlflow from mlflow.tracing.config import TracingConfig, get_config @pytest.fixture(autouse=True) def reset_tracing_config(): mlflow.tracing.reset() def test_tracing_config_default_values(): config = TracingConfig() assert config.span_processors == [] def test_configure(): # D...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/utils/test_config.py", "license": "Apache License 2.0", "lines": 74, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/tracing/utils/test_processor.py
from unittest.mock import patch import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.tracing.utils.processor import validate_span_processors from tests.tracing.helper import get_traces @mlflow.trace def predict(text: str): return "Answer: " + text @pytest.fixture(autouse=True...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/utils/test_processor.py", "license": "Apache License 2.0", "lines": 93, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:dev/clint/src/clint/comments.py
import io import re import tokenize from dataclasses import dataclass from typing import TYPE_CHECKING, Iterator from typing_extensions import Self if TYPE_CHECKING: from clint.linter import Position NOQA_REGEX = re.compile(r"#\s*noqa\s*:\s*([A-Z]\d+(?:\s*,\s*[A-Z]\d+)*)", re.IGNORECASE) @dataclass class Noqa:...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/comments.py", "license": "Apache License 2.0", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:mlflow/server/graphql/graphql_no_batching.py
from typing import NamedTuple from graphql.error import GraphQLError from graphql.execution import ExecutionResult from graphql.language.ast import DocumentNode, FieldNode from mlflow.environment_variables import ( MLFLOW_SERVER_GRAPHQL_MAX_ALIASES, MLFLOW_SERVER_GRAPHQL_MAX_ROOT_FIELDS, ) _MAX_DEPTH = 10 _M...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/server/graphql/graphql_no_batching.py", "license": "Apache License 2.0", "lines": 74, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/clint/src/clint/resolver.py
import ast from collections.abc import Iterator from contextlib import contextmanager class Resolver: def __init__(self) -> None: self.name_map: dict[str, list[str]] = {} self._scope_stack: list[dict[str, list[str]]] = [] def clear(self) -> None: """Clear all name mappings. Useful whe...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/clint/src/clint/resolver.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:dev/remove_experimental_decorators.py
""" Script to automatically remove @experimental decorators from functions that have been experimental for more than a configurable cutoff period (default: 6 months). """ import argparse import ast import json import subprocess from dataclasses import dataclass from datetime import datetime, timedelta, timezone from p...
{ "repo_id": "mlflow/mlflow", "file_path": "dev/remove_experimental_decorators.py", "license": "Apache License 2.0", "lines": 144, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/dev/test_remove_experimental_decorators.py
import subprocess import sys from pathlib import Path SCRIPT_PATH = "dev/remove_experimental_decorators.py" def test_script_with_specific_file(tmp_path: Path) -> None: test_file = tmp_path / "test.py" test_file.write_text(""" @experimental(version="1.0.0") def func(): pass """) output = subprocess.c...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/dev/test_remove_experimental_decorators.py", "license": "Apache License 2.0", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/tracing/export/utils.py
""" Utility functions for prompt linking in trace exporters. """ import logging import threading import uuid from typing import Sequence from mlflow.entities.model_registry import PromptVersion from mlflow.tracing.client import TracingClient _logger = logging.getLogger(__name__) def try_link_prompts_to_trace( ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/tracing/export/utils.py", "license": "Apache License 2.0", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
mlflow/mlflow:tests/tracing/test_tracing_client.py
import json import uuid from unittest.mock import Mock, patch import pytest from opentelemetry import trace as trace_api from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan import mlflow from mlflow.entities.span import create_mlflow_span from mlflow.environment_variables import MLFLOW_TRACING_SQL_WA...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/tracing/test_tracing_client.py", "license": "Apache License 2.0", "lines": 209, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/prompts/test_prompts.py
import json import threading import time from concurrent.futures import ThreadPoolExecutor from unittest import mock import jinja2 import pytest from pydantic import BaseModel, ValidationError import mlflow from mlflow import MlflowClient from mlflow.entities.model_registry import PromptModelConfig, PromptVersion fro...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/prompts/test_prompts.py", "license": "Apache License 2.0", "lines": 1628, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/evaluate/test_to_predict_fn.py
import importlib.metadata from unittest import mock import pytest import mlflow from mlflow.entities.trace_info import TraceInfo from mlflow.environment_variables import MLFLOW_ENABLE_ASYNC_TRACE_LOGGING from mlflow.exceptions import MlflowException from mlflow.genai.evaluation.base import to_predict_fn from mlflow.g...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/evaluate/test_to_predict_fn.py", "license": "Apache License 2.0", "lines": 482, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/store/model_registry/test_abstract_store.py
import json import threading import time from unittest import mock import pytest from mlflow.entities.logged_model import LoggedModel from mlflow.entities.logged_model_tag import LoggedModelTag from mlflow.entities.model_registry.model_version import ModelVersion from mlflow.entities.model_registry.model_version_tag ...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/store/model_registry/test_abstract_store.py", "license": "Apache License 2.0", "lines": 590, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/entities/model_registry/prompt_version.py
from __future__ import annotations import json import re from typing import Any from pydantic import BaseModel, Field, ValidationError from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity from mlflow.entities.model_registry.model_version_tag import ModelVersionTag from mlflow.except...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/entities/model_registry/prompt_version.py", "license": "Apache License 2.0", "lines": 490, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:mlflow/genai/label_schemas/label_schemas.py
from abc import ABC, abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING, TypeVar from mlflow.genai.utils.enum_utils import StrEnum if TYPE_CHECKING: from databricks.agents.review_app import label_schemas as _label_schemas _InputCategorical = _label_schemas.InputCategorical ...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/label_schemas/label_schemas.py", "license": "Apache License 2.0", "lines": 166, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:mlflow/genai/labeling/labeling.py
from typing import TYPE_CHECKING, Any, Iterable, Union from mlflow.entities import Trace from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE if TYPE_CHECKING: import pandas as pd from databricks.agents.review_app import ( LabelSchema as _Label...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/labeling/labeling.py", "license": "Apache License 2.0", "lines": 254, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/genai/label_schemas/test_label_schemas.py
import dataclasses from contextlib import contextmanager from unittest.mock import MagicMock, patch import pytest from mlflow.genai import label_schemas from mlflow.genai.label_schemas import ( EXPECTED_FACTS, EXPECTED_RESPONSE, GUIDELINES, InputCategorical, InputCategoricalList, InputNumeric,...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/label_schemas/test_label_schemas.py", "license": "Apache License 2.0", "lines": 610, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/labeling/test_labeling.py
from mlflow.genai import labeling from mlflow.genai.labeling import ( Agent, LabelingSession, ReviewApp, create_labeling_session, delete_labeling_session, get_labeling_session, get_labeling_sessions, get_review_app, ) from tests.genai.conftest import databricks_only @databricks_only d...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/labeling/test_labeling.py", "license": "Apache License 2.0", "lines": 22, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/scorers/scorer_utils.py
# This file contains utility functions for scorer functionality. import ast import inspect import json import logging import re from textwrap import dedent from typing import TYPE_CHECKING, Any, Callable from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException if TYPE_CHECKING: from mlflow.genai.ut...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scorers/scorer_utils.py", "license": "Apache License 2.0", "lines": 235, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
mlflow/mlflow:tests/genai/scorers/test_scorer_utils.py
import json import pytest from mlflow.entities import Assessment, Feedback, Trace from mlflow.exceptions import MlflowException from mlflow.genai.scorers.scorer_utils import ( BUILTIN_SCORER_PYDANTIC_DATA, INSTRUCTIONS_JUDGE_PYDANTIC_DATA, build_gateway_model, extract_endpoint_ref, extract_model_f...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/test_scorer_utils.py", "license": "Apache License 2.0", "lines": 457, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:tests/genai/scorers/test_serialization.py
import json from unittest.mock import patch import pytest from mlflow.entities import Feedback from mlflow.exceptions import MlflowException from mlflow.genai.scorers import Scorer, scorer from mlflow.genai.scorers.builtin_scorers import Guidelines @pytest.fixture(autouse=True) def mock_databricks_runtime(): wi...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/scorers/test_serialization.py", "license": "Apache License 2.0", "lines": 520, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/scheduled_scorers.py
from dataclasses import dataclass from mlflow.genai.scorers.base import Scorer _ERROR_MSG = ( "The `databricks-agents` package is required to use `mlflow.genai.scheduled_scorers`. " "Please install it with `pip install databricks-agents`." ) @dataclass() class ScorerScheduleConfig: """ A scheduled s...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/scheduled_scorers.py", "license": "Apache License 2.0", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
mlflow/mlflow:tests/genai/test_scheduled_scorers.py
from mlflow.genai.scheduled_scorers import ( ScorerScheduleConfig, ) from mlflow.genai.scorers.base import Scorer class MockScorer(Scorer): """Mock scorer for testing purposes.""" name: str = "mock_scorer" def __call__(self, *, outputs=None, **kwargs): return {"score": 1.0} def test_schedu...
{ "repo_id": "mlflow/mlflow", "file_path": "tests/genai/test_scheduled_scorers.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
mlflow/mlflow:mlflow/genai/utils/enum_utils.py
from enum import Enum, EnumMeta class MetaEnum(EnumMeta): """Metaclass for Enum classes that allows to check if a value is a valid member of the Enum.""" def __contains__(cls, item): try: cls(item) except ValueError: return False return True class StrEnum(str...
{ "repo_id": "mlflow/mlflow", "file_path": "mlflow/genai/utils/enum_utils.py", "license": "Apache License 2.0", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple