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 |
|---|---|---|---|---|---|
coremltools | coremltools/converters/mil/frontend/tensorflow/ops.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
import numpy as np
from coremltools import _logger as logger
from coremltools.co... | 3,694 | 129,113 |
probability | discussion/robust_inverse_graphics/models_test.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... | 246 | 7,514 |
readthedocs.org | readthedocs/gold/forms.py | .py | """Gold subscription forms."""
from django import forms
from django.utils.translation import gettext_lazy as _
from readthedocs.projects.models import Project
from .models import LEVEL_CHOICES
from .models import GoldUser
class GoldSubscriptionForm(forms.ModelForm):
"""Gold subscription form."""
class Met... | 63 | 1,848 |
loguru | tests/test_pickling.py | .py | import asyncio
import contextlib
import datetime
import logging
import pickle
import pytest
from loguru import logger
from .conftest import parse
def print_(message):
print(message, end="")
async def async_print(msg):
print_(msg)
@contextlib.contextmanager
def copied_logger_though_pickle(logger):
p... | 351 | 10,656 |
onnx | onnx/backend/test/case/node/scan.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
import onnx.parser
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Scan(Base):
@staticmethod
def export_scan_8... | 156 | 5,879 |
wandb | wandb/apis/public/runs.py | .py | """W&B Public API for Runs.
This module provides classes for interacting with W&B runs and their associated
data.
Example:
```python
from wandb.apis.public import Api
# Get runs matching filters
runs = Api().runs(
path="entity/project", filters={"state": "finished", "config.batch_size": 32}
)
# Access run data
... | 1,786 | 63,005 |
biopython | Bio/Nexus/StandardData.py | .py | # Copyright 2014 Joe Cora.
# Revisions copyright 2017 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
# pa... | 118 | 3,996 |
pymc | tests/sampling/test_deterministic.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... | 153 | 5,971 |
metrics | tests/unittests/classification/test_negative_predictive_value.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... | 602 | 25,003 |
pyomo | pyomo/contrib/trustregion/examples/example1.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 80 | 2,379 |
marshmallow | src/marshmallow/__init__.py | .py | from marshmallow.constants import EXCLUDE, INCLUDE, RAISE, missing
from marshmallow.decorators import (
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.schema import Schema, SchemaOpts
from . import fie... | 31 | 573 |
beam | learning/tour-of-beam/learning-content/final-challenge/final-challenge-2/python-challenge/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... | 69 | 2,520 |
probability | tensorflow_probability/python/distributions/zipf.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... | 367 | 15,185 |
openvino | tests/layer_tests/onnx_tests/test_instance_normalization.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model
class TestInstanceNormalization(OnnxRuntimeLayerTest):
def create_net(self, shape, epsilon, precision, ir_version):
... | 112 | 3,737 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/partitioned_call2.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
@tf.function
def second_func(x):
x = tf.raw_ops.TopKV2(input=x, k=tf.constant(3, tf.int32))[1]
x = tf.add(x, tf.constant(10, tf.int32))
return x
@tf.function
def first_func(x, y):
ret... | 22 | 623 |
django-cms | cms/test_utils/project/pluginapp/plugins/link/models.py | .py | from django.db import models
from cms.models import CMSPlugin
class Link(CMSPlugin):
name = models.CharField(
verbose_name='Display name',
max_length=255,
)
external_link = models.URLField(
verbose_name='External link',
max_length=2040,
)
def __str__(self):
... | 24 | 502 |
mlflow | examples/livekit/voice_agent.py | .py | import logging
import os
from livekit.agents import JobContext, JobProcess, WorkerOptions, cli
from livekit.agents.telemetry import set_tracer_provider
from livekit.agents.voice import Agent, AgentSession
from livekit.plugins import openai, silero
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.... | 79 | 2,646 |
readthedocs.org | readthedocs/search/tests/test_api.py | .py | import re
from unittest import mock
import pytest
from django.urls import reverse
from django_dynamic_fixture import get
from readthedocs.builds.models import Version
from readthedocs.projects.constants import (
MKDOCS,
MKDOCS_HTML,
PUBLIC,
SPHINX,
SPHINX_HTMLDIR,
SPHINX_SINGLEHTML,
)
from rea... | 742 | 27,296 |
mlflow | dev/clint/tests/rules/test_lazy_module.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.lazy_module import LazyModule
def test_lazy_module(index: SymbolIndex) -> None:
# Create a file that looks like mlflow/__init__.py for the rule to appl... | 29 | 1,072 |
jupytext | tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/Notebook_with_more_R_magic_111.py | .py | # ---
# jupyter:
# jupytext:
# cell_markers: '{{{,}}}'
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# {{{
# %load_ext rpy2.ipython
import pandas as pd
df = pd.DataFrame(
{
"Letter": ["a", "a", "a", "b", "b", "b", "c", "c", "c"],
"X": [4, 3, 5,... | 29 | 585 |
saleor | saleor/graphql/tax/mutations/tax_configuration_update.py | .py | from typing import Any, Final
import graphene
from django.core.exceptions import ValidationError
from ....app.utils import get_active_tax_apps
from ....permission.enums import CheckoutPermissions
from ....plugins import PLUGIN_IDENTIFIER_PREFIX
from ....tax import error_codes, models
from ...account.enums import Coun... | 377 | 15,651 |
astropy | astropy/coordinates/spectral_coordinate.py | .py | import warnings
from textwrap import indent
import numpy as np
import astropy.units as u
from astropy.constants import c
from astropy.coordinates import (
ICRS,
CartesianDifferential,
CartesianRepresentation,
SkyCoord,
)
from astropy.coordinates.baseframe import BaseCoordinateFrame, frame_transform_gr... | 789 | 31,014 |
luigi | luigi/tools/deps_tree.py | .py | # -*- coding: utf-8 -*-
"""
This module parses commands exactly the same as the luigi task runner. You must specify the module, the task and task parameters.
Instead of executing a task, this module prints the significant parameters and state of the task and its dependencies in a tree format.
Use this to visualize the ... | 77 | 2,568 |
pyomo | pyomo/repn/parameterized.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... | 169 | 5,483 |
textual | src/textual/drivers/linux_driver.py | .py | from __future__ import annotations
import asyncio
import os
import selectors
import signal
import sys
import termios
import tty
from codecs import getincrementaldecoder
from threading import Event, Thread
from typing import TYPE_CHECKING, Any, Final
import rich.repr
from textual import constants, events
from textual... | 486 | 16,950 |
probability | tensorflow_probability/python/experimental/fastgp/fast_log_det.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... | 732 | 22,197 |
django-cms | cms/tests/test_toolbar_pool.py | .py | from collections import OrderedDict
from django.core.exceptions import ImproperlyConfigured
from cms import api
from cms.exceptions import ToolbarAlreadyRegistered, ToolbarNotRegistered
from cms.test_utils.testcases import CMSTestCase
from cms.toolbar.utils import get_object_edit_url
from cms.toolbar_base import CMST... | 72 | 2,664 |
pyomo | pyomo/core/tests/unit/kernel/test_suffix.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... | 570 | 19,454 |
mlflow | docs/scripts/build-api-docs.py | .py | import os
import shutil
import subprocess
import click
@click.command()
@click.option("--with-r", "with_r", is_flag=True, default=False, help="Build R documentation")
@click.option(
"--with-ts", "with_ts", is_flag=True, default=True, help="Build TypeScript documentation"
)
def main(with_r, with_ts):
try:
... | 44 | 1,550 |
onnxruntime | tools/python/util/mobile_helpers/usability_checker.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
import argparse
import logging
import os
import pathlib
import tempfile
from collections import deque
from enum import IntEnum
import onnx
from ..onnx_model_utils import ModelProtoWithShap... | 739 | 31,640 |
pyomo | pyomo/contrib/solver/solvers/knitro/direct.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... | 59 | 2,183 |
metrics | tests/unittests/detection/test_intersection.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... | 462 | 16,676 |
textual | tests/snapshot_tests/snapshot_apps/button_outline.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Button
class ButtonIssue(App[None]):
AUTO_FOCUS = None
CSS = """
Button {
outline: white;
}
"""
def compose(self) -> ComposeResult:
yield Button("Test")
if __name__ == "__main__":
ButtonIssue().run()
| 19 | 320 |
pyro | pyro/infer/reparam/discrete_cosine.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from pyro.distributions.transforms.discrete_cosine import DiscreteCosineTransform
from .unit_jacobian import UnitJacobianReparam
class DiscreteCosineReparam(UnitJacobianReparam):
"""
Discrete Cosine reparameterizer, using a
... | 43 | 2,076 |
luigi | test/contrib/pig_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... | 241 | 7,586 |
astropy | astropy/units/function/logarithmic.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numbers
from functools import cached_property
import numpy as np
from astropy.units import (
CompositeUnit,
Unit,
UnitConversionError,
UnitsError,
UnitTypeError,
dimensionless_unscaled,
)
from .core import FunctionQuantity... | 434 | 15,155 |
probability | tensorflow_probability/examples/cifar10_bnn.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... | 282 | 10,807 |
python-prompt-toolkit | examples/dialogs/progress_dialog.py | .py | #!/usr/bin/env python
"""
Example of a progress bar dialog.
"""
import os
import time
from prompt_toolkit.shortcuts import progress_dialog
def worker(set_percentage, log_text):
"""
This worker function is called by `progress_dialog`. It will run in a
background thread.
The `set_percentage` function... | 48 | 1,138 |
hatch | tests/project/test_utils.py | .py | import pytest
from hatch.project.utils import parse_inline_script_metadata
class TestParseInlineScriptMetadata:
def test_no_metadata(self):
assert parse_inline_script_metadata("") is None
def test_too_many_blocks(self, helpers):
script = helpers.dedent(
"""
# /// scri... | 50 | 1,303 |
ipython | IPython/core/historyapp.py | .py | """
An application for managing IPython history.
To be invoked as the `ipython history` subcommand.
"""
import sqlite3
from contextlib import closing
from pathlib import Path
from traitlets.config.application import Application
from .application import BaseIPythonApplication
from traitlets import Bool, Int, Dict
fro... | 159 | 6,162 |
luigi | test/helpers_test.py | .py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2016 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... | 62 | 1,686 |
probability | tensorflow_probability/python/experimental/mcmc/covariance_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... | 310 | 12,939 |
saleor | saleor/graphql/shop/resolvers.py | .py | from django.utils import translation
from django_countries import countries
from ...account.models import Address
from ...shipping.models import ShippingMethod, ShippingMethodChannelListing
from ...shipping.postal_codes import filter_shipping_methods_by_postal_code_rules
from ...shipping.utils import convert_to_shippi... | 66 | 2,583 |
saleor | saleor/graphql/shop/types.py | .py | import graphene
from django.conf import settings
from django_countries import countries
from phonenumbers import COUNTRY_CODE_TO_REGION_CODE
from ... import __version__, schema_version
from ...account import models as account_models
from ...app.utils import get_active_tax_apps
from ...channel import models as channel_... | 814 | 28,652 |
pyomo | pyomo/mpec/complementarity.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... | 387 | 14,144 |
deap | examples/ga/onemax.py | .py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 161 | 5,307 |
sqlmap | plugins/dbms/h2/filesystem.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 checkFile
from lib.core.convert import encodeHex
from lib.core.data import kb
from lib.core.data import logger
from lib.core.enums import CHARSET_TYPE
... | 49 | 2,082 |
confluent-kafka-python | tests/schema_registry/data/proto/newerwidget_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: newerwidget.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 _symb... | 29 | 1,124 |
cvxpy | cvxpy/lin_ops/backends/base.py | .py | """
Copyright 2025, 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, sof... | 1,005 | 36,499 |
mlflow | tests/tracking/context/test_registry.py | .py | from importlib import reload
from unittest import mock
import pytest
import mlflow.tracking.context.registry
from mlflow.tracking.context.databricks_job_context import DatabricksJobRunContext
from mlflow.tracking.context.databricks_notebook_context import DatabricksNotebookRunContext
from mlflow.tracking.context.data... | 161 | 5,786 |
mlflow | tests/genai/judges/test_judge_tool_get_traces_in_session.py | .py | from unittest.mock import MagicMock, patch
import pytest
from mlflow.entities.trace import Trace, TraceData
from mlflow.entities.trace_info import TraceInfo as MlflowTraceInfo
from mlflow.entities.trace_location import TraceLocation
from mlflow.entities.trace_state import TraceState
from mlflow.exceptions import Mlfl... | 166 | 6,004 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/NodeType.py | .py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
class NodeType(object):
Primitive = 0
Fused = 1
| 8 | 144 |
python-prompt-toolkit | src/prompt_toolkit/lexers/__init__.py | .py | """
Lexer interface and implementations.
Used for syntax highlighting.
"""
from __future__ import annotations
from .base import DynamicLexer, Lexer, SimpleLexer
from .pygments import PygmentsLexer, RegexSync, SyncFromStart, SyntaxSync
__all__ = [
# Base.
"Lexer",
"SimpleLexer",
"DynamicLexer",
# ... | 22 | 409 |
pyro | tests/ops/test_gaussian.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
from collections import OrderedDict
import pytest
import torch
from torch.distributions import constraints, transform_to
from torch.nn.functional import pad
import pyro.distributions as dist
from pyro.distributions.ut... | 613 | 23,038 |
beam | sdks/python/apache_beam/transforms/deduplicate_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... | 168 | 6,786 |
probability | tensorflow_probability/python/bijectors/moyal_cdf_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... | 79 | 3,098 |
probability | tensorflow_probability/python/bijectors/expm1.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... | 104 | 2,985 |
saleor | saleor/page/tasks.py | .py | from django.conf import settings
from django.db import transaction
from ..celeryconf import app
from ..core.db.connection import allow_writer
from .lock_objects import page_qs_select_for_update
from .models import Page
from .search import update_pages_search_vector
# Results in update time ~1s, consumes ~25 MB
UPDATE... | 39 | 1,122 |
probability | tensorflow_probability/python/internal/backend/numpy/keras_layers.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... | 27 | 884 |
mkdocs-material | material/plugins/meta/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... | 34 | 1,557 |
onnxruntime | onnxruntime/test/python/quantization/test_quant_preprocess.py | .py | #!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------... | 242 | 9,369 |
astropy | astropy/io/misc/pyarrow/csv.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides functionality to read CSV files into Astropy Tables using PyArrow.
"""
import datetime
import io
import os
from typing import TYPE_CHECKING, BinaryIO, Literal, Union
import numpy as np
from numpy.typing import DTypeLike, NDArray
... | 543 | 20,259 |
mlflow | tests/system_metrics/test_collect_metrics.py | .py | from mlflow.system_metrics.metrics.cpu_monitor import CPUMonitor
from mlflow.system_metrics.metrics.disk_monitor import DiskMonitor
from mlflow.system_metrics.metrics.gpu_monitor import GPUMonitor
from mlflow.system_metrics.metrics.network_monitor import NetworkMonitor
def test_cpu_monitor():
cpu_monitor = CPUMon... | 89 | 3,644 |
astropy | astropy/io/votable/tests/test_converter.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
# THIRD-PARTY
import numpy as np
import pytest
from numpy.testing import assert_array_equal
# LOCAL
from astropy.io.votable import converters, exceptions, tree
from astropy.io.votable.table import parse_single_table
from astropy.utils.data imp... | 337 | 10,840 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_MatrixDiag.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestMatrixDiag(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
assert 'diagonal:0' in inputs... | 43 | 1,590 |
astropy | astropy/conftest.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains pytest configuration settings that are astropy-specific.
"""
import builtins
import os
import sys
import warnings
from dataclasses import replace
from pathlib import Path
from threading import Lock
try:
from pytest_astropy_head... | 224 | 7,355 |
onnxruntime | onnxruntime/test/testdata/make_conv_int4_weights_model.py | .py | import numpy as np
import onnx
from onnxruntime.quantization import CalibrationDataReader, QuantType, quantize
from onnxruntime.quantization.execution_providers.qnn import get_qnn_qdq_config
INPUT0_SHAPE = (1, 3, 8, 8)
INPUT0_NAME = "input_0"
def create_f32_model():
input_0 = onnx.helper.make_tensor_value_info(... | 99 | 4,182 |
beam | sdks/python/apache_beam/io/external/xlang_kafkaio_perf_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... | 145 | 5,200 |
pdm | tests/resolver/test_graph.py | .py | import itertools
from pdm.resolver.graph import OrderedSet
def test_ordered_set():
elems = ["A", "bb", "c3"]
all_sets = set()
for case in itertools.permutations(elems):
s = OrderedSet(case)
all_sets.add(s)
assert list(s) == list(case)
assert len(s) == len(case)
for... | 21 | 561 |
probability | tensorflow_probability/python/mcmc/langevin.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... | 950 | 36,728 |
openvino | src/bindings/python/tests/test_runtime/test_experimental.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.experimental import evaluate_as_partial_shape, evaluate_both_bounds, set_element_type, set_tensor_type
import pytest
from openvino import Shape, PartialShape, Dimension, Type
from openvino.op import... | 71 | 2,251 |
confluent-kafka-python | src/confluent_kafka/avro/load.py | .py | #!/usr/bin/env python
#
# Copyright 2017 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... | 58 | 1,737 |
probability | tensorflow_probability/python/bijectors/softmax_centered.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,844 |
astropy | astropy/time/tests/test_sidereal.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import itertools
import erfa
import numpy as np
import pytest
from astropy import units as u
from astropy.tests.helper import _skip_docstring_tests_with_optimized_python
from astropy.time import Time
from astropy.time.core import SIDEREA... | 306 | 11,843 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_MatrixBandPart.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
rng = np.random.default_rng()
class TestMatrixBandPart(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
... | 40 | 1,742 |
mlflow | mlflow/data/tensorflow_dataset.py | .py | import json
import logging
from functools import cached_property
from typing import Any
import numpy as np
from mlflow.data.dataset import Dataset
from mlflow.data.dataset_source import DatasetSource
from mlflow.data.digest_utils import (
MAX_ROWS,
compute_numpy_digest,
get_normalized_md5_digest,
)
from m... | 345 | 13,319 |
mlflow | tests/webhooks/test_e2e.py | .py | import contextlib
import os
import subprocess
import sys
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Generator
import psutil
import pytest
import requests
from cryptography.fernet import Fernet
from mlflow import MlflowClient
from mlflow.entities.webhook import Webho... | 960 | 33,039 |
mlflow | tests/dev/test_dev_stubs.py | .py | import importlib.util
import json
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
import pytest
from mlflow.assistant.providers.claude_code import ClaudeCodeProvider
from mlflow.assistant.types import EventType
REPO_ROOT = Path(__file__).resolve().parents[2]
DEV_STUBS = REPO_ROOT ... | 133 | 4,462 |
python-prompt-toolkit | src/prompt_toolkit/contrib/telnet/server.py | .py | """
Telnet server.
"""
from __future__ import annotations
import asyncio
import contextvars
import socket
from asyncio import get_running_loop
from collections.abc import Callable, Coroutine
from typing import Any, TextIO, cast
from prompt_toolkit.application.current import create_app_session, get_app
from prompt_to... | 430 | 13,488 |
loguru | tests/exceptions/source/modern/grouped_max_length.py | .py | from loguru import logger
import sys
@logger.catch
def main():
errors = [ValueError(i) for i in range(100)]
raise ExceptionGroup("group", errors)
logger.remove()
logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False)
logger.add(sys.stderr, format="", diagnose=True, backtrace=True... | 16 | 345 |
astropy | astropy/constants/tests/test_prior_version.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import numpy as np
import pytest
import astropy.constants as const
import astropy.units as u
from astropy import astronomical_constants, physical_constants
from astropy.constants import Constant, EMConstant
def test_c():
from astropy.c... | 242 | 7,317 |
hypercorn | src/hypercorn/trio/udp_server.py | .py | from __future__ import annotations
import socket
import trio
from .task_group import TaskGroup
from .worker_context import WorkerContext
from ..config import Config
from ..events import Event, RawData
from ..typing import AppWrapper, ConnectionState, LifespanState
from ..utils import parse_socket_addr
MAX_RECV = 2*... | 55 | 1,720 |
probability | tensorflow_probability/python/experimental/util/special_methods.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... | 407 | 12,385 |
pymc | tests/ode/test_ode.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... | 470 | 17,232 |
ipython | IPython/utils/path.py | .py | """
Utilities for path handling.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import sys
import errno
import glob
import warnings
#-----------------------------------------------------------------------------
# Code
#------------------------------... | 360 | 11,458 |
coremltools | coremltools/converters/mil/mil/scope.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 copy
from collections import defaultdict
from enum import Enum
from typing import Dict, List, ... | 350 | 12,996 |
mlflow | tests/utils/test_workspace_utils.py | .py | from __future__ import annotations
import os
from mlflow.environment_variables import MLFLOW_WORKSPACE
from mlflow.utils.workspace_context import (
ServerWorkspaceContext,
WorkspaceContext,
clear_server_request_workspace,
get_request_workspace,
)
from mlflow.utils.workspace_utils import (
DEFAULT_... | 56 | 1,756 |
saleor | saleor/graphql/translations/tests/mutations/test_promotion_translate.py | .py | import json
from unittest.mock import ANY, patch
import graphene
from freezegun import freeze_time
from .....webhook.event_types import WebhookEventAsyncType
from .....webhook.transport.asynchronous.transport import WebhookPayloadData
from ....tests.utils import assert_no_permission, get_graphql_content
PROMOTION_TR... | 235 | 6,658 |
pdm | src/pdm/project/config.py | .py | from __future__ import annotations
import collections
import dataclasses
import os
from collections.abc import Callable, Iterator, Mapping, MutableMapping
from functools import cached_property
from pathlib import Path
from typing import Any, ClassVar, cast
import platformdirs
import rich.theme
from pdm import termui... | 538 | 20,500 |
onnx | onnx/backend/test/case/node/rmsnormalization.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.reference.ops.op_rms_normalization import _rms_normalization
def c... | 127 | 3,912 |
scikit-optimize | skopt/tests/test_searchcv.py | .py | """Test scikit-optimize based implementation of hyperparameter
search with interface similar to those of GridSearchCV
"""
import pytest
from sklearn.datasets import load_iris, make_classification
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.svm import SVC, Li... | 466 | 14,055 |
coveragepy | tests/test_phystokens.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
"""Tests for coverage.py's improved tokenizer."""
from __future__ import annotations
import os.path
import re
import sys
import textwrap
import warnings
import... | 304 | 10,260 |
sqlmap | sqlmap.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
try:
import sys
sys.dont_write_bytecode = True
try:
__import__("lib.utils.versioncheck") # this has to be the first n... | 680 | 28,273 |
astropy | astropy/cosmology/io.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""I/O subpackage for cosmology.
This subpackage contains classes and functions for reading, writing
and converting cosmology objects to and from various formats.
User access to the I/O functionality is provided through the methods
on the `~astropy.cosmo... | 34 | 985 |
django-cms | cms/test_utils/project/pluginapp/plugins/no_custom_model/cms_plugins.py | .py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
class NoCustomModel(CMSPluginBase):
name = 'NoCustomModel'
render_plugin = True
render_template = "plugins/no_custom_model.html"
plugin_pool.register_plugin(NoCustomModel)
| 12 | 270 |
cvxpy | cvxpy/tests/nlp_tests/stress_tests_diff_engine/test_permuted_dense.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
... | 244 | 8,980 |
metrics | src/torchmetrics/functional/classification/average_precision.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... | 472 | 23,577 |
jupytext | tests/data/notebooks/outputs/ipynb_to_hydrogen/Notebook_with_more_R_magic_111.py | .py | # ---
# jupyter:
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
%load_ext rpy2.ipython
import pandas as pd
df = pd.DataFrame(
{
"Letter": ["a", "a", "a", "b", "b", "b", "c", "c", "c"],
"X": [4, 3, 5, 2, 1, 7, 7, 5, 9],
"Y": [0, 4, 3, 6, 7... | 26 | 499 |
wagtail | wagtail/contrib/frontend_cache/backends/base.py | .py | import logging
from django.http.request import validate_host
logger = logging.getLogger("wagtail.frontendcache")
__all__ = ["BaseBackend"]
class BaseBackend:
def __init__(self, params):
# If unspecified, invalidate all hosts
self.hostnames = params.get("HOSTNAMES", ["*"])
def purge(self, ... | 29 | 718 |
mlflow | tests/gateway/providers/test_anthropic.py | .py | from unittest import mock
import pytest
from aiohttp import ClientTimeout
from fastapi.encoders import jsonable_encoder
from pydantic import ValidationError
from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS
from mlflow.gateway.config import EndpointConfig
from mlflow.gateway.constants impo... | 1,698 | 61,276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.