repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_activation_quantization.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 __future__ import annotations from typing import TYPE_CHECKING import numpy as np from coremlt...
295
10,282
coremltools
coremltools/test/sklearn_tests/test_SVR.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 import random import tempfile import unittest import numpy as np import pandas as pd import pytest fro...
260
8,749
funcy
tests/test_flow.py
.py
from datetime import timedelta import pytest from funcy.flow import * def test_silent(): assert silent(int)(1) == 1 assert silent(int)('1') == 1 assert silent(int)('hello') is None assert silent(str.upper)('hello') == 'HELLO' class MyError(Exception): pass def test_ignore(): assert ignore...
262
5,718
kombu
kombu/transport/librabbitmq.py
.py
"""`librabbitmq`_ transport. .. _`librabbitmq`: https://pypi.org/project/librabbitmq/ """ from __future__ import annotations import os import socket import warnings import librabbitmq as amqp from librabbitmq import ChannelError, ConnectionError from kombu.utils.amq_manager import get_manager from kombu.utils.text...
198
6,413
probability
tensorflow_probability/python/distributions/transformed_distribution_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...
1,340
55,981
saleor
saleor/graphql/translations/mutations/attribute_bulk_translate.py
.py
import graphene from django.core.exceptions import ValidationError from graphql.error import GraphQLError from ....attribute import models from ....permission.enums import SitePermissions from ...attribute.types import AttributeTranslation from ...core.doc_category import DOC_CATEGORY_ATTRIBUTES from ...core.enums imp...
126
4,137
clearml
clearml/backend_api/services/v2_13/queues.py
.py
""" queues service Provides a management API for queues of tasks waiting to be executed by workers deployed anywhere (see Workers Service). """ from typing import List, Optional, Any from datetime import datetime import six from clearml.backend_api.session import ( Request, Response, NonStrictDataModel, ...
2,525
82,567
saleor
saleor/tests/e2e/orders/utils/order_line_discount_update.py
.py
from .....graphql.tests.utils import get_graphql_content ORDER_LINE_DISCOUNT_UPDATE = """ mutation OrderLineDiscountUpdate($input: OrderDiscountCommonInput!, $orderLineId: ID!){ orderLineDiscountUpdate(orderLineId: $orderLineId, input: $input){ order { id voucherCode voucher { id ...
85
1,650
conda
conda/plugins/subcommands/doctor/health_checks/requests_ca_bundle.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Health check: REQUESTS_CA_BUNDLE environment variable.""" from __future__ import annotations import os from pathlib import Path from typing import TYPE_CHECKING from requests.exceptions import RequestException # noqa: TID253 from .....ba...
56
1,909
probability
tensorflow_probability/python/experimental/sequential/ensemble_kalman_filter.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...
523
23,048
mlflow
examples/evaluation/evaluate_on_multiclass_classifier.py
.py
from sklearn.datasets import make_classification from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split import mlflow X, y = make_classification(n_samples=10000, n_classes=10, n_informative=5, random_state=1) X_train, X_test, y_train, y_test = train_test_split(X, y, ...
26
881
sqlmap
tests/test_library.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Unit coverage for the library facade (import sqlmap; sqlmap.scan(...)). The facade drives the engine out-of-process through a generated configuration file (the same '-c' mechanism th...
147
6,369
biopython
Bio/Blast/__init__.py
.py
# Copyright 1999 by Jeffrey Chang. All rights reserved. # Revisions 2023 by Michiel de Hoon. 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 in...
1,353
51,446
confluent-kafka-python
tests/schema_registry/_sync/test_proto.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 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 requi...
161
5,085
textual
docs/examples/guide/dom2.py
.py
from textual.app import App, ComposeResult from textual.widgets import Header, Footer class ExampleApp(App): def compose(self) -> ComposeResult: yield Header() yield Footer() if __name__ == "__main__": app = ExampleApp() app.run()
14
263
onnxruntime
tools/python/util/platform_helpers.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import sys def is_windows(): return sys.platform.startswith("win") def is_macOS(): # noqa: N802 return sys.platform.startswith("darwin") def is_linux(): return sys.platform.startswith("linux")
17
307
metrics
tests/unittests/_helpers/testers.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...
797
31,808
saleor
saleor/graphql/app/tests/queries/test_apps_installations.py
.py
import graphene import pytest from .....thumbnail import IconThumbnailFormat from .....thumbnail.models import Thumbnail from ....tests.utils import assert_no_permission, get_graphql_content APPS_INSTALLATION_QUERY = """ { appsInstallations{ id } } """ def test_apps_installation(app_inst...
151
4,431
mkdocs-material
material/plugins/blog/plugin.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
1,084
45,378
openvino
tests/layer_tests/tensorflow_tests/test_tf_Pad.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestPad(CommonTFLayerTest): def create_pad_net(self, input_shape, pads_values, const_value, pad_mode, pad_op): ...
133
6,285
beam
sdks/python/apache_beam/io/gcp/gce_metadata_util.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...
47
1,572
beam
sdks/python/apache_beam/coders/stream_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...
225
7,382
openvino
tests/layer_tests/pytorch_tests/test_set_item.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSetItem(PytorchLayerTest): def _prepare_input(self): return [self.random.randint(-10, 10, [10]).tolist()] def create_model(self, idx): ...
32
924
hydra
plugins/hydra_optuna_sweeper/tests/test_optuna_sweeper_plugin.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os import sys from pathlib import Path from typing import Any, List import optuna from hydra.core.override_parser.overrides_parser import OverridesParser from hydra.core.plugins import Plugins from hydra.errors import InstantiationException ...
326
11,041
wagtail
wagtail/models/media.py
.py
from django.conf import settings from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _...
240
8,186
astropy
astropy/table/ndarray_mixin.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.utils.data_info import ParentDtypeInfo class NdarrayMixinInfo(ParentDtypeInfo): _represent_as_dict_primary_data = "data" def _represent_as_dict(self): """Represent Column as a dict that can be serialized...
66
2,118
luigi
test/contrib/hadoop_jar_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...
115
3,773
cvxpy
cvxpy/reductions/solvers/conic_solvers/mosek_conif.py
.py
""" Copyright 2015 Enzo Busseti, 2017 Robin Verschueren, 2018 Riley Murray 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 applica...
765
32,407
sphinx
tests/roots/test-ext-viewcode-find-package/main_package/subpackage/_subpackage2/submodule.py
.py
"""submodule""" # raise RuntimeError('This module should not get imported') def decorator(f): return f @decorator def func1(a, b): """this is func1""" return a, b @decorator class Class1: """this is Class1""" class Class3: """this is Class3""" class_attr = 42 """this is the class at...
25
342
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys import numpy as np from openvino import Shape, PartialShape, Dimension # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.error import Error def get_static_shape(shape: [PartialShape, list, tuple], dy...
110
4,025
pyomo
pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_block.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,205
44,236
probability
tensorflow_probability/python/layers/conv_variational.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...
1,694
69,246
saleor
saleor/csv/tests/export/products_data/utils.py
.py
from collections import defaultdict from django.db.models import prefetch_related_objects from django.db.models.expressions import Exists, OuterRef from .....attribute import AttributeInputType from .....attribute.models import ( AssignedProductAttributeValue, Attribute, AttributeProduct, ) from .....core...
157
6,309
onnx
onnx/backend/test/case/node/atan.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 Atan(Base): @staticmethod def export() -> None: node =...
29
723
saleor
saleor/graphql/invoice/mutations/invoice_create.py
.py
import graphene from django.core.exceptions import ValidationError from ....core import JobStatus from ....invoice import events, models from ....invoice.error_codes import InvoiceErrorCode from ....order import events as order_events from ....order.search import update_order_search_vector from ....permission.enums im...
140
5,142
wandb
wandb/sdk/wandb_alerts.py
.py
# from enum import Enum """ Call run.alert() to generate an email or Slack notification programmatically. """ class AlertLevel(Enum): INFO = "INFO" WARN = "WARN" ERROR = "ERROR"
13
193
mlflow
tests/utils/test_proto_json_utils.py
.py
import base64 import datetime import json import numpy as np import pandas as pd import pytest from google.protobuf.text_format import Parse as ParseTextIntoProto from mlflow.entities import Experiment, Metric from mlflow.entities.model_registry import ModelVersion, RegisteredModel from mlflow.exceptions import Mlflo...
712
25,695
confluent-kafka-python
src/confluent_kafka/deserializing_consumer.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 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 requi...
154
6,585
tqdm
tests/tests_utils.py
.py
from ast import literal_eval from collections import defaultdict from typing import Union # py<3.10 import pytest from tqdm.utils import envwrap def test_envwrap_deprecated(monkeypatch): """Test @envwrap (basic)""" monkeypatch.setenv('FUNC_A', "42") monkeypatch.setenv('FUNC_TyPe_HiNt', "1337") monk...
69
1,863
tqdm
tqdm/gui.py
.py
""" Matplotlib GUI progress bar decorator for iterators. Usage: >>> from tqdm.gui import trange, tqdm >>> for i in trange(10): ... ... """ # future division is important to divide integers and get as # a result precise floating numbers (instead of truncated int) import re from warnings import warn # to inherit fr...
180
5,481
probability
tensorflow_probability/python/experimental/auto_batching/__init__.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,818
sphinx
tests/roots/test-ext-autodoc/target/enums.py
.py
# ruff: NoQA: PIE796 import enum from typing import final class MemberType: """Custom data type with a simple API.""" # this mangled attribute will never be shown on subclasses # even if :inherited-members: and :private-members: are set __slots__ = ('__data',) def __new__(cls, value): se...
245
5,158
pyomo
pyomo/util/subsystems.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...
395
14,560
textual
tests/test_tooltips.py
.py
"""Tests for the tooltips.""" from typing_extensions import Final from textual.app import App, ComposeResult from textual.widgets import Static class TooltipApp(App[None]): TOOLTIP_DELAY = 0.4 CSS = """ Static { width: 1fr; height: 1fr; } """ @staticmethod def tip(static...
119
4,975
tqdm
tqdm/__init__.py
.py
from ._monitor import TMonitor, TqdmSynchronisationWarning from ._tqdm_pandas import tqdm_pandas from .cli import main # TODO: remove in v5.0.0 from .gui import tqdm as tqdm_gui # TODO: remove in v5.0.0 from .gui import trange as tgrange # TODO: remove in v5.0.0 from .std import ( TqdmDeprecationWarning, TqdmExp...
39
1,572
onnx
onnx/reference/ops/op_reduce_prod.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 OpRunReduceNumpy class ReduceProd_1(OpRunReduceNumpy): def _run(self, data, axes=None, keepdims=None): axes = tuple(axes) if axes is n...
31
1,071
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_BroadcastArgs.py
.py
import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [1, 5], 'broadcast_shape': [5, 5]}, {'shape': [1], 'broadcast_shape': [7]} ] class TestTFLiteBroadcastArgsLayerTest(TFLiteLayerTest): inputs = ["Input", "Input1"]...
43
1,656
lemur
lemur/plugins/lemur_acme/plugin.py
.py
""" .. module: lemur.plugins.lemur_acme.plugin :platform: Unix :synopsis: This module is responsible for communicating with an ACME CA. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. Snippets from https://raw.githubusercontent.com/alex/let...
492
18,592
cvxpy
cvxpy/tests/test_param_cone_prog.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 ...
154
6,492
mlflow
tests/cli/test_datasets.py
.py
import json import pytest from click.testing import CliRunner import mlflow from mlflow.cli.datasets import commands from mlflow.genai.datasets import create_dataset @pytest.fixture def runner(): return CliRunner(catch_exceptions=False) @pytest.fixture def experiment(): exp_id = mlflow.create_experiment("...
185
5,785
wagtail
wagtail/images/tests/test_api_v3/test_create.py
.py
from django.contrib.auth.models import Group, Permission from django.core.files.uploadedfile import SimpleUploadedFile from django.test import override_settings 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 impo...
165
6,446
ipython
IPython/testing/skipdoctest.py
.py
"""Decorators marks that a doctest should be skipped. The IPython.testing.decorators module triggers various extra imports, including numpy and sympy if they're present. Since this decorator is used in core parts of IPython, it's in a separate module so that running IPython doesn't trigger those imports.""" from __fut...
23
788
probability
tensorflow_probability/python/experimental/auto_batching/type_inference.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...
324
12,355
pdm
tests/fixtures/projects/demo-#-with-hash/setup.py
.py
from setuptools import setup setup( name="demo", version="0.0.1", description="test demo", py_modules=["demo"], python_requires=">=3.3", install_requires=["idna", "chardet; os_name=='nt'"], extras_require={ "tests": ["pytest"], "security": ['requests; python_version>="3.6"'...
16
332
mlflow
dev/clint/tests/test_config.py
.py
import subprocess from pathlib import Path from typing import Generator import pytest from clint.config import Config from clint.utils import get_repo_root @pytest.fixture(autouse=True) def clear_repo_root_cache() -> Generator[None, None, None]: """Clear the get_repo_root cache before each test to avoid cross-te...
128
3,516
probability
tensorflow_probability/python/bijectors/reshape_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
424
16,467
wandb
wandb/sdk/artifacts/_generated/upsert_registry.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import RegistryFragment class UpsertRegistry(GQLResult): upsert_model: UpsertRegistryUpsertModel | None = Field(alias="u...
24
517
wagtail
wagtail/contrib/settings/templatetags/wagtailsettings_tags.py
.py
from django.template import Library, Node from django.template.defaulttags import token_kwargs from wagtail.contrib.settings.context_processors import SettingProxy from wagtail.models import Site register = Library() class SettingsNode(Node): @staticmethod def get_settings_object(context, use_default_site=F...
41
1,341
metrics
src/torchmetrics/functional/text/__init__.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...
54
2,067
beam
sdks/python/apache_beam/testing/benchmarks/wordcount/wordcount.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...
40
1,416
sphinx
tests/test_markup/test_metadata.py
.py
"""Test our handling of metadata in files with bibliographic metadata.""" # adapted from an example of bibliographic metadata at # https://docutils.sourceforge.io/docs/user/rst/demo.txt from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from sphinx.testing.util i...
53
2,041
httpie
httpie/output/ui/rich_palette.py
.py
from collections import ChainMap from typing import TYPE_CHECKING, Any, Optional if TYPE_CHECKING: from rich.theme import Theme from httpie.output.ui.palette import GenericColor, PieStyle, Styles, ColorString, _StyledGenericColor # noqa RICH_BOLD = ColorString('bold') # Rich-specific color code declarations # ...
74
2,294
loguru
tests/exceptions/source/others/sys_tracebacklimit_none.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=True, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False) logger.add(sys.std...
58
676
attrs
tests/conftest.py
.py
# SPDX-License-Identifier: MIT from datetime import timedelta import pytest from hypothesis import HealthCheck, settings from attr._compat import PY_3_14_PLUS @pytest.fixture(name="slots", params=(True, False)) def _slots(request): return request.param @pytest.fixture(name="frozen", params=(True, False)) de...
37
809
confluent-kafka-python
src/confluent_kafka/schema_registry/common/protobuf.py
.py
import base64 import io import sys from collections import deque from decimal import MAX_PREC, Context, Decimal from typing import Any, Deque, List, Set from google.protobuf import __version__ as _protobuf_version from google.protobuf import ( any_pb2, api_pb2, descriptor_pb2, duration_pb2, empty_p...
422
13,030
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_with_numerical_names.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import tensorflow as tf # Create the graph and model tf.compat.v1.reset_default_graph() with tf.compat.v1.Session() as sess: tf_x = tf.compat.v1.placeholder(dtype=tf.float32, shape=[1], name='0') tf_y = tf....
19
751
mlflow
dev/clint/tests/rules/test_version_major_check.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import lint_file from clint.rules.version_major_check import MajorVersionCheck def test_version_major_check(index: SymbolIndex) -> None: code = """ from packaging.version import Version Version("0.9.0"...
43
1,369
onnxruntime
onnxruntime/test/python/quantization/test_op_squeeze_unsqueeze.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
248
9,177
wandb
wandb/util.py
.py
from __future__ import annotations import colorsys import contextlib import dataclasses import enum import importlib import importlib.util import json import logging import math import numbers import os import pathlib import platform import queue import random import re import secrets import shlex import socket import...
1,729
54,735
biopython
Bio/Align/stockholm.py
.py
# Copyright 2006-2016 by Peter Cock. All rights reserved. # Copyright 2021 by Michiel de Hoon. 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 ...
625
26,134
saleor
saleor/graphql/product/mutations/collection/collection_reorder_products.py
.py
import graphene from django.core.exceptions import ObjectDoesNotExist, ValidationError from .....core.tracing import traced_atomic_transaction from .....permission.enums import ProductPermissions from .....product import models from .....product.error_codes import CollectionErrorCode, ProductErrorCode from ....core im...
107
3,867
onnxruntime
plugin-ep-cuda/csharp/test/CudaEpNuGetTest/generate_mul_model.py
.py
"""Generate a simple Mul ONNX model for testing. Produces mul.onnx in the same directory as this script. The model computes z = x * y (element-wise) for float32 tensors of shape [2, 3]. """ import os from onnx import TensorProto, checker, helper, save X = helper.make_tensor_value_info("x", TensorProto.FLOAT, [2, 3]...
26
849
biopython
Bio/SearchIO/_model/_base.py
.py
# Copyright 2012 by Wibowo Arindrarto. 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. """Abstract base classe...
70
2,671
colorama
colorama/ansitowin32.py
.py
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import re import sys import os from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL from .winterm import enable_vt_processing, WinTerm, WinColor, WinStyle from .win32 import windll, winapi_test winterm = None if windll is not None: ...
278
11,112
mlflow
mlflow/protos/mlflow_artifacts_pb2.py
.py
import google.protobuf from packaging.version import Version if Version(google.protobuf.__version__).major >= 5: # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: mlflow_artifacts.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" from g...
383
31,197
astropy
astropy/table/tests/test_np_utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from dataclasses import dataclass import numpy as np import pytest from numpy.testing import assert_array_equal from astropy.table._np_utils import join_inner # Strict type aliases for 1D index arrays and 1D boolean mask arrays IndexArray = np.ndarray[...
359
13,248
beam
sdks/python/apache_beam/typehints/pytorch_type_compatibility_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
168
5,733
toolz
bench/test_pluck.py
.py
from toolz import pluck tuples = [(1, 2, 3) for i in range(100000)] less_tuples = [(1, 2, 3) for i in range(100)] def test_pluck(): for i in pluck(2, tuples): pass for i in range(1000): tuple(pluck(2, less_tuples))
13
243
pymc
pymc/variational/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...
156
4,675
saleor
saleor/graphql/account/mutations/authentication/external_obtain_access_tokens.py
.py
import graphene from ....core import ResolveInfo from ....core.doc_category import DOC_CATEGORY_AUTH from ....core.fields import JSONString from ....core.mutations import BaseMutation from ....core.types import AccountError from ....plugins.dataloaders import get_plugin_manager_promise from ...types import User from ....
62
2,303
mlflow
mlflow/sagemaker/__init__.py
.py
""" The ``mlflow.sagemaker`` module provides an API for deploying MLflow models to Amazon SageMaker. """ import json import logging import os import signal import subprocess import sys import tarfile import time import urllib.parse import uuid from typing import Any import mlflow import mlflow.version from mlflow imp...
3,029
132,273
hydra
examples/plugins/example_registered_plugin/example_registered_plugin/__init__.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from hydra.core.plugins import Plugins from hydra.plugins.plugin import Plugin class ExampleRegisteredPlugin(Plugin): def __init__(self, v: int) -> None: self.v = v def add(self, x: int) -> int: return self.v + x def reg...
17
488
saleor
saleor/invoice/notifications.py
.py
from typing import TYPE_CHECKING, Optional from ..core.notification.utils import get_site_context from ..core.notify import NotifyEventType, NotifyHandler from ..graphql.core.utils import to_global_id_or_none if TYPE_CHECKING: from ..account.models import User from ..app.models import App from ..plugins.m...
52
1,625
saleor
saleor/core/apps.py
.py
from collections.abc import Callable from django.apps import AppConfig from django.conf import settings from django.db.models import CharField, TextField from django.utils.module_loading import import_string from .db.filters import PostgresILike class CoreAppConfig(AppConfig): name = "saleor.core" def read...
38
1,243
wandb
wandb/apis/public/api.py
.py
"""Use the Public API to export or update data that you have saved to W&B. Before using this API, you'll want to log data from your script — check the [Quickstart](https://docs.wandb.ai/models/quickstart) for more details. You might use the Public API to - update metadata or metrics for an experiment after it has be...
2,659
96,183
sphinx
tests/roots/test-toctree-empty/conf.py
.py
exclude_patterns = ['_build'] templates_path = ['_templates']
3
62
mlflow
dev/clint/tests/rules/test_redundant_test_docstring.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import lint_file from clint.rules.redundant_test_docstring import RedundantTestDocstring def test_redundant_docstrings_are_flagged(index: SymbolIndex) -> None: code = ''' def test_feature_a(): """ ...
230
6,049
cvxpy
cvxpy/atoms/pnorm.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...
291
9,738
black
tests/data/cases/fmtskip9.py
.py
print () # fmt: skip print () # fmt:skip # output print () # fmt: skip print () # fmt:skip
9
94
astropy
astropy/stats/info_theory.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple functions for model selection. """ import numpy as np __all__ = [ "akaike_info_criterion", "akaike_info_criterion_lsq", "bayesian_info_criterion", "bayesian_info_criterion_lsq", ] __doctest_requires__ = {...
424
15,139
probability
tensorflow_probability/python/experimental/sequential/ensemble_kalman_filter_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...
715
26,274
saleor
saleor/product/tests/test_product.py
.py
import datetime from collections import defaultdict from decimal import Decimal from unittest.mock import patch import graphene import pytest from prices import Money from ...attribute.utils import associate_attribute_values_to_instance from ...discount import RewardValueType from ...discount.models import PromotionR...
428
13,437
openvino
tests/layer_tests/tensorflow_tests/test_tf_Transpose.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestTranspose(CommonTFLayerTest): def create_transpose_net(self, x_shape, perm_value): tf.compat.v1.reset_default_graph() ...
76
3,033
wagtail
wagtail/snippets/bulk_actions/delete.py
.py
from django.contrib.admin.utils import quote from django.urls import reverse from django.utils.functional import cached_property from django.utils.text import capfirst from django.utils.translation import gettext_lazy as _ from django.utils.translation import ngettext from wagtail.admin.views.bulk_action.mixins import...
87
3,587
gunicorn
tests/requests/valid/rfc9110_field_value_obs_text_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9110 section 5.5: field-vchar = VCHAR / obs-text (0x80-0xFF). # Value carries two obs-text bytes 0xC3 0xA9 (UTF-8 "e"-acute), stored # as latin-1 per the WSGI environ convention. request = { "method": "GE...
18
487
onnxruntime
onnxruntime/python/tools/quantization/matmul_bnb4_quantizer.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ar...
240
9,024
rq
rq/command.py
.py
import json import os import signal from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from redis import Redis from .worker import BaseWorker from rq.exceptions import InvalidJobOperation from rq.executions import Execution from rq.job import Job PUBSUB_CHANNEL_TEMPLATE = 'rq:pubsub:%s' def send_comm...
177
5,504
wandb
wandb/sdk/artifacts/_generated/project_artifacts.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from typing import Literal from pydantic import Field from wandb._pydantic import GQLResult, Typename from .fragments import ArtifactFragment, PageInfoFragment class ProjectArtifacts(GQLResult): proje...
55
1,736
wagtail
wagtail/api/v3/permissions.py
.py
import functools from django.core.exceptions import PermissionDenied from wagtail.permissions import policy_registry def require_any_permission(model, actions=("add", "change", "delete", "view")): """ Decorator factory that gates a view behind authentication and any of the given permission actions for `...
40
1,357
saleor
saleor/order/actions.py
.py
import logging from collections import defaultdict from copy import deepcopy from decimal import Decimal from typing import TYPE_CHECKING, Optional, TypedDict from uuid import UUID import graphene from django.contrib.sites.models import Site from django.db import transaction from django.db.models import F from ..acco...
2,111
74,528