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 |
|---|---|---|---|---|---|
clearml | clearml/storage/cache.py | .py | import atexit
import os
import shutil
from collections import OrderedDict
from threading import RLock
from typing import Union, Optional, Tuple, Dict
from pathlib2 import Path
from clearml.utilities.hashing import md5_safe_hash
from .helper import StorageHelper
from .url import quote_url
from ..config import get_cac... | 418 | 16,491 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_ShapeN.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestShapeN(CommonTFLayerTest):
def create_shape_n_net(self, input_shapes, out_type):
tf.compat.v1.reset_default_graph()
... | 37 | 1,336 |
pyro | pyro/distributions/transforms/radial.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Transform, constraints
from pyro.nn import DenseNN
from ..conditional import Conditiona... | 261 | 8,708 |
astropy | astropy/units/format/generic.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This module includes files automatically generated from ply (these end in
# _lextab.py and _parsetab.py). To generate these files, remove them from this
# folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
#... | 518 | 16,954 |
coremltools | coremltools/optimize/torch/quantization/_backend_config.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 operator as _operator
from typing import Any as _Any
from typing import List as _List
from typ... | 1,142 | 31,349 |
probability | tensorflow_probability/python/mcmc/random_walk_metropolis_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... | 278 | 10,941 |
probability | tensorflow_probability/python/distributions/batch_reshape_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... | 662 | 25,429 |
owasp-mstg | src/scripts/excel_styles_and_validation.py | .py | from openpyxl.styles import PatternFill, Alignment, Border, Side, NamedStyle, Font
from openpyxl.styles.differential import DifferentialStyle
from openpyxl.styles.colors import Color
from openpyxl.formatting.rule import Rule
from openpyxl.worksheet.datavalidation import DataValidation
styles = []
align_center = Align... | 125 | 4,965 |
coveragepy | tests/test_annotate.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 annotation from coverage.py."""
from __future__ import annotations
import coverage
from tests.coveragetest import CoverageTest
from tests.goldtest... | 146 | 3,785 |
wagtail | wagtail/contrib/redirects/forms.py | .py | from django import forms
from django.core.signing import BadSignature, Signer
from django.utils.translation import gettext_lazy as _
from wagtail.admin.forms.models import WagtailAdminModelForm
from wagtail.admin.widgets import AdminPageChooser
from wagtail.contrib.redirects.models import Redirect
from wagtail.models ... | 130 | 4,440 |
mlflow | tests/genai/scorers/ragas/test_models.py | .py | import sys
from unittest.mock import Mock, patch
import pytest
from pydantic import BaseModel
from mlflow.exceptions import MlflowException
from mlflow.genai.scorers.ragas.models import MlflowRagasLLM, create_ragas_model
class DummyResponseModel(BaseModel):
answer: str
score: int
@pytest.fixture(autouse=T... | 102 | 3,338 |
gunicorn | tests/t.py | .py | # Copyright 2009 Paul J. Davis <paul.joseph.davis@gmail.com>
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import io
import os
import tempfile
dirname = os.path.dirname(__file__)
from gunicorn.http.parser import RequestParser
def data_source(fname):
bu... | 67 | 1,576 |
beam | sdks/python/apache_beam/runners/portability/expansion_service.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... | 129 | 5,702 |
coremltools | deps/protobuf/python/setup.py | .py | #! /usr/bin/env python
#
# See README for usage instructions.
from distutils import util
import fnmatch
import glob
import os
import pkg_resources
import re
import subprocess
import sys
import sysconfig
import platform
# We must use setuptools, not distutils, because we need to use the
# namespace_packages option for ... | 314 | 12,982 |
probability | spinoffs/autobnn/autobnn/operators.py | .py | # Copyright 2023 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... | 302 | 10,426 |
textual | docs/examples/how-to/containers01.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app to pl... | 30 | 567 |
pyomo | examples/pyomo/piecewise/step.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,665 |
eve | tests/test_prefix_version.py | .py | # -*- coding: utf-8 -*-
URL_PREFIX = "prefix"
API_VERSION = "v1"
DOMAIN = {"contacts": {}}
| 6 | 92 |
pyomo | pyomo/contrib/viewer/tests/test_data_model_tree.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... | 264 | 10,074 |
astropy | astropy/io/misc/__init__.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains miscellaneous utility functions for data
input/output with astropy.
"""
from .pickle_helpers import *
| 8 | 193 |
mlflow | mlflow/genai/judges/tools/search_trace_regex.py | .py | """
Tool for searching traces using regex patterns.
This module provides functionality to search through entire traces (including
spans, metadata, tags, requests, and responses) using regular expressions
with case-insensitive matching.
"""
import re
from dataclasses import dataclass
from mlflow.entities.trace import... | 165 | 5,826 |
mkdocs | mkdocs/tests/structure/nav_tests.py | .py | #!/usr/bin/env python
import sys
import unittest
from mkdocs.structure.files import File, Files, set_exclusions
from mkdocs.structure.nav import Section, _get_by_type, get_navigation
from mkdocs.structure.pages import Page
from mkdocs.tests.base import dedent, load_config
class SiteNavigationTests(unittest.TestCase... | 551 | 22,939 |
qutip | qutip/solver/propagator.py | .py | # Required for Sphinx to follow autodoc_type_aliases
from __future__ import annotations
__all__ = ['Propagator', 'propagator', 'propagator_steadystate']
import numbers
import numpy as np
from .. import Qobj, qeye, qeye_like, unstack_columns, QobjEvo, liouvillian
from ..core import data as _data
from ..typing import ... | 435 | 14,504 |
beam | learning/katas/python/Core Transforms/Combine/CombineFn/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... | 55 | 1,676 |
mlflow | mlflow/genai/prompts/__init__.py | .py | import json
import warnings
from contextlib import contextmanager
from typing import Any
from pydantic import BaseModel
import mlflow.tracking._model_registry.fluent as registry_api
from mlflow.entities.model_registry.prompt import Prompt
from mlflow.entities.model_registry.prompt_version import (
PromptModelConf... | 415 | 14,905 |
cvxpy | cvxpy/reductions/dcp2cone/canonicalizers/quad_over_lin_canon.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... | 94 | 3,158 |
beam | learning/katas/python/Core Transforms/Map/ParDo/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... | 44 | 1,359 |
cvxpy | cvxpy/atoms/von_neumann_entr.py | .py | """
Copyright 2022, 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, soft... | 135 | 4,314 |
pyomo | conftest.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... | 113 | 4,072 |
coremltools | deps/protobuf/python/protobuf_distutils/setup.py | .py | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | 76 | 3,337 |
metrics | src/torchmetrics/image/vif.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... | 100 | 4,206 |
wagtail | wagtail/test/urls_multilang.py | .py | from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
urlpatterns = [
path("admin/", include(wagtailadmin_urls)),
]
urlpatterns += i18n_patterns(path("", include(wagtail_urls)))
| 12 | 310 |
openvino | src/bindings/python/src/openvino/opset2/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
from openvino.opset1.ops import add
from openvino.opset1.ops import asin
from openvino.... | 118 | 4,887 |
onnxruntime | onnxruntime/core/providers/coreml/mlprogram_test_scripts/concat_test.py | .py | import coremltools as ct
import numpy as np
from coremltools.converters.mil import Builder as mb
target = ct.target.iOS15
a_shape = (1, 1, 3, 3)
@mb.program(
input_specs=[mb.TensorSpec(shape=a_shape), mb.TensorSpec(shape=a_shape), mb.TensorSpec(shape=a_shape)],
opset_version=target,
)
def prog(x, y, z):
... | 34 | 767 |
mlflow | tests/xgboost/test_xgboost_autolog.py | .py | import functools
import json
import os
import pickle
from unittest import mock
import matplotlib as mpl
import numpy as np
import pandas as pd
import pytest
import xgboost as xgb
import yaml
from packaging.version import Version
from sklearn import datasets
import mlflow
import mlflow.xgboost
from mlflow import Mlflo... | 787 | 27,912 |
pyomo | pyomo/contrib/gdpopt/branch_and_bound.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... | 610 | 25,956 |
saleor | saleor/tests/e2e/orders/test_update_draft_order_metadata.py | .py | import pytest
from .. import DEFAULT_ADDRESS
from ..metadata.utils import (
delete_metadata,
delete_private_metadata,
update_metadata,
update_private_metadata,
)
from ..product.utils.preparing_product import prepare_product
from ..shop.utils.preparing_shop import prepare_default_shop
from ..utils impor... | 137 | 4,782 |
luigi | test/interface_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... | 223 | 9,719 |
deap | doc/code/tutorials/part_3/3_next_step.py | .py | ## 3.1 A First Individual
import random
from deap import base
from deap import creator
from deap import tools
IND_SIZE = 5
creator.create("FitnessMin", base.Fitness, weights=(-1.0, -1.0))
creator.create("Individual", list, fitness=creator.FitnessMin)
toolbox = base.Toolbox()
toolbox.register("attr_float", random.ra... | 58 | 1,523 |
saleor | saleor/graphql/product/tests/mutations/test_collection_channel_listing_update.py | .py | import datetime
import graphene
from freezegun import freeze_time
from .....product.error_codes import CollectionErrorCode
from ....tests.utils import assert_no_permission, get_graphql_content
COLLECTION_CHANNEL_LISTING_UPDATE_MUTATION = """
mutation UpdateCollectionChannelListing(
$id: ID!
$input: Collectio... | 556 | 18,755 |
gunicorn | tests/requests/valid/024.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.config import Config
cfg = Config()
# Request line is 8194 bytes, header line is 8209 bytes (both include CRLF)
cfg.set('limit_request_line', 8200)
cfg.set('limit_request_field_size', 8210)
request =... | 21 | 16,827 |
wagtail | wagtail/documents/tests/test_api_v3/test_detail.py | .py | from django.urls import reverse
from wagtail.models import CollectionViewRestriction
from .base import TestV3DocumentsBase
class TestV3DocumentDetail(TestV3DocumentsBase):
def get_response(self, document_id):
return self.client.get(
reverse(
"wagtailapi_v3:detail_document",
... | 35 | 1,257 |
jupyterlab | examples/test_examples.py | .py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""
This file is meant to be used to test all of the example here and and
in ../packages/services/examples. We import each of the applications
and add instrument them with a Playwright test that makes sure
there are n... | 72 | 2,326 |
flit | doc/conf.py | .py | # Flit documentation build configuration file, created by
# sphinx-quickstart on Sun Mar 15 19:16:41 2015.
#
# 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 file.
#
# All configuration values have ... | 260 | 8,272 |
clearml | clearml/utilities/locks/__init__.py | .py | from .utils import RLock, Lock
__all__ = ["RLock", "Lock"]
| 4 | 60 |
beam | learning/katas/python/Streaming/Windows/Fixed Windows/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... | 41 | 1,607 |
textual | docs/examples/styles/border_subtitle_align.py | .py | from textual.app import App
from textual.widgets import Label
class BorderSubtitleAlignApp(App):
CSS_PATH = "border_subtitle_align.tcss"
def compose(self):
lbl = Label("My subtitle is on the left.", id="label1")
lbl.border_subtitle = "< Left"
yield lbl
lbl = Label("My subtitl... | 25 | 610 |
openvino | samples/python/model_creation_sample/model_creation_sample.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import sys
from functools import reduce
import numpy as np
import openvino as ov
from openvino import op, opset1, opset8
from data import digits
def create_model(mod... | 210 | 9,116 |
beam | learning/tour-of-beam/learning-content/cross-language/multi-pipeline/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... | 97 | 3,060 |
wagtail | wagtail/api/v3/registry.py | .py | """
Content type registry backing ``/schema/`` discovery.
Registrations run from ``WagtailAPIV3AppConfig.ready()`` so other apps can register types from
their own ``ready()`` hooks.
"""
from dataclasses import dataclass
from typing import Any
from pydantic import BaseModel
from wagtail.api.v3.schemas import Content... | 158 | 5,995 |
luigi | test/contrib/test_ssh.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... | 256 | 8,459 |
mlflow | mlflow/genai/optimize/job.py | .py | import logging
from dataclasses import asdict, dataclass
from enum import Enum
from typing import Any, Callable
from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException
from mlflow.genai.datasets import get_dataset
from mlflow.genai.optimize import optimize_prompts
from mlflow.genai.optimize.optimizers i... | 322 | 12,142 |
mlflow | mlflow/types/type_hints.py | .py | import base64
import logging
from datetime import datetime
from functools import lru_cache
from types import UnionType
from typing import Any, NamedTuple, Optional, TypeVar, Union, get_args, get_origin
import pydantic
import pydantic.fields
from mlflow.environment_variables import _MLFLOW_IS_IN_SERVING_ENVIRONMENT
fr... | 633 | 24,613 |
onnxruntime | onnxruntime/python/tools/layering/layer_annotate.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import logging
import pathlib
import onnx
def get_logger(name, level=logging.DEBUG):
logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s")
logger = logging.getLogger(name)... | 166 | 5,571 |
gunicorn | tests/support_dirty_apps.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""Support module for multi-app dirty tests.
Provides test applications with distinct behaviors for verifying
that requests are correctly routed to the appropriate app.
"""
from gunicorn.dirty.app import DirtyApp... | 141 | 3,185 |
mlflow | mlflow/store/db_migrations/versions/cbc13b556ace_add_v3_trace_schema_columns.py | .py | """add V3 trace schema columns
Create Date: 2025-06-17 12:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "cbc13b556ace"
down_revision = "bda7b8c39065"
branch_labels = None
depends_on = None
def upgrade():
# Add V3 specific columns to trace_i... | 30 | 928 |
ipython | tests/test_help.py | .py | """Test help output of various IPython entry points"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import pytest
import IPython.testing.tools as tt
def test_ipython_help():
tt.help_all_output_test()
def test_profile_help():
tt.help_all_output_test("... | 37 | 728 |
pdm | tests/resolver/test_providers.py | .py | from __future__ import annotations
from collections.abc import Iterator
from resolvelib.resolvers import RequirementInformation
from pdm.models.candidates import Candidate
from pdm.models.requirements import parse_requirement
from pdm.resolver.providers import _CONFLICT_PRIORITY_THRESHOLD
def _build_candidates(ide... | 69 | 2,406 |
httpie | tests/test_config.py | .py | from pathlib import Path
import pytest
from _pytest.monkeypatch import MonkeyPatch
from httpie.compat import is_windows
from httpie.encoding import UTF8
from httpie.config import (
Config, DEFAULT_CONFIG_DIRNAME, DEFAULT_RELATIVE_LEGACY_CONFIG_DIR,
DEFAULT_RELATIVE_XDG_CONFIG_HOME, DEFAULT_WINDOWS_CONFIG_DIR,... | 105 | 3,765 |
astropy | astropy/io/ascii/tests/test_tdat.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests some methods related to ``tdat`` format
reader/writer.
Requires `pyyaml <https://pyyaml.org/>`_ to be installed.
"""
import copy
import warnings
from collections import OrderedDict
from io import StringIO
import numpy as np
import ... | 819 | 27,143 |
onnx | onnx/backend/test/case/node/expand.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
class Expand(Base):
@staticmethod
def export_dim_changed() -> None:
... | 67 | 1,947 |
sphinx | sphinx/builders/latex/theming.py | .py | """Theming support for LaTeX builder."""
from __future__ import annotations
import configparser
from typing import TYPE_CHECKING
from sphinx.errors import ThemeError
from sphinx.locale import __
from sphinx.util import logging
if TYPE_CHECKING:
from pathlib import Path
from sphinx.config import Config
log... | 136 | 4,431 |
beam | sdks/python/apache_beam/ml/gcp/visionml_test_it.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... | 85 | 2,599 |
mlflow | mlflow/tracking/_tracking_service/registry.py | .py | import threading
from functools import lru_cache
from mlflow.tracking.registry import StoreRegistry
_building_store_lock = threading.Lock()
class TrackingStoreRegistry(StoreRegistry):
"""Scheme-based registry for tracking store implementations
This class allows the registration of a function or class to pr... | 57 | 2,419 |
openvino | tools/ovc/openvino/tools/ovc/telemetry_stub.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
class Telemetry(object):
"""
Stab file for the Telemetry class which is used when Telemetry class is not available.
"""
def __init__(self, *arg, **kwargs):
pass
def send_event(self, *arg, **kwargs):
... | 29 | 619 |
cvxpy | cvxpy/atoms/cumprod.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
... | 85 | 2,409 |
openvino | tests/layer_tests/pytorch_tests/test_select_scatter.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from pytorch_layer_test_class import PytorchLayerTest
import torch
class TestSelectScatter(PytorchLayerTest):
def _prepare_input(self):
return (self.random.randn(2, 5, 3, 4),)
def create_model(self, src, ... | 36 | 1,159 |
probability | tensorflow_probability/python/experimental/math/manual_special_functions_test.py | .py | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 422 | 13,127 |
metrics | tests/unittests/classification/test_stat_scores.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... | 668 | 28,215 |
ipython | IPython/core/magics/extension.py | .py | """Implementation of magic functions for the extension machinery.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distrib... | 64 | 2,453 |
coremltools | coremltools/converters/libsvm/_libsvm_util.py | .py | # Copyright (c) 2017, 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 ..._deps import _HAS_LIBSVM
def load_model(model_path):
"""Load a libsvm model from a path on... | 38 | 971 |
bazel | third_party/py/concurrent/futures/_base.py | .py | # Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
from __future__ import with_statement
import functools
import logging
import threading
import time
try:
from collections import namedtuple
except ImportError:
from third_party.py.concurrent.futures._compat im... | 576 | 19,681 |
mlflow | tests/entities/test_trace.py | .py | import importlib.util
import json
import re
from dataclasses import dataclass
from datetime import datetime
from typing import Any
from unittest import mock
import pytest
from pydantic import BaseModel
import mlflow
import mlflow.tracking.context.default_context
from mlflow.entities import (
AssessmentSource,
... | 585 | 20,667 |
metrics | src/torchmetrics/clustering/calinski_harabasz_score.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 129 | 5,357 |
gunicorn | tests/test_ssl.py | .py | # Copyright 2013 Dariusz Suchojad <dsuch at zato.io>
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import pytest
from gunicorn.config import (
KeyFile, CertFile, CACerts, SuppressRaggedEOFs,
DoHandshakeOnConnect, Setting, Ciphers,
)
ssl = pytest.impo... | 66 | 1,990 |
biopython | Bio/AlignIO/__init__.py | .py | # Copyright 2008-2018 by Peter Cock. All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Multiple sequence al... | 475 | 18,499 |
beam | playground/frontend/playground_components/test/tools/extract_symbols_python/sdk_mock/directory/file2.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 ... | 18 | 802 |
textual | tests/test_freeze.py | .py | import pytest
from textual.app import App
from textual.screen import Screen
from textual.widgets import Footer, Header, Input
class MyScreen(Screen):
def compose(self):
yield Header()
yield Input()
yield Footer()
class MyApp(App):
def on_mount(self):
self.install_screen(MySc... | 27 | 616 |
ipython | IPython/core/async_helpers.py | .py | """
Async helper function that are invalid syntax on Python 3.5 and below.
This code is best effort, and may have edge cases not behaving as expected. In
particular it contain a number of heuristics to detect whether code is
effectively async and need to run in an event loop or not.
Some constructs (like top-level `r... | 163 | 4,407 |
kombu | kombu/common.py | .py | """Common Utilities."""
from __future__ import annotations
import os
import socket
import threading
from collections import deque
from contextlib import contextmanager
from functools import partial
from itertools import count
from uuid import NAMESPACE_OID, uuid3, uuid4, uuid5
from amqp import ChannelError, Recovera... | 460 | 14,482 |
openvino | tests/layer_tests/pytorch_tests/test_rad2deg.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
import numpy as np
from pytorch_layer_test_class import PytorchLayerTest
class TestRad2Deg(PytorchLayerTest):
def _prepare_input(self, input_shape=(2, 2), dtype=np.float32):
return (self.random.un... | 27 | 1,035 |
mlflow | tests/test_xdist_serial_partition.py | .py | # Tests for the xdist serial/parallel partition used by the two-pass `python` CI job.
#
# The `python` job runs the suite twice: `--serial=exclude` (parallel bulk) and
# `--serial=only` (serial tail). The safety-critical property is that these two passes
# form an *exhaustive, disjoint* partition of the collected tests... | 198 | 9,104 |
pyomo | examples/pyomo/radertext/Ex2_1.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... | 69 | 2,131 |
textual | src/textual/_node_list.py | .py | from __future__ import annotations
import sys
import weakref
from operator import attrgetter
from typing import TYPE_CHECKING, Any, Callable, Iterator, Sequence, overload
import rich.repr
if TYPE_CHECKING:
from _typeshed import SupportsRichComparison
from textual.dom import DOMNode
from textual.widget i... | 237 | 7,599 |
saleor | saleor/graphql/translations/tests/deprecated/test_translations.py | .py | import graphene
import pytest
from ....core.enums import LanguageCodeEnum
from ....tests.utils import get_graphql_content
from ...schema import TranslatableKinds
QUERY_TRANSLATION_PRODUCT = """
query translation(
$kind: TranslatableKinds!, $id: ID!, $languageCode: LanguageCodeEnum!
){
translat... | 540 | 15,666 |
confluent-kafka-python | src/confluent_kafka/admin/_records.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... | 29 | 921 |
probability | tensorflow_probability/python/distributions/cauchy_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... | 482 | 18,651 |
returns | tests/test_future/test_future_result/test_future_result_equality.py | .py | import pytest
from returns.future import FutureResult
def test_nonequality():
"""Ensures that containers can be compared."""
assert FutureResult.from_value(1) != FutureResult.from_value(1)
assert hash(FutureResult.from_value(1))
@pytest.mark.anyio
async def test_equality():
"""Ensures that containe... | 18 | 457 |
lemur | lemur/plugins/lemur_adcs/tests/test_adcs.py | .py | import unittest
from flask import Flask
class TestAdcs(unittest.TestCase):
def setUp(self):
# Creates a new Flask application for a test duration. In python 3.8, manual push of application context is
# needed to run tests in dev environment without getting error 'Working outside of application co... | 26 | 865 |
kombu | kombu/transport/SLMQ.py | .py | """SoftLayer Message Queue transport module for kombu.
Features
========
* Type: Virtual
* Supports Direct: Yes
* Supports Topic: Yes
* Supports Fanout: No
* Supports Priority: No
* Supports TTL: No
Connection String
=================
*Unreviewed*
Transport Options
=================
*Unreviewed*
"""
from __future... | 203 | 6,215 |
luigi | test/auto_namespace_test/__init__.py | .py | import luigi
luigi.auto_namespace(scope=__name__)
| 4 | 51 |
cvxpy | cvxpy/expressions/leaf.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... | 1,111 | 46,891 |
wagtail | wagtail/management/commands/show_references_index.py | .py | from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from wagtail.models import ReferenceIndex
def model_name(model):
return f"{model.__module__}.{model.__name__}"
class Command(BaseCommand):
def handle(self, **options):... | 37 | 1,221 |
sqlmap | plugins/dbms/access/__init__.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.enums import DBMS
from lib.core.settings import ACCESS_SYSTEM_DBS
from lib.core.unescaper import unescaper
from plugins.dbms.access.enumeration import Enumeration
fr... | 30 | 918 |
luigi | luigi/contrib/docker_runner.py | .py | # -*- coding: utf-8 -*-
#
# Copyright 2017 Open Targets
#
# 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... | 258 | 8,902 |
hatch | src/hatch/cli/test/core.py | .py | from __future__ import annotations
from functools import cached_property
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from configparser import ConfigParser
from hatch.utils.fs import Path
class PatchedCoverageConfig:
def __init__(self, project_root: Path, data_dir: Path) -> None:
self.pro... | 57 | 1,936 |
coremltools | deps/pybind11/tests/test_numpy_dtypes.py | .py | from __future__ import annotations
import re
import pytest
import env # noqa: F401
from pybind11_tests import PYBIND11_NUMPY_1_ONLY
from pybind11_tests import numpy_dtypes as m
np = pytest.importorskip("numpy")
@pytest.fixture(scope="module")
def simple_dtype():
ld = np.dtype("longdouble")
return np.dtyp... | 449 | 14,655 |
pdm | src/pdm/models/reporter.py | .py | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any
from rich import get_console
from rich.live import Live
from rich.progress import MofNCompleteColumn, Progress, SpinnerColumn, TaskProgressColumn, TimeElapsedColumn
from pdm import term... | 114 | 3,625 |
mlflow | tests/genai/scorers/test_serialization.py | .py | import json
from typing import Any, ClassVar
from unittest.mock import Mock, patch
import pytest
import mlflow
from mlflow.entities import Feedback
from mlflow.entities.scorer import ScorerVersion
from mlflow.exceptions import MlflowException
from mlflow.genai.scorers import Scorer, scorer
from mlflow.genai.scorers.b... | 901 | 30,447 |
pyomo | examples/pyomo/concrete/Whiskas.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... | 96 | 2,740 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.