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 |
|---|---|---|---|---|---|
probability | tensorflow_probability/python/sts/decomposition_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... | 173 | 6,768 |
onnxruntime | orttraining/orttraining/python/training/ortmodule/_graph_execution_interface.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# _graph_execution_interface.py
from abc import ABC
class GraphExecutionInterface(ABC): # noqa: B024
def __init__(self, module):
self._original_module = module
self._validate_module_type(module)
de... | 30 | 1,092 |
django-cms | cms/test_utils/project/pluginapp/plugins/extra_context/cms_plugins.py | .py | from django.utils.translation import gettext as _
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
class ExtraContextPlugin(CMSPluginBase):
model = CMSPlugin
name = _("Extra Context")
render_template = "extra_context_plugin.htm... | 19 | 477 |
mkdocs-material | material/plugins/privacy/config.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... | 79 | 3,227 |
returns | returns/contrib/pytest/plugin.py | .py | import inspect
import sys
from collections.abc import Callable, Iterator
from contextlib import ExitStack, contextmanager
from functools import partial, wraps
from types import FrameType, MappingProxyType
from typing import TYPE_CHECKING, Any, Final, TypeAlias, TypeVar, Union, final
from unittest import mock
import py... | 226 | 7,199 |
kafka | tests/kafkatest/tests/streams/streams_topology_description_plugin_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 use ... | 164 | 8,031 |
confluent-kafka-python | tests/test_error.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... | 67 | 2,221 |
openvino | tests/e2e_tests/common/readers/readers.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""File readers."""
# pylint:disable=no-member
import numpy as np
import cv2
import logging as log
import sys
from copy import deepcopy
from e2e_tests.test_utils.path_utils import resolve_file_path
from e2e_tests.test_utils.tf_hub_utils... | 171 | 5,802 |
returns | returns/pointfree/cond.py | .py | from collections.abc import Callable
from typing import TypeVar, overload
from returns.context import NoDeps
from returns.interfaces.failable import DiverseFailableN, SingleFailableN
from returns.methods.cond import internal_cond
from returns.primitives.hkt import Kinded, KindN
_ValueType = TypeVar('_ValueType')
_Err... | 82 | 2,133 |
mlflow | mlflow/store/db_migrations/versions/c8d9e0f1a2b3_add_span_metrics_and_dimension_attributes.py | .py | """add span metrics table and dimension attributes column
Create Date: 2026-01-27 12:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mssql
# revision identifiers, used by Alembic.
revision = "c8d9e0f1a2b3"
down_revision = "d0e1f2a3b4c5"
branch_labels = None
depends_on... | 65 | 1,971 |
httpie | httpie/context.py | .py | import argparse
import sys
import os
import warnings
from contextlib import contextmanager
from pathlib import Path
from typing import Iterator, IO, Optional, TYPE_CHECKING
from enum import Enum
try:
import curses
except ImportError:
curses = None # Compiled w/o curses
from .compat import is_windows, cached... | 218 | 6,739 |
saleor | saleor/account/widgets.py | .py | from django.forms import Select
class DatalistTextWidget(Select):
input_type = "text"
def get_context(self, *args):
context = super().get_context(*args)
context["widget"]["type"] = self.input_type
return context
def format_value(self, value):
value = super().format_value(... | 15 | 351 |
onnxruntime | orttraining/orttraining/python/training/ort_triton/triton_op_executor.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import functools
import json
import os
import re
import sys
from types i... | 187 | 8,077 |
probability | tensorflow_probability/python/math/ode/bdf_util_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... | 127 | 5,160 |
saleor | saleor/shipping/tests/fixtures/shipping_zone.py | .py | import pytest
from django_countries import countries
from ....core.prices import Money
from ....warehouse.models import Warehouse
from ...models import ShippingMethodChannelListing, ShippingMethodType, ShippingZone
@pytest.fixture
def shipping_zone(db, channel_USD, default_tax_class): # pylint: disable=W0613
sh... | 188 | 6,531 |
biopython | Tests/test_Nexus.py | .py | # Copyright 2005 by Iddo Friedberg. All rights reserved.
# Revisions copyright 2006-2013,2017 by Peter Cock. All rights reserved.
# Revisions copyright 2008 by Frank Kauff. All rights reserved.
# Revisions copyright 2009 by Michiel de Hoon. All rights reserved.
# Revisions copyright 2015 by Joe Cora. All rights reserv... | 1,608 | 62,903 |
pyomo | examples/kernel/constraints.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... | 99 | 1,895 |
readthedocs.org | readthedocs/organizations/apps.py | .py | """Organizations app."""
from django.apps import AppConfig
class OrganizationsConfig(AppConfig):
name = "readthedocs.organizations"
def ready(self):
import readthedocs.organizations.signals # noqa
| 11 | 218 |
luigi | test/contrib/mysqldb_test.py | .py | import datetime
import mock
import pytest
from helpers import unittest
import luigi.contrib.mysqldb
from luigi.tools.range import RangeDaily
def datetime_to_epoch(dt):
td = dt - datetime.datetime(1970, 1, 1)
return td.days * 86400 + td.seconds + td.microseconds / 1e6
class MockMysqlCursor(mock.Mock):
... | 120 | 4,411 |
onnxruntime | onnxruntime/python/tools/quantization/operators/maxpool.py | .py | from ..quant_utils import FLOAT8_TYPES
from .base_operator import QuantOperatorBase
from .direct_q8 import Direct8BitOp, QDQDirect8BitOp
class QMaxPool(Direct8BitOp):
def __init__(self, onnx_quantizer, onnx_node):
super().__init__(onnx_quantizer, onnx_node)
def quantize(self):
node = self.nod... | 45 | 1,349 |
scikit-bio | skbio/util/_typing.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.
# --------------------------------------------... | 208 | 8,378 |
mlflow | dev/clint/tests/rules/test_os_environ_delete_in_test.py | .py | from pathlib import Path
from clint.config import Config
from clint.index import SymbolIndex
from clint.linter import Position, Range, lint_file
from clint.rules.os_environ_delete_in_test import OsEnvironDeleteInTest
def test_os_environ_delete_in_test(index: SymbolIndex) -> None:
code = """
import os
def test_s... | 97 | 2,773 |
wagtail | wagtail/api/v3/schemas/pages.py | .py | from datetime import datetime
from typing import ClassVar, Literal, cast
import swapper
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import FieldDoesNotExist
from django.db.models import Model
from django.shortcuts import get_object_or_404
from django.urls import reverse
from ... | 154 | 4,398 |
onnxruntime | onnxruntime/test/testdata/transform/fusion/transpose_matmul_gen.py | .py | import onnx
from onnx import OperatorSetIdProto, TensorProto, helper
onnxdomain = OperatorSetIdProto()
onnxdomain.version = 12
# The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification.
onnxdomain.domain = ""
msdomain = OperatorSetIdProto()
msdomain.ver... | 316 | 11,409 |
jupytext | demo/World population.lgt.py | .py | # ---
# jupyter:
# jupytext:
# cell_markers: region,endregion
# formats: ipynb,.pct.py:percent,.lgt.py:light,.spx.py:sphinx,md,Rmd,.pandoc.md:pandoc
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.0
# kernelspec:
# ... | 96 | 2,732 |
mlflow | tests/genai/judges/optimizers/memalign/conftest.py | .py | """Shared test fixtures for memalign optimizer tests."""
import pytest
from mlflow.genai.judges.optimizers.memalign.utils import (
_get_model_max_input_tokens,
truncate_to_token_limit,
)
@pytest.fixture(autouse=True)
def clear_lru_caches():
"""Clear lru_cache before each test to ensure mocks work correc... | 19 | 514 |
wandb | wandb/sdk/internal/handler.py | .py | """Handle Manager."""
from __future__ import annotations
import json
import logging
import math
import numbers
import time
from collections import defaultdict
from collections.abc import Callable, Sequence
from queue import Queue
from threading import Event
from typing import TYPE_CHECKING, Any, cast
from wandb.erro... | 808 | 29,824 |
beam | sdks/python/apache_beam/examples/inference/multi_language_inference/multi_language_custom_transform/setup.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 ... | 24 | 926 |
saleor | saleor/account/exceptions.py | .py | class NoDefaultCustomerType(Exception):
def __init__(self, msg=None):
if msg is None:
msg = "The default customer type does not exist."
super().__init__(msg)
| 6 | 190 |
gunicorn | benchmarks/dirty_bench_wsgi.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
WSGI app for integration benchmarking of the dirty pool.
This simple WSGI application calls the dirty pool and returns results.
Use with gunicorn for end-to-end benchmarking that includes HTTP overhead.
Examp... | 168 | 5,605 |
lemur | lemur/authorities/models.py | .py | """
.. module: lemur.authorities.models
:platform: unix
:synopsis: This module contains all of the models need to create an authority within Lemur.
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix... | 143 | 4,637 |
sphinx | tests/test_builders/test_build_epub.py | .py | """Test the HTML builder and check output against XPath."""
from __future__ import annotations
import os
import re
import subprocess
import xml.etree.ElementTree as ET
from collections import Counter
from pathlib import Path
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
import pytest
fr... | 688 | 23,782 |
saleor | saleor/graphql/product/dataloaders/attributes.py | .py | from collections import defaultdict
from ....attribute.models import (
Attribute,
AttributeProduct,
AttributeVariant,
)
from ...attribute.dataloaders.attributes import AttributesByAttributeId
from ...core.dataloaders import DataLoader
class BaseProductAttributesByProductTypeIdLoader(DataLoader):
"""L... | 99 | 3,473 |
wagtail | wagtail/sites/wagtail_hooks.py | .py | from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from wagtail import hooks
from wagtail.admin.menu import MenuItem
from wagtail.models import Site
from wagtail.permissions import policy_registry
from .views import SiteViewSet
@hooks.register("register_admin_viewset")
def regist... | 33 | 836 |
openvino | src/frontends/onnx/tests/tests_python/test_frontend_onnx.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import io
import os
import onnx
import numpy as np
from onnx.helper import make_graph, make_model, make_tensor_value_info
import pytest
from pathlib import Path
from itertools import chain
import tempfile
import s... | 890 | 30,320 |
metrics | src/torchmetrics/functional/classification/auroc.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 481 | 23,714 |
openvino | tests/layer_tests/onnx_tests/test_elu.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136")
from common.layer_test_class import check_ir_version
from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model
from unit_tests.utils.... | 190 | 6,378 |
beam | learning/tour-of-beam/learning-content/windowing/fixed-time-window/python-example/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"); y... | 51 | 1,722 |
luigi | test/most_common_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... | 32 | 1,023 |
mlflow | mlflow/catboost/__init__.py | .py | """
The ``mlflow.catboost`` module provides an API for logging and loading CatBoost models.
This module exports CatBoost models with the following flavors:
CatBoost (native) format
This is the main flavor that can be loaded back into CatBoost.
:py:mod:`mlflow.pyfunc`
Produced for use by generic pyfunc-based de... | 383 | 13,506 |
textual | docs/examples/guide/styles/dimensions02.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see i... | 28 | 760 |
scikit-bio | skbio/io/format/__init__.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.
# --------------------------------------------... | 10 | 373 |
beam | sdks/python/apache_beam/transforms/core_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... | 803 | 28,908 |
textual | tests/snapshot_tests/snapshot_apps/modified_tabs.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Button, TabbedContent
class FiddleWithTabsApp(App[None]):
CSS = """
TabPane:disabled {
background: red;
}
"""
def compose(self) -> ComposeResult:
with TabbedContent():
yield Button()
yie... | 28 | 679 |
textual | tests/snapshot_tests/snapshot_apps/data_table_add_row_auto_height.py | .py | from rich.panel import Panel
from rich.text import Text
from textual.app import App
from textual.widgets import DataTable
class AutoHeightRowsApp(App[None]):
def compose(self):
table = DataTable()
self.column = table.add_column("N")
table.add_column("Column", width=10)
table.add_r... | 26 | 764 |
scikit-bio | skbio/io/format/tests/test_binary_dm.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.
# --------------------------------------------... | 165 | 6,075 |
hydra | examples/advanced/hydra_app_example/tests/test_installed_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import re
import subprocess
import sys
# The following tests are testing that the app actually runs as expected
# when installed and executed from the command line.
# You don't need to repeat those tests in your own app.
class TestAppOutput:
#... | 41 | 1,509 |
probability | tensorflow_probability/python/stats/sample_stats.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,113 | 45,766 |
pyomo | pyomo/contrib/trustregion/tests/test_funnel.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,044 |
tablib | src/tablib/formats/_rst.py | .py | """ Tablib - reStructuredText Support
"""
__lazy_modules__ = {"itertools", "statistics", "textwrap"}
from itertools import zip_longest
from statistics import median
from textwrap import TextWrapper
JUSTIFY_LEFT = 'left'
JUSTIFY_CENTER = 'center'
JUSTIFY_RIGHT = 'right'
JUSTIFY_VALUES = (JUSTIFY_LEFT, JUSTIFY_CENTER,... | 270 | 9,286 |
saleor | saleor/graphql/app/dataloaders/utils.py | .py | from functools import partial, wraps
from django.utils.functional import LazyObject
from promise import Promise
from ....app.models import App
from ....core.auth import get_token_from_request
from ....core.utils.lazyobjects import unwrap_lazy
from ...core import SaleorContext
from .app import AppByTokenLoader
def p... | 38 | 1,074 |
pyro | tests/distributions/test_cuda.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from torch.autograd import grad
from tests.common import (
assert_equal,
requires_cuda,
xfail_if_not_implemented,
)
@requires_cuda
def test_sample(dist):
for idx in range(len(dist.dist_... | 97 | 3,189 |
metrics | src/torchmetrics/functional/pairwise/manhattan.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... | 84 | 3,196 |
astropy | astropy/utils/xml/check.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A collection of functions for checking various XML-related strings for
standards compliance.
"""
import re
import urllib.parse
def check_id(ID):
"""
Returns `True` if *ID* is a valid XML ID.
"""
return re.match(r"^[A-Za-z_][A-Za-z0-9... | 85 | 2,189 |
jupytext | tests/data/notebooks/outputs/ipynb_to_script/Notebook_with_R_magic.py | .py | # ---
# jupyter:
# kernelspec:
# display_name: Python 2
# language: python
# name: python2
# ---
# # A notebook with R cells
#
# This notebook shows the use of R cells to generate plots
# %load_ext rpy2.ipython
# + language="R"
# suppressMessages(require(tidyverse))
# + language="R"
# ggplot(iris, aes... | 26 | 644 |
pyomo | examples/dae/run_Path_Constraint.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... | 47 | 1,746 |
saleor | saleor/graphql/account/mutations/authentication/external_logout.py | .py | import graphene
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_AUTH
from ....core.fields import JSONString
from ....core.mutations import BaseMutation
from ....core.types import AccountError
from ....plugins.dataloaders import get_plugin_manager_promise
class ExternalLogout(BaseMutat... | 38 | 1,269 |
pyomo | doc/OnlineDocs/src/scripting/abstract2.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... | 42 | 1,304 |
wagtail | wagtail/contrib/search_promotions/forms.py | .py | from django import forms
from django.forms.models import inlineformset_factory
from django.utils.translation import gettext_lazy as _
from wagtail.admin.forms.models import WagtailAdminModelForm
from wagtail.admin.widgets import AdminPageChooser
from wagtail.contrib.search_promotions.models import Query, SearchPromoti... | 140 | 4,823 |
mlflow | mlflow/pyfunc/loaders/responses_agent.py | .py | from typing import Any, Generator
import pydantic
from mlflow.exceptions import MlflowException
from mlflow.models.utils import _convert_llm_ndarray_to_list
from mlflow.protos.databricks_pb2 import INTERNAL_ERROR
from mlflow.pyfunc.model import _load_context_model_and_signature
from mlflow.types.responses import (
... | 104 | 4,053 |
wandb | wandb/sdk/launch/environment/local_environment.py | .py | """Dummy local environment implementation. This is the default environment."""
from __future__ import annotations
from typing import Any
from wandb.sdk.launch.errors import LaunchError
from .abstract import AbstractEnvironment
class LocalEnvironment(AbstractEnvironment):
"""Local environment class."""
de... | 66 | 2,246 |
mlflow | dev/update_ml_package_versions.py | .py | """
Backward-compatibility entry point that delegates to `flavors update`.
Internal jobs still invoke `python dev/update_ml_package_versions.py [--skip-yml]`.
Prefer `uv run flavors update` for new callers.
TODO: Delete this file once all internal jobs have migrated.
"""
import sys
from flavors._cli import main
if... | 17 | 410 |
saleor | saleor/graphql/webhook/mutations/__init__.py | .py | from .event_delivery_retry import EventDeliveryRetry
from .webhook_create import WebhookCreate
from .webhook_delete import WebhookDelete
from .webhook_dry_run import WebhookDryRun
from .webhook_trigger import WebhookTrigger
from .webhook_update import WebhookUpdate
__all__ = [
"EventDeliveryRetry",
"WebhookCre... | 16 | 413 |
openvino | tools/benchmark_tool/openvino/tools/benchmark/benchmark.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import time
from math import ceil
from openvino import Core, get_version, AsyncInferQueue
from .utils.constants import GPU_DEVICE_NAME, XML_EXTENSION, BIN_EXTENSION
from .utils.logging import logger
from .utils.utils import ge... | 211 | 8,797 |
mlflow | mlflow/protos/unity_catalog_messages_pb2.py | .py |
import google.protobuf
from packaging.version import Version
if Version(google.protobuf.__version__).major >= 5:
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: unity_catalog_messages.proto
# Protobuf Python Version: 5.26.0
"""Generated protocol buffer code."""
... | 815 | 68,475 |
saleor | saleor/graphql/menu/mutations/__init__.py | .py | from .assign_navigation import AssignNavigation
from .menu_create import MenuCreate
from .menu_delete import MenuDelete
from .menu_item_create import MenuItemCreate
from .menu_item_delete import MenuItemDelete
from .menu_item_move import MenuItemMove
from .menu_item_update import MenuItemUpdate
from .menu_update import... | 20 | 511 |
openvino | tests/layer_tests/jax_tests/test_mul.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import jax.numpy as jnp
import numpy as np
import pytest
from jax_layer_test_class import JaxLayerTest
def get_rand_jnp_array(shape, dtype):
if dtype in [np.float32, np.float16, np.float64]:
return jnp.array(np.random.unif... | 138 | 4,499 |
saleor | saleor/graphql/tax/tests/mutations/test_tax_class_create.py | .py | from ....tests.utils import assert_no_permission, get_graphql_content
from ..fragments import TAX_CLASS_FRAGMENT
MUTATION = (
"""
mutation TaxClassCreate($input: TaxClassCreateInput!) {
taxClassCreate(input: $input) {
errors {
field
message
co... | 78 | 1,991 |
bazel | src/test/py/bazel/testdata/runfiles_test/foo/foo.py | .py | # Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 74 | 2,135 |
coveragepy | coverage/html.py | .py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt
"""HTML reporting for coverage.py."""
from __future__ import annotations
import collections
import dataclasses
import datetime
import functools
import json
impo... | 864 | 31,877 |
wandb | tests/system_tests/test_core/test_cli_full.py | .py | import netrc
import os
from unittest import mock
import pytest
import wandb
import wandb.errors.term
from wandb.cli import cli
from wandb.sdk import wandb_setup
@pytest.fixture
def empty_netrc(monkeypatch):
class FakeNet:
@property
def hosts(self):
return {"api.wandb.ai": None}
m... | 206 | 7,083 |
pyro | pyro/infer/trace_elbo.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import weakref
import pyro
import pyro.ops.jit
from pyro.distributions.util import is_identically_zero
from pyro.infer.elbo import ELBO
from pyro.infer.enum import get_importance_trace
from pyro.infer.util import (
MultiFrameT... | 258 | 10,334 |
saleor | saleor/warehouse/tests/utils.py | .py | from django.db.models import Sum
from django.db.models.functions import Coalesce
def get_quantity_allocated_for_stock(stock):
"""Count how many items are allocated for stock."""
return stock.allocations.aggregate(
quantity_allocated=Coalesce(Sum("quantity_allocated"), 0)
)["quantity_allocated"]
... | 16 | 537 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_ceil.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# ceil paddle model generator
#
import numpy as np
from save_model import saveModel
import sys
def ceil(name: str, x, dtype="float32"):
import paddle
paddle.enable_static()
with paddle.static.program_guard(paddle.static.P... | 41 | 1,071 |
qutip | qutip/tests/test_random.py | .py | import numpy as np
from numpy.random import SeedSequence, default_rng
import pytest
from qutip import qeye, to_kraus, kraus_to_choi, CoreOptions, Qobj
from qutip import data as _data
from qutip.core.dimensions import Space
from qutip.core.energy_restricted import EnrSpace
from qutip.random_objects import (
rand_he... | 334 | 10,151 |
saleor | saleor/graphql/page/tests/mutations/test_page_type_update.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....core.utils.json_serializer import CustomJsonEncoder
from .....page.error_codes import PageErrorCode
from .....page.models import PageType
from .....webhook.event_types... | 559 | 16,470 |
wagtail | wagtail/images/rect.py | .py | import math
class Vector:
def __init__(self, x, y):
self.x = x
self.y = y
def __iter__(self):
return iter((self.x, self.y))
def __getitem__(self, key):
return (self.x, self.y)[key]
def __eq__(self, other):
return tuple(self) == tuple(other)
def __repr__(... | 203 | 5,800 |
beam | learning/katas/python/Streaming/Triggers/Early Triggers/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... | 66 | 2,411 |
wagtail | wagtail/admin/panels/group.py | .py | from django.forms import Media
from django.utils.functional import cached_property
from wagtail.admin.telepath import register as register_telepath_adapter
from .base import Panel
class PanelGroup(Panel):
"""
Abstract class for panels that manage a set of sub-panels.
Concrete subclasses must attach a 'c... | 194 | 6,726 |
pyro | pyro/infer/reparam/neutra.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from contextlib import ExitStack
from torch.distributions import biject_to
import pyro
import pyro.distributions as dist
from pyro import poutine
from pyro.distributions.util import sum_rightmost
from pyro.infer.autoguide.guides ... | 142 | 5,549 |
pyfilesystem2 | tests/test_tempfs.py | .py | from __future__ import unicode_literals
import os
from fs import errors
from fs.tempfs import TempFS
from .test_osfs import TestOSFS
try:
from unittest import mock
except ImportError:
import mock
class TestTempFS(TestOSFS):
"""Test OSFS implementation."""
def make_fs(self):
return TempFS(... | 36 | 829 |
sqlmap | plugins/dbms/cubrid/fingerprint.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from lib.core.common import Backend
from lib.core.common import Format
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.e... | 95 | 2,540 |
bazel | third_party/def_parser/empty_test.py | .py | # Copyright 2017 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... | 28 | 810 |
sphinx | tests/roots/test-prolog/prolog_markdown_parser.py | .py | from docutils.parsers import Parser
class DummyMarkdownParser(Parser):
supported = ('markdown',)
def parse(self, inputstring, document):
document.rawsource = inputstring
def setup(app):
app.add_source_suffix('.md', 'markdown')
app.add_source_parser(DummyMarkdownParser)
| 14 | 299 |
readthedocs.org | readthedocs/organizations/views/public.py | .py | """Views that don't require login."""
# pylint: disable=too-many-ancestors
import structlog
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.urls import reverse_lazy
from django.views.generic.base import TemplateView
from vanilla import DetailView
from vanilla import GenericView... | 130 | 4,538 |
mlflow | examples/spark_udf/spark_udf.py | .py | from pyspark.sql import SparkSession
from sklearn import datasets
from sklearn.neighbors import KNeighborsClassifier
import mlflow
from mlflow.models import infer_signature
with SparkSession.builder.getOrCreate() as spark:
X, y = datasets.load_iris(as_frame=True, return_X_y=True)
model = KNeighborsClassifier(... | 24 | 792 |
mlflow | tests/tracing/processor/test_mlflow_v3_processor.py | .py | import json
from unittest import mock
import pytest
from opentelemetry.sdk.trace.export import BatchSpanProcessor, SpanExportResult
import mlflow.tracking.context.default_context
from mlflow.entities.span import LiveSpan
from mlflow.entities.trace_status import TraceStatus
from mlflow.environment_variables import MLF... | 438 | 15,240 |
gunicorn | tests/requests/invalid/version_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.errors import InvalidHTTPVersion
request = InvalidHTTPVersion
| 7 | 187 |
saleor | saleor/graphql/account/mutations/staff/address_delete.py | .py | from .....account import models
from .....permission.enums import AccountPermissions
from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import Address
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
from ....core.utils import WebhookEventInfo
f... | 26 | 903 |
clearml | clearml/datasets/__init__.py | .py | from .dataset import FileEntry, Dataset
__all__ = [
"FileEntry",
"Dataset",
]
| 7 | 87 |
mlflow | tests/data/test_spark_dataset_source.py | .py | import json
import pandas as pd
import pytest
from mlflow.data.dataset_source_registry import get_dataset_source_from_json
from mlflow.data.spark_dataset_source import SparkDatasetSource
from mlflow.exceptions import MlflowException
@pytest.fixture(scope="module")
def spark_session():
from pyspark.sql import Sp... | 92 | 3,689 |
sphinx | tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py | .py | from docutils.parsers import Parser
class TestSourceParser(Parser):
supported = ('test',)
def setup(app):
app.add_source_suffix('.test', 'test')
app.add_source_parser(TestSourceParser)
| 11 | 201 |
confluent-kafka-python | src/confluent_kafka/schema_registry/rules/encryption/azurekms/azure_driver.py | .py | # 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 required by applicable law or agreed to in writing, s... | 131 | 5,561 |
pyomo | pyomo/contrib/parmest/tests/test_scenariocreator.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... | 589 | 22,350 |
mlflow | tests/genai/scorers/guardrails/test_registry.py | .py | from unittest.mock import MagicMock, patch
import pytest
from mlflow.exceptions import MlflowException
from mlflow.genai.scorers.guardrails.registry import get_validator_class
@pytest.mark.parametrize(
("validator_name", "expected_class"),
[
("ToxicLanguage", "ToxicLanguage"),
("NSFWText", "... | 43 | 1,299 |
astropy | astropy/io/ascii/setup_package.py | .py | # Licensed under a 3-clause BSD style license
from pathlib import Path
from numpy import get_include as get_numpy_include
from setuptools import Extension
ROOT = Path(__file__).parent.relative_to(Path.cwd())
def get_extensions():
sources = [
str(ROOT / "cparser.pyx"),
str(ROOT / "src" / "tokeni... | 22 | 501 |
coremltools | coremltools/test/ml_program/test_compression.py | .py | # Copyright (c) 2022, 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 Optional
import numpy as np
import torch
import coremltools as ct
from coremltools.... | 175 | 8,123 |
astropy | astropy/utils/metadata/utils.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module contains helper functions handling metadata."""
import numpy as np
from .exceptions import MergeConflictError
__all__ = ["common_dtype"]
def dtype(arr):
return getattr(arr, "dtype", np.dtype("O"))
def common_dtype(arrs):
"""
... | 70 | 2,075 |
probability | tensorflow_probability/python/layers/distribution_layer_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,574 | 60,503 |
django-cms | cms/api.py | .py | """
Python APIs for creating CMS content. This is done in :mod:`cms.api` and not
on the models and managers, because the direct API via models and managers is
slightly counterintuitive for developers.
The api for both Pages and Plugins has changed significantly since django CMS
Version 4.
Also, the functions defined ... | 729 | 26,845 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.