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 |
|---|---|---|---|---|---|
gunicorn | tests/test_control_socket_integration.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Integration tests for control socket fork safety.
These tests verify that the control socket server properly handles fork()
with different worker types (sync, gthread, gevent) without causing deadlocks.
"""
im... | 474 | 16,479 |
wagtail | wagtail/admin/views/editing_sessions.py | .py | from datetime import datetime
from django.apps import apps
from django.contrib.admin.utils import unquote
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.http import Http404, JsonResponse
from django.shortcuts import get_object_or_404
from djang... | 217 | 8,508 |
scikit-bio | skbio/table/_augment.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.
# --------------------------------------------... | 991 | 34,229 |
onnxruntime | onnxruntime/python/tools/transformers/onnx_model_bert_tf.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import logging
import numpy as np
import onnx
from onnx import TensorP... | 589 | 24,915 |
onnxruntime | onnxruntime/test/python/onnxruntime_test_float8_gemm8.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# pylint: disable=C0116,W0212,R1720,C0103,C0114
#
# Note: the precision is different on V100, H100 even with the same code.
# The thresholds were adjusted on H100 as the precision seems lower on this machine.
import itertools... | 343 | 13,603 |
pyomo | pyomo/solvers/tests/piecewise_linear/test_piecewise_linear_kernel.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... | 149 | 6,086 |
sqlmap | tamper/randomcomments.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.common import randomRange
from lib.core.compat import xrange
from lib.core.data import kb
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW... | 51 | 1,212 |
saleor | saleor/graphql/page/resolvers.py | .py | from ...channel.models import Channel
from ...page import models
from ..core.context import 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 ..utils import get_user_or_app_from_context
from .types import P... | 69 | 2,363 |
probability | tensorflow_probability/python/experimental/auto_batching/virtual_machine_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... | 202 | 7,569 |
clearml | clearml/automation/trigger.py | .py | import json
import logging
from datetime import datetime, timezone
from threading import enumerate as enumerate_threads
from typing import List, Optional, Union, Callable, Set, Any
from attr import attrs, attrib
from .job import ClearmlJob
from .scheduler import BaseScheduleJob, BaseScheduler, ExecutedJob
from ..back... | 967 | 39,625 |
saleor | saleor/graphql/invoice/mutations/invoice_request_delete.py | .py | import graphene
from ....core import JobStatus
from ....invoice import events, models
from ....permission.enums import OrderPermissions
from ....webhook.event_types import WebhookEventAsyncType
from ...app.dataloaders import get_app_promise
from ...core import ResolveInfo
from ...core.mutations import DeprecatedModelM... | 51 | 1,897 |
openvino | src/frontends/tensorflow_lite/tests/test_models/gen_scripts/generate_dequantize.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import struct
import sys
import flatbuffers
from flatbuffers import builder as flatbuffers_builder
import tensorflow as tf
# Create the graph and model
class SampleGraph(tf.Module):
def __init__(self):
super(SampleGrap... | 213 | 7,987 |
wandb | wandb/_pydantic/pagination.py | .py | """Utilities for client-side handling of "relay-style" GraphQL pagination.
For formal specs and definitions, see https://relay.dev/graphql/connections.htm.
"""
from __future__ import annotations
import re
from collections.abc import Collection, Iterator
from dataclasses import dataclass
from typing import Annotated,... | 150 | 5,222 |
saleor | saleor/discount/events.py | .py | import graphene
from ..account.models import User
from ..app.models import App
from . import PromotionEvents
from .models import Promotion, PromotionEvent, PromotionRule
def _promotion_base_event(
promotion: Promotion,
user: User | None,
app: App | None,
type: str,
):
return PromotionEvent.object... | 103 | 2,518 |
probability | tensorflow_probability/python/experimental/psd_kernels/additive_kernel_test.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... | 179 | 7,271 |
pyomo | pyomo/contrib/observer/tests/test_component_collector.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... | 30 | 1,329 |
saleor | saleor/tests/e2e/account/utils/customer_bulk_update.py | .py | from ...utils import get_graphql_content
CUSTOMER_BULK_UPDATE_MUTATION = """
mutation CustomerBulkUpdate($errorPolicy: ErrorPolicyEnum, $customers: [CustomerBulkUpdateInput!]!) {
customerBulkUpdate(errorPolicy: $errorPolicy, customers: $customers) {
count
results {
customer {
id
email
... | 55 | 1,009 |
astropy | astropy/cosmology/traits.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Traits for building ``astropy`` :class:`~astropy.cosmology.Cosmology` classes."""
__all__ = (
"BaryonComponent",
"CriticalDensity",
"CurvatureComponent",
"DarkEnergyComponent",
"DarkMatterComponent",
"HubbleParameter",
"Matt... | 33 | 736 |
beam | sdks/python/apache_beam/examples/wordcount_minimal_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... | 71 | 2,491 |
gunicorn | tests/test_asgi_protocol_compat.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Protocol-level tests reproducing ASGI framework compatibility failures.
These tests verify gunicorn's ASGI protocol handling without needing
Docker or external frameworks. They target specific issues discovere... | 1,199 | 42,913 |
saleor | saleor/page/tests/fixtures/page_type.py | .py | import pytest
from ...models import Page, PageType
@pytest.fixture
def page_type(db, size_page_attribute, tag_page_attribute):
page_type = PageType.objects.create(name="Test page type", slug="test-page-type")
page_type.page_attributes.add(size_page_attribute)
page_type.page_attributes.add(tag_page_attrib... | 46 | 1,325 |
astropy | astropy/cosmology/_src/tests/traits/test_trait_darkenergy.py | .py | import numpy as np
import pytest
from astropy.cosmology._src.traits.darkenergy import DarkEnergyComponent
from .helper import is_positional_only
class MinimalDarkEnergy(DarkEnergyComponent):
Ode0 = 0.7
def w(self, z, /):
return -1.0
class ConcreteDarkEnergy(DarkEnergyComponent):
Ode0 = 0.7
... | 49 | 1,117 |
metrics | src/torchmetrics/clustering/fowlkes_mallows_index.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... | 123 | 4,619 |
clearml | examples/advanced/model_finetuning/finetune.py | .py | import argparse
import logging
from transformers import AutoConfig
from clearml import Task, Dataset, InputModel, OutputModel
from pathlib import Path
from datasets import load_dataset
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
Trainer,
TrainingArguments,
default_data_collator,... | 175 | 5,463 |
sqlmap | tests/test_target_parsing.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Target-environment setup in lib/core/target.py.
target.py wires a single scan's per-host state together: it derives the output /
dump / files directories from the hostname, opens (an... | 536 | 19,393 |
textual | docs/examples/widgets/tree.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Tree
class TreeApp(App):
def compose(self) -> ComposeResult:
tree: Tree[str] = Tree("Dune")
tree.root.expand()
characters = tree.root.add("Characters", expand=True)
characters.add_leaf("Paul")
characters... | 19 | 460 |
pyomo | examples/pyomobook/mpec-ch/ex1a.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... | 28 | 939 |
coremltools | deps/pybind11/tests/test_tagbased_polymorphic.py | .py | from __future__ import annotations
from pybind11_tests import tagbased_polymorphic as m
def test_downcast():
zoo = m.create_zoo()
assert [type(animal) for animal in zoo] == [
m.Labrador,
m.Dog,
m.Chihuahua,
m.Cat,
m.Panther,
]
assert [animal.name for animal in ... | 31 | 777 |
wandb | tests/unit_tests/test_automations/_strategies.py | .py | """Example generation strategies for automations tests that rely on `hypothesis`."""
from __future__ import annotations
from enum import Enum
from secrets import choice
from string import ascii_letters
from typing import Any
from hypothesis.strategies import (
DrawFn,
SearchStrategy,
booleans,
compos... | 212 | 6,739 |
pyomo | examples/pyomobook/performance-ch/persistent.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... | 138 | 3,524 |
textual | docs/examples/widgets/data_table_renderables.py | .py | from rich.text import Text
from textual.app import App, ComposeResult
from textual.widgets import DataTable
ROWS = [
("lane", "swimmer", "country", "time"),
(4, "Joseph Schooling", "Singapore", 50.39),
(2, "Michael Phelps", "United States", 51.14),
(5, "Chad le Clos", "South Africa", 51.14),
(6, "... | 38 | 1,122 |
cvxpy | cvxpy/reductions/solvers/nlp_solvers/copt_nlpif.py | .py | """
Copyright 2025, the CVXPY 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 law or agreed to in writing, s... | 308 | 11,025 |
textual | docs/examples/styles/margin_all.py | .py | from textual.app import App
from textual.containers import Container, Grid
from textual.widgets import Placeholder
class MarginAllApp(App):
CSS_PATH = "margin_all.tcss"
def compose(self):
yield Grid(
Container(Placeholder("no margin", id="p1"), classes="bordered"),
Container(P... | 25 | 951 |
django-cms | cms/test_utils/project/nested_plugins_app/cms_plugins.py | .py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
class PlanetPlugin(CMSPluginBase):
"""
The contents of this plugin are never rendered.
Only render the toolbar entries.
"""
parent_classes = ['SolarSystemPlugin']
render_template = 'nested_plugins_app/planet.html... | 23 | 605 |
pyomo | pyomo/contrib/appsi/utils/collect_vars_and_named_exprs.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,976 |
attrs | tests/test_funcs.py | .py | # SPDX-License-Identifier: MIT
"""
Tests for `attr._funcs`.
"""
import re
from collections import OrderedDict
from typing import Generic, NamedTuple, TypeVar
import pytest
from hypothesis import assume, given
from hypothesis import strategies as st
import attr
from attr import asdict, assoc, astuple, evolve, fie... | 851 | 24,424 |
cvxpy | cvxpy/cvxcore/python/__init__.py | .py | # HACK: import coptpy first if its available because if we import it
# after cvxcore, the SWIG module initialization messes it up
try:
import coptpy
except ImportError:
pass
# TODO(akshayka): This is a hack; the swig-auto-generated cvxcore.py
# tries to import cvxcore as `from . import _cvxcore`
try:
import _cvxcor... | 14 | 348 |
mlflow | mlflow/entities/assessment.py | .py | from __future__ import annotations
import json
import time
from dataclasses import dataclass
from typing import Any
from google.protobuf.json_format import MessageToDict, ParseDict
from google.protobuf.struct_pb2 import Value
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.entities.assessment_er... | 708 | 27,670 |
onnxruntime | onnxruntime/contrib_ops/cuda/sparse/sparse_attention_v2/sparse_attention_v2_triton.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import triton
import triton.language as tl
@triton.jit
def block_spars... | 216 | 8,494 |
probability | tensorflow_probability/python/distributions/johnson_su.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... | 277 | 10,193 |
qutip | qutip/tests/core/data/test_expect.py | .py | """This file provides tests for expect specialisation. For tests at Qobj level
see `qutip/tests/core/test_expect.py`"""
from .test_mathematics import BinaryOpMixin
import pytest
import numpy as np
from qutip import data
from qutip.core.data import CSR, Dense, Dia
from itertools import product
class TestExpect(Binary... | 74 | 2,616 |
ipython | tests/test_paths.py | .py | import errno
import os
import shutil
import tempfile
import warnings
from unittest.mock import patch
from tempfile import TemporaryDirectory
from testpath import assert_isdir, assert_isfile, modified_env
from IPython import paths
from IPython.testing.decorators import skip_win32
TMP_TEST_DIR = os.path.realpath(tempf... | 230 | 7,268 |
pymc | scripts/check_all_tests_are_covered.py | .py | """
In .github/workflows/pytest.yml, tests are split between multiple jobs.
Here, we check that the jobs ignored by the first job actually end up getting
run by the other jobs.
This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
You can run it manually with `pre-commit run check-no-tests-a... | 116 | 4,070 |
wandb | wandb/apis/public/organizations.py | .py | """W&B Public API for reading organizations."""
from __future__ import annotations
from dataclasses import KW_ONLY, InitVar
from typing import Literal
from pydantic import ConfigDict
from pydantic.alias_generators import to_camel
from pydantic.dataclasses import dataclass as pydantic_dataclass
from wandb._pydantic ... | 51 | 1,469 |
textual | tests/test_call_x_schedulers.py | .py | import asyncio
from textual._context import active_message_pump
from textual.app import App
from textual.message_pump import MessagePump
class CallLaterApp(App[None]):
def __init__(self) -> None:
self.display_count = 0
super().__init__()
def post_display_hook(self) -> None:
self.disp... | 51 | 1,432 |
coremltools | coremltools/models/ml_program/experimental/debugging_utils.py | .py | # Copyright (c) 2025, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import gc
import random
from collections import OrderedDict, deque
from collections.abc import AsyncIter... | 1,591 | 57,197 |
conda | tests/test_solvers.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from conda.core.solve import Solver
from conda.testing.solver_helpers import SolverTests
class TestClassicSolver(SolverTests):
@property
def solver_class(self) -> type[Solver]:
return Solver
... | 41 | 1,203 |
confluent-kafka-python | src/confluent_kafka/schema_registry/rules/encryption/dek_registry/mock_dek_registry_client.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2024 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... | 132 | 4,001 |
pyro | pyro/contrib/gp/likelihoods/multi_class.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch.nn.functional as F
import pyro
import pyro.distributions as dist
from pyro.contrib.gp.likelihoods.likelihood import Likelihood
def _softmax(x):
return F.softmax(x, dim=-1)
class MultiClass(Likelihood):
"""... | 78 | 2,859 |
pyomo | pyomo/common/tests/relo_mod_new.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... | 15 | 590 |
openvino | src/bindings/python/src/openvino/opset3/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
from openvino.opset1.ops import add
from openvino.opset1.ops import asin
from openvino.... | 134 | 5,642 |
cvxpy | cvxpy/atoms/affine/hstack.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... | 85 | 2,553 |
mkdocs-material | material/plugins/projects/plugin.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 293 | 12,024 |
flit | tests/samples/modulewithlocalversion/modulewithlocalversion.py | .py | """
A module with a local version specifier
"""
__version__ = "0.1.dev0+test"
| 6 | 79 |
openvino | tests/model_hub_tests/tensorflow/test_tf_hub_api_notebooks.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import pytest
import tensorflow as tf
import tensorflow_hub as hub
from models_hub_common.test_convert_model import TestConvertModel
from utils import get_input_info
class TestTFHubApiNotebooks(TestConvertModel):
... | 85 | 3,907 |
mlflow | mlflow/genai/scorers/deepeval/__init__.py | .py | """
DeepEval integration for MLflow.
This module provides integration with DeepEval metrics, allowing them to be used
with MLflow's scorer interface.
Example usage:
.. code-block:: python
from mlflow.genai.scorers.deepeval import get_scorer
scorer = get_scorer("AnswerRelevancy", threshold=0.7, model="opena... | 322 | 9,783 |
astropy | astropy/config/tests/test_concurrency.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from functools import partial
from pathlib import Path
from threading import Barrier
from typing import Generic, TypeVar
from uuid import uuid4
import pytest
from astrop... | 119 | 3,562 |
python-prompt-toolkit | tests/test_style_transformation.py | .py | from __future__ import annotations
import pytest
from prompt_toolkit.styles import AdjustBrightnessStyleTransformation, Attrs
@pytest.fixture
def default_attrs():
return Attrs(
color="",
bgcolor="",
bold=False,
underline=False,
strike=False,
italic=False,
... | 53 | 1,562 |
readthedocs.org | readthedocs/oauth/services/bitbucket.py | .py | """OAuth utility functions."""
import json
import re
import structlog
from allauth.socialaccount.providers.bitbucket_oauth2.provider import BitbucketOAuth2Provider
from django.conf import settings
from requests.exceptions import RequestException
from readthedocs.builds import utils as build_utils
from readthedocs.in... | 453 | 17,442 |
pymc | tests/logprob/test_abstract.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... | 162 | 5,737 |
metrics | tests/unittests/text/test_chrf.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... | 164 | 5,609 |
mlflow | tests/shap/test_shap.py | .py | import os
from typing import Any, NamedTuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytest
import shap
from sklearn.datasets import load_diabetes, load_iris
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
import mlflow
from mlflow import MlflowClient
f... | 265 | 9,075 |
conda | conda/gateways/connection/adapters/s3.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Defines S3 transport adapter for CondaSession (requests.Session)."""
from __future__ import annotations
from logging import LoggerAdapter, getLogger
from tempfile import SpooledTemporaryFile
from typing import TYPE_CHECKING
from ....common... | 174 | 5,849 |
pymc | tests/test_math.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... | 185 | 5,725 |
beam | infra/enforcement/iam.py | .py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | 419 | 18,381 |
coremltools | coremltools/converters/mil/backend/mil/passes/test_passes.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 copy
import itertools
import numpy as np
import pytest
import coremltools as ct
from coremlt... | 1,281 | 44,661 |
sphinx | sphinx/writers/texinfo.py | .py | """Custom docutils writer for Texinfo."""
from __future__ import annotations
import os.path
import re
import textwrap
from typing import TYPE_CHECKING, cast
from docutils import nodes, writers
from sphinx import __display_version__, addnodes
from sphinx.locale import _, __, admonitionlabels
from sphinx.util import ... | 1,596 | 52,980 |
probability | tensorflow_probability/python/distributions/generalized_pareto_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... | 400 | 15,809 |
openvino | tests/e2e_tests/common/model_loader/load_pytorch_model.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import os
import torch
from e2e_tests.test_utils.pytorch_loaders import *
from e2e_tests.common.model_loader.provider import ClassProvider
class PyTorchModelLoader(ClassProvider):
"""PyTorch models loader ru... | 50 | 1,682 |
wandb | wandb/sdk/mailbox/__init__.py | .py | """A message protocol for the internal service process.
The core of W&B is implemented by a side process that asynchronously uploads
data. The client process (such as this Python code) sends requests to the
service, and for some requests, the service eventually sends a response.
The client can send multiple requests ... | 24 | 856 |
mlflow | mlflow/ag2/ag2_logger.py | .py | import functools
import logging
import time
import uuid
from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Any
from autogen import Agent, ConversableAgent
from autogen.logger.base_logger import BaseLogger
from openai.types.chat import ChatCompletion
from mlflow.entitie... | 327 | 12,975 |
returns | tests/test_examples/test_future/test_future_result.py | .py | import asyncio # we use `asyncio` only as an example, you can use any io lib
from collections.abc import Sequence
from typing import Final, cast
import httpx # you would need to `pip install httpx`
from typing_extensions import TypedDict
from returns.future import FutureResult, future_safe
from returns.io import IO... | 63 | 1,920 |
beam | sdks/python/apache_beam/examples/inference/runinference_metrics/main.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... | 128 | 4,354 |
pyomo | pyomo/contrib/pynumero/interfaces/tests/test_cyipopt_interface.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... | 285 | 9,795 |
kafka | tests/kafkatest/services/trogdor/share_consume_bench_workload.py | .py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | 56 | 2,470 |
openvino | tools/benchmark_tool/openvino/tools/benchmark/utils/constants.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
NPU_DEVICE_NAME = 'NPU'
CPU_DEVICE_NAME = 'CPU'
GPU_DEVICE_NAME = 'GPU'
HETERO_DEVICE_NAME = 'HETERO'
MULTI_DEVICE_NAME = 'MULTI'
AUTO_DEVICE_NAME = 'AUTO'
UNKNOWN_DEVICE_TYPE = 'UNKNOWN'
XML_EXTENSION = '.xml'
BIN_EXTENSION = '.bin'
BL... | 27 | 689 |
jupytext | tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/sample_rise_notebook_66.py | .py | # ---
# jupyter:
# jupytext:
# cell_markers: '{{{,}}}'
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# {{{ [markdown] slideshow={"slide_type": "slide"}
# A markdown cell
# }}}
# {{{ slideshow={"slide_type": ""}
1+1
# }}}
# {{{ [markdown] cell_style="center" slide... | 22 | 378 |
astropy | astropy/time/tests/test_delta.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import operator
from datetime import timedelta
from decimal import Decimal
import numpy as np
import pytest
from astropy import units as u
from astropy.table import Table
from astropy.time import (
STANDARD_TIME_SCALES,
TIME_DELT... | 870 | 28,162 |
probability | tensorflow_probability/python/experimental/auto_batching/test_programs.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... | 590 | 22,281 |
pyomo | pyomo/core/tests/transform/test_scaling.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... | 739 | 27,925 |
saleor | saleor/core/utils/country.py | .py | from typing import TYPE_CHECKING, Optional
from ...account.models import Address
from ...channel.models import Channel
if TYPE_CHECKING:
from ...graphql.account.types import AddressInput
def get_active_country(
channel: "Channel",
shipping_address: Optional["Address"] = None,
billing_address: Option... | 37 | 1,237 |
wagtail | wagtail/images/tests/test_permissions.py | .py | from django.test import TestCase, override_settings
from wagtail.images import get_image_model
from wagtail.permission_policies.collections import CollectionOwnershipPermissionPolicy
from wagtail.permissions import policy_registry
from wagtail.test.testapp.models import CustomImage
from wagtail.utils.deprecation impor... | 37 | 1,620 |
beam | sdks/python/apache_beam/examples/inference/huggingface_language_modeling.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... | 184 | 6,766 |
onnxruntime | tools/ci_build/github/apple/objectivec/assemble_objc_pod_package.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import pathlib
import sys
_script_dir = pathlib.Path(__file__).parent.resolve(strict=True)
sys.path.append(str(_script_dir.parent))
from c.assemble_c_pod_package import get_pod_confi... | 205 | 6,820 |
wandb | tests/unit_tests/test_sender_config.py | .py | from wandb.proto import wandb_internal_pb2
from wandb.sdk.internal import sender_config
from wandb.sdk.lib import telemetry
def test_config_record_update():
config = sender_config.ConfigState({"b": {"x": 9, "c": "old"}})
config.update_from_proto(
wandb_internal_pb2.ConfigRecord(
update=[
... | 82 | 2,095 |
structlog | src/structlog/_output.py | .py | # SPDX-License-Identifier: MIT OR Apache-2.0
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the MIT License. See the LICENSE file in the root of this
# repository for complete details.
"""
Logger classes responsible for output.
"""
from __future__ import annotations
import co... | 377 | 10,031 |
astropy | astropy/convolution/tests/test_convolve_models.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import math
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal
from astropy.convolution.convolve import convolve, convolve_fft, convolve_models
from astropy.modeling import fitting, models
from astropy.utils.... | 99 | 3,905 |
pymc | tests/conftest.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... | 59 | 1,723 |
cvxpy | cvxpy/atoms/dotsort.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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 149 | 5,003 |
qutip | qutip/solver/countstat.py | .py | """
This module contains functions for calculating current and current noise using
the counting statistics formalism.
"""
__all__ = ['countstat_current', 'countstat_current_noise']
import numpy as np
from itertools import product
from ..core import (
sprepost, spre, qeye_like, Qobj, operator_to_vector, CoreOption... | 333 | 11,304 |
coremltools | coremltools/converters/mil/mil/types/type_dict.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 . import type_bool, type_int
from .annotate import annotate
from .get_type_info import get_type_... | 69 | 1,765 |
mlflow | tests/gateway/providers/test_togetherai.py | .py | import textwrap
from unittest import mock
import pytest
from aiohttp import ClientTimeout
from fastapi.encoders import jsonable_encoder
from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS
from mlflow.gateway.config import EndpointConfig
from mlflow.gateway.exceptions import AIGatewayExceptio... | 599 | 22,238 |
biopython | Bio/motifs/alignace.py | .py | # Copyright 2003 by Bartek Wilczynski. 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.
"""Parsing AlignACE ... | 69 | 2,118 |
saleor | saleor/account/error_codes.py | .py | from enum import Enum
class AccountErrorCode(Enum):
ACTIVATE_OWN_ACCOUNT = "activate_own_account"
ACTIVATE_SUPERUSER_ACCOUNT = "activate_superuser_account"
DUPLICATED_INPUT_ITEM = "duplicated_input_item"
DEACTIVATE_OWN_ACCOUNT = "deactivate_own_account"
DEACTIVATE_SUPERUSER_ACCOUNT = "deactivate_s... | 116 | 3,958 |
pyomo | doc/OnlineDocs/src/kernel/examples/kernel_solving.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... | 21 | 814 |
pyro | pyro/distributions/one_one_matching.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import itertools
import logging
import warnings
import torch
from torch.distributions import constraints
from torch.distributions.utils import lazy_property
from .torch import Categorical
from .torch_distribution import TorchDistribu... | 176 | 6,714 |
textual | docs/examples/guide/workers/weather03.py | .py | import httpx
from rich.text import Text
from textual import work
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Input, Static
class WeatherApp(App):
"""App to display the current weather."""
CSS_PATH = "weather.tcss"
def compose(self... | 43 | 1,307 |
pyomo | pyomo/scripting/interface.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... | 122 | 3,359 |
pyomo | pyomo/core/tests/unit/kernel/test_piecewise.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... | 961 | 39,588 |
mlflow | tests/tracing/export/genai_semconv/test_translator.py | .py | import json
import pytest
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.trace import SpanContext, SpanKind, TraceFlags
from opentelemetry.trace.status import Status, StatusCode
from mlflow.tracing.constant import GenAiSemconvKey, SpanAttributeKey
from mlflow.tracing.export.genai_semconv.translat... | 247 | 8,301 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.