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
clearml
examples/frameworks/fastai/fastai_with_tensorboard_example.py
.py
# ClearML - Fastai v2 with tensorboard callbacks example code, automatic logging the model and various scalars # import argparse from clearml import Task import fastai try: from fastai.vision.all import ( untar_data, URLs, get_image_files, ImageDataLoaders, Resize, ...
47
1,247
slimit
src/slimit/lexer.py
.py
############################################################################### # # Copyright (c) 2011 Ruslan Spivak # # 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, inc...
448
15,253
pyomo
pyomo/contrib/mindtpy/tests/MINLP4_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...
64
2,213
mlflow
mlflow/types/schema.py
.py
from __future__ import annotations import builtins import datetime as dt import json import string from abc import ABC, abstractmethod from copy import deepcopy from dataclasses import is_dataclass from enum import Enum from types import UnionType from typing import Any, TypedDict, Union, get_args, get_origin import ...
1,518
56,238
python-prompt-toolkit
src/prompt_toolkit/completion/__init__.py
.py
from __future__ import annotations from .base import ( CompleteEvent, Completer, Completion, ConditionalCompleter, DummyCompleter, DynamicCompleter, ThreadedCompleter, get_common_complete_suffix, merge_completers, ) from .deduplicate import DeduplicateCompleter from .filesystem impo...
44
992
mlflow
tests/entities/test_dataset_record.py
.py
import json import pytest from mlflow.entities.dataset_record import DatasetRecord from mlflow.entities.dataset_record_source import DatasetRecordSource from mlflow.protos.datasets_pb2 import DatasetRecord as ProtoDatasetRecord from mlflow.protos.datasets_pb2 import DatasetRecordSource as ProtoDatasetRecordSource d...
466
16,265
astropy
astropy/units/tests/test_quantity.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test the Quantity class and related.""" import copy import decimal import numbers import operator import pickle from fractions import Fraction import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_almost_equal, asser...
2,138
70,399
onnx
onnx/reference/ops/op_unique.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 def _specify_int64(indices, inverse_indices, counts): return ( np.array(indices, dtype=np.int64), np.array(inverse_indice...
52
1,773
pyomo
pyomo/contrib/gdpopt/solve_subproblem.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...
406
15,970
wagtail
wagtail/admin/tests/test_dismissibles.py
.py
from django.test import TestCase from django.urls import reverse from wagtail.test.utils import WagtailTestUtils from wagtail.users.models import UserProfile class TestDismissiblesView(WagtailTestUtils, TestCase): def setUp(self): self.user = self.login() self.profile = UserProfile.get_for_user(s...
66
2,671
mkdocs-material
material/plugins/group/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...
162
7,109
sphinx
sphinx/builders/texinfo.py
.py
"""Texinfo builder.""" from __future__ import annotations import os.path from typing import TYPE_CHECKING from docutils import nodes from sphinx import addnodes, package_dir from sphinx._cli.util.colour import darkgreen from sphinx.builders import Builder from sphinx.environment.adapters.asset import ImageAdapter f...
265
9,908
textual
tests/test_immutable_sequence_view.py
.py
from typing import Sequence import pytest from textual._immutable_sequence_view import ImmutableSequenceView def wrap(source: Sequence[int]) -> ImmutableSequenceView[int]: """Wrap a sequence of integers inside an immutable sequence view.""" return ImmutableSequenceView[int](source) def test_empty_immutabl...
71
2,175
sqlmap
plugins/dbms/informix/syntax.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import re from lib.core.common import isDBMSVersionAtLeast from lib.core.common import randomStr from lib.core.convert import getOrds from plugins.generic.syntax import Syntax as...
43
1,271
onnx
onnx/defs/gen_shape_inference_information.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx import defs def main() -> None: # domain -> support level -> name -> [schema] with_inference = [] without_inference = [] for schema in defs.get_all_schemas(): domain,...
32
875
luigi
test/contrib/prometheus_metric_test.py
.py
import pytest from helpers import unittest from prometheus_client import CONTENT_TYPE_LATEST from luigi.contrib.prometheus_metric import PrometheusMetricsCollector from luigi.metrics import MetricsCollectors from luigi.scheduler import Scheduler try: from unittest import mock except ImportError: import mock ...
111
3,817
django-cms
cms/tests/test_urlutils.py
.py
from cms.test_utils.testcases import CMSTestCase from cms.utils import urlutils class UrlutilsTestCase(CMSTestCase): def test_levelize_path(self): path = '/application/item/new' output = ['/application/item/new', '/application/item', '/application'] self.assertEqual(urlutils.levelize_path(...
30
1,349
pyomo
examples/pyomo/sos/sos2_piecewise.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...
84
2,914
confluent-kafka-python
tests/common/_async/producer.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2025 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...
106
3,853
mlflow
tests/genai/optimize/test_job.py
.py
import sys from unittest import mock import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.optimize.job import ( OptimizerType, _build_predict_fn, _create_optimizer, _load_scorers, optimize_prompts_job, ) from mlflow.genai.optimize.optimizers import GepaPrompt...
318
12,006
saleor
saleor/graphql/product/tests/queries/test_product_type_query.py
.py
from unittest.mock import patch import graphene import pytest from django.contrib.sites.models import Site from measurement.measures import Weight from .....attribute import AttributeInputType, AttributeType from .....attribute.models import Attribute from .....core.taxes import TaxType from .....core.units import We...
859
27,797
pyomo
pyomo/solvers/tests/models/LP_infeasible2.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...
71
2,413
pyomo
pyomo/core/tests/unit/kernel/test_component_map.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...
252
8,708
mlflow
mlflow/entities/presigned_upload.py
.py
from __future__ import annotations from dataclasses import dataclass, field from typing import Any @dataclass class CreatePresignedUploadResponse: """Response from creating a presigned upload URL.""" presigned_url: str headers: dict[str, str] = field(default_factory=dict) def to_proto(self): ...
43
1,194
loguru
tests/exceptions/source/ownership/indirect.py
.py
import sys import _init from somelib import divide_indirect from loguru import logger def test(*, backtrace, colorize, diagnose): logger.remove() logger.add(sys.stderr, format="", colorize=colorize, backtrace=backtrace, diagnose=diagnose) try: divide_indirect(10, 0) except ZeroDivisionError...
24
615
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/generate_conv_with_dynamic_input_channel.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: filter = tf.constant(value=0, shape=[3, 3, 6, 6], dtype=tf.float32) input = tf.co...
20
781
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/stochastic_volatility_log_sp500.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...
7,620
185,245
scikit-bio
skbio/alignment/_pairwise.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. # --------------------------------------------...
888
32,811
wandb
tests/system_tests/test_functional/keras/keras_metrics_logger.py
.py
import numpy as np import tensorflow as tf import wandb from wandb.integration.keras import WandbMetricsLogger tf.keras.utils.set_random_seed(1234) run = wandb.init(project="keras") x = np.random.randint(255, size=(100, 28, 28, 1)) y = np.random.randint(10, size=(100,)) dataset = (x, y) def get_model(): model...
39
843
pyomo
pyomo/gdp/plugins/bound_pretransformation.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...
369
16,563
hatch
tests/cli/env/test_create.py
.py
import os import sys import pytest from hatch.config.constants import AppEnvVars, ConfigEnvVars from hatch.env.utils import get_env_var from hatch.project.core import Project from hatch.utils.structures import EnvVars from hatch.venv.core import UVVirtualEnv, VirtualEnv from hatchling.utils.constants import DEFAULT_B...
2,180
67,864
beam
sdks/python/apache_beam/yaml/__init__.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...
19
831
cvxpy
cvxpy/tests/test_linear_cone.py
.py
""" Copyright 2013 Steven Diamond, 2017 Robin Verschueren 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...
357
16,631
openvino
tests/e2e_tests/common/comparator/object_detection.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import copy import logging as log import sys from collections import OrderedDict import numpy as np from .threshold_utils import get_default_thresholds, get_default_iou_threshold from e2e_tests.common.table_utils import make_table from...
267
14,324
pyomo
pyomo/contrib/aslfunctions/build.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...
31
1,102
rich-cli
src/rich_cli/__main__.py
.py
from operator import itemgetter import sys from typing import TYPE_CHECKING, List, NoReturn, Optional, Tuple import click from pygments.util import ClassNotFound from rich.console import Console, RenderableType from rich.markup import escape from rich.text import Text console = Console() error_console = Console(stder...
940
27,292
saleor
saleor/graphql/notifications/tests/test_external_notification_query.py
.py
import json from unittest.mock import patch import pytest from graphql_relay.node.node import to_global_id from ....account.models import User from ....core.notify import UserNotifyEvent from ....graphql.tests.utils import assert_no_permission from ....plugins.tests.sample_plugins import PluginSample query_test_inva...
132
3,861
probability
tensorflow_probability/python/sts/holiday_effects_test.py
.py
# Copyright 2021 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
122
5,469
onnxruntime
onnxruntime/test/testdata/transform/noop-add.py
.py
import onnx from onnx import OperatorSetIdProto, TensorProto, helper opsets = [] onnxdomain = OperatorSetIdProto() onnxdomain.version = 12 onnxdomain.domain = "" # The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification. opsets.append(onnxdomain) msdo...
82
3,274
wandb
tests/system_tests/test_artifacts/test_gqlutils.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, Any, Protocol from pytest import fixture, mark, raises from wandb.proto import wandb_internal_pb2 as pb from wandb.sdk.artifacts._gqlutils import resolve_org_entity_name, server_supports if TYPE_CHECKING: from wandb import Api from tests.f...
336
9,404
mlflow
tests/gateway/providers/test_portkey.py
.py
from unittest import mock import pytest from fastapi.encoders import jsonable_encoder from mlflow.gateway.config import EndpointConfig, PortkeyConfig from mlflow.gateway.providers.portkey import PortkeyProvider from mlflow.gateway.schemas import chat from tests.gateway.tools import MockAsyncResponse, mock_http_clien...
156
5,544
onnxruntime
orttraining/orttraining/python/training/ortmodule/_inference_manager.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import Logger import onnx import torch from onnxruntime.c...
228
11,080
pynacl
tests/test_generichash.py
.py
# Copyright 2016 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
248
7,421
astropy
astropy/coordinates/builtin_frames/cirs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.attributes import EarthLocationAttribute, TimeAttribute from astropy.coordinates.baseframe import base_doc from astropy.utils.decorators import format_doc from .baseradec import BaseRADecFrame, doc_components from .utils import D...
99
4,284
cvxpy
cvxpy/reductions/solvers/conic_solvers/conic_solver.py
.py
""" Copyright 2017 Robin Verschueren, 2017 Akshay Agrawal Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
394
15,701
saleor
saleor/graphql/discount/schema.py
.py
import graphene from ...permission.enums import DiscountPermissions from ..core import ResolveInfo from ..core.connection import create_connection_slice, filter_connection_queryset from ..core.descriptions import ( DEPRECATED_IN_3X_INPUT, ) from ..core.doc_category import DOC_CATEGORY_DISCOUNTS from ..core.fields ...
248
8,929
omegaconf
tests/test_to_container.py
.py
import re from enum import Enum from importlib import import_module from typing import Any, Callable, Dict, List, Optional from pytest import fixture, mark, param, raises from omegaconf import ( DictConfig, ListConfig, MissingMandatoryValue, OmegaConf, SCMode, open_dict, ) from omegaconf._util...
774
26,783
astropy
astropy/coordinates/tests/test_separation.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for `position_angle()`, `separation()` and `separation_3d()` methods. They are implemented in `BaseCoordinateFrame`, but are also exposed by `SkyCoord` instances, so they should be tested on both. """ from contextlib import nullcontext from typ...
409
13,309
saleor
saleor/core/tests/test_event_payload.py
.py
import pytest from django.core.files.base import ContentFile from django.utils.crypto import get_random_string from storages.utils import safe_join from ..models import EventPayload @pytest.fixture def payload_data(): return '{\n "product": {\n "name": "Żółta ćma"\n }\n}\n' def test_reading_event_...
40
1,029
mlflow
mlflow/client.py
.py
""" The ``mlflow.client`` module provides a Python CRUD interface to MLflow Experiments, Runs, Model Versions, and Registered Models. This is a lower level API that directly translates to MLflow `REST API <../rest-api.html>`_ calls. For a higher level API for managing an "active run", use the :py:mod:`mlflow` module. "...
13
407
mlflow
mlflow/genai/utils/display_utils.py
.py
import sys from mlflow.entities import Run from mlflow.store.tracking.rest_store import RestStore from mlflow.tracing.display.display_handler import _is_jupyter from mlflow.tracking._tracking_service.utils import _get_store, get_tracking_uri from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_WORKSPACE_URL from mlf...
157
4,953
textual
src/textual/_loop.py
.py
from __future__ import annotations from typing import Iterable, Literal, Sequence, TypeVar T = TypeVar("T") def loop_first(values: Iterable[T]) -> Iterable[tuple[bool, T]]: """Iterate and generate a tuple with a flag for first value.""" iter_values = iter(values) try: value = next(iter_values) ...
87
2,602
confluent-kafka-python
src/confluent_kafka/schema_registry/rules/encryption/gcpkms/gcp_driver.py
.py
# Copyright 2024 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...
90
3,171
probability
tensorflow_probability/python/experimental/auto_batching/liveness.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...
148
6,714
coremltools
coremltools/converters/mil/mil/ops/tests/iOS17/test_tensor_operation.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 itertools import numpy as np import pytest from coremltools.converters.mil.mil import Builde...
148
5,598
mlflow
dev/clint/tests/rules/test_no_shebang.py
.py
from pathlib import Path import pytest from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules import NoShebang def test_no_shebang(index: SymbolIndex) -> None: config = Config(select={NoShebang.name}) # Test file with shebang ...
66
1,968
pyomo
examples/pyomo/concrete/sodacan_fig.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...
42
1,403
coremltools
coremltools/converters/mil/backend/nn/load.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 coremltools as ct from coremltools.converters._profile_utils import _profile from coremltools....
312
13,862
saleor
saleor/graphql/product/tests/test_product_sorting.py
.py
import datetime import random import graphene import pytest from django.utils import timezone from freezegun import freeze_time from ....product.models import CollectionProduct, Product, ProductChannelListing from ...core.connection import from_global_cursor, to_global_cursor from ...tests.utils import get_graphql_co...
850
27,092
saleor
saleor/account/tasks.py
.py
import logging from typing import cast from urllib.parse import urlencode from django.utils import timezone from ..celeryconf import app from ..core.db.connection import allow_writer from ..core.tokens import ( account_confirm_token_generator, password_reset_token_generator, ) from ..core.utils.events import ...
123
3,507
onnxruntime
onnxruntime/test/python/onnxruntime_test_scatternd.py
.py
import itertools import json import os import typing import unittest import warnings import numpy as np import onnx.helper as oh from onnx import TensorProto, load from onnx.numpy_helper import from_array from onnx.reference import ReferenceEvaluator import onnxruntime def has_cuda(): available_providers = list...
330
12,894
readthedocs.org
readthedocs/api/v3/tests/test_remoteorganizations.py
.py
from django.urls import reverse from allauth.socialaccount.models import SocialAccount import django_dynamic_fixture as fixture from readthedocs.oauth.constants import GITHUB from readthedocs.oauth.models import ( RemoteOrganization, RemoteOrganizationRelation, ) from .mixins import APIEndpointMixin class R...
66
2,133
luigi
luigi/contrib/rdbms.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...
362
11,125
pyomo
examples/doc/samples/comparisons/cutstock/cutstock_grb.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...
76
2,234
qutip
qutip/ui/progressbar.py
.py
__all__ = ['BaseProgressBar', 'TextProgressBar', 'EnhancedTextProgressBar', 'TqdmProgressBar', 'HTMLProgressBar', 'progress_bars'] import time import datetime import sys from qutip import settings class BaseProgressBar(object): """ An abstract progress bar with some shared functionality...
207
6,173
beam
sdks/python/apache_beam/ml/rag/types.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...
171
5,253
rq
tests/test_callbacks.py
.py
from datetime import timedelta from unittest import mock from rq import Queue, Worker from rq.job import UNEVALUATED, Callback, Job, JobStatus from rq.serializers import JSONSerializer from rq.worker import SimpleWorker from tests import RQTestCase from tests.fixtures import ( div_by_zero, erroneous_callback, ...
390
17,382
beam
playground/infrastructure/models.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 ...
274
7,753
qutip
qutip/partial_transpose.py
.py
__all__ = ['partial_transpose'] import numpy as np import scipy.sparse as sp from . import ( Qobj, state_index_number, state_number_index, state_number_enumerate, ) from .core.dimensions import flatten def partial_transpose(rho, mask, method='dense'): """ Return the partial transpose of a Qobj instance ...
122
3,622
textual
docs/examples/styles/text_style.py
.py
from textual.app import App from textual.widgets import Label TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past, I will turn the inner eye to see its path. Where th...
25
645
probability
tensorflow_probability/python/experimental/fastgp/partial_lanczos_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...
205
7,233
hatch
tests/cli/dep/show/test_table.py
.py
import os import pytest from hatch.config.constants import ConfigEnvVars from hatch.project.core import Project from hatch.utils.structures import EnvVars from hatchling.utils.constants import DEFAULT_CONFIG_FILE @pytest.fixture(scope="module", autouse=True) def _terminal_width(): with EnvVars({"COLUMNS": "200"...
264
8,128
gunicorn
tests/requests/invalid/016.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.http.errors import InvalidRequestLine request = InvalidRequestLine
8
188
black
profiling/dict_big.py
.py
config = some.Structure( some_mapping={ "00501": "AB890X", "00544": "AB890X", "01001": "AB889X", "01002": "AB889X", "01003": "AB889X", "01004": "AB889X", "01005": "AB889X", "01007": "AB889X", "01008": "AB889X", "01009": "AB889X", ...
8,002
215,971
rq
rq/rate_limit.py
.py
from __future__ import annotations from datetime import datetime from functools import cached_property from redis import Redis from redis.client import Pipeline from .utils import as_text, current_timestamp, now, utcformat class RateLimit: """Defines a concurrency-based rate limit for jobs. Args: ...
272
11,056
onnx
onnx/reference/ops/op_erf.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from math import erf import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class Erf(OpRunUnaryNum): def __init__(self, onnx_node, run_params): OpRunUnaryNum.__init__(self, ...
20
466
beam
sdks/python/apache_beam/examples/complete/game/hourly_team_score_it_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...
126
4,620
pyomo
pyomo/solvers/plugins/solvers/pywrapper.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...
41
1,494
wandb
wandb/sdk/artifacts/_generated/registry_versions.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 ArtifactMembershipFragment, PageInfoFragment class RegistryVersions(GQLResult): organization: RegistryVersionsOrg...
42
1,314
jupyterlab
jupyterlab/tests/__init__.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from typing import NamedTuple class Response(NamedTuple): """Fake tornado response.""" body: bytes def fake_client_factory(): class FakeClient: """Fake AsyncHTTPClient body can be set ...
26
500
wandb
tools/perf/scripts/setup_helper.py
.py
import logging from . import _PACKAGE_LOGGER def setup_package_logger() -> None: """Configure the package logger to write to a file and to the screen.""" _PACKAGE_LOGGER.setLevel(logging.DEBUG) # Create handlers for screen (console) and file logging console_handler = logging.StreamHandler() file...
28
918
onnxruntime
onnxruntime/test/testdata/make_transpose_optimizer_empty_dq_q_at_output_model.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import numpy as np import onnx def make_model(model_path: str): """ Creates a QDQ model with a (DQ -> Transpose -> Q -> GRAPH OUTPUT) sequence. The Transpose is optimized out and the TransposeOptimizer should al...
118
4,128
saleor
saleor/graphql/payment/mutations/payment/__init__.py
.py
from .checkout_payment_create import CheckoutPaymentCreate from .payment_capture import PaymentCapture from .payment_check_balance import PaymentCheckBalance from .payment_initialize import PaymentInitialize from .payment_refund import PaymentRefund from .payment_void import PaymentVoid __all__ = [ "CheckoutPaymen...
16
446
ipython
IPython/utils/_process_win32.py
.py
"""Windows-specific implementation of process utilities. This file is only meant to be imported by process.py, not by end-users. """ import ctypes import os import subprocess import sys import time from ctypes import POINTER, c_int from ctypes.wintypes import HLOCAL, LPCWSTR from subprocess import STDOUT from threadi...
209
6,549
hatch
tests/helpers/templates/wheel/standard_default_build_script_artifacts_with_src_layout.py
.py
from hatch.template import File from hatch.utils.fs import Path from hatchling.__about__ import __version__ from hatchling.metadata.spec import DEFAULT_METADATA_VERSION from ..new.default import get_files as get_template_files from .utils import update_record_file_contents def get_files(**kwargs): metadata_direc...
52
1,398
wagtail
wagtail/test/numberformat.py
.py
# Patch Django's number formatting functions during tests so that outputting a number onto a # template without explicitly passing it through one of |intcomma, |localize, |unlocalize or # |filesizeformat will raise an exception. This helps to catch bugs where # USE_THOUSAND_SEPARATOR = True incorrectly reformats number...
135
5,040
rq
tests/test_connection.py
.py
from redis import ConnectionPool, Redis, SSLConnection, UnixDomainSocketConnection from rq.connections import parse_connection from tests import RQTestCase class TestConnectionInheritance(RQTestCase): def test_parse_connection(self): """Test parsing the connection""" conn_class, pool_class, pool_...
20
834
beam
sdks/python/apache_beam/ml/anomaly/detectors/pyod_adapter.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,116
mkdocs
mkdocs/utils/meta.py
.py
""" Copyright (c) 2015, Waylan Limberg All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following...
101
3,645
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/quad_form_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...
48
1,757
probability
tensorflow_probability/python/distributions/lognormal_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...
169
6,974
python-prompt-toolkit
examples/dialogs/checkbox_dialog.py
.py
#!/usr/bin/env python """ Example of a checkbox-list-based dialog. """ from prompt_toolkit.formatted_text import HTML from prompt_toolkit.shortcuts import checkboxlist_dialog, message_dialog from prompt_toolkit.styles import Style results = checkboxlist_dialog( title="CheckboxList dialog", text="What would yo...
38
1,062
astropy
astropy/coordinates/tests/test_sky_coord_velocities.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for putting velocity differentials into SkyCoord objects. Note: the skyoffset velocity tests are in a different file, in test_skyoffset_transformations.py """ import numpy as np import pytest from astropy import units as u from astropy.coordi...
298
9,229
probability
tensorflow_probability/python/debugging/__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...
22
827
pyomo
pyomo/core/expr/visitor.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,780
64,045
openvino
src/bindings/python/tests/test_graph/test_ops_scatter.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.opset13 as ov from openvino import Type def test_scatter_update_props(): dtype = np.int8 parameter_r = ov.parameter([2, 3, 4], dtype=dtype, name="data") ...
63
2,197
luigi
test/customized_run_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...
128
3,990
cvxpy
cvxpy/reductions/solvers/conic_solvers/ecos_bb_conif.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...
148
5,650
sqlmap
lib/techniques/ssti/inject.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import difflib import re import time from collections import namedtuple from lib.core.common import beep from lib.core.common import randomInt from lib.core.common import random...
1,141
57,261
saleor
saleor/graphql/product/tests/test_attributes.py
.py
from unittest import mock import graphene import pytest from ....attribute import AttributeInputType, AttributeType from ....attribute.models import ( AssignedProductAttributeValue, Attribute, AttributeProduct, AttributeValue, AttributeVariant, ) from ....attribute.tests.model_helpers import ( ...
2,053
65,182