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 |
|---|---|---|---|---|---|
biopython | Bio/Pathway/Rep/Graph.py | .py | # Copyright 2002 by Tarjei Mikkelsen. All rights reserved.
# Revisions copyright 2018 by Maximilian Greil. 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... | 150 | 5,865 |
coremltools | deps/protobuf/python/google/protobuf/service.py | .py | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | 229 | 9,146 |
wagtail | wagtail/admin/tests/test_filters.py | .py | from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.test import TestCase
from wagtail.admin.filters import FilteredModelChoiceField
from wagtail.test.utils import WagtailTestUtils
User = get_user_model()
class TestFilteredModelChoiceField(... | 129 | 4,535 |
onnxruntime | onnxruntime/test/python/onnxruntime_test_python_preload_dlls.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# pylint: disable=C0114,C0115,C0116,W0212
import unittest
import onnxruntime
class TestGetNvidiaDllPaths(unittest.TestCase):
"""Unit tests for the private _get_nvidia_dll_paths helper that locates CUDA/cuDNN
librari... | 80 | 4,370 |
pymc | tests/step_methods/test_state.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 159 | 4,551 |
wandb | tests/unit_tests/test_launch/test_builder/test_kaniko.py | .py | import os
from unittest.mock import MagicMock
import boto3
import kubernetes_asyncio
import pytest
import wandb
from google.cloud import storage
from wandb.sdk.launch._project_spec import EntryPoint, LaunchProject
from wandb.sdk.launch.builder import kaniko_builder
from wandb.sdk.launch.builder.kaniko_builder import (... | 535 | 19,297 |
lemur | lemur/plugins/lemur_cryptography/plugin.py | .py | """
.. module: lemur.plugins.lemur_cryptography.plugin
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
import uuid
from flask import current_app
from cryptography import x... | 239 | 9,793 |
jupytext | src/jupytext/combine.py | .py | """Combine source and outputs from two notebooks"""
import re
from copy import copy
from nbformat import NotebookNode
from .cell_metadata import _IGNORE_CELL_METADATA
from .formats import long_form_one_format
from .header import _DEFAULT_NOTEBOOK_METADATA
from .metadata_filter import restore_filtered_metadata
_BLAN... | 178 | 6,447 |
sphinx | tests/roots/test-ext-viewcode-find/not_a_package/submodule.py | .py | """
submodule
""" # NoQA: D212
raise RuntimeError('This module should not get imported') # NoQA: EM101,TRY003
def decorator(f):
return f
@decorator
def func1(a, b):
"""
this is func1
""" # NoQA: D212
return a, b
@decorator
class Class1:
"""this is Class1"""
class Class3:
"""this ... | 30 | 403 |
cvxpy | cvxpy/tests/test_von_neumann_entr.py | .py | """
Copyright, 2022 - 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... | 297 | 10,653 |
confluent-kafka-python | tests/integration/share_consumer/test_share_consumer_close.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2026 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... | 254 | 10,215 |
openvino | src/bindings/python/src/openvino/opset10/ops.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Factory functions for all openvino ops."""
from functools import partial
from typing import Optional
from openvino import Node
from openvino.utils.node_factory import _get_node_factory
from openvino.utils.deco... | 177 | 7,350 |
hydra | examples/instantiate/schema/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass, field
from typing import Any, List
from omegaconf import MISSING
import hydra
from hydra.core.config_store import ConfigStore
from hydra.utils import instantiate, target_whitelist
class DBConnection:
def __... | 81 | 1,926 |
lemur | lemur/defaults/schemas.py | .py | """
.. module: lemur.defaults.schemas
:platform: unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from marshmallow import fields
from lemur.common.schema import LemurOutputSchema
from le... | 24 | 736 |
jupyterlab | packages/extensionmanager-extension/examples/listings/main.py | .py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
HERE = os.path.dirname(__file__)
os.environ["JUPYTERLAB_SETTINGS_DIR"] = str(os.path.join(HERE, "settings"))
import json # noqa
from jupyter_server.base.handlers import FileFindHandler # noqa
from jupyt... | 41 | 1,130 |
onnx | onnx/reference/ops/op_range.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
from onnx import TensorProto
from onnx.reference.op_run import OpRun
_STASH_TYPE_TO_DTYPE: dict[int, np.dtype] = {
int(TensorProto.FLOAT): np.dtype(np.float32),
... | 40 | 1,410 |
pyomo | pyomo/common/gc_manager.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... | 80 | 3,007 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/top_largest.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");... | 53 | 1,565 |
saleor | saleor/webhook/tests/response_schemas/test_taxes.py | .py | from decimal import Decimal
import pytest
from pydantic import ValidationError
from ....core.prices import MAXIMUM_PRICE
from ...response_schemas.taxes import CalculateTaxesSchema, LineCalculateTaxesSchema
@pytest.mark.parametrize(
"data",
[
# Decimal values
{
"tax_rate": Decimal... | 271 | 8,454 |
wandb | tests/system_tests/test_api/test_public_api_history.py | .py | from __future__ import annotations
import pathlib
import tempfile
from typing import Any
import pytest
import wandb
from wandb.apis.public import DownloadHistoryResult, IncompleteRunHistoryError, Run
from wandb.errors import CommError
def stub_run_parquet_history(
wandb_backend_spy,
parquet_file_server,
... | 440 | 12,306 |
probability | tensorflow_probability/python/internal/backend/numpy/rewrite_equivalence_test.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... | 80 | 2,824 |
readthedocs.org | readthedocs/builds/signals_receivers.py | .py | """
Receiver signals for the Builds app.
NOTE: Done in a separate file to avoid circular imports.
"""
import structlog
from django.db.models.signals import post_save
from django.dispatch import receiver
from readthedocs.builds.models import Build
from readthedocs.projects.models import Project
log = structlog.get_... | 25 | 648 |
metrics | src/torchmetrics/utilities/prints.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... | 74 | 2,368 |
tablib | src/tablib/_vendor/dbfpy/record.py | .py | import sys
from . import utils
__version__ = "$Revision: 1.7 $"[11:-2]
__date__ = "$Date: 2007/02/11 09:05:49 $"[7:-2]
__all__ = ["DbfRecord"]
"""DBF record definition.
"""
"""History (most recent first):
11-feb-2007 [als] __repr__: added special case for invalid field values
10-feb-2007 [als] added .rawFromS... | 263 | 8,433 |
mamba | micromamba/tests/test_list.py | .py | import platform
import subprocess
import sys
import pytest
import re
from . import helpers
@pytest.mark.parametrize("reverse_flag", ["", "--reverse"])
@pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"])
@pytest.mark.parametrize("env_selector", ["", "name", "prefix"])
@pytest.mark.parametrize("shared_pkgs_... | 318 | 12,185 |
bazel | tools/python/pywrapper_test.py | .py | # pylint: disable=g-bad-file-header
# Copyright 2019 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
... | 178 | 6,150 |
mlflow | tests/entities/test_trace_location.py | .py | import pytest
from mlflow.entities.trace_location import (
InferenceTableLocation,
MlflowExperimentLocation,
TraceLocation,
TraceLocationType,
UCSchemaLocation,
UnityCatalog,
)
from mlflow.exceptions import MlflowException
from mlflow.protos import databricks_tracing_pb2 as tracing_pb
from mlfl... | 198 | 7,163 |
clearml | clearml/backend_api/services/v2_13/projects.py | .py | """
projects service
Provides support for defining Projects containing Tasks, Models and Dataset Versions.
"""
from typing import List, Optional, Any
from datetime import datetime
import six
from clearml.backend_api.session import (
Request,
Response,
NonStrictDataModel,
schema_property,
)
from dateuti... | 3,475 | 121,977 |
astropy | astropy/io/fits/hdu/compressed/compressed.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import ctypes
import math
import time
import warnings
import numpy as np
from astropy.io.fits.fitsrec import FITS_rec
from astropy.io.fits.hdu.base import BITPIX2DTYPE, DELAYED
from astropy.io.fits.hdu.compressed._quantization import DITHER_METHODS
from... | 744 | 33,091 |
sqlmap | plugins/dbms/sqlite/fingerprint.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.common import Backend
from lib.core.common import Format
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.e... | 113 | 3,185 |
probability | tensorflow_probability/python/distributions/half_normal.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... | 227 | 7,940 |
saleor | saleor/graphql/schema_printer.py | .py | """Code ported from GraphQL Core 3.0.
Can be dropped once we upgrade from the legacy version of GraphQL Core.
"""
from collections.abc import Callable
from typing import cast
from graphene.types.definitions import GrapheneObjectType
from graphql.language.printer import print_ast
from graphql.type.definition import (... | 499 | 15,952 |
beam | sdks/python/apache_beam/examples/avro_nyc_trips.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... | 287 | 9,381 |
coremltools | coremltools/converters/sklearn/_normalizer.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
from coremltools import proto
from ... import SPECIFICATION_VERSION
from ..._deps import _HAS_SKLEARN
f... | 82 | 2,275 |
django-cms | cms/models/managers.py | .py | # ruff: noqa: W605
import functools
import operator
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Q
from cms.constants import ROOT_USER_LEVEL
from cms.exceptions import NoPermissionsException
from cms.models.query import PageQuerySet
from cms.util... | 383 | 14,335 |
pyomo | examples/pyomobook/abstract-ch/param5.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 | 838 |
pyomo | pyomo/contrib/mindtpy/tests/test_mindtpy_feas_pump.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... | 128 | 4,854 |
coremltools | coremltools/optimize/coreml/experimental/_model_debugger.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from typing import List
import numpy as np
from tqdm import tqdm
import coremltools as ct
from coremlt... | 328 | 13,572 |
astropy | astropy/stats/histogram.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Methods for selecting the bin width of histograms.
Ported from the astroML project: https://www.astroml.org/
"""
from typing import Literal
import numpy as np
from numpy.typing import ArrayLike, NDArray
from .bayesian_blocks import bayesian_blocks... | 463 | 13,919 |
deap | examples/es/cma_bipop.py | .py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 200 | 8,278 |
biopython | Tests/test_PDB_Superimposer.py | .py | # Copyright 2017 by Francesco Gastaldello. All rights reserved.
#
# Converted by Francesco Gastaldello from an older unit test copyright 2004
# by Thomas Hamelryck.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Ple... | 121 | 6,484 |
saleor | saleor/graphql/app/tests/mutations/test_app_problem_create.py | .py | from .....app.models import AppProblem
from ....tests.utils import assert_no_permission, get_graphql_content
APP_PROBLEM_CREATE_MUTATION = """
mutation AppProblemCreate($input: AppProblemCreateInput!) {
appProblemCreate(input: $input) {
appProblem {
id
message
... | 60 | 1,777 |
textual | docs/examples/styles/padding_all.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Placeholder
class PaddingAllApp(App):
CSS_PATH = "padding_all.tcss"
def compose(self):
yield Grid(
Placeholder("no padding", id="p1"),
Placeholder("padding: 1", id="p2"),
Pl... | 25 | 703 |
wandb | wandb/sdk/data_types/base_types/json_metadata.py | .py | from __future__ import annotations
import codecs
import os
from typing import TYPE_CHECKING
from wandb import util
from wandb.sdk.lib import runid
from .._private import MEDIA_TMP
from .media import Media
if TYPE_CHECKING: # pragma: no cover
from wandb.sdk.artifacts.artifact import Artifact
from ...wandb_... | 58 | 1,564 |
wandb | wandb/automations/__init__.py | .py | from .actions import ActionType, DoNothing, SendNotification, SendWebhook
from .automations import Automation, NewAutomation
from .events import (
ArtifactEvent,
EventType,
MetricChangeFilter,
MetricThresholdFilter,
MetricZScoreFilter,
OnAddArtifactAlias,
OnAddArtifactTag,
OnAddCollectio... | 73 | 1,763 |
beam | examples/notebooks/notebook_test_scripts/runner.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... | 149 | 4,847 |
wagtail | wagtail/admin/panels/page_chooser_panel.py | .py | from wagtail.admin.widgets import AdminPageChooser
from .field_panel import FieldPanel
class PageChooserPanel(FieldPanel):
def __init__(self, field_name, page_type=None, can_choose_root=False, **kwargs):
super().__init__(field_name=field_name, **kwargs)
self.page_type = page_type
self.can... | 30 | 937 |
sphinx | sphinx/pygments_styles.py | .py | """Sphinx theme specific highlighting styles."""
from __future__ import annotations
from pygments.style import Style
from pygments.styles.friendly import FriendlyStyle
from pygments.token import (
Comment,
Error,
Generic,
Keyword,
Name,
Number,
Operator,
String,
Whitespace,
)
cla... | 96 | 2,607 |
returns | tests/test_contrib/test_pytest/test_plugin_has_trace.py | .py | import pytest
from returns.contrib.pytest import ReturnsAsserts
from returns.io import IOFailure, IOSuccess
from returns.result import Failure, Success, safe
def _create_container_function(container_type, container_value):
return container_type(container_value)
def _create_container_function_intermediate(conta... | 116 | 3,134 |
qutip | qutip/solver/dysolve_propagator.py | .py | from qutip import Qobj, qeye_like
from .cy.dysolve import cy_compute_integrals
from numpy.typing import ArrayLike
import numpy as np
import scipy as sp
from numbers import Number
import itertools
__all__ = ['DysolvePropagator', 'dysolve_propagator']
class DysolvePropagator:
"""
A generator of propagator usi... | 373 | 10,952 |
clearml | examples/reporting/model_reporting_plots.py | .py | # ClearML - Example of manual model reporting
from clearml import Task, OutputModel
from clearml.utilities.plotly_reporter import SeriesInfo
import pandas as pd
import numpy as np
# Connecting ClearML with the current process,
task = Task.init(project_name="examples", task_name="Model reporting plots example")
# Crea... | 63 | 1,889 |
wagtail | wagtail/test/streamfield_migrations/models.py | .py | import swapper
from django.db import models
from wagtail.blocks import CharBlock, ListBlock, StreamBlock, StructBlock
from wagtail.fields import StreamField
if swapper.is_swapped("wagtailcore", "Page"):
from wagtail.test.basepage.models import BasePage as Page
else:
from wagtail.models import Page
class Sim... | 55 | 1,362 |
beam | sdks/python/apache_beam/yaml/yaml_provider_unit_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... | 380 | 12,204 |
saleor | saleor/discount/tests/test_utils/test_update_rule_variant_relation.py | .py | from decimal import Decimal
import graphene
from ... import RewardValueType
from ...models import PromotionRule
from ...utils.promotion import update_rule_variant_relation
def test_update_rule_variant_relation(
catalogue_promotion_without_rules, channel_USD, product_variant_list
):
# given
promotion = c... | 53 | 1,821 |
saleor | saleor/giftcard/tests/fixtures/giftcard_event.py | .py | import datetime
import pytest
from django.utils import timezone
from ... import GiftCardEvents
from ...models import GiftCardEvent
@pytest.fixture
def gift_card_event(gift_card, order, app, staff_user):
parameters = {
"message": "test message",
"email": "testemail@email.com",
"tags": ["t... | 36 | 955 |
mkdocs | mkdocs/utils/rendering.py | .py | from __future__ import annotations
import copy
from typing import TYPE_CHECKING, Callable
import markdown
import markdown.treeprocessors
if TYPE_CHECKING:
from xml.etree import ElementTree as etree
# TODO: This will become unnecessary after min-versions have Markdown >=3.4
_unescape: Callable[[str], str]
try:
... | 105 | 3,504 |
qutip | qutip/typing.py | .py | from typing import Sequence, Union, Any, Protocol, Callable, TypeVar
from numbers import Number, Real
import numpy as np
import scipy.interpolate
__all__ = ["QobjEvoLike", "CoefficientLike", "LayerType"]
class QEvoProtocol(Protocol):
def __call__(self, t: Real, **kwargs) -> "Qobj":
...
class CoeffProt... | 56 | 1,050 |
saleor | saleor/graphql/discount/mutations/voucher/voucher_update.py | .py | import graphene
from django.core.exceptions import ValidationError
from django.db import transaction
from django.db.models import Exists, OuterRef
from .....checkout import models as checkout_models
from .....discount import models
from .....discount.error_codes import DiscountErrorCode
from .....order import models a... | 167 | 6,006 |
ipython | docs/autogen_magics.py | .py | from pathlib import Path
from IPython.core.alias import Alias
from IPython.core.interactiveshell import InteractiveShell
from IPython.core.magic import MagicAlias
from IPython.utils.text import dedent, indent
def _strip_underline(line):
chars = set(line.strip())
if len(chars) == 1 and ("-" in chars or "=" in ... | 74 | 2,224 |
astropy | astropy/modeling/parameters.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
"""
This module defines classes that deal with parameters.
It is unlikely users will need to work with these classes directly,
unless they define their own models.
"""
import functools
import numbers
import operator
impor... | 797 | 26,728 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_hard_sigmoid.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# hard_sigmoid paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def hard_sigmoid(name: str, x, slope: float = 0.2, offset: float = 0.5, data_type='float32'):
paddle.enable_stat... | 44 | 1,270 |
readthedocs.org | readthedocs/proxito/tests/test_old_redirects.py | .py | """
Most of this code is copied from:
readthedocs/rtd_tests/tests/test_redirects.py
and adapted to use:
* El Proxito
"""
from django.urls import reverse
import django_dynamic_fixture as fixture
from django.test.utils import override_settings
from readthedocs.builds.constants import EXTERNAL
from readthedocs.bui... | 1,625 | 56,074 |
qutip | qutip/tests/conftest.py | .py | import pytest
import functools
import os
import tempfile
import numpy as np
def _add_repeats_if_marked(metafunc):
"""
If the metafunc is marked with the 'repeat' mark, then add the requisite
number of repeats via parametrisation.
"""
marker = metafunc.definition.get_closest_marker('repeat')
if... | 60 | 1,927 |
wandb | wandb/sdk/internal/tb_watcher.py | .py | """tensorboard watcher."""
from __future__ import annotations
import glob
import logging
import os
import queue
import socket
import sys
import threading
import time
from typing import TYPE_CHECKING, Any
import wandb
from wandb import util
from wandb.plot import CustomChart
from wandb.sdk.lib import filesystem
from... | 521 | 18,540 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_unique.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# unique paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
data_type = "float32"
def unique(name: str, x, **op_args):
paddle.enable_static()
with paddle.static.program_gua... | 79 | 2,457 |
beam | sdks/python/apache_beam/examples/complete/game/game_stats_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... | 84 | 3,301 |
pyro | pyro/params/param_store.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import re
import warnings
import weakref
from contextlib import contextmanager
from typing import (
Callable,
Dict,
ItemsView,
Iterator,
KeysView,
Optional,
Tuple,
Union,
)
import torch
from torch.d... | 396 | 14,527 |
coremltools | deps/pybind11/tests/test_call_policies.py | .py | from __future__ import annotations
import pytest
import env # noqa: F401
from pybind11_tests import ConstructorStats
from pybind11_tests import call_policies as m
@pytest.mark.xfail("env.PYPY", reason="sometimes comes out 1 off on PyPy", strict=False)
def test_keep_alive_argument(capture):
n_inst = Constructor... | 250 | 6,585 |
mlflow | tests/store/_unity_catalog/registry/test_uc_prompt_utils.py | .py | 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,
PROMPT_TYPE_TAG_KEY,
PROMPT_TYPE_TEXT,
RESPONSE_FORMAT_TAG_KEY,
)
from mlflow.protos.unity_cata... | 219 | 7,173 |
pdm | tests/cli/test_add.py | .py | import shutil
import pytest
from unearth import Link
from pdm.cli.commands.add import Command
from pdm.cli.filters import GroupSelection
from pdm.models.markers import EnvSpec
from pdm.models.specifiers import PySpecSet
from pdm.pytest import Distribution
from pdm.utils import cd
from tests import FIXTURES
def make... | 462 | 20,485 |
hydra | tests/test_compose.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import re
import subprocess
import sys
import warnings
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional
from omegaconf import MISSING, OmegaConf
from pytest import ... | 922 | 29,632 |
sphinx | tests/roots/test-api-set-translator/nonext/conf.py | .py | import sys
from pathlib import Path
sys.path.insert(0, str(Path.cwd().resolve()))
project = 'test'
| 7 | 101 |
mlflow | tests/entities/test_input_tag.py | .py | from mlflow.entities import InputTag
def _check(input_tag, key, value):
assert isinstance(input_tag, InputTag)
assert input_tag.key == key
assert input_tag.value == value
def test_creation_and_hydration():
key = "my_key"
value = "my_value"
input_tag = InputTag(key, value)
_check(input_ta... | 28 | 640 |
sphinx | sphinx/util/_lines.py | .py | from __future__ import annotations
def parse_line_num_spec(spec: str, total: int) -> list[int]:
"""Parse a line number spec (such as "1,2,4-6") and return a list of
wanted line numbers.
"""
items = []
parts = spec.split(',')
for part in parts:
try:
begend = part.strip().spl... | 30 | 1,071 |
pyomo | pyomo/contrib/cp/tests/test_sequence_expressions.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... | 174 | 5,864 |
openvino | tests/layer_tests/ovc_python_api_tests/test_paddle.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tempfile
import unittest
import numpy as np
import openvino as ov
import pytest
from openvino import PartialShape, Model
from openvino.test_utils import compare_functions
from common.mo_convert_test_class import CommonMOConvertT... | 185 | 6,405 |
textual | docs/examples/guide/widgets/hello05.py | .py | from itertools import cycle
from textual.app import App, ComposeResult
from textual.widgets import Static
hellos = cycle(
[
"Hola",
"Bonjour",
"Guten tag",
"Salve",
"Nǐn hǎo",
"Olá",
"Asalaam alaikum",
"Konnichiwa",
"Anyoung haseyo",
... | 45 | 863 |
cvxpy | cvxpy/reductions/solvers/solving_chain.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import scipy.sparse as sp
import cvxpy.settings as s
from cvxpy.constraints import (
SOC,
FiniteSet,
)
from cvxpy.error import DPPError, SolverError
from cvxpy.problems.objective import Maximize
from cvxpy.problems.problem... | 564 | 20,628 |
pymc | pymc/logprob/order.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 346 | 12,702 |
pyomo | pyomo/contrib/gdpopt/nlp_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... | 52 | 2,307 |
saleor | saleor/tests/e2e/checkout/taxes/test_checkout_calculate_simple_taxes_based_on_shipping_country.py | .py | import pytest
from ... import ADDRESS_DE
from ...product.utils.preparing_product import prepare_product
from ...shop.utils import prepare_shop
from ...taxes.utils import update_country_tax_rates
from ...utils import assign_permissions
from ..utils import (
checkout_billing_address_update,
checkout_complete,
... | 217 | 6,722 |
beam | sdks/python/apache_beam/metrics/monitoring_infos.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... | 580 | 22,102 |
httpie | extras/packaging/linux/scripts/httpie_cli.py | .py | from httpie.manager.__main__ import main
if __name__ == '__main__':
import sys
sys.exit(main())
| 6 | 105 |
conda | conda/plugins/subcommands/doctor/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Implementation for `conda doctor` subcommand.
Adds various environment and package checks to detect issues or possible environment
corruption.
"""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from ....... | 143 | 4,584 |
textual | tests/animations/test_progress_bar_animation.py | .py | """
Tests for the indeterminate progress bar 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 ProgressBar
from textual.widgets._progress_bar import Bar
class ProgressBarApp(App[None]):
d... | 48 | 1,611 |
pyomo | pyomo/solvers/tests/models/LP_block.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... | 80 | 2,687 |
readthedocs.org | readthedocs/forms.py | .py | """Community site-wide form overrides."""
import structlog
from allauth.account.forms import SignupForm
from django import forms
from readthedocs.core.models import UserProfile
log = structlog.get_logger(__name__) # noqa
class SignupFormWithNewsletter(SignupForm):
"""Custom signup form that includes a checkb... | 38 | 940 |
coremltools | deps/protobuf/python/google/protobuf/internal/keywords_test.py | .py | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | 104 | 4,156 |
pymc | tests/smc/test_smc.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 329 | 11,713 |
coveragepy | coverage/annotate.py | .py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt
"""Source file annotation for coverage.py."""
from __future__ import annotations
import os
import re
from typing import TYPE_CHECKING
from coverage.files impor... | 114 | 3,699 |
django-cms | cms/test_utils/project/mti_pluginapp/cms_plugins.py | .py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import TestPluginAlphaModel, TestPluginBetaModel
class TestPluginAlpha(CMSPluginBase):
model = TestPluginAlphaModel
render_template = 'mti_pluginapp/alpha.html'
name = 'test mti plugin alpha'
def render(se... | 32 | 828 |
pyomo | pyomo/repn/tests/ampl/small3_testCase.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... | 27 | 1,063 |
conda | tests/env/test_pip_util.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda.env.pip_util import get_pip_installed_packages
pip_output_attrs = """
Collecting attrs
Using cached https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19... | 82 | 4,430 |
beam | website/notebooks/generate.py | .py | #!/usr/bin/env python
#
# 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
# "Li... | 131 | 4,669 |
conda | conda/exceptions.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Conda exceptions."""
from __future__ import annotations
import os
import sys
from collections import defaultdict
from datetime import timedelta
from logging import getLogger
from os.path import join
from textwrap import dedent, indent
from ... | 1,897 | 63,451 |
pyomo | doc/OnlineDocs/src/data/table4.ul.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... | 22 | 780 |
saleor | saleor/graphql/webhook/tests/queries/test_webhook.py | .py | import graphene
from .....app.models import App
from .....webhook.models import Webhook
from ....tests.utils import (
assert_no_permission,
get_graphql_content,
get_graphql_content_from_response,
)
from ...enums import WebhookEventTypeAsyncEnum, WebhookEventTypeSyncEnum
QUERY_WEBHOOK = """
query webho... | 261 | 9,262 |
beam | sdks/python/apache_beam/io/gcp/datastore/v1new/types.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... | 307 | 9,998 |
mkdocs-material | src/__init__.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... | 22 | 1,155 |
openvino | src/bindings/python/src/openvino/utils/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Generic utilities. Factor related functions out to separate files."""
from openvino._pyopenvino.util import numpy_to_c, replace_node, replace_output_update_name
from openvino.package_utils import get_cmake_pa... | 14 | 547 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.