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
jupytext
tests/data/notebooks/outputs/ipynb_to_script/Notebook with html and latex cells.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + language="html" # <p><a href="https://github.com/mwouts/jupytext", style="color: rgb(0,0,255)">Jupytext</a> on GitHub</p> # + language="latex" # $\frac{\pi}{2}$ # - # %load_ext rpy2.ipython # + languag...
26
531
saleor
saleor/graphql/core/validators/query_cost.py
.py
from collections import defaultdict from functools import reduce from operator import add, mul from typing import Any, cast from graphql import ( GraphQLArgument, GraphQLError, GraphQLInterfaceType, GraphQLObjectType, GraphQLSchema, get_named_type, ) from graphql.execution.values import get_arg...
350
12,841
mlflow
mlflow/system_metrics/metrics/base_metrics_monitor.py
.py
"""Base class of system metrics monitor.""" import abc from collections import defaultdict class BaseMetricsMonitor(abc.ABC): """Base class of system metrics monitor.""" def __init__(self): self._metrics = defaultdict(list) @abc.abstractmethod def collect_metrics(self): """Method to...
33
780
saleor
saleor/graphql/checkout/mutations/checkout_lines_delete.py
.py
import graphene from django.core.exceptions import ValidationError from ....checkout.actions import call_checkout_info_event from ....checkout.error_codes import CheckoutErrorCode from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from ....checkout.utils import invalidate_checkout from ....webhoo...
123
4,732
onnxruntime
onnxruntime/test/python/quantization/resnet_code.py
.py
import numpy from onnx import numpy_helper from onnx.helper import make_graph, make_model, make_node, make_opsetid, make_tensor_value_info, set_model_props def create_model(): initializers = [] nodes = [] inputs = [] outputs = [] functions = [] # opsets opsets = {"": 13} # initialize...
13,758
407,364
scikit-bio
skbio/util/_gpu.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. # --------------------------------------------...
32
803
mlflow
mlflow/entities/assessment_error.py
.py
from dataclasses import dataclass from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.assessments_pb2 import AssessmentError as ProtoAssessmentError _STACK_TRACE_TRUNCATION_PREFIX = "[Stack trace is truncated]\n...\n" _STACK_TRACE_TRUNCATION_LENGTH = 10000 @dataclass class AssessmentError(_M...
78
2,498
mlflow
tests/cli/test_crypto.py
.py
import logging from contextlib import contextmanager from unittest import mock import pytest from click.testing import CliRunner from mlflow.cli.crypto import commands from mlflow.exceptions import MlflowException @pytest.fixture(autouse=True) def suppress_logging(): original_root = logging.root.level origi...
415
15,629
readthedocs.org
readthedocs/proxito/urls.py
.py
""" A quick rundown of all the URL's we are hoping to parse. ## Projects pip.rtfd.io/<lang>/<version>/ * Can be single version (pip.rtfd.io/index.html) * Can be translated (pip.rtfd.io/cz/latest/index.html) * Can have subprojects (pip.rtfd.io/projects/foo/en/latest/index.html) ## Subprojects pip.rtfd.io/projects/<...
232
7,506
openvino
tests/layer_tests/tensorflow_tests/test_tf_Split.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 TestSplit(CommonTFLayerTest): def create_split_net(self, value_shape, axis_value, num_split): tf.compat.v1.reset_default_g...
38
1,539
onnx
onnx/reference/ops/_helpers.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import Any from onnx.reference.op_run import OpRun def _split_class_name(name): if "_" in name: prefix, vers = name.rsplit("_", maxsplit=1) try: v = int(ve...
68
2,139
mlflow
mlflow/store/artifact/optimized_s3_artifact_repo.py
.py
import json import logging import os import posixpath import urllib.parse from mimetypes import guess_type from mlflow.entities import FileInfo from mlflow.environment_variables import ( MLFLOW_ENABLE_MULTIPART_UPLOAD, MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE, MLFLOW_S3_EXPECTED_BUCKET_OWNER, MLFLOW_S3_UPLOA...
409
17,354
onnx
onnx/__init__.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations __all__ = [ # Constants "ONNX_ML", "IR_VERSION", "IR_VERSION_2017_10_10", "IR_VERSION_2017_10_30", "IR_VERSION_2017_11_3", "IR_VERSION_2019_1_22", "IR_VERSION_2019_3_18"...
471
15,429
textual
src/textual/features.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, cast from typing_extensions import Literal if TYPE_CHECKING: from typing_extensions import Final FEATURES: Final = {"devtools", "debug", "headless"} FeatureFlag = Literal["devtools", "debug", "headless"] def parse_features(features: str) ->...
30
699
saleor
saleor/webhook/observability/tests/test_buffer.py
.py
import datetime import pytest from django.utils import timezone from freezegun import freeze_time from ..buffers import RedisBuffer, get_buffer from ..exceptions import ConnectionNotConfigured from ..tests.conftest import BATCH_SIZE, BROKER_URL_HOST, KEY, MAX_SIZE def test_get_buffer(redis_server, settings): bu...
159
5,101
pyomo
examples/pyomo/radertext/Ex2_6a.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...
70
1,953
astropy
astropy/samp/hub_proxy.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import xmlrpc.client as xmlrpc from .errors import SAMPHubError from .lockfile_helpers import get_main_running_hub from .utils import SAMPXXEServerProxy, ServerProxyPool __all__ = ["SAMPHubProxy"] class SAMPHubProxy: """ Proxy cla...
198
6,061
mlflow
examples/transformers/simple.py
.py
import transformers import mlflow task = "text-generation" generation_pipeline = transformers.pipeline( task=task, model="gpt2", ) input_example = ["prompt 1", "prompt 2", "prompt 3"] parameters = {"max_length": 512, "do_sample": True} with mlflow.start_run() as run: model_info = mlflow.transformers.l...
32
806
black
src/blib2to3/pgen2/conv.py
.py
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # mypy: ignore-errors """Convert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar no...
257
9,596
mlflow
tests/helper_functions.py
.py
import functools import json import logging import numbers import os import random import signal import socket import subprocess import sys import tempfile import time import uuid from contextlib import contextmanager from functools import wraps from pathlib import Path from typing import Iterator from unittest import ...
854
27,931
textual
docs/examples/guide/input/binding01.py
.py
from textual.app import App, ComposeResult from textual.color import Color from textual.widgets import Footer, Static class Bar(Static): pass class BindingApp(App): CSS_PATH = "binding01.tcss" BINDINGS = [ ("r", "add_bar('red')", "Add Red"), ("g", "add_bar('green')", "Add Green"), ...
31
734
coremltools
coremltools/models/ml_program/__init__.py
.py
# Copyright (c) 2022, 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 . import compression_utils, experimental
7
262
saleor
saleor/channel/tests/fixtures/channel.py
.py
import pytest from django.conf import settings from ....channel import AllocationStrategy from ....channel.models import Channel from ....graphql.channel.tests.benchmark import CHANNEL_COUNT_IN_BENCHMARKS from ....tax.tests.fixtures.utils import create_channel_tax_configuration from ....warehouse.models import Warehou...
96
2,652
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_subtract.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 TestKerasSubtract(CommonTF2LayerTest): def create_keras_subtract_net(self, input_names, input_shapes, input_type, ir_version): ...
57
2,671
saleor
saleor/graphql/product/filters/collection.py
.py
import django_filters import graphene from django.db.models import Q from ....product.models import ( Collection, ) from ...channel.filters import get_channel_slug_from_filter_data from ...core.doc_category import DOC_CATEGORY_PRODUCTS from ...core.filters import ( ChannelFilterInputObjectType, EnumFilter,...
86
2,685
saleor
saleor/graphql/checkout/tests/mutations/test_utils.py
.py
import graphene from .....checkout.fetch import fetch_checkout_lines from ...mutations.utils import ( CheckoutLineData, group_lines_input_data_on_update, group_lines_input_on_add, ) def test_group_on_add_when_same_variants_in_multiple_lines(): variant_1_id = graphene.Node.to_global_id("ProductVariant...
189
6,175
conda
tests/common/test_toposort.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import pytest from conda.common.toposort import pop_key, toposort def test_pop_key(): key = pop_key({"a": {"b", "c"}, "b": {"c"}}) assert key == "b" key = pop_key({"a": {"b"}, "b": {"c", "a"}}) assert key == "a" key = po...
99
2,816
mlflow
mlflow/store/model_registry/sqlalchemy_workspace_store.py
.py
""" Workspace-aware variant of the model registry SQLAlchemy store. """ from __future__ import annotations import logging from mlflow.store.model_registry.sqlalchemy_store import SqlAlchemyStore from mlflow.store.workspace_aware_mixin import WorkspaceAwareMixin _logger = logging.getLogger(__name__) class Workspac...
36
1,195
mlflow
mlflow/genai/scheduled_scorers.py
.py
from dataclasses import dataclass from mlflow.genai.scorers.base import Scorer _ERROR_MSG = ( "The `databricks-agents` package is required to use `mlflow.genai.scheduled_scorers`. " "Please install it with `pip install databricks-agents`." ) @dataclass() class ScorerScheduleConfig: """ A scheduled s...
83
3,568
pyomo
pyomo/contrib/piecewise/tests/test_reduced_inner_repn.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...
261
10,809
pyfilesystem2
examples/find_dups.py
.py
""" Find paths to files with identical contents. Usage: python find_dups.py <PATH or FS URL> """ import sys from collections import defaultdict from fs import open_fs hashes = defaultdict(list) with open_fs(sys.argv[1]) as fs: for path in fs.walk.files(): file_hash = fs.hash(path, "md5") ...
28
473
wandb
tests/system_tests/test_launch/test_launch_kubernetes.py
.py
from unittest.mock import AsyncMock, MagicMock import kubernetes_asyncio import pytest from wandb.apis.internal import Api from wandb.sdk.launch import loader from wandb.sdk.launch.agent.agent import LaunchAgent from wandb.sdk.launch.runner import kubernetes_monitor, kubernetes_runner from wandb.sdk.launch.utils impor...
419
12,574
pyomo
pyomo/dataportal/tests/test_dataportal.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,279
80,645
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_roi_align.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # roi_align paddle model generator # import numpy as np from save_model import saveModel import paddle import ops import sys def make_rois(batch_size, width, height, pooled_width, pooled_height, spatial_scale, roi_per_batch): roi...
126
4,319
saleor
saleor/graphql/payment/mutations/transaction/transaction_initialize.py
.py
import uuid import graphene from django.conf import settings from django.core.exceptions import ValidationError from .....app.models import App from .....channel.models import Channel from .....checkout import models as checkout_models from .....checkout.utils import activate_payments, cancel_active_payments from ......
245
9,560
pyomo
pyomo/core/expr/sympy_tools.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,718
cvxpy
cvxpy/tests/nlp_tests/test_nlp_solvers.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 ...
496
18,997
pyomo
pyomo/contrib/pynumero/interfaces/__init__.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...
17
834
hatch
tests/helpers/templates/new/licenses_empty.py
.py
from hatch.template import File from hatch.utils.fs import Path def get_files(**kwargs): return [ File(Path("src", kwargs["package_name"], "__init__.py")), File(Path("src", kwargs["package_name"], "__about__.py"), '__version__ = "0.0.1"\n'), File(Path("tests", "__init__.py")), File...
98
2,793
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/partition_multiple_arguments.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,612
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_conv_lstm_2d.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.tf2_layer_test_class import CommonTF2LayerTest class TestKerasConvLSTM2D(CommonTF2LayerTest): def _prepare_input(self, inputs_info): # Need to generate th...
69
3,137
probability
tensorflow_probability/python/math/integration.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...
89
3,511
onnxruntime
onnxruntime/test/testdata/transformers/tiny_t5/tiny_t5.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import os from sentencepiece import SentencePieceProcessor, SentencePi...
86
2,685
pyomo
pyomo/dae/misc.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...
508
18,740
textual
docs/examples/guide/screens/questions01.py
.py
from textual import on, work from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Button, Label class QuestionScreen(Screen[bool]): """Screen with a parameter.""" def __init__(self, question: str) -> None: self.question = question super().__...
46
1,142
astropy
astropy/io/fits/tests/test_fitstime.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.coordinates import EarthLocation from astropy.io import fits from astropy.io.fits.fitstime import ( GLOBAL_TIME_INFO, is_time_column_keyword, time_to_fits, ) from astropy.table import Column, QTab...
584
22,079
astropy
docs/wcs/examples/cube_wcs.py
.py
# Define the astropy.wcs.WCS object using a Python dictionary as input import astropy.wcs wcs_dict = { "CTYPE1": "WAVE ", "CUNIT1": "Angstrom", "CDELT1": 0.2, "CRPIX1": 0, "CRVAL1": 10, "NAXIS1": 5, "CTYPE2": "HPLT-TAN", "CUNIT2": "deg", "CDELT2": 0.5, "CRPIX2": 2, "CRVA...
26
504
wandb
tests/unit_tests/test_util.py
.py
import enum import json import os import platform import random import sys import tarfile import tempfile from dataclasses import dataclass from unittest import mock import matplotlib.pyplot as plt import numpy as np import plotly import pytest import wandb from wandb import util #####################################...
701
21,520
probability
spinoffs/fun_mc/fun_mc/util_tfp.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...
137
4,460
beam
playground/infrastructure/helper.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 ...
386
13,598
astropy
astropy/io/votable/tests/test_resource.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # LOCAL import io from astropy.io.votable import parse from astropy.utils.data import get_pkg_data_filename def test_resource_groups(): # Read the VOTABLE votable = parse(get_pkg_data_filename("data/resource_groups.xml")) resource = votable...
50
1,274
sqlmap
tamper/greatest.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.enums import PRIORITY __priority__ = PRIORITY.HIGHEST def dependencies(): pass def tamper(payload, **kwargs): """ Replaces greater than ope...
56
1,362
bazel
third_party/py/abseil/absl/flags/_defines.py
.py
# Copyright 2017 The Abseil 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 ...
928
31,800
probability
spinoffs/fun_mc/fun_mc/malt_test.py
.py
# Copyright 2022 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...
220
6,260
beam
sdks/python/apache_beam/testing/benchmarks/nexmark/queries/query9.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...
33
1,258
confluent-kafka-python
src/confluent_kafka/schema_registry/rules/encryption/gcpkms/gcp_client.py
.py
# Copyright 2024 Confluent Inc. # Copyright 2019 Google LLC # # 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 applicab...
83
2,986
lemur
lemur/destinations/models.py
.py
""" .. module: lemur.destinations.models :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy import Column, Integer, String, Text from sqlalchemy.orm import valid...
36
1,018
astropy
astropy/utils/tests/data/test_package/__init__.py
.py
from astropy.utils.data import get_pkg_data_filename def get_data_filename(): return get_pkg_data_filename("data/foo.txt")
6
129
probability
tensorflow_probability/python/bijectors/rational_quadratic_spline_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...
302
11,802
rq
rq/executions.py
.py
from __future__ import annotations import logging from datetime import datetime, timezone from typing import TYPE_CHECKING, Any from uuid import uuid4 from redis import Redis if TYPE_CHECKING: from redis.client import Pipeline from .worker.base import BaseWorker from .job import Job from .registry import B...
251
10,215
pyro
tests/poutine/test_counterfactual.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from tests.common import assert_equal, assert_not_equal def _item(x): if isinstance(x, torch.Tensor): x = x.item...
103
3,829
openvino
tests/e2e_tests/common/marks.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re from enum import Enum from itertools import chain from typing import Union from _pytest.nodes import Item from .config import repository_name from .logger import get_logger RePattern = type(re.compile("")) logger = get_logg...
276
9,671
pyomo
pyomo/opt/solver/shellcmd.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...
417
15,777
pyomo
pyomo/contrib/alternative_solutions/tests/test_solution.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...
92
2,841
mlflow
tests/agent/test_cli.py
.py
from __future__ import annotations import json import subprocess from pathlib import Path from unittest import mock import click import pytest from click.testing import CliRunner from mlflow.agent.agents import AGENTS from mlflow.agent.setup.cli import _git_root, _is_localhost_tracking_uri, setup from mlflow.telemet...
564
22,807
conda
conda/activate.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Conda activate and deactivate logic. Implementation for all shell interface logic exposed via `conda shell.* [activate|deactivate|reactivate|hook|commands]`. This includes a custom argument parser, an abstract shell class, and special path h...
1,191
45,132
onnx
onnx/backend/test/case/node/bitwiseor.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 from onnx.numpy_helper import create_random_int class BitwiseOr(Base): @...
53
1,640
pyomo
pyomo/core/tests/unit/test_logical_constraint.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...
427
14,223
beam
sdks/python/apache_beam/tools/map_fn_microbenchmark.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 ...
73
2,527
openvino
src/bindings/python/tests/test_transformations/test_compression_4bit.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import opset13 as opset import openvino as ov import pytest @pytest.mark.parametrize( ("ov_type", "numpy_dtype"), [ (ov.Type.f32, np.float32), (ov.Type....
102
2,774
openvino
tests/layer_tests/tensorflow_tests/test_tf_BinaryOps.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import platform import pytest from common.tf_layer_test_class import CommonTFLayerTest rng = np.random.default_rng() def generate_input(x_shape, x_type, bound=False): # usual function domain lower = -25 ...
100
3,778
saleor
saleor/graphql/page/tests/mutations/test_page_attribute_assign.py
.py
from unittest.mock import ANY import graphene from .....page.error_codes import PageErrorCode from ....tests.utils import assert_no_permission, get_graphql_content PAGE_ASSIGN_ATTR_QUERY = """ mutation assign($pageTypeId: ID!, $attributeIds: [ID!]!) { pageAttributeAssign(pageTypeId: $pageTypeId, attributeI...
438
13,406
wagtail
wagtail/images/permissions.py
.py
import warnings from wagtail.images import get_image_model, get_permission_policy from wagtail.permissions import policy_registry from wagtail.utils.deprecation import RemovedInWagtail90Warning warnings.warn( "wagtail.images.permissions.permission_policy is deprecated. " "Use wagtail.permissions.policy_regist...
25
987
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/withtimestamps_processing_time.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");...
67
2,130
pyomo
pyomo/gdp/tests/test_bigm.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,942
115,968
sphinx
tests/roots/test-ext-viewcode-find-package/conf.py
.py
import sys from pathlib import Path source_dir = str(Path.cwd().resolve()) if source_dir not in sys.path: sys.path.insert(0, source_dir) extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] exclude_patterns = ['_build'] if 'test_linkcode' in tags: # NoQA: F821 (tags is injected into conf.py) extension...
25
815
coveragepy
tests/test_concurrency.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """Tests for concurrency libraries.""" from __future__ import annotations import glob import multiprocessing import os import pathlib import random import re im...
825
27,229
sqlmap
plugins/dbms/extremedb/enumeration.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.data import logger from plugins.generic.enumeration import Enumeration as GenericEnumeration class Enumeration(GenericEnumeration): def getBanner(self): ...
85
2,426
onnx
onnx/reference/ops/op_quantize_linear.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 import TensorProto from onnx.helper import ( np_dtype_to_tensor_dtype, tensor_dtype_to_np_dtype, ) from onnx.reference.op_run import OpRun from onnx.re...
191
5,708
textual
docs/examples/guide/screens/modal01.py
.py
from textual.app import App, ComposeResult from textual.containers import Grid from textual.screen import Screen from textual.widgets import Button, Footer, Header, 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 t...
51
1,423
saleor
saleor/graphql/warehouse/filters.py
.py
import django_filters import graphene from django.db.models import Exists, OuterRef, Q from ...account.models import Address from ...product.models import Product, ProductVariant from ...warehouse import WarehouseClickAndCollectOption from ...warehouse.models import Stock, Warehouse from ..channel.types import Channel...
135
4,456
readthedocs.org
readthedocs/core/templatetags/readthedocs/socialaccounts.py
.py
from allauth.socialaccount.adapter import get_adapter from allauth.socialaccount.providers.github.provider import GitHubProvider from django import forms from django import template from readthedocs.allauth.providers.githubapp.provider import GitHubAppProvider from readthedocs.oauth.utils import is_access_revoked as u...
44
1,226
beam
sdks/python/apache_beam/ml/transforms/embeddings/vertex_ai_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...
403
14,962
openvino
tests/layer_tests/tensorflow_tests/test_tf_IsInf.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 from common.utils.tf_utils import mix_array_with_value class TestIsInf(CommonTFLayerTest): def _prepare_input(self, i...
45
1,612
lemur
lemur/common/celery.py
.py
""" This module controls defines celery tasks and their applicable schedules. The celery beat server and workers will start when invoked. When ran in development mode (LEMUR_CONFIG=<location of development configuration file. To run both the celery beat scheduler and a worker simultaneously, and to have jobs kick off ...
1,113
38,390
biopython
Bio/Medline/__init__.py
.py
# Copyright 1999 by Jeffrey Chang. 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. """Code to work with Med...
226
6,272
sqlmap
tamper/commalessmid.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os import re from lib.core.common import singleTimeWarnMessage from lib.core.enums import DBMS from lib.core.enums import PRIORITY __priority__ = PRIORITY.HIGH def depen...
45
1,224
metrics
examples/image/clip_score.py
.py
""" CLIPScore =============================== The CLIPScore is a model-based image captioning metric that correlates well with human judgments. The benefit of CLIPScore is that it does not require reference captions for evaluation. """ # %% # Here's a hypothetical Python example demonstrating the usage of the CLIPSc...
110
3,101
pyomo
pyomo/contrib/parmest/examples/reactor_design/reactor_design.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...
161
4,787
saleor
saleor/graphql/order/tests/queries/test_order.py
.py
from decimal import Decimal import graphene import pytest from django.utils import timezone from prices import Money, TaxedMoney from .....core.prices import quantize_price from .....core.taxes import zero_taxed_money from .....discount import DiscountType from .....giftcard import GiftCardEvents, events from .....gi...
2,413
76,468
pyro
pyro/poutine/do_messenger.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import numbers import warnings from typing import Dict, Union import torch from pyro.poutine.messenger import Messenger from pyro.poutine.runtime import Message, apply_stack class DoMessenger(Messenger): """ Given a sto...
95
3,476
scikit-bio
skbio/diversity/alpha/tests/test_ace.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. # --------------------------------------------...
41
1,496
conda
conda/instructions.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Define the instruction set (constants) for conda operations.""" from logging import getLogger from os.path import isfile, join from .core.link import UnlinkLinkTransaction from .core.package_cache_data import ProgressiveFetchExtract from .d...
114
2,862
metrics
src/torchmetrics/classification/logauc.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...
508
23,446
python-prompt-toolkit
examples/full-screen/simple-demos/margins.py
.py
#!/usr/bin/env python """ Example of Window margins. This is mainly used for displaying line numbers and scroll bars, but it could be used to display any other kind of information as well. """ from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.key_binding i...
73
2,183
black
tests/data/cases/trailing_commas_in_leading_parts.py
.py
zero(one,).two(three,).four(five,) func1(arg1).func2(arg2,).func3(arg3).func4(arg4,).func5(arg5) # Inner one-element tuple shouldn't explode func1(arg1).func2(arg1, (one_tuple,)).func3(arg3) (a, b, c, d,) = func1(arg1) and func2(arg2) # Example from https://github.com/psf/black/issues/3229 def refresh_token(self, ...
89
2,123
mlflow
mlflow/metrics/genai/prompts/v1.py
.py
from dataclasses import dataclass, field from typing import Any from mlflow.metrics.genai.base import EvaluationExample from mlflow.metrics.genai.prompt_template import PromptTemplate # TODO: Update the default_mode and default_parameters to the correct values post experimentation default_model = "openai:/gpt-4" # De...
458
22,799
sphinx
sphinx/transforms/i18n.py
.py
"""Docutils transforms used by Sphinx when reading documents.""" from __future__ import annotations from operator import attrgetter from re import DOTALL, match from textwrap import indent from typing import TYPE_CHECKING, Any import docutils.utils from docutils import nodes from sphinx import addnodes from sphinx....
721
28,201
onnxruntime
onnxruntime/python/tools/quantization/operators/resize.py
.py
from .direct_q8 import Direct8BitOp, QDQDirect8BitOp class QResize(Direct8BitOp): def __init__(self, onnx_quantizer, onnx_node): super().__init__(onnx_quantizer, onnx_node) def quantize(self): node = self.node assert node.op_type == "Resize" # if version is less than 11, go t...
35
928
saleor
saleor/graphql/product/bulk_mutations/product_variant_stocks_create.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from ....core.tracing import traced_atomic_transaction from ....core.utils.events import call_event from ....permission.enums import ProductPermissions from ....warehouse.channel_stock_availability import ( trig...
168
6,570