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
scikit-bio
skbio/stats/composition/_ancombc.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. # --------------------------------------------...
1,126
46,702
luigi
luigi/mypy.py
.py
"""Plugin that provides support for luigi.Task This Code reuses the code from mypy.plugins.dataclasses https://github.com/python/mypy/blob/0753e2a82dad35034e000609b6e8daa37238bfaa/mypy/plugins/dataclasses.py """ from __future__ import annotations from typing import Callable, Dict, Final, Iterator, List, Literal, Opt...
506
20,313
mkdocs
mkdocs/utils/yaml.py
.py
from __future__ import annotations import functools import logging import os import os.path from typing import IO, TYPE_CHECKING, Any import mergedeep # type: ignore import yaml import yaml.constructor import yaml_env_tag # type: ignore from mkdocs import exceptions if TYPE_CHECKING: from mkdocs.config.defaul...
151
5,108
sqlmap
plugins/dbms/frontbase/filesystem.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.filesystem import Filesystem as GenericFilesystem class Filesystem(GenericFilesystem): d...
19
676
probability
tensorflow_probability/python/sts/forecast.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...
546
24,494
sqlmap
lib/techniques/blind/inference.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 difflib import heapq import re import time from lib.core.agent import agent from lib.core.common import Backend from lib.core.common impor...
1,308
70,697
pyro
tests/infer/test_conjugate_gradients.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pyro from pyro.infer.tracegraph_elbo import TraceGraph_ELBO from tests.common import assert_equal from tests.integration_tests.test_conjugate_gaussian_models import GaussianChain class ConjugateChainGradientTests(GaussianC...
44
1,616
onnx
onnx/reference/ops/_op_list.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 """Every class imported in this module defines an implementation of an operator of the main domain. Any class name uses `_` to specify a version defined in a specific opset. The class name without `_` defines the current implementation. If...
630
21,806
pynacl
tests/test_bindings.py
.py
# Copyright 2013-2018 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 applicabl...
1,022
31,086
pyomo
pyomo/contrib/pynumero/examples/external_grey_box/react_example/reactor_model_residuals.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...
498
17,680
pyomo
examples/pyomobook/nonlinear-ch/rosen/rosenbrock.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...
28
995
pyomo
doc/OnlineDocs/src/data/set1.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...
23
874
coremltools
coremltools/converters/xgboost/_tree_ensemble.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 copy import deepcopy import numpy as _np from ..._deps import _HAS_XGBOOST from ...models.tree_en...
348
11,931
pyro
pyro/contrib/oed/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """Tasks such as choosing the next question to ask in a psychology study, designing an election polling strategy, and deciding which compounds to synthesize and test in biological sciences are all fundamentally asking the same ques...
73
3,789
hypercorn
src/hypercorn/protocol/h2.py
.py
from __future__ import annotations from collections.abc import Awaitable, Callable import h2 import h2.connection import h2.events import h2.exceptions import priority from .events import ( Body, Data, EndBody, EndData, Event as StreamEvent, InformationalResponse, Request, Response, ...
401
15,592
openvino
src/bindings/python/tests/test_graph/test_node_factory.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from sys import platform from openvino import compile_model, Model from openvino import Extension import openvino.opset8 as ov from openvino.exceptions import UserInputError from o...
142
4,438
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/top_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");...
125
3,849
pyfilesystem2
fs/appfs.py
.py
"""Manage filesystems in platform-specific application directories. These classes abstract away the different requirements for user data across platforms, which vary in their conventions. They are all subclasses of `~fs.osfs.OSFS`. """ # Thanks to authors of https://pypi.org/project/appdirs # see http://technet.micr...
169
4,335
probability
tensorflow_probability/python/experimental/psd_kernels/feature_scaled_with_categorical.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...
306
13,268
pyfilesystem2
fs/_typing.py
.py
""" Typing objects missing from Python3.5.1 """ import sys import six _PY = sys.version_info from typing import overload # type: ignore if _PY.major == 3 and _PY.minor == 5 and _PY.micro in (0, 1): def overload(func): # pragma: no cover # noqa: F811 return func try: from typing import Text ex...
23
399
scikit-bio
skbio/stats/ordination/_principal_component_analysis.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. # --------------------------------------------...
258
10,438
gunicorn
benchmarks/dirty_streaming.py
.py
#!/usr/bin/env python # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Benchmark suite for dirty worker streaming functionality. This script benchmarks the streaming performance of dirty workers to measure throughput, latency, and memory usage. Usage: p...
756
23,176
probability
spinoffs/inference_gym/inference_gym/using_jax.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...
24
819
gunicorn
tests/treq.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # Copyright 2009 Paul J. Davis <paul.joseph.davis@gmail.com> # # This file is part of the pywebmachine package released # under the MIT license. import inspect import importlib.machinery import os import random im...
331
11,321
conda
conda/auxlib/compat.py
.py
from collections import OrderedDict as odict # noqa: F401 import os from shlex import split from ..deprecations import deprecated @deprecated("26.3", "26.9", addendum="Use `conda.common.compat.isiterable` instead.") def isiterable(obj): # and not a string from collections.abc import Iterable return not ...
44
1,352
sqlmap
lib/utils/progress.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 dataToStdout from lib.core.convert import getUnicode from lib.core.data import conf from lib.core.data im...
134
5,042
wagtail
wagtail/admin/tests/pages/test_delete_page.py
.py
from unittest import mock from django.contrib.auth.models import Permission from django.db.models.signals import post_delete, pre_delete from django.http import HttpRequest, HttpResponse from django.test import TestCase, override_settings from django.urls import reverse from wagtail.signals import page_unpublished fr...
396
16,338
metrics
src/torchmetrics/functional/text/cer.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...
88
2,970
sqlmap
tamper/chardoubleencode.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import string from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOWEST def dependencies(): pass def tamper(payload, **kwargs): """ Double URL-encodes eac...
43
1,214
coremltools
coremltools/optimize/coreml/_quantization_passes.py
.py
# Copyright (c) 2023, 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 atexit from itertools import repeat from multiprocessing import Pool from typing import Callable,...
1,747
73,588
coveragepy
coverage/collector.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 """Raw data collector for coverage.py.""" from __future__ import annotations import contextlib import functools import os import sys from collections.abc import...
499
19,141
textual
examples/pride.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class PrideApp(App): """Displays a pride flag.""" COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] def compose(self) -> ComposeResult: for color in self.COLORS: stripe = Static() ...
20
469
black
tests/data/cases/preview_cantfit_string.py
.py
# flags: --unstable # long arguments normal_name = normal_function_name( "but with super long string arguments that on their own exceed the line limit so there's no way it can ever fit", "eggs with spam and eggs and spam with eggs with spam and eggs and spam with eggs with spam and eggs and spam with eggs", ...
19
829
openvino
tests/layer_tests/pytorch_tests/test_rsub.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestRsub(PytorchLayerTest): def _prepare_input(self): return self.input_data def create_model(self, second_type...
112
3,804
confluent-kafka-python
tests/schema_registry/data/proto/newwidget_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: newwidget.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol...
29
1,110
pyomo
examples/pyomobook/pyomo-components-ch/con_declaration.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...
98
2,303
beam
sdks/python/apache_beam/io/concat_source_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...
248
9,400
django-cms
cms/test_utils/project/app_with_cms_feature_and_config/cms_config.py
.py
from cms.app_base import CMSAppConfig, CMSAppExtension class CMSConfig(CMSAppConfig): app_with_cms_feature_enabled = False class CMSExtension(CMSAppExtension): def configure_app(self, cms_config): pass
12
223
scikit-bio
skbio/binaries/_ordination.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2025--, 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. # --------------------------------------------...
202
8,317
eve
tests/suite_generator.py
.py
from datetime import datetime class EmbeddedDoc: def __init__(self, _id): self._id = _id self._created = datetime.utcnow()
8
145
probability
tensorflow_probability/python/bijectors/fill_scale_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...
63
2,352
onnxruntime
onnxruntime/python/tools/transformers/fusion_conformer_attention.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging from fusion_attention import AttentionMask, FusionAttent...
298
11,705
wagtail
wagtail/query.py
.py
import posixpath import warnings from collections import defaultdict from collections.abc import Iterable from typing import Any from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.db.models import CharField, Prefetch, Q from django.db.models.expressions import Exists, O...
781
30,892
python-prompt-toolkit
examples/full-screen/hello-world.py
.py
#!/usr/bin/env python """ A simple example of a a text area displaying "Hello World!". """ from prompt_toolkit.application import Application from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout import Layout from prompt_toolkit.widgets import Box, Frame, TextArea # Layout for displaying hell...
45
937
probability
spinoffs/inference_gym/inference_gym/targets/probit_regression_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...
123
4,324
biopython
Scripts/GenBank/check_output.py
.py
#!/usr/bin/env python # Copyright 2000 Brad Chapman. 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. """Check for the ability to read and write identical GenBank records. This...
98
2,832
pyomo
pyomo/contrib/interior_point/tests/test_reg.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...
151
5,292
python-prompt-toolkit
tests/test_async_generator.py
.py
from __future__ import annotations from asyncio import run from prompt_toolkit.eventloop import generator_to_async_generator def _sync_generator(): yield 1 yield 10 def test_generator_to_async_generator(): """ Test conversion of sync to async generator. This should run the synchronous parts in...
29
658
coremltools
coremltools/converters/mil/mil/passes/tests/test_pass_pipeline.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np import pytest from coremltools.converters.mil.mil import Builder as mb from corem...
127
5,566
wagtail
wagtail/admin/rich_text/__init__.py
.py
from django.conf import settings from django.utils.module_loading import import_string from wagtail.admin.rich_text.editors.draftail import DraftailRichTextArea # NOQA: F401 DEFAULT_RICH_TEXT_EDITORS = { "default": {"WIDGET": "wagtail.admin.rich_text.DraftailRichTextArea"} } def get_rich_text_editor_widget(nam...
33
965
django-cms
cms/tests/test_placeholder_operation_signals.py
.py
from cms.api import add_plugin from cms.models import Placeholder, UserSettings from cms.operations import ( ADD_PLUGIN, ADD_PLUGINS_FROM_PLACEHOLDER, CHANGE_PLUGIN, CLEAR_PLACEHOLDER, CUT_PLUGIN, DELETE_PLUGIN, MOVE_PLUGIN, PASTE_PLACEHOLDER, PASTE_PLUGIN, ) from cms.signals import ...
706
30,998
cvxpy
cvxpy/expressions/cvxtypes.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...
173
3,433
sqlmap
lib/utils/api.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from __future__ import print_function import contextlib import logging import os import re import shlex import socket import sqlite3 import sys import tem...
1,134
45,030
luigi
luigi/date_interval.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...
266
8,608
saleor
saleor/graphql/checkout/tests/deprecated/test_customer_detach_mutation.py
.py
import graphene from .....checkout.error_codes import CheckoutErrorCode from ....tests.utils import get_graphql_content MUTATION_CHECKOUT_CUSTOMER_DETACH = """ mutation checkoutCustomerDetach($checkoutId: ID, $token: UUID) { checkoutCustomerDetach(checkoutId: $checkoutId, token: $token) { chec...
98
3,186
mlflow
tests/deployments/test_utils.py
.py
import pytest from mlflow.deployments.utils import ( get_deployments_target, set_deployments_target, ) from mlflow.exceptions import MlflowException def test_set_deployments_target(monkeypatch): monkeypatch.setattr("mlflow.deployments.utils._deployments_target", None) valid_target = "databricks" ...
42
1,362
sqlmap
tests/test_brotli.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Tests for the dependency-free Brotli (RFC 7932) decompressor under lib/utils/brotli.py, and its wiring into lib/request/basic.py::decodePage. The compressed fixtures were produced by ...
121
5,314
biopython
Scripts/SeqGui/SeqGui.py
.py
# Copyright 2000 by Katharine Lindner (Cayte). # Copyright 2016 by Markus Piotrowski. # 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. # # The original SeqGui was written by Kath...
183
6,244
gunicorn
tests/docker/uwsgi/test_uwsgi_integration.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Integration tests for gunicorn's uWSGI binary protocol with nginx. These tests verify that gunicorn correctly implements the uWSGI binary protocol by running actual requests through nginx's uwsgi_pass directiv...
317
11,888
sqlmap
tests/test_xslt.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 XSLT injection engine (lib/techniques/xslt/inject.py) and the XQuery tier the XPath engine gained (lib/techniques/xpath/inject.py). Network-free: the payload builder...
314
16,225
sphinx
tests/test_environment/test_environment_toctree.py
.py
"""Test the sphinx.environment.adapters.toctree.""" from __future__ import annotations from typing import TYPE_CHECKING import docutils import pytest from docutils import nodes from docutils.nodes import bullet_list, list_item, literal, reference, title from sphinx import addnodes from sphinx.addnodes import compac...
1,105
34,108
probability
tensorflow_probability/python/layers/conv_variational_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...
744
30,627
wandb
wandb/automations/_generated/get_automations_legacy.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import PageInfoFields, ProjectTriggersFields class GetAutomationsLegacy(GQLResult): scope: GetAutomationsLegacyScope |...
34
877
pyro
examples/capture_recapture/cjs.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ We show how to implement several variants of the Cormack-Jolly-Seber (CJS) [4, 5, 6] model used in ecology to analyze animal capture-recapture data. For a discussion of these models see reference [1]. We make use of two datase...
387
14,374
metrics
src/torchmetrics/functional/classification/specificity.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...
395
18,562
pyomo
pyomo/contrib/mpc/modeling/terminal.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...
162
6,147
returns
tests/test_examples/test_your_container/test_pair4.py
.py
from abc import abstractmethod from collections.abc import Callable, Sequence from typing import ClassVar, Never, TypeVar, final from returns.contrib.hypothesis.laws import check_all_laws from returns.interfaces import bindable, equable, lashable, swappable from returns.primitives.asserts import assert_equal from retu...
250
7,318
pyomo
pyomo/common/pyomo_typing.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...
39
1,396
pyfilesystem2
tests/test_mountfs.py
.py
from __future__ import unicode_literals import unittest from fs.memoryfs import MemoryFS from fs.mountfs import MountError, MountFS from fs.tempfs import TempFS from fs.test import FSTestCases class TestMountFS(FSTestCases, unittest.TestCase): """Test OSFS implementation.""" def make_fs(self): fs =...
93
2,686
onnxruntime
tools/python/gen_opkernel_doc.py
.py
#!/usr/bin/env python # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import io # noqa: F401 import os import pathlib from collections import defaultdict import onnxruntime.capi.onnxruntime_pybind11_state as rtpy def format_version_range(v): if v[1]...
237
8,709
pymc
tests/variational/test_callbacks.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...
55
1,755
eve
eve/methods/post.py
.py
# -*- coding: utf-8 -*- """ eve.methods.post ~~~~~~~~~~~~~~~~ This module implements the POST method, supported by the resources endpoints. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from cerberus.validator import DocumentError from flask import ...
310
11,479
saleor
saleor/graphql/webhook/tests/queries/test_event_delivery_query.py
.py
import datetime import graphene from .....core import EventDeliveryStatus from .....core.models import EventDelivery from .....webhook.event_types import WebhookEventAsyncType from ....tests.utils import get_graphql_content EVENT_DELIVERY_QUERY = """ query webhook( $id: ID! $first: Int, $last: Int, $...
210
7,223
sqlmap
tests/test_generic_takeover.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Unit tests for the generic plugin mixins covering: * plugins/generic/custom.py - sqlQuery SELECT/non-query/stacked branches, the MSSQL FROM rewrite, METADB suffix stripping, ...
606
21,302
probability
tensorflow_probability/python/math/diag_jacobian_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...
116
4,868
saleor
saleor/shipping/tests/test_postal_codes.py
.py
from unittest.mock import Mock, patch import pytest from .. import PostalCodeRuleInclusionType from ..postal_codes import ( check_postal_code_in_range, is_shipping_method_applicable_for_postal_code, ) @pytest.mark.parametrize( ("code", "start", "end", "in_range"), [ ("BH3 2BC", "BH2 1AA", "B...
125
4,408
probability
discussion/robust_inverse_graphics/util/test_util_test.py
.py
# Copyright 2024 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
52
1,891
astropy
astropy/coordinates/tests/test_matrix_utilities.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal from astropy import units as u from astropy.coordinates import Angle, is_rotation_or_reflection, rotation_matrix from astropy.coordinates.matrix_utilities impor...
167
5,529
astropy
astropy/stats/setup_package.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os from numpy import get_include as get_numpy_include from setuptools import Extension ROOT = os.path.relpath(os.path.dirname(__file__)) SRCFILES = ["wirth_select.c", "compute_bounds.c", "fast_sigma_clip.c"] SRCFILES = [os.path.join(ROOT, "src", ...
27
795
kafka
tests/kafkatest/services/console_consumer.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 ...
322
15,823
saleor
saleor/tests/e2e/product/utils/collection_add_products.py
.py
from ...utils import get_graphql_content COLLECTION_ADD_PRODUCTS_MUTATION = """ mutation CollectionAssignProduct($id: ID!, $productIds: [ID!]!) { collectionAddProducts(collectionId: $id, products: $productIds) { errors { code message field } collection { id products(first: 5...
44
925
mlflow
dev/benchmarks/tracing/test_trace_perf.py
.py
import random from _data import generate_trace_data from pytest_benchmark.fixture import BenchmarkFixture import mlflow from mlflow.entities.span import SpanType from mlflow.store.tracking.sqlalchemy_store import SqlAlchemyStore DEFAULT_SPANS = 100 INGEST_ROUNDS = 20 INGEST_WARMUP = 3 def test_ingest(benchmark: Be...
132
3,923
openvino
src/bindings/python/src/openvino/frontend/pytorch/patch_functions.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import builtins import torch from typing import Any, Optional originals_map = { "divmod": builtins.divmod } def patched_divmod(lhs: Any, rhs: Any) -> tuple[Any, Any]: # TorchScript tracing outputs torch...
48
1,486
saleor
saleor/graphql/account/sorters.py
.py
from django.db.models import Count, QuerySet from ..core.doc_category import DOC_CATEGORY_USERS from ..core.types import BaseEnum, SortInputObjectType class UserSortField(BaseEnum): FIRST_NAME = ["first_name", "last_name", "pk"] LAST_NAME = ["last_name", "first_name", "pk"] EMAIL = ["email"] ORDER_CO...
88
2,836
probability
tensorflow_probability/python/distributions/truncated_normal_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...
635
24,173
pymc
pymc/distributions/timeseries.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...
1,040
38,860
sphinx
sphinx/search/ru.py
.py
"""Russian search language.""" from __future__ import annotations import snowballstemmer from sphinx.search import SearchLanguage from sphinx.search._stopwords.ru import RUSSIAN_STOPWORDS class SearchRussian(SearchLanguage): lang = 'ru' language_name = 'Russian' js_stemmer_rawcode = 'russian-stemmer.js...
23
596
wagtail
wagtail/tests/test_sites.py
.py
from django.core.exceptions import ValidationError from django.test import TestCase, override_settings from wagtail.coreutils import get_dummy_request from wagtail.models import Site from wagtail.test.utils import Page class TestSiteNaturalKey(TestCase): def test_natural_key(self): site = Site(hostname="...
291
11,474
coremltools
coremltools/optimize/torch/_utils/model_size_utils.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 import math import torch.nn from coremltools.optimize.torch._utils.metadata_utils import Compressio...
43
1,516
mlflow
tests/store/artifact/test_sftp_artifact_repo.py
.py
import os import posixpath import pytest import mlflow from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository from mlflow.store.artifact.sftp_artifact_repo import SFTPArtifactRepository from mlflow.utils.file_utils import TempDir pytestmark = pytest.mark.requires_ssh def test_artifa...
217
8,996
sphinx
sphinx/util/http_date.py
.py
"""Convert times to and from HTTP-date serialisations. Reference: https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1 """ from __future__ import annotations import time from email.utils import parsedate_tz _WEEKDAY_NAME = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun') _MONTH_NAME = ('', # Placeholder for ind...
46
1,508
mlflow
tests/gateway/schemas/test_completions.py
.py
import time import pydantic import pytest from mlflow.gateway.schemas import completions def test_completions_request(): completions.RequestPayload(**{"prompt": "prompt"}) completions.RequestPayload(**{"prompt": ""}) completions.RequestPayload(**{"prompt": "", "extra": "extra", "temperature": 2.0}) ...
136
3,773
probability
tensorflow_probability/python/mcmc/internal/util_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
463
17,066
deap
examples/gp/symbreg_harm.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 ...
93
3,371
openvino
src/common/conditional_compilation/scripts/ccheader.py
.py
#!/usr/bin/env python3 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # The main purpose of this script is code generation for conditional compilation. # After collecting statistics using IntelSEAPI, several CSV files are generated. # This script can read these files and can pro...
192
6,425
onnx
onnx/backend/test/case/node/xor.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 Xor(Base): @staticmethod def export() -> None: node = ...
77
2,504
saleor
saleor/graphql/discount/tests/queries/test_sales.py
.py
from ....tests.utils import get_graphql_content def test_sale_query( staff_api_client, promotion_converted_from_sale, permission_manage_discounts, channel_USD, permission_manage_products, product, ): # given query = """ query sales { sales(first: 1) { ...
220
6,253
coremltools
coremltools/converters/sklearn/_logistic_regression.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 collections.abc import Iterable from ..._deps import _HAS_SKLEARN from ...models import MLModel as...
110
3,111
biopython
Tests/test_KeyWList.py
.py
# Copyright 1999 by Jeffrey Chang. 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 KeyWList.""" import os.path import unittest from Bio.SwissProt import KeyWList ...
126
5,892
coremltools
coremltools/converters/mil/mil/ops/defs/iOS15/classify.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Operation, types from coremltools.conv...
77
3,285