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
astropy
astropy/time/tests/test_ut1.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import numpy as np import pytest from astropy.time import Time from astropy.utils.iers import conf as iers_conf from astropy.utils.iers import iers # used in testing allclose_jd = functools.partial(np.allclose, rtol=0, atol=1e-9) allcl...
159
5,219
textual
docs/examples/guide/reactivity/refresh01.py
.py
from textual.app import App, ComposeResult from textual.reactive import reactive from textual.widget import Widget from textual.widgets import Input class Name(Widget): """Generates a greeting.""" who = reactive("name") def render(self) -> str: return f"Hello, {self.who}!" class WatchApp(App):...
30
640
coremltools
coremltools/test/optimize/torch/palettization/test_sensitive_k_means.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from collections import OrderedDict from contextlib import nullcontext from typing import Any, Dict f...
360
11,866
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/top_per_key.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
66
2,083
cvxpy
cvxpy/cvxcore/python/cppbackend.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 ...
266
8,562
textual
docs/examples/styles/scrollbars2.py
.py
from textual.app import App from textual.widgets import Label 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 its path. Where th...
24
569
cvxpy
cvxpy/tests/test_problem.py
.py
""" Copyright 2017 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...
2,373
95,102
astropy
astropy/cosmology/_src/tests/flrw/test_lambdacdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.flrw.lambdacdm`.""" import pathlib import re import numpy as np import pytest import astropy.constants as const import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import FlatLambdaCD...
1,060
40,147
pyomo
pyomo/contrib/parmest/examples/semibatch/parallel_example.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
56
2,132
pyfilesystem2
tests/test_subfs.py
.py
from __future__ import unicode_literals import os import shutil import tempfile import unittest from fs import osfs from fs.memoryfs import MemoryFS from fs.path import relpath from fs.subfs import SubFS from .test_osfs import TestOSFS class TestSubFS(TestOSFS): """Test OSFS implementation.""" def setUp(s...
74
1,927
saleor
saleor/graphql/account/dataloaders.py
.py
from collections import defaultdict from collections.abc import Iterable from typing import TypeVar, cast from ...account.exceptions import NoDefaultCustomerType from ...account.models import Address, CustomerEvent, CustomerType, Group, User from ...account.utils import get_default_customer_type from ...attribute.mode...
277
10,396
wagtail
wagtail/images/tests/test_bulk_actions/test_bulk_add_to_collection.py
.py
from django.contrib.auth.models import Group, Permission from django.test import TestCase from django.urls import reverse from wagtail.images import get_image_model from wagtail.images.tests.utils import get_test_image_file from wagtail.models import Collection from wagtail.test.utils import WagtailTestUtils Image = ...
168
5,858
wandb
tests/system_tests/test_launch/test_launch_public_api.py
.py
import json import pytest import wandb import wandb.apis.public from wandb import Api from wandb.errors import UnsupportedError SWEEP_CONFIGURATION = { "method": "random", "name": "sweep", "metric": {"goal": "maximize", "name": "val_acc"}, "parameters": { "batch_size": {"values": [16, 32, 64]}...
148
4,254
pyomo
pyomo/dae/initialization.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...
152
6,035
biopython
Bio/SCOP/Residues.py
.py
# Copyright 2000 by Jeffrey Chang. All rights reserved. # Revisions copyright 2001 by Gavin E. Crooks. 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 ...
91
3,083
openvino
tests/stress_tests/scripts/run_memcheck.py
.py
#!/usr/bin/env python3 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ This script runs memcheck tests isolated with help of gtest_parallel. It can upload memory measurment results to database and generate reports. """ import argparse import json import logging import os import ...
225
9,553
conda
conda/testing/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause # Attempt to move any conda entries in PATH to the front of it. # IDEs have their own ideas about how PATH should be managed and # they do dumb stuff like add /usr/bin to the front of it # meaning conda takes a submissive role and the wrong stuf...
70
2,954
probability
tensorflow_probability/python/bijectors/invert_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...
157
5,871
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/common_smooth_canons.py
.py
""" Copyright 2025 CVXPY 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 law or agreed to in writing, softwa...
103
4,246
saleor
saleor/graphql/product/tests/mutations/test_product_update.py
.py
import json from unittest.mock import ANY, patch import graphene import pytest from django.conf import settings from django.utils.html import strip_tags from django.utils.text import slugify from freezegun import freeze_time from .....attribute import AttributeInputType from .....attribute.models import ( Assigne...
3,911
119,649
deap
examples/de/sphere.py
.py
# This file is part of EAP. # # EAP 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. # # EAP is distributed in ...
122
3,767
mlflow
mlflow/tracing/attachments.py
.py
import mimetypes import uuid from pathlib import Path from urllib.parse import parse_qs, urlencode, urlparse class Attachment: """ Represents a binary attachment (image, audio, PDF, etc.) that can be logged as part of a trace span's inputs or outputs. When an Attachment is set as a span input/output ...
74
2,437
textual
docs/examples/guide/layout/grid_layout1.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class GridLayoutExample(App): CSS_PATH = "grid_layout1.tcss" def compose(self) -> ComposeResult: yield Static("One", classes="box") yield Static("Two", classes="box") yield Static("Three", classes="box") ...
20
521
returns
returns/io.py
.py
from abc import ABC from collections.abc import Callable, Generator, Iterator from functools import wraps from inspect import FrameInfo from typing import TYPE_CHECKING, Any, TypeAlias, TypeVar, final, overload from typing_extensions import ParamSpec from returns.interfaces.specific import io, ioresult from returns.p...
989
29,841
saleor
saleor/plugins/webhook/plugin.py
.py
import json import logging from collections import defaultdict from collections.abc import Callable, Iterable from decimal import Decimal from functools import partial from typing import TYPE_CHECKING, Any, Optional, Union, cast import graphene from django.conf import settings from django.utils.functional import LazyO...
3,557
125,753
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/dummy_dataset_source.py
.py
from typing import Any from urllib.parse import urlparse from mlflow.data.dataset_source import DatasetSource from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE class DummyDatasetSource(DatasetSource): def __init__(self, uri): self._uri = uri ...
56
1,535
mlflow
tests/cli/test_genai_eval_utils.py
.py
from unittest import mock import click import pandas as pd import pytest from mlflow.cli.genai_eval_utils import ( NA_VALUE, Assessment, EvalResult, extract_assessments_from_results, format_table_output, resolve_scorers, ) from mlflow.exceptions import MlflowException from mlflow.tracing.const...
478
14,268
beam
playground/infrastructure/ci_cd.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 ...
127
4,494
pyro
tests/infer/autoguide/test_mean_field_entropy.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import scipy.special as sc import torch import pyro import pyro.distributions as dist from pyro.infer.autoguide.utils import mean_field_entropy from tests.common import assert_equal def mean_field_guide(batch_tenso...
39
1,064
astropy
astropy/cosmology/_src/traits/totalcomponent.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ("TotalComponent",) from abc import abstractmethod import numpy as np from numpy.typing import ArrayLike from astropy.cosmology._src.typing import FArray from astropy.units import Quantity class TotalComponent: """The cosmology has attr...
43
1,201
wagtail
wagtail/images/api/v2/views.py
.py
from wagtail.api.v2.filters import FieldsFilter, OrderingFilter, SearchFilter from wagtail.api.v2.views import BaseAPIViewSet from wagtail.models import CollectionViewRestriction from ... import get_image_model from .serializers import ImageSerializer class ImagesAPIViewSet(BaseAPIViewSet): base_serializer_class...
35
1,250
saleor
saleor/graphql/core/tests/test_query_cost_validation.py
.py
import graphene import pytest from django.test import override_settings from ...query_cost_map import COST_MAP from ..const import DEFAULT_NESTED_LIST_LIMIT @override_settings(GRAPHQL_QUERY_MAX_COMPLEXITY=1) def test_query_exceeding_cost_limit_fails_validation( api_client, variant_with_many_stocks, chann...
551
15,463
onnxruntime
docs/python/examples/plot_convert_pipeline_vectorizer.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ Train, convert and predict with ONNX Runtime ============================================ This example demonstrates an end to end scenario starting with the training of a scikit-learn pipeline which takes as inputs not a...
99
3,477
probability
tensorflow_probability/python/distributions/laplace.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...
249
9,127
biopython
Bio/PDB/NACCESS.py
.py
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. # NACCESS interface ...
212
7,219
metrics
src/torchmetrics/image/rase.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...
136
4,945
scikit-optimize
skopt/searchcv.py
.py
import warnings try: from collections.abc import Sized except ImportError: from collections import Sized import numpy as np from scipy.stats import rankdata from sklearn.model_selection._search import BaseSearchCV from sklearn.utils import check_random_state from sklearn.utils.validation import check_is_fit...
521
20,988
pyomo
pyomo/common/tempfiles.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...
482
16,787
textual
tests/test_partition.py
.py
from textual._partition import partition def test_partition(): def is_odd(value: int) -> bool: return bool(value % 2) def is_greater_than_five(value: int) -> bool: return value > 5 assert partition(is_odd, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == ( [2, 4, 6, 8, 10], [1, 3, 5, ...
28
778
black
tests/data/cases/comments3.py
.py
# The percent-percent comments are Spyder IDE cells. # %% def func(): x = """ a really long string """ lcomp3 = [ # This one is actually too long to fit in a single line. element.split("\n", 1)[0] # yup for element in collection.select_elements() # right ...
48
1,573
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_take_along_axis.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # fill_const paddle model generator # import numpy as np from save_model import saveModel import paddle import sys def take_along_axis(name : str, x,index,axis): paddle.enable_static() with paddle.static.program_guard(paddle....
39
1,319
pyomo
pyomo/core/tests/examples/test_pyomo.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...
316
12,771
mlflow
tests/statsmodels/test_statsmodels_model_export.py
.py
import json import os from pathlib import Path from unittest import mock import numpy as np import pandas as pd import pytest import yaml import mlflow.pyfunc.scoring_server as pyfunc_scoring_server import mlflow.statsmodels from mlflow import pyfunc from mlflow.exceptions import MlflowException from mlflow.models im...
485
17,982
confluent-kafka-python
examples/fips/fips_producer.py
.py
#!/usr/bin/env python # # Copyright 2023 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...
84
3,047
probability
tensorflow_probability/python/experimental/linalg/linear_operator_interpolated_psd_kernel_test.py
.py
# Copyright 2022 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
301
11,107
cvxpy
cvxpy/atoms/affine/kron.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...
127
4,363
coremltools
coremltools/converters/lightgbm/_tree_ensemble.py
.py
# Copyright (c) 2026, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as _np from ..._deps import _HAS_LIGHTGBM from ...models.tree_ensemble import TreeEnsemble...
265
10,119
loguru
docs/conf.py
.py
"""Configuration file for the Sphinx documentation builder. This file does only contain a selection of the most common options. For a full list see the documentation: http://www.sphinx-doc.org/en/master/config -- Path setup -------------------------------------------------------------- If extensions (or modules to d...
184
5,655
probability
tensorflow_probability/python/experimental/mcmc/step_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...
155
5,667
pyomo
pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_model.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...
1,145
43,481
coveragepy
tests/plugin1.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 """A file tracer plugin for test_plugins.py to import.""" from __future__ import annotations import os.path from types import FrameType from typing import Any ...
64
1,932
qutip
qutip/tests/solver/test_propagator.py
.py
from unittest.mock import patch import numpy as np from scipy.integrate import trapezoid from qutip import (destroy, propagator, Propagator, propagator_steadystate, steadystate, tensor, qeye, basis, QobjEvo, sesolve, liouvillian, rand_dm, enr_identity, enr_destroy) import qutip imp...
394
10,352
saleor
saleor/graphql/product/dataloaders/products.py
.py
from collections import defaultdict from collections.abc import Iterable from django.db.models import Exists, F, OuterRef, Q from ....core.db.connection import allow_writer_in_context from ....product import ProductMediaTypes from ....product.models import ( Category, Collection, CollectionChannelListing,...
746
27,906
astropy
astropy/io/votable/connect.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import numpy as np from astropy.io import registry as io_registry from astropy.table import Table from astropy.table.column import BaseColumn from astropy.units import Quantity from astropy.utils.misc import NOT_OVERWRITING_MSG from . import...
283
10,558
mlflow
mlflow/utils/validation.py
.py
""" Utilities for validating user inputs such as metric names and parameter names. """ import ipaddress import json import logging import numbers import posixpath import re import socket import threading import urllib.parse from fnmatch import fnmatch from typing import Any from mlflow.entities import Dataset, Datase...
1,203
44,967
openvino
src/bindings/python/src/openvino/opset6/__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.opset4.ops import acosh from openvino.opset1.ops import add from openvino...
155
6,531
onnxruntime
plugin-ep-cuda/python/test/test_cuda_plugin_ep.py
.py
#!/usr/bin/env python3 """Smoke test for the onnxruntime-ep-cuda Python package. Tests: 1. Package import and library path resolution 2. EP registration with ONNX Runtime 3. Device discovery 4. Inference with a simple Mul model (requires CUDA-capable hardware) The inference test is skipped gracefully if no CUDA devic...
184
6,961
onnx
onnx/backend/test/case/node/nonzero.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 NonZero(Base): @staticmethod def export() -> None: nod...
27
723
biopython
Bio/PopGen/GenePop/LargeFileParser.py
.py
# Copyright 2010 by Tiago Antao. 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. """Large file parsing of G...
121
3,919
confluent-kafka-python
tests/_util/test_librdkafka_string_parser.py
.py
# Copyright 2026 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
227
7,702
astropy
astropy/wcs/wcsapi/tests/test_low_level_api.py
.py
import pytest from astropy.wcs.wcsapi.low_level_api import validate_physical_types def test_validate_physical_types(): # Check valid cases validate_physical_types(["pos.eq.ra", "pos.eq.ra"]) validate_physical_types(["spect.dopplerVeloc.radio", "custom:spam"]) validate_physical_types(["time", None]) ...
23
738
deap
doc/code/tutorials/part_4/sortingnetwork.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 ...
129
4,640
clearml
clearml/utilities/networking.py
.py
import socket import subprocess import requests from typing import Optional from ..backend_config import EnvEntry def get_private_ip() -> str: """ Get the private IP of this machine :return: A string representing the IP of this machine """ approaches = ( _get_private_ip_from_env_vars, ...
108
3,205
mlflow
mlflow/genai/scorers/phoenix/registry.py
.py
from __future__ import annotations from mlflow.exceptions import MlflowException from mlflow.genai.scorers.phoenix.utils import check_phoenix_installed _METRIC_REGISTRY = { "Hallucination": "HallucinationEvaluator", "Relevance": "RelevanceEvaluator", "Toxicity": "ToxicityEvaluator", "QA": "QAEvaluator...
51
1,740
pyro
pyro/contrib/easyguide/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from pyro.contrib.easyguide.easyguide import EasyGuide, easy_guide __all__ = [ "EasyGuide", "easy_guide", ]
10
206
wandb
tests/system_tests/test_automations/test_automations_api.py
.py
from __future__ import annotations import math from collections import deque from collections.abc import Callable, Generator from itertools import islice from typing import TYPE_CHECKING, Any import wandb from pytest import FixtureRequest, fixture, mark, raises, skip from wandb.apis.public import ArtifactCollection, ...
1,017
34,838
sphinx
tests/roots/test-config/conf.py
.py
project = 'Sphinx <Tests>' release = '0.6alpha1' templates_path = ['_templates']
4
81
metrics
src/torchmetrics/functional/text/perplexity.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...
143
5,304
textual
src/textual/reactive.py
.py
""" This module contains the `Reactive` class which implements [reactivity](/guide/reactivity/). """ from __future__ import annotations from functools import partial from inspect import isawaitable from typing import ( TYPE_CHECKING, Any, Awaitable, Callable, ClassVar, Generic, Type, ...
533
18,056
pyro
pyro/optim/clipped_adam.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math from typing import Any, Callable, Optional, Tuple import torch from torch.optim.optimizer import Optimizer class ClippedAdam(Optimizer): """ :param params: iterable of parameters to optimize or dicts defining...
111
4,093
mlflow
tests/projects/test_entry_point.py
.py
import os from shlex import quote from unittest import mock import pytest from mlflow.exceptions import ExecutionException from mlflow.projects._project_spec import EntryPoint from mlflow.utils.file_utils import TempDir, path_to_local_file_uri from tests.projects.utils import TEST_PROJECT_DIR, load_project def tes...
263
10,751
pynacl
src/nacl/bindings/crypto_aead.py
.py
# Copyright 2017 Donald Stufft and individual contributors # # 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...
998
28,197
openvino
src/bindings/python/tests/test_graph/test_ops_result.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import PartialShape, Model, Type import openvino.opset13 as ops from openvino.op import Result def test_result(): param = ops.parameter(PartialShape([1]), dtype=np.float32, ...
29
925
probability
tensorflow_probability/python/distributions/mvn_diag_plus_low_rank_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...
378
14,478
wandb
wandb/integration/sklearn/calculate/calibration_curves.py
.py
from warnings import simplefilter import numpy as np import sklearn from sklearn import model_selection, naive_bayes from sklearn.calibration import CalibratedClassifierCV from sklearn.linear_model import LogisticRegression import wandb from wandb.integration.sklearn import utils # ignore all future warnings simplef...
127
3,863
hypercorn
src/hypercorn/app_wrappers.py
.py
from __future__ import annotations import sys from collections.abc import Callable from functools import partial from io import BytesIO from .typing import ( ASGIFramework, ASGIReceiveCallable, ASGISendCallable, HTTPScope, Scope, WSGIFramework, ) class InvalidPathError(Exception): pass ...
168
5,516
biopython
Tests/test_SearchIO_exonerate_text_index.py
.py
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for SearchIO exonerate-text indexing.""" import os import unittest from search_...
31
955
pyomo
pyomo/contrib/parmest/tests/test_examples.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...
212
7,073
onnxruntime
tools/python/wgsl_template/loader.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """PASS0: load template files from one or more source directories.""" from __future__ import annotations import os import re from collections.abc import Sequence from pathlib import Path from typing import Union from .error...
195
5,561
beam
sdks/python/apache_beam/io/gcp/pubsub_integration_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...
412
16,432
luigi
test/execution_summary_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2015-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...
1,141
37,958
sphinx
tests/roots/test-ext-autodoc/target/descriptor.py
.py
class CustomDataDescriptor: """Descriptor class docstring.""" def __init__(self, doc): self.__doc__ = doc def __get__(self, obj, type=None): if obj is None: return self return 42 def meth(self): """Function.""" return 'The Answer' class CustomData...
33
684
biopython
Bio/PopGen/__init__.py
.py
# Copyright 2007 by Tiago Antao. 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. """PopGen: Population Genet...
9
359
lemur
lemur/plugins/bases/issuer.py
.py
""" .. module: lemur.plugins.bases.issuer :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from lemur.plugins.base import Plugin class IssuerPlugin(Plugin): """ Thi...
37
962
probability
tensorflow_probability/python/distributions/mvn_tril_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...
620
24,456
astropy
astropy/wcs/wcs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Under the hood, there are 3 separate classes that perform different # parts of the transformation: # # - `~astropy.wcs.Wcsprm`: Is a direct wrapper of the core WCS # functionality in `wcslib`_. (This includes TPV and TPD # polynomial disto...
3,997
143,452
openvino
tests/layer_tests/pytorch_tests/test_cumsum.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestCumSum(PytorchLayerTest): def _prepare_input(self, out=False, out_dtype=None): x = self.random.randn(1, 3, 224, 224) if...
81
3,086
onnx
onnx/backend/test/case/node/lstm.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import Any import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class LSTMHelper: def __init__(self, **params: A...
416
12,445
saleor
saleor/tests/e2e/conftest.py
.py
import json import pytest from django.core.serializers.json import DjangoJSONEncoder from django.test import TestCase from django.test.client import MULTIPART_CONTENT, Client from ...account.tests.fixtures.user import dangerously_create_test_user from ...app.models import App from ...graphql.tests.fixtures import Bas...
98
2,627
saleor
saleor/graphql/account/tests/queries/test_address_validation_rules.py
.py
import re from ....tests.utils import assert_graphql_error_with_message, get_graphql_content GET_ADDRESS_VALIDATION_RULES_QUERY = """ query getValidator( $country_code: CountryCode!, $country_area: String, $city_area: String) { addressValidationRules( countryCode: $country_code, ...
150
4,731
saleor
saleor/graphql/product/tests/queries/products_filtrations/test_over_attributes_date.py
.py
import datetime import pytest from ......attribute import AttributeInputType, AttributeType from ......attribute.models import Attribute from ......attribute.utils import associate_attribute_values_to_instance from .....tests.utils import get_graphql_content from .shared import PRODUCTS_FILTER_QUERY, PRODUCTS_WHERE_Q...
103
3,233
saleor
saleor/plugins/webhook/tests/test_app_lifecycle_webhooks.py
.py
"""End-to-end tests for app lifecycle webhook self-receive. Confirms an app without MANAGE_APPS permission receives its own APP_INSTALLED, APP_UPDATED, APP_DELETED, APP_STATUS_CHANGED events, and that the delivery-time gate keeps lifecycle deliveries when the receiving app is inactive (soft-deleted or deactivated). ""...
277
9,112
wandb
wandb/sdk/artifacts/storage_handlers/multi_handler.py
.py
"""Multi storage handler.""" from __future__ import annotations from typing import TYPE_CHECKING from urllib.parse import urlparse from wandb.sdk.artifacts.storage_handler import StorageHandler, _BaseStorageHandler from wandb.sdk.lib.paths import FilePathStr, URIStr if TYPE_CHECKING: from wandb.sdk.artifacts.ar...
58
1,898
textual
tests/tree/test_tree_expand_etc.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.widgets import Tree class TreeApp(App[None]): """Test tree app.""" def compose(self) -> ComposeResult: yield Tree("Test") def on_mount(self) -> None: tree = self.query_one(Tree) for n in r...
107
4,824
onnxruntime
onnxruntime/test/testdata/transform/model_parallel/mlp_megatron_basic_test.py
.py
import numpy as np import onnx from onnx import OperatorSetIdProto, TensorProto, helper, numpy_helper hidden_size = 4 weight_dim_to_split = 16 X = helper.make_tensor_value_info("input", TensorProto.FLOAT, ["batch", "seqlen", hidden_size]) Y = helper.make_tensor_value_info("output", TensorProto.FLOAT, ["batch", "seqle...
102
3,044
metrics
tests/unittests/retrieval/test_precision_recall_curve.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...
189
6,536
jupytext
tests/functional/others/test_hide_remove_input_outputs_rmarkdown.py
.py
import pytest import jupytext from jupytext.compare import compare, compare_notebooks @pytest.mark.parametrize( "md,rmd", [ ('tags=["remove_cell"]', "include=FALSE"), ('tags=["remove_output"]', "results='hide'"), ('tags=["remove_output"]', 'results="hide"'), ('tags=["remove_in...
89
1,947
owasp-mstg
src/scripts/combine_data_for_checklist.py
.py
import yaml import os import glob import re import requests MASVS = None def retrieve_masvs(version="latest"): global MASVS url = f"https://github.com/OWASP/masvs/releases/{version}/download/OWASP_MASVS.yaml" response = requests.get(url) content = response.content MASVS = yaml.safe_load(content) ...
111
3,681
deap
examples/ga/knn.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 ...
104
3,438
wandb
wandb/sdk/lib/runid.py
.py
"""runid util.""" import os import random import secrets from string import ascii_lowercase, digits _ID_CHARS = f"{ascii_lowercase}{digits}" # Create a dedicated Random instance with its own state so it # is not affected by global random.seed() calls _random = random.Random() # Reset the random number generator on...
39
1,407