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
conda
tests/cli/test_main_config.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import json from pathlib import Path from typing import TYPE_CHECKING import pytest import conda.exceptions from conda.base.constants import SafetyChecks from conda.base.context import context, reset_context...
726
22,467
saleor
saleor/graphql/account/tests/bulk_mutations/test_customer_bulk_delete.py
.py
from unittest.mock import patch import graphene from .....account.models import User from .....attribute.models import AssignedUserAttributeValue, AttributeValue from ....tests.utils import get_graphql_content CUSTOMER_BULK_DELETE_MUTATION = """ mutation customerBulkDelete($ids: [ID!]!) { customerBulkDel...
183
5,774
loguru
tests/test_add_option_enqueue.py
.py
import pickle import re import sys import time import pytest from loguru import logger from .conftest import default_threading_excepthook class NotPicklable: def __getstate__(self): raise pickle.PicklingError("You shall not serialize me!") def __setstate__(self, state): pass class NotPic...
295
8,480
attrs
tests/test_forward_references.py
.py
""" Tests for behavior specific to forward references via PEP 749. """ from attrs import define, fields, resolve_types def test_forward_class_reference(): """ Class A can reference B even though it is defined later. """ @define class A: b: B class B: pass resolve_types(...
23
357
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/raw_cell_with_complex_yaml_like_content.py
.py
# --- # # This is a complex paragraph # that is split over multiple lines. # # It also includes blank lines. # # # jupyter: # jupytext: # cell_markers: '{{{,}}}' # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- print("Hello, World!")
19
286
openvino
src/bindings/python/tests/test_graph/test_reduction.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset10 as ov @pytest.mark.parametrize( ("graph_api_helper", "reduction_axes", "expected_shape"), [ (ov.reduce_max, np.array([0, 1, 2, 3]), []), ...
202
6,446
saleor
saleor/permission/utils.py
.py
from collections.abc import Iterable from typing import TYPE_CHECKING, Union from .auth_filters import AuthorizationFilters, resolve_authorization_filter_fn from .enums import AccountPermissions, BasePermissionEnum if TYPE_CHECKING: from ..account.models import User from ..app.models import App def all_perm...
116
3,695
confluent-kafka-python
tests/oauthbearer/aws/test_aws_sts_token_provider.py
.py
# Copyright 2026 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
462
16,744
astropy
astropy/visualization/interval.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Classes that deal with computing intervals from arrays of values based on various criteria. """ import abc import numpy as np from astropy.utils.masked import get_data_and_mask from .transform import BaseTransform __all__ = [ "AsymmetricPerce...
380
11,601
conda
conda/common/toposort.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Topological sorting implementation.""" from __future__ import annotations from collections.abc import Hashable from functools import reduce as _reduce from logging import getLogger from typing import TYPE_CHECKING, TypeVar if TYPE_CHECKING...
127
3,925
openvino
tests/layer_tests/tensorflow_tests/test_tf_TensorListResize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from sys import platform import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestTensorListResize(CommonTFLayerTest): def _prepare_input(self, inputs_info): ...
51
2,205
mlflow
tests/tracking/test_rest_tracking.py
.py
import json import logging import math import os import pathlib import posixpath import subprocess import sys import time import urllib.parse from dataclasses import asdict from io import StringIO from pathlib import Path from unittest import mock import flask import pandas as pd import pytest import requests from ope...
5,538
202,790
mlflow
dev/build_docs.py
.py
"""Build MLflow release documentation and publish to mlflow-legacy-website.""" from __future__ import annotations import argparse import json import os import shutil import subprocess import uuid from datetime import datetime, timezone from pathlib import Path from packaging.version import InvalidVersion, Version #...
282
9,201
kafka
tests/kafkatest/tests/client/client_compatibility_features_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 use ...
142
6,839
pymc
pymc/variational/stein.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...
99
3,053
conda
conda/notices/core.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Core conda notices logic.""" from __future__ import annotations import logging import time from functools import wraps from typing import TYPE_CHECKING from ..base.constants import NOTICES_DECORATOR_DISPLAY_INTERVAL_NS, NOTICES_FN from ..b...
237
7,602
loguru
tests/exceptions/source/diagnose/assertion_error_in_string.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True) def foo(abc, xyz): exec("assert abc > 10 and xyz == 60") try: foo(9, 55) except AssertionError: logger.exception("")
17
269
saleor
saleor/graphql/app/mutations/app_deactivate.py
.py
import graphene from ....app import models from ....permission.enums import AppPermission from ....webhook.event_types import WebhookEventAsyncType from ...core.mutations import DeprecatedModelMutation from ...core.types import AppError from ...core.utils import WebhookEventInfo from ...plugins.dataloaders import get_...
44
1,448
sqlmap
tests/test_openapi_drift.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Contract test: the OpenAPI spec (sqlmapapi.yaml) must stay in lock-step with the REST API actually served by lib/utils/api.py. The spec is hand-maintained, so it is the exact thing th...
115
4,139
astropy
astropy/units/tests/test_equivalencies.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Separate tests specifically for equivalencies.""" import numpy as np # THIRD-PARTY import pytest from numpy.testing import assert_allclose # LOCAL from astropy import constants from astropy import units as u from astropy.tests.helper import assert_qu...
1,045
35,154
flit
flit_core/tests_core/samples/module2.py
.py
""" Docstring formatted like this. """ a = {} # An assignment to a subscript (a['test']) broke introspection # https://github.com/pypa/flit/issues/343 a['test'] = 6 __version__ = '7.0'
11
187
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/ArgTypeAndIndex.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class ArgTypeAndIndex(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(...
68
2,026
scikit-bio
web/suburl.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. # --------------------------------------------...
53
1,629
pyro
pyro/infer/rws.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch import pyro import pyro.poutine as poutine from pyro.infer.elbo import ELBO from pyro.infer.enum import get_importance_trace from pyro.infer.util import is_validation_enabled from pyro.poutine.util import...
275
11,140
saleor
saleor/graphql/warehouse/bulk_mutations/__init__.py
.py
from .stock_bulk_update import StockBulkUpdate __all__ = ["StockBulkUpdate"]
4
78
openvino
tests/layer_tests/onnx_tests/test_resize.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...
697
35,618
luigi
test/contrib/external_program_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2016 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...
343
12,510
wagtail
wagtail/contrib/table_block/apps.py
.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class WagtailTableBlockAppConfig(AppConfig): name = "wagtail.contrib.table_block" label = "wagtailtableblock" verbose_name = _("Wagtail table block")
9
253
readthedocs.org
readthedocs/oauth/tasks.py
.py
"""Tasks for OAuth services.""" import datetime from functools import cached_property import structlog from django.contrib.auth.models import User from django.db.models.functions import ExtractIsoWeekDay from django.urls import reverse from django.utils import timezone from readthedocs.api.v2.views.integrations impo...
985
38,426
clearml
examples/hyperdatasets/dataview.py
.py
import argparse from clearml import Task from tqdm import tqdm # ClearML HyperDataset helpers for dataset resolution and dataview streaming from clearml.hyperdatasets import ( HyperDatasetManagement, DataView, ) def main(): ap = argparse.ArgumentParser() ap.add_argument("--dataset", required=True, he...
56
1,997
saleor
saleor/core/tasks.py
.py
import logging from celery import Task from celery.utils.log import get_task_logger from django.conf import settings from django.core.files.storage import default_storage from django.db import connections from django.db.models import Exists, OuterRef from django.utils import timezone from ..celeryconf import app from...
105
3,623
pyomo
pyomo/core/tests/unit/test_param.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,377
82,515
sqlmap
tests/test_cloak.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission cloak / decloak (extra/cloak/cloak.py) - the zlib+XOR transform used to pack the payload stager files (.py_) that sqlmap drops and unpacks on a target during takeover/file-write. A br...
68
2,381
pyomo
pyomo/core/tests/unit/kernel/test_component_set.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...
276
9,507
sphinx
tests/roots/test-basic/conf.py
.py
html_theme = 'basic' latex_documents = [ ( 'index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report', ) ]
11
182
wagtail
wagtail/embeds/models.py
.py
from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ EMBED_TYPES = ( ("video", "Video"), ("photo", "Photo"), ("link", "Link"), ("rich", "Rich"), ) class Embed(models.Model): """ When embed code is fetched from a provider (eg, you...
62
1,924
confluent-kafka-python
src/confluent_kafka/admin/_config.py
.py
# Copyright 2022 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
242
9,191
luigi
test/simulate_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...
119
2,971
rq
tests/cron_config.py
.py
from rq import cron from tests.fixtures import div_by_zero, do_nothing, say_hello # Define additional test function def calculate_value(a, b): """Function that performs a calculation.""" return a + b # Register jobs with various configurations # 1. Basic job that runs every minute cron.register(say_hello, ...
29
712
saleor
saleor/graphql/app/tests/queries/test_app_extensions.py
.py
import pytest from .....app.models import AppExtension from .....core.jwt import jwt_decode from ....tests.utils import assert_no_permission, get_graphql_content QUERY_APP_EXTENSIONS = """ query ($filter: AppExtensionFilterInput){ appExtensions(first: 10, filter: $filter){ edges{ node{ label ...
415
11,445
scikit-bio
skbio/alignment/_pair.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,394
47,022
gunicorn
gunicorn/http/parser.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import socket import ssl import time from gunicorn.http.message import Request from gunicorn.http.unreader import SocketUnreader, IterUnreader # Cap on bytes drained from an unconsumed request body before a keep...
122
4,274
hydra
hydra/_internal/utils.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import inspect import logging.config import os import sys import traceback import warnings from os.path import dirname, join, normpath, realpath from types import TracebackType from typing import Any, List, Optional, Sequence, Tuple ...
693
23,264
textual
tests/notifications/test_notification.py
.py
from __future__ import annotations from time import sleep from textual.notifications import Notification def test_message() -> None: """A notification should not change the message.""" assert Notification("test").message == "test" def test_default_title() -> None: """A notification with no title shoul...
41
1,146
hydra
examples/advanced/hydra_app_example/hydra_app/main.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any from omegaconf import DictConfig import hydra def add(app_cfg: DictConfig, key1: str, key2: str) -> Any: num1 = app_cfg[key1] num2 = app_cfg[key2] ret = num1 + num2 print(f"Hello {app_cfg.user}, {num1} + {n...
24
514
readthedocs.org
readthedocs/config/parser.py
.py
"""YAML parser for the RTD configuration file.""" import yaml __all__ = ("parse", "ParseError") class ParseError(Exception): """Parser related errors.""" def parse(stream): """ Take file-like object and return a project configuration. The file need be valid YAML and only contain mappings as docu...
29
690
pyomo
pyomo/solvers/tests/models/QCP_simple.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...
125
4,409
wagtail
wagtail/locales/utils.py
.py
import swapper from wagtail.models import get_translatable_models Page = swapper.load_model("wagtailcore", "Page") def get_locale_usage(locale): """ Returns the number of pages and other objects that use a locale """ num_pages = Page.objects.filter(locale=locale).exclude(depth=1).count() num_ot...
23
522
beam
sdks/python/apache_beam/runners/interactive/sql/sql_chain_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...
110
4,146
hatch
tests/cli/env/test_remove.py
.py
import os from hatch.config.constants import AppEnvVars from hatch.project.core import Project from hatchling.utils.constants import DEFAULT_CONFIG_FILE def test_unknown(hatch, temp_dir_data, helpers): project_name = "My.App" with temp_dir_data.as_cwd(): result = hatch("new", project_name) asse...
451
12,629
saleor
saleor/app/apps.py
.py
from django.apps import AppConfig as DjangoAppConfig from django.db.models.signals import post_delete class AppConfig(DjangoAppConfig): name = "saleor.app" def ready(self): from .models import App, AppInstallation from .signals import delete_brand_images # preventing duplicate signal...
23
643
hydra
tools/configen/tests/test_modules/default_flags/convert.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Generated by configen, do not edit. # See https://github.com/hydra-ecosystem/hydra/tree/main/tools/configen # fmt: off # isort:skip_file # flake8: noqa from dataclasses import dataclass, field @dataclass class EmptyConf: _target_: str = "te...
15
371
beam
sdks/python/apache_beam/io/fileio_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...
847
28,334
ipython
IPython/sphinxext/tests/test_ansi_stripping.py
.py
"""Test that ANSI escape sequences are stripped from directive output.""" import re _ANSI_RE = re.compile(r"\x1b\[[0-9;]*m") def test_strip_ansi_basic(): """ANSI color codes should be removed from output.""" raw = "\x1b[31mred text\x1b[0m" assert _ANSI_RE.sub("", raw) == "red text" def test_strip_ansi...
29
845
saleor
saleor/core/prices.py
.py
from collections.abc import Iterable from decimal import Decimal from typing import TYPE_CHECKING, TypeVar from babel.numbers import get_currency_precision from prices import Money, TaxedMoney, TaxedMoneyRange from saleor import settings if TYPE_CHECKING: from django.db.models import Model PriceType = TypeVar("...
34
1,029
deap
deap/creator.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
194
7,187
onnx
onnx/reference/ops/op_cum_sum.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class CumSum(OpRun): def _run(self, x, axis, exclusive=None, reverse=None): axis = np.asarray(axis) if axis.ndim != 0: ...
32
1,085
saleor
saleor/graphql/warehouse/tests/mutations/test_warehouse_shipping_zone_assign.py
.py
import graphene from .....warehouse.error_codes import WarehouseErrorCode from ....tests.utils import get_graphql_content MUTATION_ASSIGN_SHIPPING_ZONE_WAREHOUSE = """ mutation assignWarehouseShippingZone($id: ID!, $shippingZoneIds: [ID!]!) { assignWarehouseShippingZone(id: $id, shippingZoneIds: $shippingZoneIds) {...
184
5,618
coremltools
coremltools/optimize/torch/quantization/modules/quantized_modules.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from collections import OrderedDict as _OrderedDict from typing import Type as _Type import torch.ao...
63
1,811
bazel
third_party/def_parser/def_parser_test.py
.py
# Copyright 2017 The Bazel Authors. All rights reserved. # # 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 la...
113
4,223
pyomo
pyomo/contrib/pynumero/linalg/base.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...
80
2,838
mlflow
mlflow/genai/judges/tools/get_span_performance_and_timing_report.py
.py
""" Get span timing report tool for MLflow traces. This tool generates a timing report showing span latencies, execution order, and concurrency patterns for performance analysis. """ from collections import defaultdict from dataclasses import dataclass from mlflow.entities.span import Span from mlflow.entities.trace...
500
17,080
sphinx
tests/test_application.py
.py
"""Test the Sphinx class.""" from __future__ import annotations import shutil import sys from io import StringIO from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock import pytest from docutils import nodes import sphinx.application from sphinx._cli.util.errors import strip_escap...
179
6,088
beam
sdks/python/apache_beam/runners/portability/fn_api_runner/visualization_tools.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...
130
4,421
wagtail
wagtail/images/tests/test_api_v3/test_detail.py
.py
from django.urls import reverse from wagtail.models import CollectionViewRestriction from .base import TestV3ImagesBase class TestV3ImageDetail(TestV3ImagesBase): def get_response(self, image_id): return self.client.get( reverse("wagtailapi_v3:detail_image", kwargs={"image_id": image_id}) ...
40
1,504
wagtail
wagtail/admin/tests/viewsets/test_model_viewset.py
.py
import datetime from io import BytesIO from django.conf import settings from django.contrib.admin.utils import quote from django.contrib.auth import get_permission_codename from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.db import models from dja...
2,221
89,363
saleor
saleor/graphql/meta/inputs.py
.py
import graphene class MetadataInputDescription: DATA_SECURITY_WARNING = ( "Warning: never store sensitive information, including financial data such as " "credit card details." ) PRIVATE_METADATA_INPUT = ( "Requires permissions to modify and to read the metadata of the object " ...
23
767
mlflow
tests/store/tracking/sqlalchemy_store/test_sqlalchemy_workspace_store.py
.py
import json import math import time import uuid from pathlib import Path from unittest import mock import pytest from mlflow.entities import ( AssessmentSource, Dataset, DatasetInput, Expectation, Experiment, ExperimentTag, Feedback, GatewayEndpointModelConfig, GatewayModelLinkageT...
2,940
120,501
gunicorn
gunicorn/workers/sync.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # from datetime import datetime import errno import os import select import ssl import sys from gunicorn import http from gunicorn.http import wsgi from gunicorn import sock from gunicorn import util from gunicorn...
213
7,421
mlflow
tests/data/test_dataset_registry.py
.py
from unittest import mock import pytest import mlflow.data from mlflow.data.dataset import Dataset from mlflow.data.dataset_registry import DatasetRegistry, register_constructor from mlflow.data.dataset_source_registry import DatasetSourceRegistry, resolve_dataset_source from mlflow.exceptions import MlflowException ...
152
5,074
textual
tests/command_palette/test_events.py
.py
from typing import Union from unittest import mock from textual import on from textual.app import App from textual.command import CommandPalette, Hit, Hits, Provider CommandPaletteEvent = Union[ CommandPalette.Opened, CommandPalette.Closed, CommandPalette.OptionHighlighted ] class SimpleSource(Provider): as...
76
2,153
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/OptimizerGroup.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class OptimizerGroup(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(f...
118
4,018
python-prompt-toolkit
examples/progress-bar/styled-apt-get-install.py
.py
#!/usr/bin/env python """ Styled just like an apt-get installation. """ import time from prompt_toolkit.shortcuts import ProgressBar from prompt_toolkit.shortcuts.progress_bar import formatters from prompt_toolkit.styles import Style style = Style.from_dict( { "label": "bg:#ffff00 #000000", "perc...
40
942
onnx
onnx/reference/ops/op_sequence_empty.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class SequenceEmpty(OpRun): def _run(self, dtype=None): # type: ignore[override] # noqa: ARG002 return ([],)
12
282
saleor
saleor/graphql/app/mutations/app_activate.py
.py
import graphene from ....app import models from ....permission.enums import AppPermission from ....webhook.event_types import WebhookEventAsyncType from ...core.mutations import DeprecatedModelMutation from ...core.types import AppError from ...core.utils import WebhookEventInfo from ...plugins.dataloaders import get_...
44
1,439
beam
sdks/python/apache_beam/runners/direct/evaluation_context.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...
455
17,411
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/power_canon.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
109
3,425
probability
tensorflow_probability/python/experimental/mcmc/sample_discarding_kernel.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...
173
6,542
probability
tensorflow_probability/python/internal/numerics_testing.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...
392
14,631
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/filter_side_inputs_singleton.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");...
75
2,367
hatch
scripts/utils.py
.py
import re from pathlib import Path ROOT = Path(__file__).resolve().parent.parent def get_latest_release(project): history_file = ROOT / "docs" / "history" / f"{project}.md" release_headers = 0 history_file_lines = [] with history_file.open(encoding="utf-8") as f: for line in f: h...
29
825
wagtail
wagtail/management/commands/publish_scheduled_pages.py
.py
from wagtail.management.commands.publish_scheduled import ( Command as PublishScheduledCommand, ) class Command(PublishScheduledCommand): """ Alias for the publish_scheduled management command for backwards-compatibility. """
10
244
probability
discussion/robust_inverse_graphics/diffusion_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...
159
5,733
mlflow
tests/genai/simulators/test_simulator.py
.py
import re from unittest.mock import Mock, patch import pandas as pd import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.datasets.evaluation_dataset import EvaluationDataset from mlflow.genai.simulators import ( BaseSimulatedUserAgent, ConversationSimulator, Simulate...
1,020
34,999
saleor
saleor/graphql/product/types/products.py
.py
import sys from collections import defaultdict from dataclasses import asdict from decimal import Decimal import graphene from graphene import relay from promise import Promise from ....attribute import models as attribute_models from ....channel.models import Channel from ....core.db.connection import allow_writer_i...
2,132
80,812
pyomo
pyomo/contrib/trustregion/tests/test_filter.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
47
1,993
saleor
saleor/graphql/order/tests/mutations/test_draft_order_create.py
.py
import datetime from datetime import timedelta from decimal import Decimal from unittest.mock import ANY, patch import graphene import pytest from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from prices import Money from .....account.models import Address f...
4,422
156,081
saleor
saleor/plugins/openid_connect/plugin.py
.py
import logging from typing import cast from urllib.parse import urlparse from authlib.common.errors import AuthlibBaseError from django.core import signing from django.core.exceptions import ValidationError from jwt import DecodeError, ExpiredSignatureError, InvalidTokenError from requests import HTTPError, PreparedRe...
578
22,704
black
tests/data/cases/tricky_unicode_symbols.py
.py
ä = 1 µ = 2 蟒 = 3 x󠄀 = 4 មុ = 1 Q̇_per_meter = 4 A᧚ = 3 A፩ = 8
10
80
hydra
tests/test_apps/setting_env/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from omegaconf import DictConfig import hydra @hydra.main(config_name="config") def my_app(_: DictConfig) -> None: print(f"foo={os.environ['foo']}") print(f"bar={os.environ['bar']}") if __name__ == "__main__": my_app()
17
318
saleor
saleor/graphql/csv/tests/queries/test_export_files.py
.py
import datetime import graphene import pytest from .....account.tests.fixtures.user import dangerously_create_test_user from .....app.models import App from .....core import JobStatus from .....csv.models import ExportFile from ....tests.utils import get_graphql_content FILTER_EXPORT_FILES_QUERY = """ query($fil...
303
8,197
pyro
pyro/contrib/mue/missingdatahmm.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions import Categorical, OneHotCategorical from pyro.distributions import constraints from pyro.distributions.hmm import _sequential_logmatmulexp from pyro.distributions.torch_distribution import Torch...
318
13,358
tqdm
tests/tests_dask.py
.py
from time import sleep from .tests_tqdm import importorskip, mark pytestmark = mark.slow def test_dask(capsys): """Test tqdm.dask.TqdmCallback""" ProgressBar = importorskip('tqdm.dask').TqdmCallback dask = importorskip('dask') schedule = [dask.delayed(sleep)(i / 10) for i in range(5)] with Prog...
19
467
tomli
fuzzer/fuzz.py
.py
import atheris with atheris.instrument_imports(): from math import isnan import sys import warnings import tomli_w import tomli # Disable any caching used so that the same lines of code run # on a given input consistently. tomli._re.cached_tz = tomli._re.cached_tz.__wrapped__ # Suppress all war...
80
2,132
onnxruntime
orttraining/orttraining/python/training/ortmodule/graph_optimizers/_aten_attn.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ PyTorch's _efficient_attention_forward/_efficient_attention_backward...
269
10,540
mlflow
tests/genai/judges/test_judge_tool_get_trace_info.py
.py
from mlflow.entities.trace import Trace from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.trace_state import TraceState from mlflow.genai.judges.tools.get_trace_info import GetTraceInfoTool from mlflow.types.llm import ToolDefinition def tes...
81
2,474
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_maxpool2D.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasMaxPool2D(CommonTF2LayerTest): def create_keras_maxpool2D_net(self, input_names, input_shapes, input_type, pool_size, ...
55
2,708
onnxruntime
onnxruntime/python/tools/transformers/fusion_fastgelu.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger from fusion_base import Fusion from onnx ...
493
17,689
attrs
tests/test_utils.py
.py
from .utils import simple_class class TestSimpleClass: """ Tests for the testing helper function `make_class`. """ def test_returns_class(self): """ Returns a class object. """ assert type is simple_class().__class__ def test_returns_distinct_classes(self): ...
20
440
beam
learning/tour-of-beam/learning-content/core-transforms/flatten/python-example/task.py
.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); y...
55
1,943