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
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/local_artifact.py
.py
from mlflow.store.artifact.local_artifact_repo import LocalArtifactRepository class PluginLocalArtifactRepository(LocalArtifactRepository): """LocalArtifactRepository provided through plugin system""" is_plugin = True
8
229
django-cms
docs/conf.py
.py
# # django cms documentation build configuration file, created by # sphinx-quickstart on Tue Sep 15 10:47:03 2009. # # This file is execfile()d with the current directory set to its containing # dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration valu...
342
10,862
conda
conda/testing/http_test_server.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ HTTP test server for serving local files during tests. This module provides a local HTTP server that can be used in pytest fixtures to serve files from a specified directory. The server runs on a random port and supports both IPv4 and IPv6....
86
2,920
readthedocs.org
readthedocs/doc_builder/config.py
.py
"""An API to load config from a readthedocs.yml file.""" from readthedocs.config import load as load_config def load_yaml_config(version, readthedocs_yaml_path=None): """ Load a build configuration file (`.readthedocs.yaml`). This uses the configuration logic from `readthedocs-build`, which will keep ...
30
1,099
probability
tensorflow_probability/python/sts/anomaly_detection/anomaly_detection_lib.py
.py
# Copyright 2021 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...
381
17,771
wandb
wandb/proto/v6/wandb_server_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_server.proto # Protobuf Python Version: 6.30.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descripto...
81
8,941
mlflow
mlflow/gateway/providers/deepseek.py
.py
from mlflow.gateway.config import _OpenAICompatibleConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class DeepSeekProvider(OpenAICompatibleProvider): DISPLAY_NAME = "DeepSeek" CONFIG_TYPE = _OpenAICompatibleConfig DEFAULT_API_BASE = "https://api.deepseek.com/v1"
9
315
biopython
Bio/Align/analysis.py
.py
# Copyright 2013 by Zheng Ruan (zruan1991@gmail.com). All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Code...
1,300
46,214
wagtail
wagtail/admin/forms/comments.py
.py
from django.contrib.auth import get_user_model from django.forms import BooleanField, ValidationError from django.utils.timezone import now from django.utils.translation import gettext as _ from modelcluster.forms import BaseChildFormSet from modelcluster.models import get_serializable_data_for_fields from wagtail.adm...
141
5,115
saleor
saleor/graphql/menu/resolvers.py
.py
from ...menu import models from ..core.context import ( ChannelContext, ChannelQsContext, get_database_connection_name, ) from ..core.utils import from_global_id_or_error from ..core.validators import validate_one_of_args_is_in_query from .types import Menu def resolve_menu(info, channel, menu_id=None, na...
57
1,693
wandb
tests/unit_tests/test_launch/test_builder/test_bootstrap.py
.py
import re import pytest from wandb.sdk.launch.builder.templates._wandb_bootstrap import TORCH_DEP_REGEX @pytest.mark.parametrize( "dep,expected", [ ("torch", None), ("torch==1.7.0", (None, None)), ("torch==1.7.0+cu110", (None, "+cu110")), ( "torch==1.7.0+cu110 -f h...
33
947
luigi
test/contrib/sqla_test.py
.py
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Gouthaman Balaraman # # 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 applic...
394
14,116
gunicorn
gunicorn/arbiter.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import errno import os import queue import random import signal import sys import time import traceback import socket from gunicorn.errors import HaltServer, AppImportError from gunicorn.pidfile import Pidfile from...
989
33,262
black
src/blackd/middlewares.py
.py
from collections.abc import Awaitable, Callable, Collection, Iterable from aiohttp import web from aiohttp.typedefs import Middleware from aiohttp.web_middlewares import middleware from aiohttp.web_request import Request from aiohttp.web_response import StreamResponse Handler = Callable[[Request], Awaitable[StreamRes...
46
1,487
clearml
clearml/backend_api/session/callresult.py
.py
import logging import sys import time from typing import Optional, Dict, Type, Any import requests from ...backend_api.utils import get_response_cls from .response import ResponseMeta, Response from .errors import ResultNotReadyError, TimeoutExpiredError class CallResult: @property def meta(self) -> Respon...
197
6,641
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/dummy_evaluator.py
.py
import io import os import tempfile import pandas as pd from PIL import Image from sklearn import metrics as sk_metrics from mlflow import MlflowClient from mlflow.entities import Metric from mlflow.models.evaluation import ( EvaluationArtifact, EvaluationResult, ModelEvaluator, ) from mlflow.models.evalu...
119
4,626
saleor
saleor/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py
.py
import json from decimal import Decimal from unittest.mock import MagicMock, patch import graphene import pytest from django.core.files import File from freezegun import freeze_time from ....channel.models import Channel from ....giftcard.models import GiftCard from ....graphql.webhook.subscription_query import Subsc...
3,345
115,446
jupytext
tests/data/notebooks/outputs/ipynb_to_script/jupyter_with_raw_cell_on_top.py
.py
# --- # title: Quick test # output: # ioslides_presentation: # widescreen: true # smaller: true # editor_options: # chunk_output_type: console # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- 1+2+3
19
269
wagtail
wagtail/images/api/v3/schemas.py
.py
from typing import Literal, cast from django.urls import reverse from django.urls.exceptions import NoReverseMatch from ninja import Schema from wagtail.api.v2.utils import get_full_url from wagtail.api.v3.schemas import create_generator, patch_generator, read_generator from wagtail.api.v3.schemas.base import BaseMet...
105
3,749
lemur
lemur/common/missing.py
.py
import arrow from flask import current_app from lemur.common.utils import is_weekend def convert_validity_years(data): """ Convert validity years to validity_start and validity_end :param data: :return: """ if data.get("validity_years"): now = arrow.utcnow() data["validity_st...
26
622
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_slice.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # slice paddle model generator # import sys import os import numpy as np import paddle from save_model import exportModel from save_model import saveModel data_type = 'float32' def slice(name : str, x, axes : list, start : list, en...
102
3,399
textual
tests/select/test_changed_message.py
.py
from textual import on from textual.app import App from textual.widgets import Select from textual.widgets._select import SelectOverlay class SelectApp(App[None]): def __init__(self): self.changed_messages = [] super().__init__() def compose(self): yield Select[int]([(str(n), n) for n...
68
2,082
wandb
wandb/proto/wandb_internal_pb2.py
.py
import google.protobuf protobuf_version = google.protobuf.__version__[0] if protobuf_version == "5": from wandb.proto.v5.wandb_internal_pb2 import * elif protobuf_version == "6": from wandb.proto.v6.wandb_internal_pb2 import * elif protobuf_version == "7": from wandb.proto.v7.wandb_internal_pb2 import * e...
17
543
cvxpy
cvxpy/reductions/eliminate_pwl/canonicalizers/norm_inf_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...
43
1,533
textual
tests/text_area/test_selection.py
.py
import pytest from textual.app import App, ComposeResult from textual.widgets import TextArea from textual.widgets.text_area import Selection TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. """ class TextAreaApp(App): def compose(...
356
10,670
mlflow
examples/transformers/whisper.py
.py
import requests import transformers import mlflow # Acquire an audio file resp = requests.get( "https://github.com/mlflow/mlflow/raw/master/tests/datasets/apollo11_launch.wav" ) resp.raise_for_status() audio = resp.content task = "automatic-speech-recognition" architecture = "openai/whisper-tiny" model = transf...
57
2,046
sqlmap
tamper/space2mysqlblank.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os import random from lib.core.common import singleTimeWarnMessage from lib.core.compat import xrange from lib.core.enums import DBMS from lib.core.enums import PRIORITY ...
73
2,054
mlflow
tests/pyfunc/test_chat_model.py
.py
import json import pathlib import pickle import uuid from dataclasses import asdict import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.models.model import Model from mlflow.models.signature import ModelSignature from mlflow.models.utils import load_serving_example from mlflow.pyfunc...
662
21,901
gunicorn
tests/docker/asgi_compliance/conftest.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Pytest fixtures for ASGI compliance Docker integration tests.""" import subprocess import time import socket from pathlib import Path import pytest # Directory containing this conftest.py DOCKER_DIR = Path(__...
374
12,246
onnx
onnx/backend/test/case/node/gridsample.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 GridSample(Base): @staticmethod def export_gridsample() -> Non...
643
19,717
saleor
saleor/tests/e2e/account/staff/test_should_bulk_update_customers_metadata.py
.py
import pytest from ...utils import assign_permissions from ..utils import create_customer, customer_bulk_update @pytest.mark.e2e def test_should_bulk_update_customers_metadata_core_1513( e2e_staff_api_client, permission_manage_users, ): # Before permissions = [ permission_manage_users, ] ...
67
2,064
ipython
tests/test_display.py
.py
"""Tests for IPython.lib.display.""" # ----------------------------------------------------------------------------- # Copyright (c) 2012, the 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. # ------...
342
12,046
conda
tests/plugins/test_pre_commands.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import pytest from conda import plugins from conda.plugins.reporter_backends import plugins as reporter_backends_plugins from conda.plugins.types import CondaPreCommand class PreCommandPlugin: def pre_command_action(self, command: str) ->...
65
1,970
saleor
saleor/thumbnail/tests/fixtures/thumbnail.py
.py
import pytest from ...models import Thumbnail @pytest.fixture def thumbnail_product_media(product_media_image, image_list, media_root): return Thumbnail.objects.create( product_media=product_media_image, size=128, image=image_list[1], ) @pytest.fixture def thumbnail_category(categor...
41
946
gunicorn
tests/requests/valid/018.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. req1 = { "method": "GET", "uri": uri("/first"), "version": (1, 1), "headers": [], "body": b"" } req2 = { "method": "GET", "uri": uri("/second"), "version": (1, 1), "headers": []...
22
364
mlflow
mlflow/store/artifact/utils/models.py
.py
import urllib.parse from pathlib import Path from typing import NamedTuple import mlflow.tracking from mlflow.exceptions import MlflowException from mlflow.utils.uri import ( get_databricks_profile_uri_from_artifact_uri, is_databricks_uri, is_models_uri, ) _MODELS_URI_SUFFIX_LATEST = "latest" def is_usi...
153
6,353
textual
src/textual/_path.py
.py
from __future__ import annotations import inspect from pathlib import Path, PurePath from typing import List, Union from typing_extensions import TypeAlias CSSPathType: TypeAlias = Union[ str, PurePath, List[Union[str, PurePath]], ] """Valid ways of specifying paths to CSS files.""" class CSSPathError(...
73
2,062
pynacl
tests/test_box.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # 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...
400
10,526
onnxruntime
onnxruntime/python/tools/quantization/qdq_quantizer.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from __fut...
1,542
72,744
textual
docs/examples/guide/styles/dimensions03.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past, I will turn the inner eye to see i...
28
762
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_voucher_limit_per_customer.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
201
6,312
astropy
astropy/modeling/projections.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name """ Implements projections--particularly sky projections defined in WCS Paper II [1]_. All angles are set and and displayed in degrees but internally computations are performed in radians. All functions expect inputs and out...
1,677
46,604
sqlmap
plugins/dbms/altibase/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): def co...
16
505
onnxruntime
onnxruntime/test/python/transformers/benchmark_qmoe.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import os import sys import time import unittest import numpy import t...
192
8,160
hatch
src/hatch/cli/env/remove.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="Remove environments") @click.argument("env_name", default="default") @click.pass_context def remove(ctx: click.Context, env_name: str): ...
35
1,117
coremltools
coremltools/converters/mil/frontend/torch/ssa_passes/torch_tensor_assign_to_core.py
.py
# Copyright (c) 2021, 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 coremltools.converters.mil.mil import Builder as mb from coremltools.converters.mil.mil.passes.g...
64
2,397
wagtail
wagtail/documents/__init__.py
.py
from django.conf import settings from django.core.exceptions import ImproperlyConfigured def get_document_model_string(): """ Get the dotted ``app.Model`` name for the document model as a string. Useful for developers making Wagtail plugins that need to refer to the document model, such as in foreign ...
46
1,522
beam
sdks/python/apache_beam/transforms/enrichment_handlers/feast_feature_store.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...
201
8,501
django-cms
cms/operations/helpers.py
.py
import uuid from cms.models import Page from cms.signals import post_obj_operation, pre_obj_operation def send_pre_page_operation(request, operation, sender=Page, **kwargs): token = str(uuid.uuid4()) pre_obj_operation.send( sender=sender, operation=operation, request=request, ...
27
605
readthedocs.org
readthedocs/search/tests/dummy_data.py
.py
PROJECT_DATA_FILES = { "pipeline": ["installation", "signals"], "kuma": ["documentation", "docker"], "docs": ["support", "wiping", "index", "guides/index"], } ALL_PROJECTS = PROJECT_DATA_FILES.keys()
8
213
openvino
tests/layer_tests/pytorch_tests/test_aliases.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_alias(torch.nn.Module): def forward(self, x): y = x.clone() y[:, 1, :, :] = 4. return y class aten_alias_tensor(...
67
2,200
beam
sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_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...
179
6,354
textual
src/textual/_line_split.py
.py
from __future__ import annotations import re # Pre-compile the regular expression and store it in a global constant LINE_AND_ENDING_PATTERN = re.compile(r"(.*?)(\r\n|\r|\n|$)", re.S) def line_split(input_string: str) -> list[tuple[str, str]]: r""" Splits an arbitrary string into a list of tuples, where each...
24
846
saleor
saleor/graphql/page/tests/mutations/test_page_create.py
.py
import datetime from functools import partial from unittest import mock from unittest.mock import ANY import graphene from django.conf import settings from django.utils.functional import SimpleLazyObject from django.utils.text import slugify from freezegun import freeze_time from .....page.error_codes import PageErro...
2,040
66,747
lemur
lemur/endpoints/service.py
.py
""" .. module: lemur.endpoints.service :platform: Unix :synopsis: This module contains all of the services level functions used to administer endpoints in Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson ...
230
6,021
openvino
tests/layer_tests/pytorch_tests/test_transpose.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest # x.T (numpy_T) on non-2D tensors is deprecated in PyTorch 2.9: # - 0-D: "Tensor.T is deprecated on 0-D te...
125
4,866
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_2in_2out_dynbatch.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import paddle import numpy as np import os import sys from save_model import saveModel if paddle.__version__ >= '2.6.0': import paddle.base as fluid else: from paddle import fluid paddle.enable_static() inp_blob1 = np.random....
71
2,772
clearml
clearml/utilities/lowlevel/threads.py
.py
import ctypes import sys import threading import time from typing import Any import six def get_current_thread_id() -> int: return threading._get_ident() if six.PY2 else threading.get_ident() # noqa # Nasty hack to raise exception for other threads def _lowlevel_async_raise(thread_obj: threading.Thread, excep...
129
3,575
probability
required_packages.py
.py
# Copyright 2021 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...
34
1,138
pyro
examples/contrib/mue/FactorMuE.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 """ A probabilistic PCA model with a MuE observation, called a 'FactorMuE' model [1]. This is a generative model of variable-length biological sequences (e.g. proteins) which does not require preprocessing the data by building a multip...
433
13,776
deap
doc/code/benchmarks/h1.py
.py
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.colors import LogNorm import matplotlib.pyplot as plt try: import numpy as np except: exit() from deap import benchmarks def h1_arg0(sol): return benchmarks.h1(sol)[0] fig = plt.figure() # ax = Axes3D(fig, azim = -29, elev...
29
671
onnxruntime
orttraining/orttraining/python/training/ortmodule/_utils.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # pylint: disable=W0511 import copy import functools import inspect impo...
475
20,364
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineglobally_side_inputs_iter.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");...
50
1,799
astropy
astropy/io/fits/hdu/compressed/setup_package.py
.py
# Licensed under a 3-clause BSD style license import os from setuptools import Extension SRC_DIR = os.path.relpath(os.path.join(os.path.dirname(__file__), "src")) def get_extensions(): return [ Extension( "astropy.io.fits.hdu.compressed._compression", sources=[ o...
26
860
saleor
saleor/graphql/app/tests/mutations/test_app_deactivate.py
.py
import json from unittest import mock import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....app.error_codes import AppErrorCode from .....app.models import App from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import ...
254
6,628
python-prompt-toolkit
src/prompt_toolkit/key_binding/vi_state.py
.py
from __future__ import annotations from collections.abc import Callable from enum import Enum from typing import TYPE_CHECKING from prompt_toolkit.clipboard import ClipboardData if TYPE_CHECKING: from .bindings.vi import TextObject from .key_processor import KeyPressEvent __all__ = [ "InputMode", "C...
109
3,364
metrics
src/torchmetrics/functional/detection/ciou.py
.py
# Copyright The PyTorch 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 i...
128
4,912
saleor
saleor/app/tests/test_manifest_validations.py
.py
import pytest from django.core.exceptions import ValidationError from pydantic import ValidationError as PydanticValidationError from ...permission.enums import AppPermission, ProductPermissions from ..error_codes import AppErrorCode from ..manifest_schema import ( EXTENSION_IDENTIFIER_MAX_LENGTH, ICON_MIME_TY...
773
23,095
beam
sdks/python/apache_beam/io/filesystem.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...
942
31,390
textual
docs/examples/widgets/rich_log.py
.py
import csv import io from rich.syntax import Syntax from rich.table import Table from textual import events from textual.app import App, ComposeResult from textual.widgets import RichLog CSV = """lane,swimmer,country,time 4,Joseph Schooling,Singapore,50.39 2,Michael Phelps,United States,51.14 5,Chad le Clos,South Af...
66
1,746
onnxruntime
onnxruntime/python/tools/transformers/fusion_nhwc_conv.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger from fusion_base import Fusion from fusi...
100
3,849
mlflow
mlflow/llama_index/tracer.py
.py
import inspect import json import logging from functools import singledispatchmethod from typing import Any, Generator import llama_index.core import pydantic from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.base.llms.b...
749
32,309
hydra
hydra/plugins/completion_plugin.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # TODO: Test with /miniconda3/envs/hydra36/bin/python , seems to be running python for some reason. # TODO: Add tests for completion with +prefix (should suggest config groups that are not listed) # TODO: Test completion when defaults has a missing...
304
11,337
wagtail
wagtail/rich_text/rewriters.py
.py
""" Utility classes for rewriting elements of HTML-like strings """ import re from collections import defaultdict from collections.abc import Callable from django.utils.functional import cached_property FIND_A_TAG = re.compile(r"<a(\b[^>]*)>") FIND_EMBED_TAG = re.compile(r"<embed(\b[^>]*)/>") FIND_ATTRS = re.compile...
243
8,054
conda
conda/core/prefix_data.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tools for managing the packages installed within an environment.""" from __future__ import annotations import os import re import warnings from collections import UserDict from datetime import datetime, timezone from logging import getLogge...
821
31,121
probability
tensorflow_probability/python/experimental/mcmc/preconditioned_nuts.py
.py
# Copyright 2019 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...
1,117
46,021
returns
tests/test_context/test_requires_context_ioresult/test_context_ioresult.py
.py
from copy import copy, deepcopy import pytest from returns.context import RequiresContextIOResult from returns.primitives.exceptions import ImmutableStateError def test_requires_context_result_immutable(): """Ensures that container is immutable.""" with pytest.raises(ImmutableStateError): RequiresCo...
25
872
pyomo
pyomo/contrib/pynumero/algorithms/solvers/implicit_functions.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...
617
24,647
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_BroadcastTo.py
.py
import platform import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [1, 1, 1, 1, 40], 'broadcast_shape': [1, 1, 56, 56, 40]}, {'shape': [1, 1, 1, 1, 10], 'broadcast_shape': [1, 1, 10, 10, 10]} ] class TestTFLiteBroadcastToLayerTest(TFLi...
38
1,486
bazel
src/test/py/bazel/bzlmod/bazel_overrides_test.py
.py
# pylint: disable=g-backslash-continuation # Copyright 2023 The Bazel Authors. All rights reserved. # # 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/LICEN...
967
29,949
eve
eve/io/mongo/flask_pymongo.py
.py
# -*- coding: utf-8 -*- """ eve.io.mongo.flask_pymongo ~~~~~~~~~~~~~~~~~~~ Flask extension to create Mongo connection and database based on configuration. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from bson import UuidRepresentation from flask im...
136
4,962
probability
tensorflow_probability/python/distributions/untestable_distributions.py
.py
# Copyright 2020 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...
21
992
mlflow
mlflow/genai/evaluation/constant.py
.py
class AgentEvaluationReserverKey: """ Expectation column names that are used by Agent Evaluation. Ref: https://docs.databricks.com/aws/en/generative-ai/agent-evaluation/evaluation-schema """ EXPECTED_RESPONSE = "expected_response" EXPECTED_RETRIEVED_CONTEXT = "expected_retrieved_context" EX...
48
1,260
astropy
astropy/units/format/ogip.py
.py
# Licensed under a 3-clause BSD style license - see LICNSE.rst # This module includes files automatically generated from ply (these end in # _lextab.py and _parsetab.py). To generate these files, remove them from this # folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # ...
339
11,578
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Range.py
.py
import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest np.random.seed(42) test_params = [ {'dtype': np.float32, 'negative_delta': False}, {'dtype': np.int32, 'negative_delta': True}, ] class TestTFLiteRangeLayerTest(TFLiteLayerTest): inputs =...
53
1,997
probability
tensorflow_probability/python/experimental/auto_batching/tf_backend_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...
102
4,201
pyomo
examples/pyomobook/abstract-ch/abstract6.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...
36
1,089
probability
tensorflow_probability/python/distributions/noncentral_chi2_test.py
.py
# Copyright 2022 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...
378
13,366
pyro
pyro/ops/einsum/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import opt_einsum from pyro.util import ignore_jit_warnings _PATH_CACHE = {} def contract_expression(equation, *shapes, **kwargs): """ Wrapper around :func:`opt_einsum.contract_expression` that optionally uses Pyro'...
50
1,486
saleor
saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py
.py
from .....core.tracing import traced_atomic_transaction from .....discount.error_codes import DiscountErrorCode from .....discount.models import Promotion, PromotionRule from .....graphql.core.context import ChannelContext from .....permission.enums import DiscountPermissions from .....webhook.event_types import Webhoo...
103
3,873
jupyterlab
jupyterlab/extensions/__init__.py
.py
"""Extension manager for JupyterLab.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from importlib.metadata import entry_points from traitlets.config import Configurable from .manager import ActionResult, ExtensionManager, ExtensionPackage # noqa: F401 from ...
40
1,117
openvino
tests/layer_tests/tensorflow_tests/test_tf_Equal.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import platform import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest from common.utils.tf_utils import run_in_jenkins # Testing operation Equal # Documentation: https://www.te...
310
15,372
pyomo
pyomo/core/expr/taylor_series.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...
92
3,604
astropy
astropy/coordinates/tests/test_skyoffset_transformations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from itertools import combinations import numpy as np import pytest from astropy import units as u from astropy.coordinates import HCRS, Angle, EarthLocation, SkyCoord from astropy.coordinates.builtin_frames import ( FK5, ICRS, AltAz, Ga...
379
13,685
pyomo
examples/kernel/parameters.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
968
pyomo
pyomo/solvers/tests/piecewise_linear/problems/convex_multi_vararray1.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...
78
2,803
onnx
onnx/backend/test/case/node/argmin.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 def argmin_use_numpy(data: np.ndarray, axis: int = 0, keepdims: int = 1) -> ...
257
8,442
pyomo
pyomo/contrib/multistart/plugins.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...
13
602
sphinx
tests/roots/test-latex-title/conf.py
.py
# set empty string to the third column to use the first section title to document title latex_documents = [ ('index', 'test.tex', '', 'Sphinx', 'report'), ]
5
161
mamba
version_scheme.py
.py
# Parses and validates the version scheme chosen for mamba versions. # Specifically, we use a dot to separate pre-release names and use complete names for `alpha` and `beta`. # # See: # - discussion in https://github.com/mamba-org/mamba/issues/3638 # - https://conda-forge.org/docs/maintainer/knowledge_base/#pre-relea...
70
2,984