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/core/base/transformation.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...
179
6,432
beam
sdks/python/apache_beam/tools/utils.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 use...
195
6,513
mkdocs-material
material/plugins/search/plugin.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
595
20,512
pyomo
pyomo/core/tests/unit/test_units.py
.py
# -*- coding: utf-8 -*- # ____________________________________________________________________________________ # # 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 En...
1,274
46,154
sqlmap
plugins/dbms/mysql/takeover.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os from lib.core.agent import agent from lib.core.common import Backend from lib.core.common import decloakToTemp from lib.core.common import isStackingAvailable from lib....
121
5,123
coremltools
coremltools/test/optimize/torch/quantization/test_observers.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 import pytest import torch from torch.ao.quantization import FakeQuantize from coremltools.optimize....
245
7,785
wandb
tests/system_tests/test_functional/dspy/dspy_callback_multiple_steps.py
.py
import dspy import wandb from dspy.evaluate.evaluate import EvaluationResult # type: ignore class MinimalProgram(dspy.Module): def __init__(self) -> None: super().__init__() self.predict = dspy.Predict("question: str -> answer: str") def _results(score_value: float): ex = dspy.Example(quest...
44
1,262
onnxruntime
docs/python/examples/plot_metadata.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ Metadata ======== ONNX format contains metadata related to how the model was produced. It is useful when the model is deployed to production to keep track of which instance was used at a specific time. Let's see how to d...
47
1,329
deap
tests/test_mutation.py
.py
import unittest from unittest import mock from deap.tools.mutation import mutInversion class MutationTest(unittest.TestCase): def test_mutInverstion_size_zero_chromosome_returns_unchanged_chromosome_in_tuple(self): chromosome = [] expected = [] self.assertEqual((expected,), mutInversion(...
46
1,937
mlflow
mlflow/entities/run_tag.py
.py
from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.service_pb2 import RunTag as ProtoRunTag class RunTag(_MlflowObject): """Tag object associated with a run.""" def __init__(self, key, value): self._key = key self._value = value def __eq__(self, other): i...
37
890
saleor
saleor/graphql/giftcard/tests/deprecated/test_gift_card_mutations.py
.py
import datetime from ....tests.utils import get_graphql_content CREATE_GIFT_CARD_MUTATION = """ mutation giftCardCreate( $startDate: Date, $endDate: Date, $expiryDate: Date, $channel: String, $balance: PriceInput!, $userEmail: String, $isActive: Boolean! ){ giftCardCreate(input: { ...
100
2,895
pyomo
pyomo/repn/tests/ampl/helper.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...
24
807
pyomo
doc/OnlineDocs/src/scripting/Isinglebuild.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...
57
1,798
coremltools
coremltools/converters/mil/mil/ops/tests/iOS15/test_tensor_transformation.py
.py
# Copyright (c) 2023, 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 import itertools import numpy as np import pytest import coremltools as ct from coremltools.convert...
102
3,098
pyomo
pyomo/contrib/pyros/tests/test_uncertainty_sets.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...
4,199
158,294
voila
tests/test_template/setup.py
.py
import os from setuptools import setup data_files = [] for dirpath, _dirnames, filenames in os.walk("share/jupyter/voila/templates"): if filenames: data_files.append( (dirpath, [os.path.join(dirpath, filename) for filename in filenames]) ) setup( name="test_template", version...
22
517
onnxruntime
onnxruntime/test/python/quantization/test_op_matmul_2bits.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. # ---------------------------------------------------------------...
224
8,163
openvino
src/bindings/python/tests/test_graph/test_gather.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Tensor, Type import openvino.opset8 as ov import numpy as np import pytest @pytest.mark.parametrize(("input_shape", "indices", "axis", "expected_shape", "batch_dims"), [ ((3, 3), (1, 2),...
52
2,203
clearml
examples/distributed/pytorch_distributed_example.py
.py
# ClearML - example of ClearML torch distributed support # notice all nodes will be reporting to the master Task (experiment) import os import subprocess import sys from argparse import ArgumentParser from datetime import timedelta from math import ceil from random import Random import torch as th import torch.distrib...
189
6,639
mlflow
tests/entities/test_gateway_secrets.py
.py
from mlflow.entities import GatewaySecretInfo def test_secret_creation_full(): secret = GatewaySecretInfo( secret_id="test-secret-id", secret_name="my_api_key", masked_values={"api_key": "sk-...abc123"}, created_at=1234567890000, last_updated_at=1234567890000, provi...
204
6,652
openvino
src/bindings/python/docs/examples/openvino/mymodule/myclass.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 class MyClass(): """MyClass created as part of tutorial.""" def __init__(self): pass def say_hello(self): """Say hello to the world!""" print("Hello! Let's work on OV together...
14
324
mlflow
tests/pyfunc/sample_code/func_code_with_type_hint.py
.py
from mlflow.models import set_model def predict(model_input: list[str]): return model_input set_model(predict)
9
119
onnxruntime
onnxruntime/python/torch_cpp_extensions/aten_op_executor/__init__.py
.py
import threading from functools import wraps from onnxruntime.capi import _pybind_state as _C def run_once_aten_op_executor(f): """ Decorator to run a function only once. :param f: function to be run only once during execution time despite the number of calls :return: The original function with the p...
34
1,174
hatch
src/hatch/cli/env/show.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command(short_help="Show the available environments") @click.argument("envs", required=False, nargs=-1) @click.option("--ascii", "force_ascii", is_flag=True, h...
214
7,863
mlflow
tests/gateway/providers/test_palm.py
.py
from unittest import mock import pytest from aiohttp import ClientTimeout from fastapi.encoders import jsonable_encoder from pydantic import ValidationError from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS from mlflow.gateway.config import EndpointConfig from mlflow.gateway.exceptions imp...
388
12,131
textual
src/textual/visual.py
.py
from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass from itertools import islice from typing import TYPE_CHECKING, Callable, Protocol import rich.repr from rich.console import Console, ConsoleOptions, RenderableType from rich.measure import Measurement from rich.pr...
432
13,870
django-cms
cms/test_utils/project/pluginapp/plugins/validation/cms_plugins.py
.py
from cms.plugin_base import CMSPluginBase class NonExisitngRenderTemplate(CMSPluginBase): name = 'SubTest' module = 'Test' render_template = 'i_do_not_exist.html' allow_children = True class NoSubPluginRender(CMSPluginBase): name = 'SubSubTest' module = 'Test' render_template = 'plugins/...
36
746
mlflow
examples/openai/azure_openai.py
.py
import openai import pandas as pd import mlflow """ Set environment variables for Azure OpenAI service export OPENAI_API_KEY="<AZURE OPENAI KEY>" # OPENAI_API_BASE should be the endpoint of your Azure OpenAI resource # e.g. https://<service-name>.openai.azure.com/ export OPENAI_API_BASE="<AZURE OPENAI BASE>" # OPENAI...
64
1,663
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/lambda_max_canon.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...
58
2,033
hatch
tests/cli/check/test_check_code.py
.py
from __future__ import annotations import pytest from hatch.config.constants import ConfigEnvVars from hatch.project.core import Project def construct_ruff_defaults_file(rules: tuple[str, ...]) -> str: from hatch.cli.fmt.core import PER_FILE_IGNORED_RULES lines = [ "line-length = 120", "", ...
461
15,788
saleor
saleor/webhook/utils.py
.py
from collections import defaultdict from collections.abc import Iterable from typing import TYPE_CHECKING, Optional from django.conf import settings from django.db.models import Q from django.db.models.expressions import Exists, OuterRef from ..app.models import App from .event_types import WebhookEventAsyncType, Web...
223
7,966
sqlmap
lib/controller/checks.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import copy import logging import random import re import socket import time from extra.beep.beep import beep from lib.core.agent import agent from lib.core.common import Backend...
1,874
92,568
pyomo
pyomo/dae/tests/test_initialization.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...
131
4,020
onnx
onnx/backend/test/case/model/shrink.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.model import expect class ShrinkTest(Base): @staticmethod def export() -> None: ...
43
1,200
httpie
tests/test_cookie_on_redirects.py
.py
import pytest from .utils import http @pytest.mark.parametrize('target_httpbin', [ 'httpbin', 'remote_httpbin', ]) def test_explicit_user_set_cookie(httpbin, target_httpbin, request): """User set cookies ARE NOT persisted within redirects when there is no session, even on the same domain.""" target_ht...
251
7,232
saleor
saleor/graphql/meta/tests/queries/test_page.py
.py
import graphene from ....tests.utils import assert_no_permission, get_graphql_content from .utils import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE QUERY_PAGE_TYPE_PUBLIC_META = """ query pageTypeMeta($id: ID!){ pageType(id: $id){ metadata{ key value ...
174
5,310
luigi
test/contrib/postgres_with_server_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
172
5,422
mlflow
tests/genai/utils/test_gateway_utils.py
.py
import base64 from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.genai.utils.gateway_utils import GatewayLiteLLMConfig, get_gateway_litellm_config from mlflow.utils.credentials import MlflowCreds GATEWAY_URI = "http://localhost:5000" @pytest.fixture def gateway_env(mo...
121
4,010
kombu
t/unit/utils/test_json.py
.py
from __future__ import annotations import sys import uuid from collections import namedtuple from dataclasses import dataclass from datetime import datetime, timezone from decimal import Decimal import pytest from hypothesis import given, settings from hypothesis import strategies as st from kombu.utils.encoding imp...
156
4,726
saleor
saleor/graphql/product/tests/mutations/test_product_variant_delete.py
.py
from unittest.mock import patch import graphene import pytest from prices import Money, TaxedMoney from .....discount.utils.promotion import get_active_catalogue_promotion_rules from .....order import OrderEvents, OrderStatus from .....order.models import OrderEvent, OrderLine from .....product.models import ProductV...
537
17,882
wandb
wandb/sdk/lib/__init__.py
.py
from . import lazyloader from .disabled import RunDisabled, SummaryDisabled from .run_moment import RunMoment __all__ = ("lazyloader", "RunDisabled", "SummaryDisabled", "RunMoment")
6
183
beam
playground/infrastructure/constants.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 use ...
22
1,065
pyomo
pyomo/contrib/pynumero/linalg/tests/test_ma27.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...
166
6,849
onnxruntime
tools/python/onnx_test_data_utils.py
.py
import argparse import glob import os import sys import numpy as np import onnx from onnx import numpy_helper def read_tensorproto_pb_file(filename): """Return tuple of tensor name and numpy.ndarray of the data from a pb file containing a TensorProto.""" tensor = onnx.load_tensor(filename) np_array = nu...
247
9,255
pyomo
pyomo/contrib/pynumero/interfaces/nlp.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...
597
16,621
eve
tests/renders.py
.py
# -*- coding: utf-8 -*- import simplejson as json from bson import ObjectId from eve.utils import api_prefix from . import TestBase from .test_settings import MONGO_DBNAME class TestRenders(TestBase): def test_default_render(self): r = self.test_client.get("/") self.assertEqual(r.content_type, ...
378
16,373
omegaconf
build_helpers/build_helpers.py
.py
import distutils.log import errno import os import re import shutil import subprocess import sys from functools import partial from pathlib import Path from typing import Any, ClassVar, List, Optional from setuptools import Command from setuptools.command import build_py, develop, sdist class ANTLRCommand(Command): ...
226
6,997
probability
tensorflow_probability/python/experimental/mcmc/nuts_autobatching_xla_test.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...
131
4,754
wagtail
wagtail/admin/jinja2tags.py
.py
import jinja2 from jinja2.ext import Extension from .templatetags.wagtailuserbar import wagtailuserbar class WagtailUserbarExtension(Extension): def __init__(self, environment): super().__init__(environment) self.environment.globals.update( { "wagtailuserbar": jinja2....
20
431
conda
conda/_private/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ `conda._private`. Keep `__init__.py` empty to avoid side-effects. If you are an API user, stop! This module has no stability guarantees. Symbols under `_conda` can be renamed or removed at any time. Instead, look for re-exported API under `...
10
334
sqlmap
tests/test_report.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission JSON scan report collector/assembler (lib/utils/api.py), shared by the REST API endpoint /scan/<id>/data and the CLI --report-json writer. The whole point of the feature is that both...
227
11,765
mlflow
mlflow/genai/judges/optimizers/simba.py
.py
"""SIMBA alignment optimizer implementation.""" import logging from typing import TYPE_CHECKING, Any, Callable, ClassVar, Collection from mlflow.genai.judges.optimizers.dspy import DSPyAlignmentOptimizer from mlflow.genai.judges.optimizers.dspy_utils import ( _check_dspy_installed, suppress_verbose_logging, )...
120
4,178
sphinx
tests/roots/test-api-set-translator/conf.py
.py
# set this by test # import sys # from pathlib import Path # sys.path.insert(0, str(Path.cwd().resolve())) from docutils.writers.docutils_xml import XMLTranslator from sphinx.writers.html import HTML5Translator from sphinx.writers.latex import LaTeXTranslator from sphinx.writers.manpage import ManualPageTranslator fr...
73
1,679
kombu
t/unit/transport/test_librabbitmq.py
.py
from __future__ import annotations from unittest.mock import Mock, patch import pytest pytest.importorskip('librabbitmq') from kombu.transport import librabbitmq # noqa class test_Message: def test_init(self): chan = Mock(name='channel') message = librabbitmq.Message( chan, {'pro...
190
6,754
wagtail
wagtail/api/v3/tests/test_auth.py
.py
from django.conf import settings from django.test import TestCase, override_settings from django.test.client import RequestFactory from django.urls import reverse from ninja.constants import NOT_SET from wagtail.api.v3.auth import AllowAnonymous, BearerTokenAuth from wagtail.api.v3.tests.base import TestV3Base from wa...
144
5,946
coremltools
coremltools/test/sklearn_tests/test_random_forest_regression_numeric.py
.py
# Copyright (c) 2017, 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 import itertools import unittest import pandas as pd import pytest from ..utils import load_boston fro...
108
3,695
beam
sdks/python/apache_beam/examples/dataframe/taxiride.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...
127
4,366
mlflow
mlflow/store/artifact/databricks_sdk_artifact_repo.py
.py
import logging import posixpath from concurrent.futures import Future from pathlib import Path from typing import TYPE_CHECKING from packaging.version import Version from mlflow.entities import FileInfo from mlflow.environment_variables import MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE from mlflow.exceptions import MlflowExc...
142
5,605
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/nteract_with_parameter.py
.py
# --- # jupyter: # jupytext: # cell_markers: '{{{,}}}' # kernel_info: # name: python3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # {{{ inputHidden=false outputHidden=false tags=["parameters"] param = 4 # }}} # {{{ inputHidden=false outputHidden=false impo...
31
598
marshmallow
examples/flask_example.py
.py
# /// script # requires-python = ">=3.10" # dependencies = [ # "flask", # "flask-sqlalchemy>=3.1.1", # "marshmallow", # "sqlalchemy>2.0", # ] # /// from __future__ import annotations import datetime from flask import Flask, request from flask_sqlalchemy import SQLAlchemy from sqlalchemy.exc import NoR...
163
4,551
pyro
tests/infer/mcmc/test_valid_models.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import io import logging import pytest import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.infer import config_enumerate from pyro.infer.mcmc import HMC, NUTS from pyro.infer.mcmc.a...
495
17,116
toolz
toolz/dicttoolz.py
.py
import operator import collections from functools import reduce from collections.abc import Mapping __all__ = ('merge', 'merge_with', 'valmap', 'keymap', 'itemmap', 'valfilter', 'keyfilter', 'itemfilter', 'assoc', 'dissoc', 'assoc_in', 'update_in', 'get_in') def _get_factory(f, kwargs): fac...
340
8,955
pyro
profiler/gaussianhmm.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import argparse import torch from tqdm.auto import tqdm import pyro.distributions as dist def random_mvn(batch_shape, dim, requires_grad=False): rank = dim + dim loc = torch.randn(batch_shape + (dim,), requires_grad=require...
84
2,678
black
tests/data/cases/standardize_type_comments.py
.py
def foo( a, #type:int b, #type: str c, # type: List[int] d, # type: Dict[int, str] e, # type: ignore f, # type : ignore g, # type : ignore ): pass # output def foo( a, # type: int b, # type: str c, # type: List[int] d, # type: Dict[int, str] e, ...
23
396
wagtail
wagtail/admin/ui/tables/__init__.py
.py
"""Helper classes for formatting data as tables""" from collections import OrderedDict from collections.abc import Mapping from django.contrib.admin.utils import quote from django.contrib.humanize.templatetags.humanize import intcomma from django.forms import MediaDefiningClass from django.template.loader import get_...
716
25,935
mlflow
mlflow/store/_unity_catalog/registry/utils.py
.py
""" Utility functions for converting between Unity Catalog proto and MLflow entities. """ import json from mlflow.entities.model_registry.prompt import Prompt from mlflow.entities.model_registry.prompt_version import PromptVersion from mlflow.prompt.constants import PROMPT_MODEL_CONFIG_TAG_KEY, RESPONSE_FORMAT_TAG_KE...
159
5,557
mlflow
mlflow/genai/judges/tools/get_span_image.py
.py
""" Get span image tool for MLflow GenAI judges. This module provides a tool that resolves an ``mlflow-attachment://`` image reference inside a span, downloads the real bytes, and returns them as a base64 data URL so a multimodal judge model can actually view the image. When autolog extracts an image from a span it r...
198
8,690
onnx
onnx/backend/test/case/node/constant.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 Constant(Base): @staticmethod def export() -> None: va...
30
801
mlflow
mlflow/langchain/__init__.py
.py
from mlflow.langchain.autolog import autolog from mlflow.langchain.constants import FLAVOR_NAME from mlflow.version import IS_TRACING_SDK_ONLY __all__ = ["autolog", "FLAVOR_NAME"] # Import model logging APIs only if mlflow skinny or full package is installed, # i.e., skip if only mlflow-tracing package is installed. ...
25
655
readthedocs.org
readthedocs/oauth/tests/test_querysets.py
.py
from django.contrib.auth.models import User from django.test import TestCase from django_dynamic_fixture import get from readthedocs.oauth.models import RemoteRepository, RemoteRepositoryRelation from readthedocs.projects.models import Project class TestRemoteRepositoryQuerysets(TestCase): def setUp(self): ...
87
2,779
pyro
pyro/contrib/autoname/scoping.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ ``pyro.contrib.autoname.scoping`` contains the implementation of :func:`pyro.contrib.autoname.scope`, a tool for automatically appending a semantically meaningful prefix to names of sample sites. """ import functools from pyr...
193
6,483
gunicorn
gunicorn/pidfile.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import errno import os import tempfile class Pidfile: """\ Manage a PID file. If a specific name is provided it and '"%s.oldpid" % name' will be used. Otherwise we create a temp file using os.mkst...
88
2,381
openvino
tests/layer_tests/pytorch_tests/test_flatten.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestFlatten(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 3, 4, 5),) def create_model(self, dim0, dim1): im...
42
1,361
saleor
saleor/graphql/discount/tests/queries/test_voucher.py
.py
import graphene from ....tests.utils import ( assert_no_permission, get_graphql_content, get_graphql_content_from_response, ) QUERY_VOUCHER_BY_ID = """ query Voucher($id: ID!) { voucher(id: $id) { id codes(first: 10){ edges { node { ...
109
3,014
saleor
saleor/plugins/admin_email/tests/test_notify_events.py
.py
from unittest import mock from ....account.notifications import get_default_user_payload from ....core.notify import NotifyHandler from ....order.notifications import get_default_order_payload from ..notify_events import ( send_csv_export_failed, send_csv_export_success, send_set_staff_password_email, ...
221
7,223
saleor
saleor/graphql/product/filters/shared.py
.py
import graphene from ...core.doc_category import DOC_CATEGORY_PRODUCTS from ...core.types import BaseInputObjectType, IntRangeInput, NonNullList from ...utils.filters import filter_range_field def filter_updated_at_range(qs, _, value): return filter_range_field(qs, "updated_at", value) class ProductStockFilter...
18
532
mlflow
mlflow/assistant/types.py
.py
import json from enum import Enum from typing import Any, Literal from pydantic import BaseModel, Field # Message interface between assistant providers and the assistant client # Inspired by https://github.com/anthropics/claude-agent-sdk-python/blob/29c12cd80b256e88f321b2b8f1f5a88445077aa5/src/claude_agent_sdk/types....
138
4,369
python-prompt-toolkit
src/prompt_toolkit/eventloop/utils.py
.py
from __future__ import annotations import asyncio import contextvars import sys import time from asyncio import get_running_loop from collections.abc import Awaitable, Callable from types import TracebackType from typing import Any, TypeVar, cast __all__ = [ "run_in_executor_with_context", "call_soon_threadsa...
103
3,227
pdm
src/pdm/exceptions.py
.py
from __future__ import annotations import warnings from typing import TYPE_CHECKING if TYPE_CHECKING: from pdm.models.candidates import Candidate class PdmException(Exception): pass class ResolutionError(PdmException): pass class PdmArgumentError(PdmException): pass class PdmUsageError(PdmExce...
87
1,418
probability
tensorflow_probability/python/bijectors/sinh_arcsinh_test.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...
205
9,019
openvino
tests/e2e_tests/common/model_loader/tf_hub_model_loader.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import sys import tensorflow_hub as hub from e2e_tests.common.model_loader.provider import ClassProvider class TFHubModelLoader(ClassProvider): """TFHub models loader runner.""" __action_name__ = "load_tf...
35
1,302
pyomo
examples/pyomobook/abstract-ch/param7b.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...
24
839
cvxpy
cvxpy/atoms/quantum_rel_entr.py
.py
""" Copyright 2023, 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, soft...
134
4,133
gunicorn
tests/test_dirty_tlv.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for dirty TLV binary encoder/decoder.""" import math import struct import pytest from gunicorn.dirty.tlv import ( TLVEncoder, TYPE_NONE, TYPE_BOOL, TYPE_INT64, TYPE_FLOAT64, TYPE_...
555
18,807
openvino
tests/layer_tests/tensorflow_tests/test_tf_ComplexAbs.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest rng = np.random.default_rng(346546756) class TestComplexAbs(CommonTFLayerTest): def _prepare_input(self, inputs_info...
42
1,731
metrics
src/torchmetrics/regression/pearson.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...
265
9,769
openvino
src/frontends/tensorflow/tests/test_models/models_pbtxt/model_switch_merge_several_cond_flows.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # Documents how model_switch_merge_several_cond_flows.pbtxt was produced. # Two Switch nodes: `Switch` feeds real data (AddV2/Sub -> Merge); `Switch_1` is consumed only # through control dependencies, so the frontend prunes and frees it ...
36
1,489
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupby_expr.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");...
57
1,626
saleor
saleor/tests/e2e/orders/utils/order_bulk_create.py
.py
from saleor.graphql.tests.utils import get_graphql_content from .fragments import ORDER_LINE_FRAGMENT ORDER_BULK_CREATE_MUTATION = ( """ mutation OrderBulkCreate( $orders: [OrderBulkCreateInput!]!, $errorPolicy: ErrorPolicyEnum, $stockUpdatePolicy: StockUpdatePolicyEnum ) { orderBulkCreate( ...
204
5,148
wagtail
wagtail/test/i18n/apps.py
.py
from django.apps import AppConfig class I18nAppConfig(AppConfig): default_auto_field = "django.db.models.AutoField" name = "wagtail.test.i18n"
7
153
onnx
onnx/reference/ops/op_mean.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class Mean(OpRun): def _run(self, *args): res = args[0].copy() for m in args[1:]: res += m return ((res / len(args)).asty...
15
340
wandb
wandb/sdk/artifacts/_generated/update_user_registry_role.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLResult class UpdateUserRegistryRole(GQLResult): result: UpdateUserRegistryRoleResult | None class UpdateUserRegistryRoleResult(GQLResult): success: bool UpdateUserR...
18
348
pyomo
doc/OnlineDocs/src/scripting/noiteration1.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...
40
1,146
coremltools
coremltools/models/neural_network/quantization_utils.py
.py
# Copyright (c) 2017, 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 """ Utilities to compress Neural Network Models. Only available in coremltools 2.0b1 and onwards """ fro...
1,701
59,271
kafka
tests/kafkatest/tests/streams/streams_optimized_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 use ...
149
7,208
qutip
qutip/tests/core/data/test_convert.py
.py
import numpy as np import pytest from scipy import sparse from qutip import data, CoreOptions from .test_mathematics import UnaryOpMixin def test_init_empty_data(): shape = (3, 3) base_data = data.Data(shape) assert base_data.shape[0] == shape[0] assert base_data.shape[1] == shape[1] @pytest.mark.pa...
118
4,874
coremltools
coremltools/test/sklearn_tests/test_io_types.py
.py
# Copyright (c) 2017, 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 import unittest import numpy as np import PIL.Image from ..utils import load_boston import coremltools...
344
14,420
onnx
onnx/reference/ops/op_neg.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class Neg(OpRunUnaryNum): def _run(self, x): return (np.negative(x),)
14
270
saleor
saleor/graphql/payment/tests/queries/test_payment_sources.py
.py
from unittest.mock import ANY import graphene import pytest from .....payment.interface import CustomerSource, PaymentMethodInfo, TokenConfig from .....payment.utils import fetch_customer_id, store_customer_id from ....tests.utils import assert_no_permission, get_graphql_content DUMMY_GATEWAY = "mirumee.payments.dum...
155
4,290
astropy
astropy/stats/tests/test_circstats.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from astropy import units as u from astropy.stats.circstats import ( _length, circcorrcoef, circmean, circmoment, circvar, rayleightest, vonmisesmle, vtest, ) from astropy.utils.compat.optional_deps...
208
6,194