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 |
|---|---|---|---|---|---|
saleor | saleor/graphql/core/federation/tests/test_schema.py | .py | from typing import Any
import graphene
import pytest
from saleor.graphql.order.types import Order
VALID_QUERY = """
query Federation ($representations: [_Any!]!) {
_entities(representations: $representations) {
... on Order { number }
}
}
"""
# Query with 'Any' instead of 'Any!' - this must not be allowed, ... | 160 | 4,790 |
openvino | tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_avg_pool_1D.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import tensorflow as tf
from common.tf2_layer_test_class import CommonTF2LayerTest
class TestKerasAveragePooling1D(CommonTF2LayerTest):
def create_keras_avg_pool_1D_net(self, pool_size, strides, padding, data_format,... | 55 | 2,653 |
coremltools | coremltools/converters/mil/_testing_utils.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 numpy as np
from coremltools import proto
def random_gen_input_feature_type(input_desc):
... | 79 | 3,030 |
coremltools | coremltools/test/optimize/torch/joint/test_api_ordering.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 contextlib import nullcontext as does_not_raise
import numpy as np
import pytest
import torch
... | 325 | 11,999 |
mlflow | tests/genai/scorers/test_llm_backend.py | .py | from unittest.mock import Mock, patch
import pydantic
import pytest
from mlflow.exceptions import MlflowException
from mlflow.genai.scorers.llm_backend import ScorerLLMClient
def test_databricks_route():
backend = ScorerLLMClient("databricks")
assert backend.route == "databricks"
assert backend.is_nativ... | 245 | 7,959 |
scikit-bio | skbio/diversity/alpha/_pd.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.
# --------------------------------------------... | 447 | 17,227 |
biopython | Bio/AlignIO/EmbossIO.py | .py | # Copyright 2008-2016 by Peter Cock. 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.
"""Bio.AlignIO support ... | 221 | 8,749 |
metrics | src/torchmetrics/functional/detection/panoptic_qualities.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 250 | 11,547 |
mlflow | mlflow/tracing/export/genai_semconv/translator.py | .py | """
Core translator for converting MLflow spans to OpenTelemetry GenAI Semantic Convention format.
Phase 1: Universal attributes (model, provider, tokens, span type) normalized across all
autologging integrations.
Phase 2: Format-specific message content (gen_ai.input.messages, gen_ai.output.messages),
request params,... | 223 | 8,446 |
onnxruntime | tools/ci_build/github/apple/build_and_assemble_apple_pods.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import logging
import os
import pathlib
import shlex
import shutil
import subprocess
import sys
import tempfile
from c.assemble_c_pod_package import assemble_c_pod_package
from package... | 184 | 6,213 |
beam | sdks/python/apache_beam/ml/anomaly/specifiable_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... | 636 | 19,777 |
saleor | saleor/graphql/account/tests/mutations/permission_group/test_permission_group_update.py | .py | import json
from unittest.mock import patch
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from ......account.error_codes import PermissionGroupErrorCode
from ......account.models import Group
from ......account.tests.fixtures.user import dangerously_create_test... | 1,701 | 56,604 |
metrics | src/torchmetrics/clustering/mutual_info_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... | 128 | 5,044 |
mlflow | mlflow/genai/judges/utils/__init__.py | .py | """Main utilities module for judges. Maintains backwards compatibility."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mlflow.genai.judges.base import AlignmentOptimizer
import mlflow
from mlflow.environment_variables import MLFLOW_GENAI_JUDGE_DEFAULT_MODEL
from ml... | 134 | 3,918 |
luigi | test/contrib/datadog_metric_test.py | .py | # -*- coding: utf-8 -*-
import time
import mock
from helpers import unittest
from luigi.contrib.datadog_metric import DatadogMetricsCollector
from luigi.metrics import MetricsCollectors
from luigi.scheduler import Scheduler
WORKER = "myworker"
class DatadogMetricTest(unittest.TestCase):
def setUp(self):
... | 139 | 5,218 |
textual | docs/examples/guide/layout/grid_layout6_row_span.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class GridLayoutExample(App):
CSS_PATH = "grid_layout6_row_span.tcss"
def compose(self) -> ComposeResult:
yield Static("One", classes="box")
yield Static("Two [b](column-span: 2 and row-span: 2)", classes="box", id=... | 20 | 572 |
metrics | src/torchmetrics/image/lpip.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... | 196 | 8,460 |
sqlmap | plugins/generic/syntax.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 Backend
from lib.core.convert import getBytes
from lib.core.data import conf
from lib.core.enums import DBMS
from lib.core.exception import ... | 54 | 2,064 |
pyro | examples/toy_mixture_model_discrete_enumeration.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
A toy mixture model to provide a simple example for implementing discrete enumeration.
(A) -> [B] -> (C)
A is an observed Bernoulli variable with Beta prior.
B is a hidden variable which is a mixture of two Bernoulli distribution... | 142 | 5,184 |
pyomo | pyomo/contrib/alternative_solutions/solution.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... | 157 | 5,479 |
biopython | Tests/test_PDB_internal_coords.py | .py | # Copyright 2020-2022 by Robert T. Miller. 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.
"""Unit tests for ... | 665 | 27,426 |
coremltools | coremltools/test/modelpackage/__init__.py | .py | # Copyright (c) 2017 - 2021, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
| 5 | 225 |
luigi | luigi/contrib/hive.py | .py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 533 | 19,129 |
pyomo | pyomo/common/tests/test_tempfile.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... | 592 | 22,725 |
flit | flit/vendorized/readme/clean.py | .py | ## shim readme clean to simplify vendorizing of readme.rst
clean = lambda x:x
| 3 | 78 |
probability | tensorflow_probability/python/internal/distribute_lib.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... | 380 | 13,254 |
beam | sdks/python/apache_beam/examples/snippets/transforms/elementwise/kvswap_test.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");... | 52 | 1,522 |
conda | conda/testing/helpers.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Collection of helper functions used in conda tests."""
from __future__ import annotations
import os
import subprocess
import sys
from contextlib import contextmanager
from functools import cache
from os.path import abspath, dirname, join
fr... | 768 | 23,312 |
cvxpy | cvxpy/atoms/elementwise/square.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... | 24 | 757 |
voila | tests/app/config_paths_test.py | .py | # test all objects that should be configurable
import os
import pytest
BASE_DIR = os.path.dirname(__file__)
@pytest.fixture
def voila_config_file_paths_arg():
path = os.path.join(BASE_DIR, "..", "configs", "general")
return "--VoilaTest.config_file_paths=[%r]" % path
def test_config_app(voila_app):
as... | 32 | 862 |
hydra | tests/test_examples/test_structured_configs_tutorial.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import re
from pathlib import Path
from textwrap import dedent
from typing import Any
from omegaconf import OmegaConf
from pytest import mark
from hydra.test_utils.test_utils import (
chdir_hydra_root,
run_python_script,
run_with_error... | 179 | 4,986 |
textual | src/textual/notifications.py | .py | """Provides classes for holding and managing notifications."""
from __future__ import annotations
from dataclasses import dataclass, field
from time import time
from typing import Iterator
from uuid import uuid4
from rich.repr import Result
from typing_extensions import Literal, Self, TypeAlias
from textual.message... | 121 | 3,714 |
pymc | tests/logprob/utils.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... | 112 | 3,955 |
onnx | onnx/backend/test/case/node/celu.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Celu(Base):
@staticmethod
def export() -> Non... | 98 | 2,943 |
saleor | saleor/webhook/tests/test_webhook_payload_serializers.py | .py | from ..payload_serializers import PythonSerializer
def test_python_serializer_extra_model_fields(product_with_single_variant):
serializer = PythonSerializer(
extra_model_fields={"ProductVariant": ("quantity", "quantity_allocated")}
)
annotated_variant = (
product_with_single_variant.varian... | 35 | 1,307 |
textual | tests/input/test_input_replace.py | .py | from __future__ import annotations
import pytest
from textual.app import App, ComposeResult
from textual.widgets import Input
_FORWARD_DELETIONS = [
((0, 0), "0123456789"), # Delete nothing
((0, 10), ""), # Delete all
((0, 1), "123456789"), # Delete first character
((5, 10), "01234"), # Delete la... | 65 | 2,197 |
saleor | saleor/graphql/account/tests/mutations/customer_type/test_customer_type_unassign_attributes.py | .py | from unittest.mock import patch
import graphene
from ......account.error_codes import CustomerTypeUnassignAttributesErrorCode
from .....tests.utils import assert_no_permission, get_graphql_content
CUSTOMER_TYPE_UNASSIGN_ATTRIBUTES_MUTATION = """
mutation CustomerTypeUnassignAttributes(
$customerTypeId: I... | 250 | 8,038 |
wagtail | wagtail/images/wagtail_hooks.py | .py | from django.urls import include, path, reverse, reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
from wagtail import hooks
from wagtail.admin.admin_url_finder import (
Mode... | 202 | 6,848 |
readthedocs.org | readthedocs/subscriptions/views.py | .py | """Subscriptions views."""
from functools import lru_cache
import structlog
from django.contrib import messages
from django.http import Http404
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.translation import gettext_lazy ... | 207 | 8,273 |
onnxruntime | onnxruntime/contrib_ops/cuda/llm/moe_gemm/launchers/generate_moe_gemm_tma_ws_sm120_fp4.py | .py | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Generate SM120 FP4-based MoE GEMM kernel instantiations.
SM120 (Blackwell SM120) supports native FP4 grouped GEMM via CUTLASS TMA
warp-specialized kernels. This script generates one .cu file per
(o... | 139 | 4,795 |
probability | tensorflow_probability/python/distributions/geometric.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... | 304 | 11,752 |
gunicorn | tests/requests/valid/rfc9112_chunked_ext_quoted_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 7.1.1: chunk-ext-val can be token or quoted-string.
request = {
"method": "POST",
"uri": uri("/upload"),
"version": (1, 1),
"headers": [
("HOST", "example.com"),
(... | 16 | 384 |
biopython | Bio/Phylo/Consensus.py | .py | # Copyright (C) 2013 by Yanbo Ye (yeyanbo289@gmail.com)
#
# 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.
"""Classes and methods fo... | 655 | 24,305 |
wagtail | wagtail/admin/views/pages/history.py | .py | import django_filters
import swapper
from django.core.exceptions import PermissionDenied
from django.db.models import Q
from django.shortcuts import get_object_or_404
from django.utils.translation import gettext_lazy
from wagtail.admin.views.generic import history
from wagtail.admin.views.pages.utils import (
Gene... | 104 | 3,467 |
sqlmap | tests/test_decorators.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Function decorators in lib/core/decorators.py: cachedmethod (memoization with a
hashable fast path and a frozen slow path for unhashable arguments), stackedmethod
(value-stack realign... | 94 | 2,770 |
pdm | src/pdm/models/in_process/sysconfig_get_paths.py | .py | import json
import os
import sys
import sysconfig
def _running_under_venv():
"""This handles PEP 405 compliant virtual environments."""
return sys.prefix != getattr(sys, "base_prefix", sys.prefix)
def _running_under_regular_virtualenv():
"""This handles virtual environments created with pypa's virtualen... | 56 | 1,698 |
probability | tensorflow_probability/python/experimental/auto_batching/tf_backend.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... | 754 | 30,288 |
coremltools | coremltools/converters/mil/mil/ops/tests/iOS17/test_linear.py | .py | # Copyright (c) 2023, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import numpy as np
import pytest
import coremltools as ct
from coremltools.convert... | 186 | 7,433 |
wagtail | wagtail/admin/panels/help_panel.py | .py | from .base import Panel
class HelpPanel(Panel):
"""
A panel to display helpful information to the user.
This panel does not support the ``help_text`` parameter.
"""
def __init__(
self,
content="",
template="wagtailadmin/panels/help_panel.html",
**kwargs,
):
... | 39 | 945 |
mlflow | tests/store/tracking/test_secret_cache.py | .py | import gc
import json
import threading
import time
from concurrent.futures import ThreadPoolExecutor
import pytest
# Commented out pending integration with rest branch:
# from mlflow.entities import SecretResourceType
from mlflow.store.tracking._secret_cache import (
_MAX_TTL,
_MIN_TTL,
EphemeralCacheEncr... | 527 | 17,839 |
lemur | lemur/plugins/lemur_digicert/__init__.py | .py | try:
from importlib.metadata import version
VERSION = version(__name__)
except Exception as e:
VERSION = "unknown"
| 6 | 127 |
python-prompt-toolkit | examples/full-screen/simple-demos/colorcolumn.py | .py | #!/usr/bin/env python
"""
Colorcolumn example.
"""
from prompt_toolkit.application import Application
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.layout.containers import ColorColumn, HSplit, Window
from prompt_toolkit.layout.controls import BufferCon... | 65 | 1,868 |
mlflow | examples/multistep_workflow/als.py | .py | """
Trains an Alternating Least Squares (ALS) model for user/movie ratings.
The input is a Parquet ratings dataset (see etl_data.py), and we output
an mlflow artifact called 'als-model'.
"""
import click
import pyspark
from pyspark.ml import Pipeline
from pyspark.ml.evaluation import RegressionEvaluator
from pyspark.m... | 71 | 2,369 |
wandb | tests/system_tests/test_launch/test_job.py | .py | import json
import os
import tempfile
from unittest import mock
import pytest
import wandb
from wandb.apis.internal import Api as InternalApi
from wandb.apis.public import Api as PublicApi
from wandb.sdk.artifacts.artifact import Artifact
from wandb.sdk.launch.create_job import _create_job
from wandb.sdk.launch.git_re... | 243 | 7,599 |
probability | tensorflow_probability/python/math/gram_schmidt_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... | 120 | 4,231 |
probability | tensorflow_probability/python/internal/tensor_util.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... | 209 | 6,837 |
saleor | saleor/graphql/meta/tests/queries/test_channel.py | .py | import graphene
from ....tests.utils import assert_no_permission, get_graphql_content
from .utils import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE
QUERY_CHANNEL_PRIVATE_META = """
query channelMeta($id: ID!){
channel(id: $id){
privateMetadata{
key
val... | 180 | 5,289 |
mlflow | mlflow/tracing/export/uc_table.py | .py | import logging
from typing import Sequence
from opentelemetry.sdk.trace import ReadableSpan
from mlflow.entities.span import Span
from mlflow.entities.trace_info import TraceInfo
from mlflow.environment_variables import MLFLOW_ENABLE_ASYNC_TRACE_LOGGING
from mlflow.tracing.export.mlflow_v3 import MlflowV3SpanExporter... | 76 | 2,863 |
sqlmap | tamper/multiplespaces.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import random
import re
from lib.core.data import kb
from lib.core.datatype import OrderedSet
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.NORMAL
def dependencie... | 59 | 1,490 |
biopython | Bio/SeqIO/PirIO.py | .py | # Copyright 2008-2015 by Peter Cock. 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.
"""Bio.SeqIO support fo... | 293 | 10,021 |
textual | src/textual/css/_styles_builder.py | .py | from __future__ import annotations
from typing import Iterable, NoReturn, cast
import rich.repr
from textual._border import BorderValue, normalize_border_value
from textual._cells import cell_len
from textual._duration import _duration_as_seconds
from textual._easing import EASING
from textual.color import TRANSPARE... | 1,317 | 49,495 |
saleor | saleor/tests/e2e/orders/test_order_staff_can_overwrite_prices.py | .py | import pytest
from .. import DEFAULT_ADDRESS
from ..product.utils.preparing_product import prepare_product
from ..shop.utils.preparing_shop import prepare_default_shop
from ..utils import assign_permissions
from .utils.draft_order_complete import draft_order_complete
from .utils.draft_order_create import draft_order_c... | 100 | 3,104 |
pyomo | pyomo/contrib/doe/examples/rooney_biegler_doe_example.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... | 198 | 8,006 |
hatch | tests/helpers/templates/wheel/standard_default_shared_data.py | .py | from hatch.template import File
from hatch.utils.fs import Path
from hatchling.__about__ import __version__
from hatchling.metadata.spec import DEFAULT_METADATA_VERSION
from ..new.feature_no_src_layout import get_files as get_template_files
from .utils import update_record_file_contents
def get_files(**kwargs):
... | 53 | 1,493 |
wagtail | wagtail/contrib/settings/tests/site_specific/base.py | .py | from wagtail.coreutils import get_dummy_request
from wagtail.models import Site
from wagtail.test.testapp.models import TestSiteSetting
from wagtail.test.utils import Page
class SiteSettingsTestMixin:
def setUp(self):
root = Page.objects.first()
other_home = Page(title="Other Root")
root.a... | 34 | 1,216 |
confluent-kafka-python | tests/oauthbearer/aws/test_dispatch.py | .py | # 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 required by applicable law or agreed to in writing, s... | 474 | 17,597 |
mlflow | mlflow/utils/cli_args.py | .py | """
Definitions of click options shared by several CLI commands.
"""
import warnings
import click
from mlflow.environment_variables import MLFLOW_DISABLE_ENV_MANAGER_CONDA_WARNING
from mlflow.utils import env_manager as _EnvManager
MODEL_PATH = click.option(
"--model-path",
"-m",
default=None,
metav... | 302 | 10,406 |
mlflow | mlflow/gateway/providers/togetherai.py | .py | import json
from typing import Any, AsyncGenerator, AsyncIterable
from mlflow.exceptions import MlflowException
from mlflow.gateway.config import EndpointConfig, TogetherAIConfig
from mlflow.gateway.exceptions import AIGatewayException
from mlflow.gateway.providers.base import BaseProvider, ProviderAdapter
from mlflow... | 452 | 17,148 |
cvxpy | cvxpy/atoms/affine/transpose.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... | 191 | 5,801 |
textual | tests/text_area/test_selection_bindings.py | .py | import pytest
from textual.app import App, ComposeResult
from textual.geometry import Offset
from textual.widgets import TextArea
from textual.widgets.text_area import Selection
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
"""
clas... | 312 | 11,219 |
pyro | pyro/contrib/funsor/handlers/replay_messenger.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from pyro.contrib.funsor.handlers.primitives import to_data
from pyro.poutine.replay_messenger import ReplayMessenger as OrigReplayMessenger
class ReplayMessenger(OrigReplayMessenger):
"""
This version of :class:`~ReplayMesse... | 42 | 1,806 |
beam | sdks/python/apache_beam/tools/teststream_microbenchmark.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 ... | 126 | 4,182 |
jupytext | tests/unit/test_escape_magics.py | .py | import pytest
from jupyter_server.utils import ensure_async
from nbformat.v4.nbbase import new_code_cell, new_notebook
import jupytext
from jupytext.compare import compare, compare_notebooks, notebook_model
from jupytext.magics import (
_PYTHON_MAGIC_ASSIGN,
comment_magic,
is_magic,
uncomment_magic,
... | 301 | 8,501 |
wandb | tests/unit_tests/test_lib/test_run_messages.py | .py | import asyncio
from unittest.mock import AsyncMock, Mock
import pytest
import pytest_asyncio
from looptime import LoopTimeProxy
from wandb.proto import wandb_internal_pb2 as pb
from wandb.sdk.lib import asyncio_compat, run_messages
from tests.fixtures.mock_wandb_log import MockWandbLog
@pytest_asyncio.fixture
async... | 104 | 3,096 |
wandb | wandb/apis/public/history.py | .py | """W&B Public API for Run History.
This module provides classes for efficiently scanning and sampling run
history data.
Note:
This module is part of the W&B Public API and provides methods
to access run history data. It handles pagination automatically and offers
both complete and sampled access to metric... | 146 | 4,793 |
beam | sdks/python/apache_beam/transforms/sideinputs.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... | 113 | 3,769 |
pyomo | pyomo/contrib/aslfunctions/tests/test_functions.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 133 | 4,641 |
jupytext | tests/functional/others/test_unicode.py | .py | from nbformat.v4.nbbase import new_markdown_cell, new_notebook
import jupytext
from jupytext.compare import compare
def test_notebook_contents_is_unicode(ipynb_file):
nb = jupytext.read(ipynb_file)
for cell in nb.cells:
assert isinstance(cell.source, str)
def test_rmd_notebook_contents_is_unicode(... | 140 | 2,877 |
pyro | pyro/contrib/funsor/handlers/trace_messenger.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import funsor
import torch
from pyro.contrib.funsor.handlers.primitives import to_funsor
from pyro.contrib.funsor.handlers.runtime import _DIM_STACK
from pyro.poutine.subsample_messenger import _Subsample
from pyro.poutine.trace_messe... | 84 | 3,632 |
metrics | tests/unittests/utilities/test_plot.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... | 1,037 | 40,580 |
saleor | saleor/graphql/giftcard/tests/bulk_mutations/test_gift_card_bulk_activate.py | .py | import datetime
from unittest import mock
import graphene
from .....giftcard import GiftCardEvents
from .....giftcard.error_codes import GiftCardErrorCode
from .....giftcard.models import GiftCard, GiftCardEvent
from ....tests.utils import assert_no_permission, get_graphql_content
MUTATION_GIFT_CARD_BULK_ACTIVATE = ... | 230 | 6,641 |
beam | sdks/python/apache_beam/io/gcp/healthcare/dicomio.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... | 581 | 20,769 |
mlflow | mlflow/server/fastapi_app.py | .py | """
FastAPI application wrapper for MLflow server.
This module provides a FastAPI application that wraps the existing Flask application
using WSGIMiddleware to maintain 100% API compatibility while enabling future migration
to FastAPI endpoints.
"""
import inspect
import json
import os
import time
import typing
impo... | 261 | 11,028 |
hatch | backend/src/hatchling/version/core.py | .py | from __future__ import annotations
import os
import re
DEFAULT_PATTERN = r'(?i)^(__version__|VERSION) *= *([\'"])v?(?P<version>.+?)\2'
DEFAULT_TEMPLATE = """\
# This file is auto-generated by Hatchling. As such, do not:
# - modify
# - track in version control e.g. be sure to add to .gitignore
__version__ = VERSIO... | 59 | 2,153 |
openvino | tests/layer_tests/pytorch_tests/test_item.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import numpy as np
import torch
from pytorch_layer_test_class import PytorchLayerTest
@pytest.mark.parametrize("dtype", [pytest.param(np.int32, marks=pytest.mark.xfail(reason="item returns scalar and for i32 it returns i... | 36 | 1,318 |
gunicorn | gunicorn/reloader.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# pylint: disable=no-else-continue
import os
import os.path
import re
import sys
import time
import threading
COMPILED_EXT_RE = re.compile(r'py[co]$')
class ReloaderBase(threading.Thread):
def __init__(self,... | 129 | 3,736 |
mlflow | tests/tracing/opentelemetry/test_integration.py | .py | import pytest
from opentelemetry import trace as otel_trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
import mlflow
from mlflow.entities.span import SpanStatus... | 456 | 19,470 |
beam | sdks/python/apache_beam/ml/rag/enrichment/bigquery_vector_search_it_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... | 906 | 32,785 |
clearml | clearml/backend_api/services/v2_20/events.py | .py | """
events service
Provides an API for running tasks to report events collected by the system.
"""
from typing import List, Optional, Any
import six
import enum
from clearml.backend_api.session import (
Request,
BatchRequest,
Response,
NonStrictDataModel,
CompoundRequest,
schema_property,
S... | 5,127 | 169,733 |
metrics | tests/integrations/__init__.py | .py | import os
_INTEGRATION_ROOT = os.path.realpath(os.path.dirname(__file__))
_PACKAGE_ROOT = os.path.dirname(_INTEGRATION_ROOT)
_PATH_DATASETS = os.path.join(_PACKAGE_ROOT, "datasets")
| 6 | 183 |
black | tests/data/cases/fmtonoff_comment_only_with.py | .py | # flags: --minimum-version=3.10
with open("bug.txt", "r", encoding="utf-8") as fh1:
pass
# fmt: off
# fmt: on
# xxx
# fmt: off
# fmt: on
with open("bug.txt", "r", encoding="utf-8") as fh2:
pass
def fn(str: str) -> float:
match str:
case _:
pass
# output
with open("bug.txt", "r", encod... | 35 | 537 |
sqlmap | plugins/dbms/spanner/takeover.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from lib.core.exception import SqlmapUnsupportedFeatureException
from plugins.generic.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover):
def osCmd(s... | 29 | 974 |
omegaconf | subprojects/omegaconf-pydevd/tests/test_pydev_resolver_plugin.py | .py | import builtins
from enum import Enum
from typing import Any
from pydevd_plugins.extensions.pydevd_plugin_omegaconf import (
OmegaConfDeveloperResolver,
OmegaConfUserResolver,
)
from pytest import fixture, mark, param
from omegaconf import (
AnyNode,
BooleanNode,
BytesNode,
Container,
Dict... | 269 | 7,513 |
openvino | tests/layer_tests/tensorflow_lite_tests/test_tfl_L2Normalization.py | .py | import pytest
import tensorflow as tf
from common.tflite_layer_test_class import TFLiteLayerTest
from common.utils.tflite_utils import additional_test_params
from common.utils.tflite_utils import parametrize_tests
test_params = [
{'shape': [1]},
{'shape': [1, 22]},
{'shape': [1, 1, 8]},
{'shape': [1, ... | 38 | 1,355 |
toolz | bench/test_first_iter.py | .py | import itertools
from toolz import first, second
def test_first_iter():
iters = map(iter, [(1, 2) for i in range(1000000)])
for p in iters:
first(p)
def test_second_iter():
iters = map(iter, [(1, 2) for i in range(1000000)])
for p in iters:
second(p)
| 15 | 287 |
beam | sdks/python/apache_beam/transforms/sql.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... | 96 | 3,940 |
astropy | astropy/visualization/wcsaxes/coordinate_helpers.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file defines the classes used to represent a 'coordinate', which includes
axes, ticks, tick labels, and grid lines.
"""
import warnings
import numpy as np
from matplotlib import rcParams
from matplotlib.patches import PathPatch
from matplotlib.... | 1,628 | 59,943 |
biopython | Bio/PDB/Atom.py | .py | # Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
#
# 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.
"""Atom class, used ... | 603 | 20,481 |
mlflow | mlflow/store/db_migrations/versions/c48cb773bb87_reset_default_value_for_is_nan_in_metrics_table_for_mysql.py | .py | """reset_default_value_for_is_nan_in_metrics_table_for_mysql
Create Date: 2021-04-02 15:43:28.466043
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "c48cb773bb87"
down_revision = "39d1c3be5f05"
branch_labels = None
depends_on = None
def upgrade():
# This... | 40 | 1,247 |
pyomo | pyomo/contrib/mindtpy/tests/MINLP5_simple.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 | 2,124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.