repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
pyomo | pyomo/contrib/appsi/writers/tests/test_nl_writer.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 365 | 10,301 |
wagtail | wagtail/blocks/base.py | .py | import collections
import itertools
import json
import re
from functools import lru_cache
from importlib import import_module
from django import forms
from django.core import checks
from django.core.exceptions import ImproperlyConfigured
from django.template.loader import render_to_string
from django.utils.encoding im... | 859 | 35,001 |
black | tests/data/cases/comment_type_hint.py | .py | # flags: --no-preview-line-length-1
# split out from comments2 as it does not work with line-length=1, losing the comment
a = "type comment with trailing space" # type: str
| 4 | 174 |
saleor | saleor/graphql/checkout/schema.py | .py | import graphene
from ...permission.enums import (
AccountPermissions,
CheckoutPermissions,
PaymentPermissions,
)
from ..core import ResolveInfo
from ..core.connection import (
create_connection_slice_for_sync_webhook_control_context,
filter_connection_queryset,
)
from ..core.descriptions import DEP... | 152 | 6,046 |
flit | tests/test_vcs.py | .py | from contextlib import contextmanager
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from flit import vcs
@contextmanager
def cwd(path):
if isinstance(path, Path):
path = str(path)
old_wd = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(... | 38 | 1,046 |
metrics | src/torchmetrics/functional/classification/roc.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 551 | 28,559 |
textual | docs/examples/styles/grid_rows.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class MyApp(App):
CSS_PATH = "grid_rows.tcss"
def compose(self):
yield Grid(
Label("1fr"),
Label("1fr"),
Label("height = 6"),
Label("height = 6"),
... | 27 | 553 |
wandb | wandb/sdk/internal/run.py | .py | #
"""InternalRun - Internal-only run object.
Semi-stubbed run for internal process use.
"""
from typing_extensions import override
from wandb.sdk import wandb_run
class InternalRun(wandb_run.Run):
def __init__(self, run_obj, settings, datatypes_cb):
super().__init__(settings=settings)
self._ru... | 28 | 624 |
openvino | thirdparty/itt_collector/runtool/python_compat.py | .py | # Intel® Single Event API
#
# This file is provided under the BSD 3-Clause license.
# Copyright (c) 2021, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# Redistri... | 42 | 2,262 |
confluent-kafka-python | tests/schema_registry/_async/test_proto.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 161 | 5,115 |
onnxruntime | onnxruntime/test/python/quantization/test_op_matmul.py | .py | #!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------... | 482 | 19,032 |
loguru | loguru/_colorama.py | .py | import builtins
import os
import sys
def should_colorize(stream):
if stream is None:
return False
is_standard_stream = stream is sys.stdout or stream is sys.stderr
is_original_standard_stream = stream is sys.__stdout__ or stream is sys.__stderr__
if is_standard_stream or is_original_standard... | 84 | 2,374 |
mlflow | mlflow/utils/async_logging/run_operations.py | .py | class RunOperations:
"""Class that helps manage the futures of MLflow async logging."""
def __init__(self, operation_futures):
self._operation_futures = operation_futures or []
def wait(self):
"""Blocks on completion of all futures."""
from mlflow.exceptions import MlflowException
... | 50 | 1,944 |
mlflow | tests/utils/test_gorilla.py | .py | import pytest
from mlflow.utils import gorilla
class Delegator:
def __init__(self, delegated_fn):
self.delegated_fn = delegated_fn
def __get__(self, instance, owner):
return self.delegated_fn
def delegate(delegated_fn):
return lambda fn: Delegator(delegated_fn)
def gen_class_A_B():
... | 190 | 5,386 |
wagtail | wagtail/users/tests/test_bulk_actions/test_bulk_set_active_state.py | .py | from django.contrib.auth import get_user_model
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from django.urls import reverse
from wagtail.test.utils import WagtailTestUtils
from wagtail.users.views.bulk_actions.user_bulk_action import UserBulkAction
User = get_user_model()
class... | 112 | 4,202 |
deap | doc/code/examples/nsga3_ref_points.py | .py | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy
from deap import tools
NOBJ = 3
P = [12]
SCALES = [1]
fig = plt.figure(figsize=(7, 7))
ax = fig.add_subplot(111, projection="3d")
# the coordinate origin
ax.scatter(0, 0, 0, c="k", marker="+", s=100)
# reference points
ref_points ... | 34 | 875 |
coremltools | coremltools/converters/mil/frontend/torch/dim_order_ops.py | .py | # Copyright (c) 2025, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from typing import Tuple
import numpy as np
import torch
from coremltools.converters.mil.mil.builde... | 138 | 5,872 |
readthedocs.org | readthedocs/config/tests/test_yaml_loader.py | .py | from readthedocs.doc_builder.backends.mkdocs import ProxyPythonName, yaml_load_safely
content = """
int: 3
float: !!float 3
function: !!python/name:python_function
other_function: !!python/name:module.other.function
unknown: !!python/module:python_module
"""
def test_yaml_load_safely():
expected = {
"int... | 29 | 879 |
beam | sdks/python/apache_beam/runners/dask/dask_runner_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 418 | 14,399 |
pyomo | scripts/admin/update-copyright.py | .py | ____________________________________________________________________________________
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of Sa... | 186 | 6,017 |
ipython | examples/IPython Kernel/gui/gui-gtk4.py | .py | #!/usr/bin/env python
"""Simple Gtk example to manually test event loop integration.
This is meant to run tests manually in ipython as:
In [1]: %gui gtk4
In [2]: %run gui-gtk4.py
"""
import gi
gi.require_version("Gtk", "4.0")
from gi.repository import Gtk, GLib # noqa
def hello_world(widget, data=None):
pri... | 38 | 716 |
pyomo | pyomo/contrib/preprocessing/tests/test_detect_fixed_vars.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 50 | 1,753 |
wagtail | wagtail/users/tests/test_bulk_actions/test_bulk_delete.py | .py | import unittest
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from django.urls import reverse
from django.utils.http import urlencode
from wagtail.test... | 252 | 9,306 |
black | tests/data/cases/percent_precedence.py | .py | ("" % a) ** 2
("" % a)[0]
("" % a)()
("" % a).b
2 * ("" % a)
2 @ ("" % a)
2 / ("" % a)
2 // ("" % a)
2 % ("" % a)
+("" % a)
b + ("" % a)
-("" % a)
b - ("" % a)
b + -("" % a)
~("" % a)
2 ** ("" % a)
await ("" % a)
b[("" % a)]
b(("" % a))
# output
("" % a) ** 2
("" % a)[0]
("" % a)()
("" % a).b
2 * ("" % a)
2 @ ("" % a... | 42 | 485 |
wandb | wandb/sdk/artifacts/storage_handlers/_timing.py | .py | from __future__ import annotations
import time
from contextlib import AbstractContextManager
from typing import TYPE_CHECKING
from wandb.errors.term import termlog
if TYPE_CHECKING:
from types import TracebackType
from typing_extensions import Self
class TimedIf(AbstractContextManager):
"""Context man... | 35 | 938 |
saleor | saleor/graphql/app/tests/mutations/test_app_token_verify.py | .py | from ....tests.utils import get_graphql_content
APP_TOKEN_VERIFY_MUTATION = """
mutation AppTokenVerify($token: String!){
appTokenVerify(token:$token){
valid
errors {
field
message
code
}
}
}
"""
def test_app_token_verify_valid_token(app, api_client):
... | 78 | 1,944 |
confluent-kafka-python | src/confluent_kafka/schema_registry/schema_registry_client.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 23 | 829 |
readthedocs.org | readthedocs/notifications/models.py | .py | import structlog
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_noop as _
from django_extensions.db.models import TimeStampedModel
from ... | 136 | 4,745 |
probability | tensorflow_probability/python/experimental/auto_batching/numpy_backend.py | .py | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 499 | 16,848 |
wandb | wandb/apis/_generated/operations.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/api/
__all__ = [
"CREATE_INVITE_GQL",
"CREATE_PROJECT_GQL",
"CREATE_SERVICE_ACCOUNT_GQL",
"CREATE_TEAM_GQL",
"CREATE_USER_FROM_ADMIN_GQL",
"DELETE_API_KEY_GQL",
"DELETE_INVITE_GQL",
"GENERATE_API_KEY_GQL",
"GET_AGENT_RUN... | 574 | 8,795 |
mlflow | mlflow/server/jobs/utils.py | .py | import errno
import hashlib
import importlib
import inspect
import json
import logging
import os
import shutil
import signal
import subprocess
import sys
import tempfile
import threading
import time
from contextlib import nullcontext
from dataclasses import asdict, dataclass
from datetime import datetime
from pathlib i... | 812 | 29,422 |
sphinx | tests/roots/test-ext-autodoc/target/pep695.py | .py | from __future__ import annotations
import pathlib
from typing import NewType, TypeAliasType
import typing_extensions
#: Some buffer-like object
buffer_like = bytes | bytearray | memoryview
#: Any type of path
pathlike = str | pathlib.Path
#: A generic type alias
Handler = type[Exception]
class Foo:
"""This i... | 73 | 1,848 |
beam | sdks/python/apache_beam/testing/benchmarks/nexmark/queries/query5.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 97 | 3,473 |
onnxruntime | onnxruntime/test/python/autoep_helper.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
import os
import tempfile
import unittest
import onnxruntime as onnxrt
from onnxruntime.capi.onnxruntime_pybind11_state import Fail
class AutoEpTestCase(unittest.TestCase):
"""
Ba... | 68 | 2,687 |
mlflow | tests/claude_code/test_autolog.py | .py | import sys
from unittest.mock import MagicMock, patch
import pytest
from claude_agent_sdk.types import AssistantMessage, ResultMessage, TextBlock, UserMessage
import mlflow.anthropic
from mlflow.anthropic.autolog import patched_claude_sdk_init
def test_anthropic_autolog_without_claude_sdk():
sys.modules.pop("cl... | 138 | 4,426 |
astropy | astropy/cosmology/_src/tests/io/test_table.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy.cosmology import Cosmology
from astropy.cosmology._src.core import _COSMOLOGY_CLASSES
from astropy.cosmology._src.io.builtin.table import from_table, to_table
from astropy.table import QTable, Table, vstack
from .base import T... | 259 | 9,833 |
hydra | tests/test_basic_sweeper.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import re
import sys
from textwrap import dedent
from typing import Any, List, Optional
from pytest import mark, param
from hydra._internal.core_plugins.basic_sweeper import BasicSweeper
from hydra.core.override_parser.overrides_parser import Over... | 151 | 4,717 |
scikit-bio | skbio/stats/ordination/tests/test_canonical_correspondence_analysis.py | .py | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# --------------------------------------------... | 178 | 6,724 |
saleor | saleor/discount/tests/test_utils/test_fetch_promotion_rules_for_order.py | .py | from decimal import Decimal
from ... import RewardType, RewardValueType
from ...models import PromotionRule
from ...utils.promotion import fetch_promotion_rules_for_checkout_or_order
def test_fetch_promotion_rules_for_order(order, order_line_JPY, order_promotion_rule):
# given
rule = order_promotion_rule
... | 97 | 2,852 |
wandb | tests/system_tests/test_functional/asyncio_manager_run/interrupt_join.py | .py | """Passes if Ctrl+C during join() makes run() raise RunCancelledError."""
import asyncio
import sys
import threading
import time
from wandb.sdk.lib import asyncio_manager
_task_started = threading.Event()
_got_cancelled = threading.Event()
async def _set_task_started_then_sleep() -> None:
_task_started.set()
... | 57 | 1,579 |
saleor | saleor/graphql/page/tests/mutations/test_page_bulk_publish.py | .py | import graphene
from .....page.models import Page
from ....tests.utils import get_graphql_content
MUTATION_PUBLISH_PAGES = """
mutation publishManyPages($ids: [ID!]!, $is_published: Boolean!) {
pageBulkPublish(ids: $ids, isPublished: $is_published) {
count
}
}
"""
def test_bu... | 47 | 1,681 |
sphinx | tests/roots/test-ext-autosummary-mock_imports/conf.py | .py | import sys
from pathlib import Path
sys.path.insert(0, str(Path.cwd().resolve()))
extensions = ['sphinx.ext.autosummary']
autosummary_generate = True
autosummary_mock_imports = ['unknown']
| 9 | 191 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/latest_globally.py | .py | # coding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License");... | 77 | 2,337 |
onnxruntime | onnxruntime/python/tools/transformers/machine_info.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
# It is used to dump machine information for Notebooks
import argparse... | 231 | 7,351 |
funcy | tests/test_tree.py | .py | from whatever import _
from funcy import rest
from funcy.tree import *
def test_tree_leaves():
assert ltree_leaves([1, 2, [3, [4]], 5]) == [1, 2, 3, 4, 5]
assert ltree_leaves(1) == [1]
assert ltree_leaves(3, follow=_ > 1, children=range) == [0, 1, 0, 1]
assert ltree_leaves([1, [2, [3, 4], 5], 6], ch... | 24 | 619 |
beam | sdks/python/apache_beam/io/unbounded_source.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 1,137 | 44,489 |
coremltools | coremltools/proto/Model_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: Model.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google... | 363 | 21,728 |
wandb | tests/unit_tests/test_wandb_agent/test_cli_agent.py | .py | from __future__ import annotations
import contextlib
import io
import json
import multiprocessing
import pathlib
from unittest import mock
import pytest
import yaml
from wandb import env, wandb_agent
from wandb.sdk.launch.sweeps import SweepNotFoundError
from wandb.sdk.lib.service.service_connection import WandbApiFa... | 204 | 6,298 |
wagtail | wagtail/tests/test_page_allowed_http_methods.py | .py | from django.test import TestCase
from wagtail.models import Site
from wagtail.test.testapp.models import EventIndex
from wagtail.test.utils import Page
class AllowedHttpMethodsTestCase(TestCase):
@classmethod
def setUpTestData(cls):
super().setUpTestData()
site = Site.objects.select_related("... | 34 | 1,356 |
pyro | tests/contrib/tracking/test_measurements.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
from pyro.contrib.tracking.measurements import PositionMeasurement
def test_PositionMeasurement():
dimension = 3
time = 0.232
frame_num = 5
measurement = PositionMeasurement(
mean=torch.rand(... | 30 | 934 |
mlflow | mlflow/models/evaluation/evaluators/classifier.py | .py | import logging
import math
from contextlib import contextmanager
from typing import Any, Callable, NamedTuple, Optional
import numpy as np
import pandas as pd
from sklearn import metrics as sk_metrics
import mlflow
from mlflow import MlflowException
from mlflow.environment_variables import _MLFLOW_EVALUATE_SUPPRESS_C... | 712 | 26,949 |
wandb | wandb/sdk/artifacts/storage_handlers/local_file_handler.py | .py | """Local file storage handler."""
from __future__ import annotations
import os
import shutil
from collections import deque
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING
from urllib.parse import ParseResult
from wandb.errors.term import termlog
from wandb.sdk.artifacts... | 151 | 5,564 |
coremltools | coremltools/converters/mil/mil/passes/defs/transformer.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from typing import ClassVar, List, Tuple
import numpy as np
from coremltools.converters.mil.mil.pas... | 186 | 7,413 |
sqlmap | thirdparty/identywaf/identYwaf.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2019-2021 Miroslav Stampar (@stamparm), MIT
See the file 'LICENSE' for copying permission
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
"""
from __future__ import print_function
import base64
imp... | 586 | 25,861 |
coremltools | coremltools/proto/LinkedModel_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: LinkedModel.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from ... | 56 | 2,416 |
scikit-bio | skbio/embedding/tests/test_embedding.py | .py | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# --------------------------------------------... | 267 | 9,781 |
conda | conda/models/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Models are data transfer objects or "light-weight" domain objects with no appreciable logic
other than their own validation. Models are used to pass data between layers of the stack. In
many ways they are similar to ORM objects. Unlike ORM ... | 17 | 685 |
mlflow | dev/update_model_catalog.py | .py | """Update the MLflow model catalog from upstream data sources.
Usage:
uv run python dev/update_model_catalog.py [--output-dir PATH]
Fetches the LiteLLM model_prices_and_context_window.json from GitHub,
transforms it into the MLflow-native schema, and merges the results into the
per-provider catalog files in the o... | 467 | 18,012 |
returns | returns/converters.py | .py | from typing import TypeVar, overload
from returns.functions import identity
from returns.interfaces.bindable import BindableN
from returns.maybe import Maybe, Nothing, Some
from returns.pipeline import is_successful
from returns.primitives.hkt import KindN, kinded
from returns.result import Failure, Result, Success
_... | 111 | 3,090 |
wagtail | wagtail/snippets/tests/test_permissions.py | .py | from django.contrib.admin.utils import quote
from django.contrib.auth.models import Permission
from django.test import TestCase
from django.urls import reverse
from wagtail.test.testapp.models import Advert
from wagtail.test.utils import PageFixturesMixin, WagtailTestUtils
class TestAddOnlyPermissions(PageFixturesMi... | 168 | 6,501 |
sqlmap | tests/test_targeturl.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Target URL parsing (lib/core/common.py parseTargetUrl).
parseTargetUrl reads conf.url and populates conf.hostname / conf.port /
conf.scheme / conf.path - the values every subsequent ... | 106 | 3,311 |
wagtail | wagtail/models/content_types.py | .py | import swapper
from django.contrib.contenttypes.models import ContentType
def get_default_page_content_type():
"""
Returns the content type to use as a default for pages whose content type
has been deleted.
"""
Page = swapper.load_model("wagtailcore", "Page")
return ContentType.objects.get_fo... | 13 | 334 |
mlflow | mlflow/entities/model_registry/model_version_status.py | .py | from mlflow.protos.model_registry_pb2 import ModelVersionStatus as ProtoModelVersionStatus
class ModelVersionStatus:
"""Enum for status of an :py:class:`mlflow.entities.model_registry.ModelVersion`."""
PENDING_REGISTRATION = ProtoModelVersionStatus.Value("PENDING_REGISTRATION")
FAILED_REGISTRATION = Prot... | 36 | 1,523 |
cvxpy | cvxpy/atoms/affine/index.py | .py | """
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 226 | 7,547 |
ipython | tests/test_zzz_autoreload.py | .py | """Tests for autoreload extension."""
# -----------------------------------------------------------------------------
# Copyright (c) 2012 IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -------... | 1,209 | 40,563 |
confluent-kafka-python | tests/integration/share_consumer/conftest.py | .py | """Per-directory pytest fixtures for share consumer integration tests."""
import sys
import pytest
@pytest.fixture(scope='module', autouse=True)
def _delete_share_test_topics(kafka_cluster):
"""Cleanup of share-consumer test topics after the module
finishes. Tests create topics with deterministic prefixes
... | 36 | 1,308 |
beam | sdks/python/apache_beam/io/gcp/datastore/v1new/datastore_write_it_pipeline.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 173 | 6,106 |
cvxpy | cvxpy/atoms/norm_nuc.py | .py | """
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 82 | 2,268 |
kombu | docs/conf.py | .py | from __future__ import annotations
from sphinx_celery import conf
globals().update(conf.build_config(
'kombu', __file__,
project='Kombu',
version_dev='5.4',
version_stable='5.3',
canonical_url='https://kombu.readthedocs.io/',
webdomain='kombu.readthedocs.io',
github_project='celery/kombu',... | 32 | 938 |
pyomo | pyomo/contrib/simplification/build.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 208 | 7,556 |
qutip | qutip/tests/core/test_states.py | .py | import pytest
import numpy as np
import qutip
from functools import partial
from itertools import combinations
@pytest.mark.parametrize("size, n", [(2, 0), (2, 1), (100, 99)])
def test_basis_simple(size, n):
qobj = qutip.basis(size, n)
numpy = np.zeros((size, 1), dtype=complex)
numpy[n, 0] = 1
assert ... | 341 | 12,007 |
gunicorn | benchmarks/dirty_bench_gunicorn.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Gunicorn configuration for dirty pool integration benchmarks.
Usage:
gunicorn -c benchmarks/dirty_bench_gunicorn.py \
benchmarks.dirty_bench_wsgi:app
"""
# Bind address
bind = "127.0.0.1:8000"
# ... | 61 | 1,336 |
pymc | pymc/smc/sampling.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 501 | 18,423 |
wandb | tests/unit_tests/test_datastore.py | .py | """datastore tests."""
import json
import os
import pytest
from wandb.proto import wandb_internal_pb2 # type: ignore
from wandb.sdk.internal import datastore
FNAME = "test.dat"
try:
FileNotFoundError # noqa: B018
except NameError:
FileNotFoundError = OSError
def check(
ds,
chunk_sizes=tuple(),
... | 140 | 3,726 |
beam | sdks/python/apache_beam/typehints/typecheck.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 366 | 13,248 |
pymc | tests/logprob/test_scan.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 593 | 17,826 |
onnxruntime | onnxruntime/core/providers/coreml/mlprogram_test_scripts/dump_mlprogram_model.py | .py | import sys
import coremltools as ct
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <path to model.mlmodel in ML Package>")
print("If generated by onnxruntime this will be <ML Package root>/Data/com.microsoft.onnxruntime/model.mlmodel")
print(
"The ML Package created by the CoreML EP can saved ... | 35 | 1,205 |
mlflow | examples/gateway/bedrock/example.py | .py | from mlflow.deployments import get_deploy_client
def main():
client = get_deploy_client("http://localhost:7000")
print(f"Bedrock endpoints: {client.list_endpoints()}\n")
print(f"Bedrock completions endpoint info: {client.get_endpoint(endpoint='completions')}\n")
# Completions example
response_co... | 24 | 683 |
pyomo | examples/pyomobook/blocks-ch/lotsizing_no_time.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 35 | 1,164 |
metrics | src/torchmetrics/utilities/plot.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 367 | 14,461 |
cvxpy | cvxpy/reductions/subexpr_cache.py | .py | """
Copyright, the CVXPY authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... | 223 | 9,332 |
mlflow | tests/genai/judges/adapters/test_base_adapter.py | .py | from unittest import mock
import pytest
from mlflow.entities.assessment import Feedback
from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceType
from mlflow.exceptions import MlflowException
from mlflow.genai.judges.adapters.base_adapter import (
AdapterInvocationInput,
AdapterInvo... | 171 | 5,456 |
saleor | saleor/graphql/page/mutations/__init__.py | .py | from .page_attribute_assign import PageAttributeAssign
from .page_attribute_unassign import PageAttributeUnassign
from .page_create import PageCreate
from .page_delete import PageDelete
from .page_reorder_attribute_values import PageReorderAttributeValues
from .page_type_create import PageTypeCreate
from .page_type_del... | 24 | 753 |
onnxruntime | onnxruntime/test/python/quantization/test_calibration.py | .py | #!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------... | 815 | 34,524 |
sphinx | sphinx/ext/imgconverter.py | .py | """Image converter extension for Sphinx"""
from __future__ import annotations
import subprocess
import sys
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
import sphinx
from sphinx.errors import ExtensionError
from sphinx.locale import __
from sphinx.transforms.post_transforms.images impor... | 120 | 4,083 |
mlflow | tests/webhooks/test_ssrf.py | .py | import http.server
import socket
import threading
from collections.abc import Iterator
from unittest import mock
import pytest
import requests
from urllib3.util.retry import Retry
from mlflow.webhooks.delivery import _create_webhook_session
from mlflow.webhooks.ssrf import SSRFProtectedHTTPAdapter, SSRFProtectionErro... | 132 | 5,773 |
django-cms | cms/test_utils/project/emailuserapp/admin.py | .py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as OriginalUserAdmin
from .forms import UserChangeForm, UserCreationForm
from .models import EmailUser
class UserAdmin(OriginalUserAdmin):
# The form to add and change user instances
form = UserChangeForm
add_form = UserCrea... | 43 | 1,332 |
mlflow | mlflow/tracking/fluent.py | .py | """
Internal module implementing the fluent API, allowing management of an active
MLflow run. This module is exposed to users at the top-level :py:mod:`mlflow` module.
"""
import atexit
import contextlib
import importlib
import inspect
import io
import logging
import os
import threading
from copy import deepcopy
from ... | 4,057 | 155,523 |
mlflow | mlflow/groq/__init__.py | .py | """
The ``mlflow.groq`` module provides an API for logging and loading Groq models.
"""
from mlflow.groq._groq_autolog import patched_call
from mlflow.telemetry.events import AutologgingEvent
from mlflow.telemetry.track import _record_event
from mlflow.utils.autologging_utils import autologging_integration, safe_patch... | 47 | 1,657 |
wagtail | wagtail/admin/widgets/datetime.py | .py | import json
from django import forms
from django.conf import settings
from django.forms import widgets
from django.utils.formats import get_format
from wagtail.admin.datetimepicker import to_datetimepicker_format
from wagtail.admin.staticfiles import versioned_static
from wagtail.admin.telepath import register
from w... | 166 | 4,854 |
beam | sdks/python/apache_beam/runners/__init__.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 32 | 1,419 |
pyro | pyro/poutine/collapse_messenger.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from functools import reduce, singledispatch
from typing import TYPE_CHECKING, Any, FrozenSet, Tuple
from typing_extensions import Self
import pyro
from pyro.distributions.distribution import COERCIONS
from pyro.ops.linalg import ig... | 197 | 6,395 |
scikit-bio | skbio/metadata/tests/test_intersection.py | .py | # checklist.py:CopyrightHeadersValidator IGNORE
# ----------------------------------------------------------------------------
# This code is taken from bx-python project and added with a test for a new
# function `update` from line 195 to 211. The license for this code is
# included in licenses/bx_python.txt.
# ------... | 242 | 8,188 |
onnx | onnx/backend/test/case/node/tan.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Tan(Base):
@staticmethod
def export() -> None:
node = ... | 29 | 713 |
textual | docs/examples/styles/border.py | .py | from textual.app import App
from textual.widgets import Label
class BorderApp(App):
CSS_PATH = "border.tcss"
def compose(self):
yield Label("My border is solid red", id="label1")
yield Label("My border is dashed green", id="label2")
yield Label("My border is tall blue", id="label3")
... | 17 | 384 |
pyro | tests/infer/test_enum.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import logging
import math
import os
import timeit
from collections import defaultdict
from contextlib import ExitStack # python 3
import pytest
import torch
from torch.autograd import grad
from torch.distributions import constra... | 4,103 | 145,511 |
pyomo | examples/doc/samples/scripts/s2/script.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 54 | 1,780 |
mlflow | tests/store/tracking/test_gateway_rest_mixin.py | .py | import json
from mlflow.entities.gateway_budget_policy import (
BudgetAction,
BudgetDuration,
BudgetDurationUnit,
BudgetTargetScope,
BudgetUnit,
)
from mlflow.store.tracking.gateway.rest_mixin import RestGatewayStoreMixin
class _StubRestStore(RestGatewayStoreMixin):
def __init__(self):
... | 67 | 1,994 |
mlflow | dev/clint/src/clint/rules/except_bool_op.py | .py | import ast
from clint.rules.base import Rule
class ExceptBoolOp(Rule):
def _message(self) -> str:
return (
"Did you mean `except (X, Y):`? Using or/and in an except handler is likely a mistake."
)
@staticmethod
def check(node: ast.ExceptHandler) -> bool:
return isinst... | 15 | 348 |
beam | sdks/python/apache_beam/io/gcp/experimental/spannerio_read_perf_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 160 | 5,584 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.