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/benders/examples/grothey_ex.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...
60
1,888
wandb
wandb/sdk/artifacts/_generated/fetch_linked_artifacts.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import ArtifactAliasFragment, CollectionInfoFragment class FetchLinkedArtifacts(GQLResult): artifact: FetchLinkedArtifac...
44
1,370
pyomo
pyomo/neos/plugins/__init__.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
616
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_interpolate.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import paddle from paddle.nn.functional import interpolate from save_model import saveModel import sys def run_and_save_model(input_x, name, feed, fetch_list, main_prog, start_prog): cpu = paddle.static.cpu_places...
394
16,691
saleor
saleor/product/tests/test_product_without_variants.py
.py
from ..utils import get_products_ids_without_variants def test_get_products_ids_without_variants(product_list): assert get_products_ids_without_variants(product_list) == [] product = product_list[0] product.variants.all().delete() second_product = product_list[1] second_product.variants.all().de...
17
445
mlflow
dev/pypi/src/pypi/__init__.py
.py
from pypi._client import PyPIError, clear_cache, get_package, get_packages from pypi._models import Package, Release __all__ = [ "Package", "PyPIError", "Release", "clear_cache", "get_package", "get_packages", ]
12
237
wagtail
wagtail/embeds/rich_text/editor_html.py
.py
""" editor-html conversion for contenteditable editors """ from wagtail.admin.rich_text.converters import editor_html from wagtail.embeds import format from wagtail.embeds.exceptions import EmbedException class MediaEmbedHandler: """ MediaEmbedHandler will be invoked whenever we encounter an element in HTML ...
43
1,340
textual
docs/examples/how-to/render_compose.py
.py
from time import time from textual.app import App, ComposeResult, RenderResult from textual.containers import Container from textual.renderables.gradient import LinearGradient from textual.widgets import Static COLORS = [ "#881177", "#aa3355", "#cc6666", "#ee9944", "#eedd00", "#99dd55", "#...
58
1,173
mlflow
dev/clint/src/clint/resolver.py
.py
import ast from collections.abc import Iterator from contextlib import contextmanager class Resolver: def __init__(self) -> None: self.name_map: dict[str, list[str]] = {} self._scope_stack: list[dict[str, list[str]]] = [] def clear(self) -> None: """Clear all name mappings. Useful whe...
90
2,931
textual
docs/examples/guide/actions/actions04.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static TEXT = """ [b]Set your background[/b] [@click=app.set_background('red')]Red[/] [@click=app.set_background('green')]Green[/] [@click=app.set_background('blue')]Blue[/] """ class ActionsApp(App): BINDINGS = [ ("r", "set_backgroun...
29
683
hydra
examples/instantiate/docs_example/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra from hydra.utils import instantiate, target_whitelist class Optimizer: algo: str lr: float def __init__(self, algo: str, lr: float) -> None: self.algo = algo self.lr = lr...
85
2,384
openvino
docs/articles_en/assets/snippets/ov_denormals.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino as ov from utils import get_model device_name = 'CPU' model = get_model() # ! [ov:intel_cpu:denormals_optimization:part0] import openvino.properties.intel_cpu as intel_cpu core = ov.Core() core.set_property("CPU", in...
19
502
ipython
tests/test_hooks.py
.py
# -*- coding: utf-8 -*- """Tests for CommandChainDispatcher.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import pytest from IPython.core.error import TryNext from IPython.core.hooks import...
148
3,910
beam
sdks/python/apache_beam/transforms/combinefn_lifecycle_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...
165
6,542
metrics
tests/unittests/regression/test_js_divergence.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...
145
5,542
metrics
tests/unittests/retrieval/test_auroc.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...
206
7,549
onnxruntime
onnxruntime/python/tools/offline_tuning.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import copy import json import sys from collections import OrderedDict from pprint import pprint from typing import Any import onnx TuningResults = dict[str, Any] _TUNING_RESULTS_KEY = "tuning_results" de...
170
6,199
qutip
qutip/tests/test_entropy.py
.py
import pytest import numpy as np import qutip from qutip.core.energy_restricted import EnrSpace class TestVonNeumannEntropy: @pytest.mark.parametrize("p", np.linspace(0, 1, 17)) def test_binary(self, p): dm = qutip.qdiags([p, 1 - p], 0) expected = 0 if p in [0, 1] else p*np.log2(p) + (1-p)*np....
238
9,189
mlflow
mlflow/tracing/processor/uc_table.py
.py
import logging from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from opentelemetry.sdk.trace import Span as OTelSpan from opentelemetry.sdk.trace.export import SpanExporter from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation, UCSchemaLocation, ...
105
4,486
wandb
wandb/sdk/artifacts/_generated/project_artifact_type.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import ArtifactTypeFragment class ProjectArtifactType(GQLResult): project: ProjectArtifactTypeProject | None class Pro...
23
514
textual
docs/examples/widgets/markdown_viewer.py
.py
from textual.app import App, ComposeResult from textual.widgets import MarkdownViewer EXAMPLE_MARKDOWN = """\ # Markdown Viewer This is an example of Textual's `MarkdownViewer` widget. ## Features Markdown syntax and extensions are supported. - Typography *emphasis*, **strong**, `inline code` etc. - Headers - Lis...
71
2,007
textual
docs/examples/guide/actions/actions05.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static TEXT = """ [b]Set your background[/b] [@click=set_background('cyan')]Cyan[/] [@click=set_background('magenta')]Magenta[/] [@click=set_background('yellow')]Yellow[/] """ class ColorSwitcher(Static): def action_set_background(self, color...
36
881
textual
tests/test_lazy.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical from textual.lazy import Lazy, Reveal from textual.widgets import Label class LazyApp(App): def compose(self) -> ComposeResult: with Vertical(): with Lazy(Horizontal()): yield Label(i...
56
1,606
beam
examples/notebooks/beam-ml/rag_usecase/redis_enrichment.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...
110
3,972
textual
tests/test_expand_tabs.py
.py
import pytest from textual.expand_tabs import expand_tabs_inline, get_tab_widths @pytest.mark.parametrize( "line, expanded_line", [ (" b ar ", " b ar "), ("\tbar", " bar"), ("\tbar\t", " bar "), ("\tr\t", " r "), ("1\tbar", "1 bar"), ("12\tbar", "1...
33
1,046
coremltools
coremltools/converters/mil/backend/nn/passes/handle_unused_inputs.py
.py
# Copyright (c) 2020, 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 Block from coremltools.converters.mil.mil import Builder a...
57
1,841
readthedocs.org
readthedocs/proxito/tests/base.py
.py
# Copied from .org import django_dynamic_fixture as fixture import pytest from django.contrib.auth.models import User from django.core.files.storage import storages from django.test import TestCase from readthedocs.builds.constants import LATEST from readthedocs.projects.constants import PUBLIC, SSL_STATUS_VALID from...
95
3,301
saleor
saleor/graphql/checkout/tests/deprecated/test_checkout_shipping_method_update.py
.py
import graphene from .....checkout.error_codes import CheckoutErrorCode from ....tests.utils import get_graphql_content MUTATION_UPDATE_SHIPPING_METHOD = """ mutation checkoutShippingMethodUpdate( $checkoutId: ID, $token: UUID, $shippingMethodId: ID!){ checkoutShippingMethodUpdate( ...
146
4,581
python-prompt-toolkit
src/prompt_toolkit/contrib/completers/__init__.py
.py
from __future__ import annotations from .system import SystemCompleter __all__ = ["SystemCompleter"]
6
103
probability
tensorflow_probability/python/experimental/bayesopt/__init__.py
.py
# Copyright 2023 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...
25
976
bazel
src/test/py/bazel/first_time_use_test.py
.py
# Copyright 2018 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/LICENSE-2.0 # # Unless required by applicable la...
109
3,753
textual
tests/toggles/test_checkbox.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.widgets import Checkbox class CheckboxApp(App[None]): def __init__(self): super().__init__() self.events_received = [] def compose(self) -> ComposeResult: yield Checkbox("Test", id="cb1") ...
52
1,707
sphinx
tests/test_markup/test_smartquotes.py
.py
"""Test smart quotes.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from sphinx.testing.util import etree_parse if TYPE_CHECKING: from sphinx.testing.util import SphinxTestApp @pytest.mark.sphinx( 'html', testroot='smartquotes', freshenv=True, ) def test_bas...
172
4,553
django-cms
cms/tests/test_menu.py
.py
import copy from django.contrib.auth.models import AnonymousUser, Group, Permission from django.contrib.sites.models import Site from django.core.cache import caches from django.db import connection from django.template import Template, TemplateSyntaxError from django.template.context import Context from django.test.u...
2,217
85,080
probability
tensorflow_probability/python/experimental/linalg/linear_operator_unitary.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...
124
4,575
metrics
tests/unittests/classification/test_confusion_matrix.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...
438
18,225
onnx
onnx/reference/ops/aionnxml/op_linear_classifier.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.aionnxml._common_classifier import ( compute_probit, compute_softmax_zero, expit, ) from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunA...
99
3,589
funcy
funcy/strings.py
.py
import re from operator import methodcaller from .primitives import EMPTY __all__ = ['re_iter', 're_all', 're_find', 're_finder', 're_test', 're_tester', 'str_join', 'cut_prefix', 'cut_suffix'] def _make_getter(regex): if regex.groups == 0: return methodcaller('group') elif re...
79
2,452
readthedocs.org
readthedocs/subscriptions/urls.py
.py
from django.urls import path from readthedocs.subscriptions.views import DetailSubscription from readthedocs.subscriptions.views import StripeCustomerPortal urlpatterns = [ path( "", DetailSubscription.as_view(), name="subscription_detail", ), path( "portal", Strip...
19
395
saleor
saleor/warehouse/interface.py
.py
from dataclasses import dataclass @dataclass class VariantChannelStockInfo: variant_id: int channel_slug: str @property def pk(self) -> tuple[int, str]: """Required by deferred payload mechanism to group deliveries per object. Uses (variant_id, channel_slug) because the same variant ...
17
449
probability
spinoffs/inference_gym/inference_gym/backends/rewrite.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...
286
10,112
pdm
tests/cli/test_others.py
.py
import json from pathlib import Path import pytest from pdm.cli import actions from pdm.utils import cd from tests import FIXTURES def test_build_distributions(project): from pdm.cli.commands.build import Command Command.do_build(project) dist = project.root / "dist" assert dist.exists() wheel ...
281
10,340
mlflow
examples/gemini/tracing.py
.py
""" This is an example for leveraging MLflow's auto tracing capabilities for Gemini. For more information about MLflow Tracing, see: https://mlflow.org/docs/latest/llms/tracing/index.html """ import os import mlflow # Turn on auto tracing for Gemini by calling mlflow.gemini.autolog() mlflow.gemini.autolog() # Impo...
40
1,328
metrics
src/torchmetrics/functional/clustering/adjusted_rand_score.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...
76
2,422
mlflow
mlflow/pyfunc/scoring_server/__init__.py
.py
""" Scoring server for python model format. The passed int model is expected to have function: predict(pandas.Dataframe) -> pandas.DataFrame Input, expected in text/csv or application/json format, is parsed into pandas.DataFrame and passed to the model. Defines four endpoints: /ping used for health check /...
580
21,249
mkdocs-material
material/plugins/privacy/parser.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...
42
1,955
astropy
astropy/timeseries/binned.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import numpy as np from astropy import units as u from astropy.table import QTable, Table, groups from astropy.time import Time, TimeDelta from astropy.timeseries.core import BaseTimeSeries, autocheck_required_columns from astr...
411
16,645
confluent-kafka-python
tests/test_threads.py
.py
#!/usr/bin/env python import threading import time from confluent_kafka import Producer try: from queue import Empty, Queue except ImportError: from Queue import Empty, Queue class IntendedException(Exception): pass def thread_run(myid, p, q): def do_crash(err, msg): raise IntendedExcepti...
70
1,467
django-cms
cms/models/contentmodels.py
.py
from django.db import models from django.utils import timezone from django.utils.translation import gettext_lazy as _ from cms import constants from cms.models.fields import PlaceholderRelationField from cms.models.managers import ContentAdminManager, PageContentManager from cms.models.pagemodel import Page from cms.u...
419
15,052
mlflow
tests/tracking/test_mlflow_artifacts.py
.py
import cgi import os import pathlib import subprocess import tempfile from contextlib import contextmanager from io import BytesIO from typing import NamedTuple import pytest import requests import mlflow from mlflow import MlflowClient from mlflow.artifacts import download_artifacts from mlflow.store.tracking.sqlalc...
444
15,871
rq
rq/cli/cli.py
.py
""" RQ command line tool """ import sys import click from redis.exceptions import ConnectionError from rq import Retry from rq import __version__ as version from rq.cli.helpers import ( parse_function_args, parse_schedule, pass_cli_config, refresh, show_both, show_queues, show_workers, ) ...
271
8,326
cvxpy
cvxpy/tests/test_copt_write.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 ...
49
1,252
confluent-kafka-python
src/confluent_kafka/schema_registry/common/__init__.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...
37
1,004
pyomo
pyomo/common/multithread.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...
86
3,125
onnxruntime
onnxruntime/python/tools/microbench/layernorm.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import argparse from dataclasses import dataclass import numpy as np fr...
63
1,968
probability
tensorflow_probability/python/distributions/horseshoe_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...
278
10,671
textual
tests/animations/test_tabs_underline_animation.py
.py
""" Tests for the tabs underline animation, which is considered a basic animation. (An animation that also plays on the level BASIC.) """ from textual.app import App, ComposeResult from textual.widgets import Label, TabbedContent, Tabs class TabbedContentApp(App[None]): def compose(self) -> ComposeResult: ...
63
1,983
probability
tensorflow_probability/python/math/psd_kernels/parabolic.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...
166
6,966
sqlmap
thirdparty/chardet/codingstatemachine.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
89
3,590
saleor
saleor/graphql/attribute/schema.py
.py
import graphene from ...attribute import models from ..core import ResolveInfo from ..core.connection import create_connection_slice, filter_connection_queryset from ..core.context import ChannelContext, ChannelQsContext from ..core.descriptions import DEPRECATED_IN_3X_INPUT from ..core.doc_category import DOC_CATEGOR...
106
4,279
sphinx
sphinx/ext/autodoc/_dynamic/_mock.py
.py
"""mock for autodoc""" from __future__ import annotations import contextlib import os import sys from importlib.abc import Loader, MetaPathFinder from importlib.machinery import ModuleSpec from types import MethodType, ModuleType from typing import TYPE_CHECKING from sphinx.ext.autodoc._shared import LOGGER from sph...
221
6,379
openvino
docs/sphinx_setup/conf.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ---------...
252
7,451
scikit-bio
skbio/sequence/_dna.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. # --------------------------------------------...
498
14,667
ipython
tests/test_formatters.py
.py
"""Tests for the Formatters.""" from math import pi try: import numpy except: numpy = None import pytest from IPython import get_ipython from traitlets.config import Config from IPython.core.formatters import ( PlainTextFormatter, HTMLFormatter, PDFFormatter, _mod_name_key, DisplayFormatt...
610
15,546
coremltools
coremltools/converters/mil/mil/ops/tests/iOS17/test_activation.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 from coremltools.converters.mil.mil import Builde...
183
6,819
readthedocs.org
readthedocs/core/context_processors.py
.py
"""Template context processors for core app.""" from django.conf import settings def readthedocs_processor(request): """ Context processor to include global settings to templates. Note that we are not using the ``request`` object at all here. It's preferable to keep it like that since it's used from...
58
2,014
conda
tests/models/test_dist.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from logging import getLogger from os.path import join from tempfile import gettempdir import pytest from pytest import MonkeyPatch from conda.base.constants import UNKNOWN_CHANNEL from conda.base.context import context, reset_context from con...
173
5,385
saleor
saleor/graphql/meta/tests/mutations/test_app.py
.py
import graphene from .....app.models import App from .....core.jwt import create_access_token_for_app from ....tests.fixtures import ApiClient from ....tests.utils import assert_no_permission from . import PUBLIC_KEY, PUBLIC_VALUE from .test_delete_metadata import ( execute_clear_public_metadata_for_item, item...
299
7,764
probability
tensorflow_probability/python/internal/backend/meta/gen_tensor_shape.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...
143
3,555
saleor
saleor/app/models.py
.py
from collections.abc import Iterable from typing import cast from uuid import uuid4 from django.contrib.auth.hashers import make_password from django.db import models from django.utils.text import Truncator from oauthlib.common import generate_token from ..core.models import Job, ModelWithMetadata from ..permission.e...
252
9,366
openvino
tests/layer_tests/onnx_tests/test_reduce.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model from unit_tests.utils....
201
9,768
astropy
astropy/modeling/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module defines base classes for all models. The base class of all models is `~astropy.modeling.Model`. `~astropy.modeling.FittableModel` is the base class for all fittable models. Fittable models can be linear or nonlinear in a regression analys...
4,817
183,737
probability
tensorflow_probability/python/experimental/auto_batching/stackless_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...
80
3,354
textual
src/textual/_markup_playground.py
.py
import json from textual import containers, events, on from textual.app import App, ComposeResult from textual.content import Content from textual.reactive import reactive from textual.widgets import Footer, Pretty, Static, TextArea class MarkupPlayground(App): TITLE = "Markup Playground" CSS = """ Scre...
151
4,957
coremltools
coremltools/converters/mil/converter.py
.py
# Copyright (c) 2020, 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 tempfile as _tempfile import warnings as _warnings from typing import Optional, Text, Tuple i...
352
12,609
confluent-kafka-python
tests/integration/consumer/test_cooperative_rebalance_1.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...
112
3,578
returns
returns/pointfree/bind.py
.py
from collections.abc import Callable from typing import TypeVar from returns.interfaces.bindable import BindableN from returns.primitives.hkt import Kinded, KindN, kinded _FirstType = TypeVar('_FirstType') _SecondType = TypeVar('_SecondType') _ThirdType = TypeVar('_ThirdType') _UpdatedType = TypeVar('_UpdatedType') ...
62
1,756
mlflow
mlflow/server/constants.py
.py
""" Constants used for internal server-to-worker communication. These are internal environment variables (prefixed with _MLFLOW_SERVER_) used for communication between the MLflow CLI and forked server processes (gunicorn/uvicorn workers). They are set by the server and read by workers, and should not be set by end use...
80
3,922
sphinx
tests/test_builders/test_build_warnings.py
.py
from __future__ import annotations import os import re import sys import traceback from typing import TYPE_CHECKING import pytest from sphinx._cli.util.errors import strip_escape_sequences from sphinx.errors import SphinxError if TYPE_CHECKING: from collections.abc import Callable from pathlib import Path ...
141
4,830
wandb
tests/system_tests/test_artifacts/conftest.py
.py
from __future__ import annotations from pathlib import Path import wandb from pytest import MonkeyPatch, fixture from wandb import Api, Artifact, env from wandb.sdk.artifacts.staging import get_staging_dir @fixture def logged_artifact(user: str, example_files, api: Api) -> Artifact: with wandb.init(entity=user,...
55
1,968
openvino
tests/layer_tests/onnx_tests/test_topk.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model class TestTopK(OnnxRuntimeLayerTest): def create_net(self, shape, k, axis, ir_version, largest=None, sorted=None, opse...
175
5,831
ipython
IPython/terminal/pt_inputhooks/wx.py
.py
"""Enable wxPython to be used interactively in prompt_toolkit """ import sys import signal import time from timeit import default_timer as clock import wx def ignore_keyboardinterrupts(func): """Decorator which causes KeyboardInterrupt exceptions to be ignored during execution of the decorated function. ...
220
7,126
readthedocs.org
readthedocs/api/v3/tests/test_organizations.py
.py
import django_dynamic_fixture as fixture from django.contrib.contenttypes.models import ContentType from django.test import override_settings from django.urls import reverse from django.urls.exceptions import NoReverseMatch from readthedocs.notifications.models import Notification from readthedocs.organizations.models...
198
6,953
mlflow
tests/gateway/providers/test_gemini.py
.py
from unittest import mock import pytest from fastapi.encoders import jsonable_encoder from mlflow.gateway.config import EndpointConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import PassthroughAction from mlflow.gateway.providers.gemini import GeminiAdapter, GeminiP...
1,714
55,354
beam
sdks/python/apache_beam/testing/benchmarks/nexmark/queries/query4.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...
81
3,268
pyomo
examples/kernel/variables.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...
96
2,175
saleor
saleor/graphql/account/mutations/base.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from ....account import events as account_events from ....account import models from ....account.error_codes import AccountErrorCode from ....account.search import update_user_search_vector from ....account.utils im...
587
21,329
probability
tensorflow_probability/python/bijectors/scale_matvec_linear_operator_test.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...
251
10,050
saleor
saleor/graphql/webhook/tests/mutations/test_webhook_update.py
.py
import json from unittest.mock import patch import graphene import pytest from .....app.models import App from .....webhook.models import Webhook from ....core.enums import WebhookErrorCode from ....tests.utils import assert_no_permission, get_graphql_content from ...enums import WebhookEventTypeAsyncEnum WEBHOOK_UP...
499
15,583
ipython
IPython/utils/importstring.py
.py
""" A simple utility to import something by its string name. """ from __future__ import annotations # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from typing import Any def import_item(name: str) -> Any: """Import and return ``bar`` given the string ``foo.b...
42
1,099
ipython
tests/test_oinspect.py
.py
from contextlib import contextmanager from inspect import signature, Signature, Parameter import functools import inspect import os import pytest import re import sys from IPython.core import oinspect from IPython.testing.tools import AssertPrints, AssertNotPrints from IPython.utils.path import compress_user # ----...
652
17,474
scikit-bio
skbio/util/tests/test_docstring.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. # --------------------------------------------...
379
12,257
sphinx
sphinx/_cli/util/errors.py
.py
from __future__ import annotations import re import sys from typing import TYPE_CHECKING from sphinx.errors import SphinxError, SphinxParallelError if TYPE_CHECKING: from collections.abc import Collection from typing import Final, Protocol from sphinx.extension import Extension class SupportsWrite(...
250
7,139
openvino
tests/layer_tests/pytorch_tests/test_to.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestAtenTo(PytorchLayerTest): def _prepare_input(self, input_shape=(3,)): return (self.random.uniform(low=0.0, high=...
234
8,585
clearml
clearml/storage/url.py
.py
from typing import Sequence from six.moves.urllib.parse import quote, urlparse, urlunparse def quote_url( url: str, valid_schemes: Sequence[str] = ("http", "https"), ) -> str: parsed = urlparse(url) if parsed.scheme not in valid_schemes: return url parsed = parsed._replace(path=quote(pars...
15
365
saleor
saleor/shipping/tests/fixtures/shipping_method_data.py
.py
import pytest from ...models import ShippingMethodChannelListing from ...utils import convert_to_shipping_method_data @pytest.fixture def shipping_method_data(shipping_method, channel_USD): listing = ShippingMethodChannelListing.objects.filter( channel=channel_USD, shipping_method=shipping_method ).g...
13
394
probability
tensorflow_probability/python/experimental/bayesopt/acquisition/upper_confidence_bound_test.py
.py
# Copyright 2023 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...
144
5,375
clearml
examples/frameworks/fire/fire_single_cmd.py
.py
# ClearML - Example of Python Fire integration, with a single command passed to Fire # from clearml import Task import fire def hello(count, name="clearml", prefix="prefix_", suffix="_suffix", **kwargs): for _ in range(count): print("Hello %s%s%s!" % (prefix, name, suffix)) if __name__ == "__main__": ...
16
412
python-prompt-toolkit
src/prompt_toolkit/key_binding/defaults.py
.py
""" Default key bindings.:: key_bindings = load_key_bindings() app = Application(key_bindings=key_bindings) """ from __future__ import annotations from prompt_toolkit.filters import buffer_has_focus from prompt_toolkit.key_binding.bindings.basic import load_basic_bindings from prompt_toolkit.key_binding.bind...
64
1,975
ipython
tests/test_clipboard.py
.py
import subprocess import sys import types import pytest from IPython.core.error import TryNext from IPython.lib import clipboard from IPython.lib.clipboard import ( ClipboardEmpty, osx_clipboard_get, tkinter_clipboard_get, wayland_clipboard_get, win32_clipboard_get, ) from IPython.testing.decorato...
264
7,511