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
coveragepy
tests/test_config.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 """Test the config file handling for coverage.py""" from __future__ import annotations import os import tempfile from pathlib import Path from unittest import ...
1,142
40,716
luigi
test/worker_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...
2,289
76,511
attrs
tests/test_dunders.py
.py
# SPDX-License-Identifier: MIT """ Tests for dunder methods from `attrib._make`. """ import copy import inspect import pickle import pytest from hypothesis import given from hypothesis.strategies import booleans import attr from attr._make import ( NOTHING, Factory, _add_repr, _compile_and_eval, ...
1,062
29,087
wandb
wandb/apis/public/users.py
.py
"""W&B Public API for managing users and API keys. This module provides classes for managing W&B users and their API keys. Note: This module is part of the W&B Public API and provides methods to manage users and their authentication. Some operations require admin privileges. """ from __future__ import annota...
177
5,756
hydra
examples/advanced/hydra_app_example/tests/test_example.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import unittest from typing import List from pytest import mark import hydra_app.main from hydra import compose, initialize, initialize_config_module # 1. initialize will add config_path the config search path within the context # 2. The module ...
63
2,691
hatch
src/hatch/utils/network.py
.py
from __future__ import annotations import time from contextlib import contextmanager from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from collections.abc import Generator import httpx2 from hatch.utils.fs import Path MINIMUM_SLEEP = 2 MAXIMUM_SLEEP = 20 # The timeout should be slightly larger t...
51
1,359
coveragepy
tests/modules/namespace_420/sub1/__init__.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 sub1 = "namespace_420 sub1"
5
186
cvxpy
cvxpy/nlp/__init__.py
.py
""" cvxpy.nlp — Namespace for NLP (nonlinear programming) atoms. These atoms require a solver that supports nlp=True (e.g. IPOPT, UNO). Example usage: import cvxpy as cp x = cp.Variable() prob = cp.Problem(cp.Minimize(cp.nlp.sin(x)), [x >= 0]) prob.solve(nlp=True) """ from cvxpy.atoms.elementwise.hyp...
21
558
wagtail
wagtail/admin/tests/test_dbwhitelister.py
.py
from django.test import TestCase from wagtail.admin.rich_text.converters.editor_html import EditorHTMLConverter from wagtail.test.utils import WagtailTestUtils class TestDbWhitelisterMethods(WagtailTestUtils, TestCase): def setUp(self): self.whitelister = EditorHTMLConverter().whitelister def test_c...
136
5,986
hydra
hydra/core/config_store.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import copy from dataclasses import dataclass from typing import Any, Dict, List, Optional from omegaconf import DictConfig, OmegaConf from hydra.core.object_type import ObjectType from hydra.core.singleton import Singleton from hydra.plugins.conf...
155
4,729
pyro
tests/infer/test_tmc.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import math import pytest import torch from torch.autograd import grad from torch.distributions import constraints import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.distribution...
299
10,256
mlflow
mlflow/store/artifact/databricks_logged_model_artifact_repo.py
.py
import re from mlflow.store.artifact.databricks_tracking_artifact_repo import ( DatabricksTrackingArtifactRepository, ) class DatabricksLoggedModelArtifactRepository(DatabricksTrackingArtifactRepository): """ Artifact repository for interacting with logged model artifacts in a Databricks workspace. I...
37
1,453
coremltools
coremltools/test/api/test_api_visibilities.py
.py
# Copyright (c) 2021, 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 re import coremltools as ct def _get_visible_items(d): return [x for x in dir(d) if not x...
358
11,333
saleor
saleor/tests/__init__.py
.py
import pytest # We want to have PyTest assert introspection in the API tests pytest.register_assert_rewrite("saleor.tests.e2e")
5
129
wagtail
wagtail/admin/views/dismissibles.py
.py
import json from django.http import HttpResponseBadRequest, JsonResponse from django.views import View from wagtail.users.models import UserProfile class DismissiblesView(View): def get(self, request, *args, **kwargs): # The UserProfile may not exist for the user, in which case return an empty object ...
27
930
rich-cli
src/rich_cli/win_vt.py
.py
""" A decorator to enable windows virtual terminal processing, which allows terminals to use the ansi control codes for color supported by Linux / MacOS. """ __all__ = ["enable_windows_virtual_terminal_processing"] from contextlib import contextmanager import ctypes import platform WINDOWS = platform.system() == "...
62
1,779
onnx
onnx/reference/ops/op_relu.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class Relu(OpRunUnaryNum): def _run(self, x): return (np.maximum(x, 0).astype(x.dtype),)
14
289
pyomo
doc/OnlineDocs/conf.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...
455
15,982
astropy
astropy/time/tests/test_fast_parser.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import re import numpy as np import pytest from astropy.time import Time, TimeYearDayTime, _parse_times, conf iso_times = [ "2000-02-29", "1981-12-31 12:13", "1981-12-31 12:13:14", "2020-12-31 12:13:14.56", ] isot_times = [re.sub(" ", "...
167
6,368
wandb
wandb/errors/warnings.py
.py
class WandbWarning(Warning): """Base W&B Warning."""
3
57
cvxpy
cvxpy/problems/problem.py
.py
""" Copyright 2013 Steven Diamond, 2017 Akshay Agrawal 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...
1,656
65,460
black
tests/data/cases/docstring2.py
.py
def docstring_almost_at_line_limit(): """long docstring................................................................. """ def docstring_almost_at_line_limit_with_prefix(): f"""long docstring................................................................ """ def mulitline_docstring_almost_at_line...
105
3,518
astropy
astropy/modeling/tests/test_quantities_evaluation.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to evaluating models with quantity parameters """ import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.modeling.core import Model from astropy.modeling.models import...
447
12,460
clearml
clearml/backend_api/session/datamodel.py
.py
import keyword import enum import json from datetime import datetime from typing import Callable, Dict, Optional, Collection, Any import jsonschema from enum import Enum def format_date(obj: datetime) -> str: if isinstance(obj, datetime): return str(obj) class SchemaProperty(property): def __init_...
179
5,618
cvxpy
cvxpy/atoms/elementwise/rel_entr.py
.py
""" Copyright 2021 The 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, so...
102
3,003
pyomo
pyomo/contrib/satsolver/satsolver.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...
311
11,678
saleor
saleor/graphql/giftcard/mutations/gift_card_delete.py
.py
import graphene from ....giftcard import models from ....permission.enums import GiftcardPermissions from ....webhook.event_types import WebhookEventAsyncType from ...core import ResolveInfo from ...core.mutations import ModelDeleteMutation from ...core.types import GiftCardError from ...core.utils import WebhookEvent...
36
1,262
wagtail
wagtail/api/v3/routers/sites.py
.py
from django.http import HttpRequest from django.shortcuts import get_object_or_404 from ninja import Router, Status from ninja.pagination import paginate from wagtail.actions.create import CreateAction from wagtail.actions.delete import DeleteAction from wagtail.actions.edit import EditAction from wagtail.api.v3.auth ...
97
2,839
metrics
tests/unittests/deprecations/root_class_imports.py
.py
"""Test that domain metric with import from root raises deprecation warning.""" from functools import partial import pytest from torchmetrics import ( BLEUScore, CharErrorRate, CHRFScore, ErrorRelativeGlobalDimensionlessSynthesis, ExtendedEditDistance, MatchErrorRate, ModifiedPanopticQual...
106
2,965
pymc
pymc/sampling/parallel.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...
603
20,237
beam
sdks/python/apache_beam/runners/portability/local_job_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...
492
17,884
black
src/black/mode.py
.py
"""Data structures configuring Black behavior. Mostly around Python language feature support per version and Black configuration chosen by the user. """ from dataclasses import dataclass, field from enum import Enum, auto from hashlib import sha256 from operator import attrgetter from typing import Final from black....
356
11,456
mlflow
mlflow/tracking/request_header/databricks_request_header_provider.py
.py
from mlflow.tracking.request_header.abstract_request_header_provider import RequestHeaderProvider from mlflow.utils import databricks_utils class DatabricksRequestHeaderProvider(RequestHeaderProvider): """ Provides request headers indicating the type of Databricks environment from which a request was made...
36
1,486
kafka
committer-tools/verify_license.py
.py
#!/usr/bin/env python3 # -*- 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 Licens...
151
5,703
readthedocs.org
readthedocs/api/v3/tests/test_subprojects.py
.py
from django.test import override_settings from django.urls import reverse from readthedocs.projects.constants import PRIVATE from readthedocs.projects.models import Feature, Project from django_dynamic_fixture import get from .mixins import APIEndpointMixin @override_settings( RTD_ALLOW_ORGANIZATIONS=False, ...
446
16,842
sqlmap
lib/utils/brute.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 division import time from lib.core.common import Backend from lib.core.common import clearConsoleLine from lib.core.common import dataToStdout from lib.co...
413
16,497
pyro
pyro/contrib/timeseries/gp.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch import torch.nn as nn from torch.distributions import MultivariateNormal, constraints import pyro.distributions as dist from pyro.contrib.timeseries.base import TimeSeriesModel from pyro.nn import PyroPar...
569
23,486
pyomo
pyomo/core/tests/unit/test_visitor.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...
2,020
63,564
lemur
lemur/plugins/lemur_email/tests/test_email.py
.py
import os from collections import defaultdict from datetime import timedelta import arrow from moto import mock_ses from lemur.certificates.schemas import certificate_notification_output_schema from lemur.plugins.lemur_email.plugin import render_html from lemur.tests.factories import CertificateFactory, EndpointFacto...
252
10,691
metrics
src/torchmetrics/text/_deprecated.py
.py
from collections.abc import Sequence from typing import Any, Literal, Optional from torchmetrics.text.bleu import BLEUScore from torchmetrics.text.cer import CharErrorRate from torchmetrics.text.chrf import CHRFScore from torchmetrics.text.eed import ExtendedEditDistance from torchmetrics.text.mer import MatchErrorRat...
286
8,229
conda
tests/plugins/subcommands/doctor/health_checks/test_altered_files.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tests for the altered files health check. Note: env_ok, env_altered_files fixtures are defined in tests/plugins/subcommands/conftest.py and shared with health fix tests. """ from __future__ import annotations import json from typing import...
85
2,836
mlflow
mlflow/entities/mcp_access_endpoint.py
.py
from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any from mlflow.entities.mcp_server import MCPRemoteTransportType from mlflow.exceptions import MlflowException from mlflow.utils.annotations import experimental from mlflow.utils.workspace_utils import resol...
72
2,782
textual
tests/css/test_nested_css.py
.py
from __future__ import annotations import pytest from textual.app import App, ComposeResult from textual.color import Color from textual.containers import Vertical from textual.css.parse import parse from textual.css.tokenizer import TokenError, UnexpectedEnd from textual.widgets import Button, Label class NestedAp...
186
5,622
beam
sdks/python/apache_beam/internal/module_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...
123
2,664
sphinx
tests/test_builders/test_build_latex.py
.py
"""Test the build process with LaTeX builder with the test root.""" from __future__ import annotations import http.server import os import re import subprocess from contextlib import chdir from pathlib import Path from shutil import copyfile from subprocess import CalledProcessError from types import NoneType from ty...
2,326
82,814
gunicorn
tests/requests/valid/100.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "GET", "uri": uri("///keeping_slashes"), "version": (1, 1), "headers": [], "body": b"" }
12
237
onnx
onnx/backend/test/case/node/size.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 Size(Base): @staticmethod def export() -> None: node =...
36
843
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_should_be_able_to_remove_voucher_code_from_checkout.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
181
5,779
saleor
saleor/product/tests/test_fetch_variants_for_promotion_rules.py
.py
from decimal import Decimal import graphene from ...discount import RewardValueType from ...discount.models import PromotionRule from ...discount.utils.promotion import update_rule_variant_relation from ...tests import race_condition from ..utils.variants import fetch_variants_for_promotion_rules def test_fetch_var...
180
5,437
probability
tensorflow_probability/python/experimental/linalg/__init__.py
.py
# Copyright 2019 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...
80
3,234
mlflow
tests/autologging/test_autologging_safety_unit.py
.py
import abc import copy import inspect from contextlib import nullcontext as does_not_raise from typing import Any, NamedTuple from unittest import mock import pytest import mlflow from mlflow import MlflowClient from mlflow.entities import RunStatus from mlflow.utils import autologging_utils from mlflow.utils.autolog...
1,686
56,729
readthedocs.org
readthedocs/api/v2/views/core_views.py
.py
"""Utility endpoints relating to canonical urls, embedded content, etc.""" from django.shortcuts import get_object_or_404 from rest_framework import decorators from rest_framework import permissions from rest_framework import status from rest_framework.renderers import JSONRenderer from rest_framework.response import ...
76
2,271
wandb
tests/system_tests/test_launch/test_launch_sweep.py
.py
import json import wandb from wandb.apis.public import Api as PublicApi from wandb.cli import cli from wandb.sdk.launch.sweeps.scheduler import Scheduler from wandb.sdk.launch.utils import LAUNCH_DEFAULT_PROJECT, construct_launch_spec def test_sweeps_on_launch( use_local_wandb_backend, user, monkeypatch,...
187
5,412
saleor
saleor/graphql/core/tests/test_federation.py
.py
import graphene import pytest from ...tests.utils import get_graphql_content @pytest.fixture def user_representation_by_id(staff_user): user_id = graphene.Node.to_global_id("User", staff_user.id) return {"_representations": [{"id": user_id, "__typename": "User"}]} @pytest.fixture def user_representation_by...
51
1,476
pyro
pyro/contrib/funsor/infer/elbo.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pyro.ops.jit from pyro.infer import ELBO as _OrigELBO from pyro.util import ignore_jit_warnings class ELBO(_OrigELBO): def _get_trace(self, *args, **kwargs): raise ValueError("shouldn't be here!") def differen...
46
1,652
mlflow
mlflow/entities/dataset.py
.py
from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.service_pb2 import Dataset as ProtoDataset class Dataset(_MlflowObject): """Dataset object associated with an experiment.""" def __init__( self, name: str, digest: str, source_type: str, source...
91
2,432
readthedocs.org
readthedocs/search/models.py
.py
"""Search Queries.""" from django.db import models from django.db.models import Count from django.db.models.functions import TruncDate from django.utils import timezone from django.utils.translation import gettext_lazy as _ from django_extensions.db.models import TimeStampedModel from readthedocs.builds.models import...
97
3,031
wagtail
wagtail/images/models.py
.py
from __future__ import annotations import concurrent.futures import hashlib import itertools import logging import os.path import re import time from collections import OrderedDict, defaultdict, namedtuple from collections.abc import Iterable from contextlib import contextmanager from io import BytesIO from tempfile i...
1,550
57,166
wandb
tests/system_tests/test_functional/asyncio_manager_run/test_asyncio_manager_run.py
.py
import pathlib import signal import subprocess import time def test_interrupt_join(): script = pathlib.Path(__file__).parent / "interrupt_join.py" proc = subprocess.Popen( ["python", str(script)], stdout=subprocess.PIPE, ) assert proc.stdout # Wait for the process's main thread to...
53
1,572
mlflow
examples/demos/mlflow-3/genai.py
.py
# MLflow 3 GenAI Example # In this example, we will create an agent and then evaluate its performance. First, we will define the agent and log it to MLflow. from langchain_core.prompts import ChatPromptTemplate from langchain_openai import ChatOpenAI import mlflow # Define the chain chat_model = ChatOpenAI(name="gpt...
47
1,955
beam
sdks/python/apache_beam/examples/snippets/util_test.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");...
104
3,224
cvxpy
cvxpy/expressions/constants/constant.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...
294
9,659
sphinx
tests/roots/test-local-logo/conf.py
.py
latex_documents = [ ( 'index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report', ) ] html_logo = 'images/img.png'
11
190
gunicorn
examples/test.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # # Example code from Eventlet sources from wsgiref.validate import validator from gunicorn import __version__ @validator def app(environ, start_response): """Simplest possible application object""" dat...
27
637
openvino
tests/e2e_tests/common/common/common_base_class.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import re from copy import deepcopy from pathlib import Path from tempfile import TemporaryDirectory from logging import getLogger import numpy as np import pytest from e2e_tests.test_utils.path_utils import resolve_file_path...
211
9,553
beam
sdks/python/apache_beam/ml/rag/embeddings/base_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...
131
4,600
luigi
luigi/mock.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...
183
5,679
saleor
saleor/graphql/translations/types.py
.py
from itertools import chain from typing import TypeVar import graphene from django.conf import settings from django.db.models import Model from ...attribute import AttributeInputType from ...attribute import models as attribute_models from ...attribute.models import AttributeValue from ...discount import models as di...
1,101
42,693
biopython
Doc/examples/ACT_example.py
.py
# 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. # """Example of using GenomeDiagram cross-links to mimic ACT.""" import os import sys from reportlab.lib import colors from reportlab.lib.units impor...
133
4,467
scikit-bio
skbio/io/format/tests/test_lsmat.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
337
12,432
pynacl
src/nacl/pwhash/argon2id.py
.py
# Copyright 2013 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...
136
4,434
pymc
scripts/generate_pip_deps_from_conda.py
.py
# BSD 3-Clause License # Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team # All rights reserved. # Copyright (c) 2011-2020, Open source contributors. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
142
4,580
sqlmap
tests/test_timeless.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Coverage for the HTTP/2 timeless-timing oracle in lib/request/timeless.py: the sequential decision engine that turns response-order votes into bits, the pair transport's replay-safety...
436
20,285
beam
sdks/python/apache_beam/runners/portability/portable_runner.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...
617
23,742
openvino
tests/layer_tests/onnx_tests/test_sigmoid.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model fro...
201
6,862
pyomo
pyomo/repn/tests/ampl/small8_testCase.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...
65
1,735
wagtail
wagtail/test/testapp/urls.py
.py
from django.urls import path from wagtail.test.testapp import views urlpatterns = [ path("bob-only-zone", views.bob_only_zone, name="testapp_bob_only_zone"), path("messages/", views.message_test, name="testapp_message_test"), path("test-index/", views.TestIndexView.as_view(), name="testapp_generic_index")...
24
805
pyro
pyro/infer/reparam/unit_jacobian.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from contextlib import ExitStack from torch.distributions import biject_to from torch.distributions.transforms import ComposeTransform import pyro import pyro.distributions as dist from pyro.poutine.plate_messenger import block_plate...
103
3,913
deap
doc/code/benchmarks/rastrigin.py
.py
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.pyplot as plt try: import numpy as np except: exit() from deap import benchmarks def rastrigin_arg0(sol): return benchmarks.rastrigin(sol)[0] fig = plt.figure() ax = Axes3D(fig, azim = -29, elev = 50) X = np.arange(-5, 5...
27
614
luigi
examples/foo_complex.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...
77
1,877
wandb
tests/system_tests/test_functional/metaflow/flow_decoclass.py
.py
"""Test Metaflow Flow integration""" import os import pathlib import pandas as pd import wandb from metaflow import FlowSpec, Parameter, step from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from wandb.integration.metaf...
58
1,665
saleor
saleor/graphql/core/validators/tests/test_mutation_count_limit.py
.py
import pytest from .....core.telemetry import Scope, Unit from .....tests.utils import get_metric_data from ....api import backend, schema from ....metrics import METRIC_GRAPHQL_MUTATION_COUNT from ....views import GraphQLView @pytest.mark.parametrize( ("_case", "is_valid", "query"), [ ( ...
156
4,884
wandb
tests/fixtures/emulated_terminal.py
.py
from __future__ import annotations from itertools import takewhile import pyte import pyte.modes import pytest from wandb.errors import term @pytest.fixture def emulated_terminal( monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], ) -> EmulatedTerminal: """Emulates a terminal for the d...
113
3,670
eve
tests/test_logging.py
.py
from testfixtures import log_capture from . import TestBase class TestUtils(TestBase): """collection, document and home_link methods (and resource_uri, which is used by all of them) are tested in 'tests.methods' since we need an active flaskapp context """ @log_capture() def test_logging_inf...
22
651
pyomo
doc/OnlineDocs/src/expr/quicksum.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...
37
1,195
textual
examples/calculator.py
.py
""" An implementation of a classic calculator, with a layout inspired by macOS calculator. Works like a real calculator. Click the buttons or press the equivalent keys. """ from decimal import Decimal from textual import events, on from textual.app import App, ComposeResult from textual.containers import Container f...
172
5,930
wagtail
wagtail/contrib/settings/tests/generic/test_templates.py
.py
from django.template import Context, RequestContext, Template, engines from django.test import TestCase from django.test.utils import override_settings from wagtail.coreutils import get_dummy_request from wagtail.models import Site from wagtail.test.utils import WagtailTestUtils from .base import GenericSettingsTestM...
198
7,250
openvino
src/bindings/python/src/openvino/frontend/tensorflow/utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # flake8: noqa # mypy: ignore-errors import logging as log import numpy as np import sys from openvino import PartialShape, Dimension, Type from packaging.version import parse, Version from typing import Union # TODO: reuse this meth...
499
21,867
pyfilesystem2
tests/test_path.py
.py
from __future__ import absolute_import, print_function, unicode_literals """ fstests.test_path: testcases for the fs path functions """ import unittest from fs.path import ( abspath, basename, combine, dirname, forcedir, frombase, isabs, isbase, isdotfile, isparent, i...
227
7,655
onnxruntime
onnxruntime/python/tools/transformers/fusion_attention_sam2.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger import numpy as np from fusion_base impor...
534
20,774
wandb
tests/system_tests/test_core/test_wandb_clean_full.py
.py
import os import pytest import wandb from click.testing import CliRunner from wandb.cli import cli from wandb.cli.clean import clean @pytest.mark.usefixtures("user") # for syncing and the online run def test_cleans_expected_runs(runner: CliRunner): """An integration test for wandb clean, wandb sync and online l...
30
980
probability
tensorflow_probability/python/experimental/sts_gibbs/dynamic_spike_and_slab_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...
338
14,505
scikit-bio
skbio/stats/tests/test_misc.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
58
1,784
black
tests/data/cases/fmtskip_after_bracket_with_comment.py
.py
# A `# fmt: skip` on a line that opens a bracket, combined with a standalone # comment among the bracket's contents, used to crash inside # `is_line_short_enough` with `AttributeError: 'Leaf' object has no attribute # 'bracket_depth'`. The whole statement should now be left untouched. from m import ( # fmt: skip #...
28
465
pyomo
scripts/performance/expr_perf.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,337
45,147
saleor
saleor/graphql/attribute/mutations/attribute_delete.py
.py
import graphene from django.db import transaction from django.db.models import Exists, OuterRef from ....attribute import models as models from ....attribute.lock_objects import attribute_value_qs_select_for_update from ....page import models as page_models from ....page.utils import mark_pages_search_vector_as_dirty_...
119
4,985
sqlmap
lib/core/dump.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import hashlib import json import os import re import shutil import tempfile import threading from lib.core.common import Backend from lib.core.common import checkFile from lib.c...
799
34,074
coremltools
coremltools/models/ml_program/experimental/model_structure_path.py
.py
# Copyright (c) 2025, 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.abc import Mapping as _Mapping from collections.abc import Sequence as _Sequence from d...
399
14,270
probability
tensorflow_probability/python/experimental/auto_batching/stack_optimization.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...
80
3,408
sphinx
sphinx/search/zh.py
.py
"""Chinese search language: includes routine to split words.""" from __future__ import annotations import re from pathlib import Path from typing import TYPE_CHECKING import snowballstemmer from sphinx.search import SearchLanguage from sphinx.search._stopwords.en import ENGLISH_STOPWORDS if TYPE_CHECKING: from...
77
2,285