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 |
|---|---|---|---|---|---|
pyro | tests/distributions/test_polya_gamma.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from pyro.distributions import TruncatedPolyaGamma
from tests.common import assert_close
@pytest.mark.parametrize("batch_shape", [(), (3,), (2, 1)])
def test_polya_gamma(batch_shape, num_points=20000):
... | 28 | 904 |
beam | sdks/python/apache_beam/options/pipeline_options_context.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... | 66 | 2,369 |
pyro | pyro/distributions/transforms/householder.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import warnings
from functools import partial
import torch
import torch.nn as nn
from torch.distributions import Transform, constraints
from pyro.nn import DenseNN
from ..conditional import ConditionalTransformModule... | 292 | 10,544 |
wagtail | wagtail/admin/tests/viewsets/test_base_viewset.py | .py | import json
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from wagtail.test.utils.wagtail_tests import WagtailTestUtils
class TestBaseViewSet(WagtailTestUtils, TestCase):
def setUp(self):
self.user = self.login()
def get_main_menu_items(self, res... | 105 | 4,047 |
cvxpy | cvxpy/reductions/solvers/nlp_solving_chain.py | .py | """
Copyright, the CVXPY authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... | 239 | 8,857 |
probability | tensorflow_probability/python/mcmc/hmc_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... | 1,277 | 50,013 |
mlflow | examples/system_metrics/collect_system_metrics.py | .py | import time
import mlflow
if __name__ == "__main__":
mlflow.enable_system_metrics_logging()
with mlflow.start_run() as run:
time.sleep(11)
client = mlflow.MlflowClient()
mlflow_run = client.get_run(run.info.run_id)
print(mlflow_run.data.metrics)
| 13 | 277 |
luigi | test/contrib/cascading_test.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... | 73 | 2,770 |
onnxruntime | onnxruntime/python/tools/quantization/neural_compressor/onnx_model.py | .py | #
# The implementation of this file is based on:
# https://github.com/intel/neural-compressor/tree/master/neural_compressor
#
# Copyright (c) 2023 Intel Corporation
#
# 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 ... | 1,237 | 49,600 |
saleor | saleor/tests/e2e/orders/test_order_is_expired_after_specific_time.py | .py | import datetime
import pytest
from django.utils import timezone
from freezegun import freeze_time
from ....order.tasks import expire_orders_task
from ..checkout.utils import checkout_create, checkout_delivery_method_update
from ..product.utils.preparing_product import prepare_product
from ..shop.utils.preparing_shop ... | 123 | 3,813 |
openvino | tests/e2e_tests/pipelines/pipeline_templates/model_loader_templates.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
def pytorch_loader(model_name=None,
weights=None,
output_file=None,
model_path=None,
import_module=None,
model_param=None,
... | 41 | 1,382 |
conda | conda/plugins/package_extractors/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Package extractor plugins."""
from . import conda
plugins = [conda]
| 8 | 148 |
coremltools | coremltools/converters/mil/mil/ops/tests/coreml_dialect/test_coreml_dialect.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
import pytest
from coremltools.converters.mil.mil import types
from coremltools.converters.mil.mil.bui... | 68 | 2,648 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineperkey_side_inputs_singleton.py | .py | # coding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License");... | 50 | 1,665 |
onnxruntime | tools/ci_build/github/apple/c/assemble_c_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 shutil
import sys
_script_dir = pathlib.Path(__file__).parent.resolve(strict=True)
sys.path.append(str(_script_dir.parent))
from package_assembly_utils import (... | 181 | 6,483 |
astropy | astropy/table/tests/test_row.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy import table
from astropy import units as u
from astropy.table import Row
from .conftest import MaskedTable
def test_masked_row_with_object_col():
... | 389 | 12,508 |
saleor | saleor/graphql/product/tests/queries/test_variants_query.py | .py | import graphene
from .....product.models import ProductVariant
from ....tests.utils import assert_no_permission, get_graphql_content
def test_product_variants_by_ids(staff_api_client, variant, channel_USD):
query = """
query getProductVariants($ids: [ID!], $channel: String) {
productVariants(... | 287 | 9,794 |
openvino | tests/layer_tests/common/utils/multiprocessing_utils.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import os
import platform
import signal
import sys
import traceback
from multiprocessing import Process, Queue, TimeoutError, ProcessError
from queue import Empty as QueueEmpty
from typing import Union
from collecti... | 101 | 3,821 |
ipython | IPython/core/crashhandler.py | .py | """sys.excepthook for IPython itself, leaves a detailed report on disk.
Authors:
* Fernando Perez
* Brian E. Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
# Copyright (C) 2008-2011 The IPython Development ... | 249 | 8,877 |
saleor | saleor/graphql/menu/filters.py | .py | import django_filters
import graphene
from django.db.models import Q
from ...menu.models import Menu, MenuItem
from ..core.filters import (
FilterInputObjectType,
ListObjectTypeFilter,
MetadataFilterBase,
)
from ..utils.filters import filter_slug_list
def filter_menu_search(qs, _, value):
return qs.f... | 52 | 1,279 |
saleor | saleor/graphql/translations/mutations/utils.py | .py | from collections import defaultdict
import graphene
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db.models import F, Model, Q
from graphene.types.mutation import MutationOptions
from graphene.utils.str_converters import to_camel_case
from graphql import GraphQLError
from ....at... | 539 | 20,093 |
funcy | tests/test_seqs.py | .py | from collections.abc import Iterator
from operator import add
import pytest
from whatever import _
from funcy import is_list
from funcy.seqs import *
def test_repeatedly():
counter = count()
c = lambda: next(counter)
assert take(2, repeatedly(c)) == [0, 1]
def test_iterate():
assert take(4, iterate(... | 220 | 7,072 |
astropy | astropy/extern/ply/__init__.py | .py | # PLY package
# Author: David Beazley (dave@dabeaz.com)
__version__ = '3.11'
__all__ = ['lex','yacc']
| 6 | 103 |
astropy | astropy/units/misc.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package defines miscellaneous units. They are also available in
(and should be used through) the `astropy.units` namespace.
"""
# avoid ruff complaints about undefined names defined by def_unit
# ruff: noqa: F821
import numpy as np
from astropy... | 164 | 3,971 |
wagtail | wagtail/images/tests/test_models.py | .py | import hashlib
import unittest
from io import StringIO
from unittest import mock
from django.conf import settings
from django.contrib.auth.models import Group, Permission
from django.core import checks, management
from django.core.cache import caches
from django.core.files import File
from django.core.files.storage im... | 1,636 | 62,333 |
pyro | pyro/params/__init__.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from .param_store import (
module_from_param_with_module_name,
param_with_module_name,
user_param_name,
)
__all__ = [
"module_from_param_with_module_name",
"param_with_module_name",
"user_param_name",
]
| 15 | 317 |
probability | tensorflow_probability/python/experimental/timeseries/__init__.py | .py | # Copyright 2024 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... | 37 | 1,518 |
readthedocs.org | readthedocs/search/api/v3/urls.py | .py | from django.urls import path
from readthedocs.search.api.v3.views import SearchAPI
urlpatterns = [
path("", SearchAPI.as_view(), name="search_api_v3"),
]
| 9 | 161 |
openvino | tests/e2e_tests/common/common/dummy_comparator.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from collections import OrderedDict
from e2e_tests.common.common.common_base_class import CommonConfig
from e2e_tests.pipelines.pipeline_templates.comparators_template import dummy_comparators
from e2e_tests.pipelines.pipeline_templates... | 35 | 1,733 |
onnxruntime | orttraining/orttraining/test/external_custom_ops/setup.py | .py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import subprocess
import sys
from subprocess import CalledProcessError # noqa: F401
import onnx
import pybind11
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
import onnxruntime
class CMak... | 56 | 1,795 |
cvxpy | cvxpy/atoms/affine/diag.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... | 200 | 5,765 |
probability | tensorflow_probability/python/distributions/cholesky_util.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... | 81 | 2,982 |
beam | sdks/python/apache_beam/io/gcp/tests/xlang_spannerio_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... | 403 | 13,547 |
mlflow | mlflow/langchain/langchain_tracer.py | .py | import ast
import logging
from contextvars import ContextVar
from typing import Any, Optional, Sequence
from uuid import UUID
import pydantic
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.callbacks.base import BaseCallbackHandler
from langchain_core.documents import Document
from langc... | 806 | 32,224 |
sphinx | tests/roots/test-ext-viewcode-find/conf.py | .py | extensions = ['sphinx.ext.viewcode']
exclude_patterns = ['_build']
viewcode_follow_imported_members = False
| 4 | 108 |
textual | tests/snapshot_tests/snapshot_apps/split_segments.py | .py | from textual.app import App, ComposeResult
from textual.widgets import TextArea
FAIL_TEXT = "x"
class CodeApp(App):
def compose(self) -> ComposeResult:
yield TextArea(FAIL_TEXT, soft_wrap=False, show_line_numbers=True)
if __name__ == "__main__":
app = CodeApp()
app.run()
| 15 | 297 |
records | tests/test_105.py | .py | import pytest
@pytest.mark.usefixtures("foo_table")
def test_issue105(db):
assert db.query("select count(*) as n from foo").scalar() == 0
| 7 | 144 |
wandb | wandb/sdk/mailbox/mailbox.py | .py | from __future__ import annotations
import logging
import secrets
import string
import threading
from collections.abc import Awaitable, Callable
from wandb.proto import wandb_internal_pb2 as pb
from wandb.proto import wandb_server_pb2 as spb
from wandb.sdk.lib import asyncio_manager
from .mailbox_handle import Mailbo... | 161 | 5,242 |
saleor | saleor/graphql/shop/mutations/__init__.py | .py | from .gift_card_settings_update import GiftCardSettingsUpdate
from .refund_reason_reference_type_clear import RefundReasonReferenceTypeClear
from .refund_settings_update import RefundSettingsUpdate
from .return_reason_reference_type_clear import ReturnReasonReferenceTypeClear
from .return_settings_update import ReturnS... | 24 | 1,032 |
django-cms | cms/tests/test_wizards.py | .py | from unittest.mock import Mock, patch
from django import forms
from django.apps import apps
from django.apps.registry import Apps
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.template import TemplateSyntaxErro... | 754 | 28,344 |
wandb | tests/system_tests/test_automations/conftest.py | .py | from __future__ import annotations
import secrets
from collections.abc import Callable, Generator
from functools import lru_cache
from string import ascii_lowercase, digits
from typing import TYPE_CHECKING, TypeAlias
import wandb
from pytest import FixtureRequest, fixture, skip
from wandb import Artifact
from wandb._... | 482 | 16,059 |
pyro | tests/ops/test_newton.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import itertools
import logging
import pytest
import torch
from torch.autograd import grad
from pyro.ops.newton import newton_step
from tests.common import assert_equal
logger = logging.getLogger(__name__)
def random_inside_un... | 142 | 5,028 |
textual | tests/test_two_way_dict.py | .py | import pytest
from textual._two_way_dict import TwoWayDict
@pytest.fixture
def two_way_dict():
return TwoWayDict(
{
1: 10,
2: 20,
3: 30,
}
)
def test_get(two_way_dict):
assert two_way_dict.get(1) == 10
def test_get_key(two_way_dict):
assert two_... | 46 | 871 |
gunicorn | tests/docker/dirty_ttin_ttou/test_ttin_ttou_docker.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Docker integration tests for dirty arbiter TTIN/TTOU signals."""
import os
import subprocess
import time
from pathlib import Path
import pytest
import requests
pytestmark = [
pytest.mark.docker,
pyte... | 236 | 7,585 |
bazel | tools/ctexplain/bazel_api.py | .py | # Copyright 2020 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 181 | 5,991 |
clearml | clearml/backend_api/utils.py | .py | import logging
import ssl
import sys
from typing import Optional, List, Any
import requests
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
from urllib3 import PoolManager
import urllib3
from .session.defs import ENV_HOST_VERIFY_CERT
from ..backend_config.converters import strtobool
from fun... | 208 | 7,719 |
wandb | wandb/sdk/artifacts/_models/__init__.py | .py | """Pydantic model classes and related helpers for artifacts code.
Excludes GraphQL-generated classes.
"""
__all__ = [
"ArtifactsBase",
"RegistryData",
"ArtifactCollectionData",
]
from .artifact_collection import ArtifactCollectionData
from .base_model import ArtifactsBase
from .registry import RegistryDat... | 14 | 322 |
jupytext | jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/jupyter_server_test_config.py | .py | """Server configuration for integration tests.
!! Never use this configuration in production because it
opens the server to the world and provide access to JupyterLab
JavaScript objects through the global window variable.
"""
from jupyterlab.galata import configure_jupyter_server
configure_jupyter_server(c) # noqa:... | 14 | 412 |
astropy | astropy/units/tests/test_aliases.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test setting and adding unit aliases."""
import pytest
import astropy.units as u
trials = [
({"Angstroms": u.AA}, "Angstroms", u.AA),
({"counts": u.count}, "counts/s", u.count / u.s),
(
{"ergs": u.erg, "Angstroms": u.AA},
... | 90 | 3,058 |
pdm | tasks/max_versions.py | .py | from __future__ import annotations
import json
from html.parser import HTMLParser
from pathlib import Path
import httpx
PROJECT_DIR = Path(__file__).parent.parent
class PythonVersionParser(HTMLParser):
def __init__(self, *, convert_charrefs: bool = True) -> None:
super().__init__(convert_charrefs=conve... | 60 | 2,206 |
textual | tests/option_list/test_option_list_create.py | .py | """Core option list unit tests, aimed at testing basic list creation."""
from __future__ import annotations
import pytest
from textual.app import App, ComposeResult
from textual.widgets import OptionList
from textual.widgets.option_list import DuplicateID, Option, OptionDoesNotExist
class OptionListApp(App[None]):... | 169 | 6,381 |
pyomo | pyomo/core/base/sos.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... | 564 | 20,550 |
confluent-kafka-python | tests/schema_registry/data/proto/widget_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: widget.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_da... | 29 | 1,092 |
beam | learning/katas/python/Core Transforms/Map/ParDo OneToMany/tests/test_task.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... | 36 | 1,260 |
textual | docs/examples/tutorial/stopwatch.py | .py | from time import monotonic
from textual.app import App, ComposeResult
from textual.containers import HorizontalGroup, VerticalScroll
from textual.reactive import reactive
from textual.widgets import Button, Digits, Footer, Header
class TimeDisplay(Digits):
"""A widget to display elapsed time."""
start_time ... | 110 | 3,453 |
readthedocs.org | readthedocs/rtd_tests/tests/test_privacy.py | .py | from unittest import mock
import structlog
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.utils import override_settings
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Build, Version
from readthedocs.projects.models import Project
... | 400 | 14,987 |
mlflow | tests/store/tracking/test_gateway_sql_store.py | .py | import json
import uuid
from pathlib import Path
from unittest import mock
import pytest
from mlflow.entities import (
BudgetAction,
BudgetDuration,
BudgetDurationUnit,
BudgetTargetScope,
BudgetUnit,
FallbackConfig,
FallbackStrategy,
GatewayBudgetPolicy,
GatewayEndpoint,
Gatewa... | 3,365 | 120,961 |
astropy | astropy/io/ascii/ui.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""An extensible ASCII table reader and writer.
ui.py:
Provides the main user functions for reading and writing tables.
:Copyright: Smithsonian Astrophysical Observatory (2010)
:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)
"""
import collectio... | 1,122 | 41,001 |
saleor | saleor/csv/tests/export/products_data/test_handle_relations_data.py | .py | import datetime
from unittest.mock import patch
from django.utils import timezone
from .....attribute.models import Attribute, AttributeValue
from .....attribute.tests.model_helpers import get_product_attributes
from .....attribute.utils import associate_attribute_values_to_instance
from .....product.models import Pr... | 1,607 | 45,162 |
saleor | saleor/payment/gateway.py | .py | import logging
from collections.abc import Callable
from decimal import Decimal
from typing import TYPE_CHECKING, Optional, cast
from ..account.models import User
from ..app.models import App
from ..checkout.fetch import (
CheckoutInfo,
CheckoutLineInfo,
)
from ..core.prices import quantize_price
from ..core.t... | 633 | 19,497 |
saleor | saleor/graphql/product/tests/mutations/test_product_bulk_create.py | .py | import datetime
import json
import os
from io import BytesIO
from unittest.mock import Mock, patch
from uuid import uuid4
import graphene
import PIL
import pytest
from measurement.measures import Weight
from requests import RequestException
from requests.exceptions import InvalidSchema
from requests_hardened.ip_filter... | 3,581 | 115,926 |
pymc | tests/backends/test_arviz.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... | 900 | 38,182 |
pyomo | pyomo/core/base/action.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... | 76 | 2,683 |
metrics | tests/unittests/image/test_tv.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... | 121 | 4,091 |
pyomo | pyomo/opt/tests/base/test_solver.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... | 129 | 4,459 |
saleor | saleor/tests/e2e/vouchers/utils/__init__.py | .py | from .query_voucher import get_voucher
from .query_vouchers import get_vouchers
from .voucher_bulk_delete import voucher_bulk_delete
from .voucher_catalogues_add import add_catalogue_to_voucher
from .voucher_channel_listing import create_voucher_channel_listing
from .voucher_code_bulk_delete import voucher_code_bulk_de... | 26 | 890 |
lemur | lemur/users/models.py | .py | """
.. module: lemur.users.models
:platform: unix
:synopsis: This module contains all of the models need to create a user within
lemur
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
""... | 113 | 3,299 |
coremltools | coremltools/converters/mil/mil/passes/defs/symbol_transform.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 Dict, Set, Tuple
from coremltools import _logger as logger
from coremltools.conv... | 342 | 16,676 |
saleor | saleor/graphql/meta/tests/mutations/test_base.py | .py | from unittest import mock
import graphene
from ....tests.utils import get_graphql_content
UPDATE_METADATA = """
mutation UpdateMetadata($id: ID!, $input: [MetadataInput!]!) {
updateMetadata(id: $id, input: $input) {
errors {
code
field
message
... | 91 | 2,504 |
saleor | saleor/tests/e2e/orders/utils/order_invoice_create.py | .py | from ...utils import get_graphql_content
ORDER_INVOICE_CREATE_MUTATION = """
mutation InvoiceCreate($id: ID!, $input: InvoiceCreateInput!){
invoiceCreate(orderId: $id,
input: $input,
) {
errors {
code
field
message
}
invoice {
number
url
createdAt
metadata{
... | 49 | 833 |
cvxpy | cvxpy/interface/__init__.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... | 18 | 611 |
textual | tests/snapshot_tests/snapshot_apps/auto_fr.py | .py | from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Label
class FRApp(App):
CSS = """
Screen {
align: center middle;
border: solid cyan;
}
#container {
width: 30;
height: auto;
border: solid green... | 41 | 808 |
pyro | tests/contrib/gp/test_likelihoods.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from collections import namedtuple
import pytest
import torch
from pyro.contrib.gp.kernels import RBF
from pyro.contrib.gp.likelihoods import Binary, MultiClass, Poisson
from pyro.contrib.gp.models import VariationalGP, Variation... | 124 | 4,731 |
conda | tests/notices/test_types.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from conda.notices.types import UNDEFINED_MESSAGE_ID, ChannelNoticeResponse
from conda.testing.notices.helpers import get_test_notices
def test_channel_notice_response():
"""Tests a normal invocation of the ChannelNoticeResponse class."""... | 80 | 2,464 |
probability | tensorflow_probability/python/distributions/two_piece_student_t_test.py | .py | # Copyright 2022 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 584 | 21,849 |
mlflow | tests/entities/test_param.py | .py | from mlflow.entities import Param
from tests.helper_functions import random_int, random_str
def _check(param, key, value):
assert isinstance(param, Param)
assert param.key == key
assert param.value == value
def test_creation_and_hydration():
key = random_str(random_int(10, 25)) # random string on ... | 27 | 741 |
pyomo | pyomo/contrib/sensitivity_toolbox/examples/parameter_kaug.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... | 100 | 3,257 |
openvino | tests/layer_tests/jax_tests/test_reduce_window_max.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
class TestReduceWindowMax(JaxLayerTest):
def _prepare_input(self):
inp = jnp.array(np.random.r... | 54 | 1,849 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_logical_xor.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# logical_xor paddle model generator
#
import numpy as np
from save_model import saveModel
import sys
def equal_logical_xor(name : str, x, y, z):
import paddle
paddle.enable_static()
with paddle.static.program_guard(padd... | 53 | 1,612 |
textual | src/textual/css/constants.py | .py | from __future__ import annotations
import typing
if typing.TYPE_CHECKING:
from typing_extensions import Final
VALID_VISIBILITY: Final = {"visible", "hidden"}
VALID_DISPLAY: Final = {"block", "none"}
VALID_BORDER: Final = {
"ascii",
"blank",
"dashed",
"double",
"heavy",
"hidden",
"hkey... | 134 | 2,629 |
confluent-kafka-python | docs/conf.py | .py | # -*- coding: utf-8 -*-
#
# confluent-kafka documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 1 15:12:01 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | 283 | 9,118 |
pyro | pyro/contrib/mue/statearrangers.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import torch
import torch.nn as nn
class Profile(nn.Module):
"""
Profile HMM state arrangement. Parameterizes an HMM according to
Equation S40 in [1] (with r_{M+1,j} = 1 and u_{M+1,j} = 0
for j in {0, 1, 2}). For furt... | 208 | 9,017 |
pyro | pyro/distributions/testing/special.py | .py | # Copyright (c) 2014, Salesforce.com, Inc. All rights reserved.
# Copyright (c) 2015-2016, Gamelan Labs, Inc.
# Copyright (c) 2016, Google, Inc.
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
# Redistribution and use in source and binary forms, with or without
# m... | 108 | 3,610 |
scikit-bio | skbio/embedding/_embedding.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.
# --------------------------------------------... | 377 | 10,976 |
probability | tensorflow_probability/python/bijectors/exp_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... | 100 | 3,854 |
pyro | tests/contrib/funsor/test_valid_models_enum.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import contextlib
import logging
import os
from collections import defaultdict
from queue import LifoQueue
import pytest
import torch
from pyro.infer.enum import iter_discrete_escape, iter_discrete_extend
from pyro.ops.indexing impor... | 504 | 17,970 |
wandb | wandb/sdk/artifacts/_generated/update_artifact_sequence.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/artifacts/
from __future__ import annotations
from pydantic import Field
from wandb._pydantic import GQLResult
from .fragments import ArtifactCollectionFragment
class UpdateArtifactSequence(GQLResult):
result: UpdateArtifactSequenceResult | None
... | 23 | 542 |
probability | tensorflow_probability/python/experimental/mcmc/expectations_reducer.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... | 190 | 7,417 |
mlflow | mlflow/store/workspace/rest_store.py | .py | from __future__ import annotations
from urllib.parse import quote
from mlflow.entities import Workspace
from mlflow.entities.workspace import WorkspaceDeletionMode
from mlflow.exceptions import MlflowException, RestException
from mlflow.protos import databricks_pb2
from mlflow.protos.databricks_pb2 import INVALID_STA... | 135 | 5,618 |
qutip | setup.py | .py | import collections
import os
import pathlib
import subprocess
import sys
import sysconfig
import warnings
# Required third-party imports, must be specified in pyproject.toml.
import packaging.version
from setuptools import setup, Extension
import numpy as np
from Cython.Build import cythonize
from Cython.Distutils imp... | 312 | 11,650 |
confluent-kafka-python | examples/protobuf_producer.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 123 | 4,600 |
sqlmap | lib/parse/handler.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 xml.sax.handler import ContentHandler
from lib.core.common import sanitizeStr
class FingerprintHandler(ContentHandler):
"""
This class defines methods to... | 80 | 2,702 |
mlflow | tests/store/lineage/test_downstream_lineage.py | .py | import base64
from unittest import mock
import pytest
import mlflow
from mlflow.protos.databricks_uc_registry_messages_pb2 import (
EmitModelVersionLineageRequest,
Entity,
Job,
LineageHeaderInfo,
ModelVersionLineageDirection,
ModelVersionLineageInfo,
Notebook,
)
from mlflow.store._unity_ca... | 168 | 6,042 |
python-prompt-toolkit | examples/full-screen/pager.py | .py | #!/usr/bin/env python
"""
A simple application that shows a Pager application.
"""
from pygments.lexers.python import PythonLexer
from prompt_toolkit.application import Application
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.layout.containers import HSplit, Window
from prompt_toolkit.layout... | 110 | 2,442 |
rq | tests/test_rate_limit.py | .py | from datetime import datetime
from rq.exceptions import InvalidJobOperation
from rq.executions import Execution
from rq.job import Job, JobStatus, Retry
from rq.queue import Queue
from rq.rate_limit import RateLimit, RateLimitRegistry
from rq.registry import ScheduledJobRegistry, StartedJobRegistry
from rq.scheduler i... | 828 | 41,325 |
beam | sdks/python/apache_beam/testing/benchmarks/inference/mltransform_text_embedding_benchmark.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... | 118 | 4,453 |
beam | sdks/python/apache_beam/examples/inference/online_clustering/clustering_pipeline/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... | 123 | 4,347 |
wagtail | wagtail/contrib/simple_translation/tests/test_views.py | .py | from http import HTTPStatus
from django.contrib.admin.utils import quote
from django.contrib.auth import get_permission_codename
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.test import RequestFactory, ov... | 647 | 23,843 |
saleor | saleor/graphql/meta/tests/mutations/test_checkout.py | .py | import datetime
from unittest.mock import ANY, patch
import graphene
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....checkout.actions import call_checkout_events
from .....core.models import EventDelivery
from .....webhook.event_types import Webh... | 624 | 20,173 |
onnxruntime | onnxruntime/__init__.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
"""
ONNX Runtime is a performance-focused scoring engine for Open Neural ... | 501 | 21,447 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.