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
mlflow
examples/auth/auth.py
.py
import os import uuid import mlflow.server class User: MLFLOW_TRACKING_USERNAME = "MLFLOW_TRACKING_USERNAME" MLFLOW_TRACKING_PASSWORD = "MLFLOW_TRACKING_PASSWORD" def __init__(self, username, password) -> None: self.username = username self.password = password self.env = {} ...
67
1,883
coremltools
coremltools/test/converters/torch/test_ops.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 # # Test suite for dynamic padding conversion (Issue #2583) # These tests verify the fix for conv...
187
6,641
openvino
samples/python/classification_sample_async/classification_sample_async.py
.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import logging as log import sys import cv2 import numpy as np import openvino as ov def parse_args() -> argparse.Namespace: """Parse and return command line arguments...
132
5,211
onnx
onnx/reference/ops/op_det.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 Det(OpRun): def _run(self, x): return (np.array(np.linalg.det(x)),)
14
265
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_separableconv2d.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 TestKerasSeparableConv2D(CommonTF2LayerTest): def create_keras_separableconv2d_net(self, input_names, input_shapes, input_type,...
128
7,512
beam
sdks/python/apache_beam/internal/gcp/json_value_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
3,857
openvino
tests/layer_tests/pytorch_tests/test_prelu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestPRelu(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self, alpha): impor...
34
970
astropy
astropy/nddata/mixins/ndio.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the I/O mixin to the NDData class. from astropy.io import registry __all__ = ["NDIOMixin"] __doctest_skip__ = ["NDDataRead", "NDDataWrite"] class NDDataRead(registry.UnifiedReadWrite): """Read and parse gridded N-dimension...
115
3,689
eve
tests/versioning.py
.py
# -*- coding: utf-8 -*- import copy import time from bson import ObjectId from eve import ETAG, STATUS, STATUS_OK from . import TestBase from .test_settings import MONGO_DBNAME from .utils import DummyEvent class TestVersioningBase(TestBase): def setUp(self): self.versioned_field = "ref" self....
1,509
59,445
saleor
saleor/attribute/management/commands/update_attribute_file_urls.py
.py
import logging import re from urllib.parse import urlparse from botocore.exceptions import ClientError from django.conf import settings from django.core.management.base import BaseCommand, CommandError from ....core.storages import S3MediaStorage from ...models import AttributeValue logger = logging.getLogger(__name...
57
2,100
lemur
lemur/policies/models.py
.py
""" .. module: lemur.policies.models :platform: unix :synopsis: This module contains all of the models need to create a certificate policy within Lemur. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@ne...
24
735
mlflow
examples/pyspark_ml_autologging/pipeline.py
.py
from pyspark.ml import Pipeline from pyspark.ml.classification import LogisticRegression from pyspark.ml.feature import StandardScaler, VectorAssembler from pyspark.sql import SparkSession from sklearn.datasets import load_iris import mlflow with SparkSession.builder.getOrCreate() as spark: mlflow.pyspark.ml.auto...
34
1,250
openvino
src/bindings/python/tests/test_graph/test_log_softmax.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov from openvino import Shape, Type def test_log_softmax(): data = ov.parameter(Shape([3, 10]), dtype=np.float32, name="data") node = ov.log_softmax(data, 1)...
18
516
kafka
tests/kafkatest/services/delegation_tokens.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 ...
108
5,006
wandb
tests/unit_tests/test_lib/test_ratelimit.py
.py
import asyncio import pytest from looptime import LoopTimeProxy from wandb.sdk.lib import asyncio_compat, ratelimit @pytest.mark.asyncio @pytest.mark.looptime async def test_allows_first_event(looptime: LoopTimeProxy): cooldown = ratelimit.Cooldown(13) await cooldown.wait() # Should not sleep, so no ti...
51
1,371
cvxpy
cvxpy/atoms/norm_inf.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...
133
4,031
scikit-bio
skbio/stats/power.py
.py
r"""Empirical Power Estimation (:mod:`skbio.stats.power`) ===================================================== .. currentmodule:: skbio.stats.power The purpose of this module is to provide empirical, post-hoc power estimation of normally and non-normally distributed data. It also provides support to subsample data t...
1,231
47,548
probability
tensorflow_probability/python/distributions/lkj_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...
483
21,150
saleor
saleor/graphql/shop/tests/mutations/test_refund_settings_update.py
.py
import graphene from .....page.models import PageType from .....site.error_codes import RefundSettingsErrorCode from ....tests.utils import assert_no_permission, get_graphql_content REFUND_SETTINGS_UPDATE_MUTATION = """ mutation refundSettingsUpdate($input: RefundSettingsUpdateInput!) { refundSettingsUpda...
276
8,765
mlflow
dev/clint/src/clint/__main__.py
.py
from clint import main main()
4
31
mlflow
mlflow/genai/judges/optimizers/memalign/prompts.py
.py
DISTILLATION_PROMPT_TEMPLATE = """You are helping improve an LLM judge with the \ following instructions: {{ judge_instructions }} Given a set of examples and a user's judgement of their quality, your task is to \ distill a set of guidelines from the judgements to model this user's perspective, \ which can be used to ...
69
2,655
scikit-bio
skbio/io/format/tests/test_blast7.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. # --------------------------------------------...
211
9,968
conda
tests/cli/test_main_notices.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import datetime import glob import hashlib import json import os from typing import TYPE_CHECKING import pytest from conda.base.constants import NOTICES_DECORATOR_DISPLAY_INTERVAL from conda.base.context imp...
463
14,118
pyro
pyro/poutine/trace_struct.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import sys from collections import OrderedDict from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Literal, Optional, Set, Tuple, Union, ) import opt_e...
582
22,785
textual
tests/test_geometry.py
.py
from typing import Literal import pytest from textual.geometry import Offset, Region, Shape, Size, Spacing, clamp def test_dimensions_region(): assert Size(30, 40).region == Region(0, 0, 30, 40) def test_dimensions_contains(): assert Size(10, 10).contains(5, 5) assert Size(10, 10).contains(9, 9) a...
834
22,314
saleor
saleor/graphql/meta/tests/queries/test_order.py
.py
import graphene from .....order.models import Order from .....permission.models import Permission from ....tests.fixtures import ApiClient from ....tests.utils import assert_no_permission, get_graphql_content from .utils import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE, execute_query QUERY_ORDER_BY_TOKEN_P...
1,018
29,696
sqlmap
plugins/dbms/cache/fingerprint.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.common import Backend from lib.core.common import Format from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.data import...
114
3,134
python-prompt-toolkit
examples/prompts/get-input-vi-mode.py
.py
#!/usr/bin/env python from prompt_toolkit import prompt if __name__ == "__main__": print("You have Vi keybindings here. Press [Esc] to go to navigation mode.") answer = prompt("Give me some input: ", multiline=False, vi_mode=True) print(f"You said: {answer}")
8
273
sphinx
tests/roots/test-ext-doctest/conf.py
.py
extensions = ['sphinx.ext.doctest'] project = 'test project for doctest' root_doc = 'doctest' source_suffix = { '.txt': 'restructuredtext', } exclude_patterns = ['_build']
9
177
saleor
saleor/graphql/shop/utils.py
.py
from django.conf import settings from django_countries import countries from ...shipping.models import ShippingZone from ..site.dataloaders import get_site_promise def get_countries_codes_list( attached_to_shipping_zones: bool | None = None, database_connection_name: str = settings.DATABASE_CONNECTION_DEFAUL...
41
1,381
loguru
tests/exceptions/source/backtrace/frame_values_backward.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=False, backtrace=True, diagnose=False) k = 2 @logger.catch def a(n): 1 / n def b(n): a(n - 1) def c(n): b(n - 1) c(k)
25
237
onnxruntime
onnxruntime/test/python/onnxruntime_test_python_backend_mlops.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import unittest import numpy as np from helper import get_name from onnx import load import onnxruntime.backend as backend from onnxruntime import datasets from onnxruntime.backend.backend import OnnxRuntimeBackend as ort_b...
95
3,301
pyomo
pyomo/contrib/parmest/tests/test_utils.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...
207
8,356
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/regex_find.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");...
62
1,942
openvino
tests/layer_tests/jax_tests/test_reshape.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from jax import lax from jax import numpy as jnp from jax_layer_test_class import JaxLayerTest class TestReshape(JaxLayerTest): def _prepare_input(self): inp = jnp.array(np.random.rand(*sel...
86
2,703
hydra
hydra/plugins/search_path_plugin.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from abc import abstractmethod from hydra.core.config_search_path import ConfigSearchPath from .plugin import Plugin class SearchPathPlugin(Plugin): @abstractmethod def manipulate_search_path(self, search_path: ConfigSearchPath) -> None:...
12
325
metrics
src/torchmetrics/functional/multimodal/clip_score.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...
359
15,426
django-cms
cms/tests/test_helpers.py
.py
from cms.models import Page, PageContent from cms.test_utils.project.sampleapp.models import ( Category, Picture, SomeEditableModel, ) from cms.test_utils.testcases import CMSTestCase from cms.utils.helpers import is_editable_model class HelperTests(CMSTestCase): def test_is_editable_model(self): ...
35
1,211
confluent-kafka-python
src/confluent_kafka/schema_registry/rules/cel/extra_func.py
.py
# Copyright 2024 Confluent, Inc. # Copyright 2023 Buf Technologies, 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 require...
196
5,932
mlflow
mlflow/pyfunc/context.py
.py
import contextlib from contextvars import ContextVar from dataclasses import dataclass from typing import Any # A thread local variable to store the context of the current prediction request. # This is particularly used to associate logs/traces with a specific prediction request in the # caller side. The context varia...
79
2,967
wandb
wandb/proto/v6/wandb_settings_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_settings.proto # Protobuf Python Version: 6.30.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descrip...
59
19,477
onnxruntime
onnxruntime/test/python/onnx_node_test_equivalence_test.py
.py
#!/usr/bin/env python # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Retiring equivalence test for materialize_onnx_node_tests.py. Proves the build-time-materialized node-test tree is byte-identical to ONNX's still-present on-disk golden corpus (``.../onnx/backend/tes...
178
7,486
clearml
clearml/utilities/plotlympl/__init__.py
.py
""" matplotlylib ============ This module converts matplotlib figure objects into JSON structures which can be understood and visualized by Plotly. Most of the functionality should be accessed through the parent directory's 'tools' module or 'plotly' package. """ from __future__ import absolute_import from .mplexpo...
18
420
readthedocs.org
readthedocs/rtd_tests/tests/test_build_storage.py
.py
import os import shutil import tempfile from pathlib import Path import pytest from django.core.exceptions import SuspiciousFileOperation from django.test import TestCase, override_settings from readthedocs.builds.storage import BuildMediaFileSystemStorage files_dir = os.path.join(os.path.dirname(os.path.dirname(__f...
196
7,102
astropy
astropy/cosmology/_src/traits/rhocrit.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Critical density component.""" __all__ = ("CriticalDensity",) from collections.abc import Callable from typing import Any from numpy.typing import ArrayLike, NDArray from astropy.units import Quantity class CriticalDensity: """The object has a...
42
1,130
astropy
astropy/cosmology/_src/tests/traits/test_trait_matter.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.cosmology._src.traits.matter import MatterComponent from .helper import is_positional_only class DummyMatter(MatterComponent): Om0 = 0.3 def inv_efunc(self, z): return np.ones_like(np.asarray(z)) class ZeroMat...
57
1,189
onnxruntime
orttraining/orttraining/python/training/onnxblock/optim/optim.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import onnx import onnxruntime.training.onnxblock._graph_utils as _graph_utils import onnxruntime.training.onnxblock.blocks as blocks import onnxruntime.training.onnxblock.onnxblock as onnxblock_module class ClipGradNorm(...
320
10,204
mlflow
mlflow/gateway/budget_tracker/in_memory.py
.py
"""In-memory budget tracker implementation.""" from __future__ import annotations import threading from dataclasses import dataclass, field from datetime import datetime, timezone from mlflow.entities.gateway_budget_policy import BudgetAction, GatewayBudgetPolicy from mlflow.gateway.budget_tracker import ( Budge...
165
6,035
biopython
Bio/Data/CodonTable.py
.py
# Copyright 2000 Andrew Dalke. 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. """Codon tables based on thos...
1,309
50,509
pyomo
pyomo/contrib/solver/solvers/knitro/config.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,606
pymc
tests/ode/test_utils.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...
57
2,094
cvxpy
cvxpy/reductions/solvers/conic_solvers/sdpa_conif.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 ...
201
6,893
wagtail
wagtail/snippets/widgets.py
.py
from django import forms from django.core.exceptions import ImproperlyConfigured from django.urls import reverse from django.urls.exceptions import NoReverseMatch from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ from wagtail.admin.staticfiles import versioned_s...
68
2,286
cvxpy
cvxpy/reductions/solvers/conic_solvers/ecos_conif.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...
201
7,387
probability
spinoffs/inference_gym/inference_gym/targets/brownian_motion_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
166
6,226
mlflow
tests/store/artifact/test_gcs_artifact_repo.py
.py
import os import posixpath from unittest import mock import pytest import requests from google.auth.exceptions import DefaultCredentialsError from google.cloud.storage import client as gcs_client from mlflow.entities.multipart_upload import MultipartUploadPart from mlflow.store.artifact.artifact_repository_registry i...
574
20,443
coremltools
coremltools/optimize/torch/quantization/_configure.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 defaultdict as _defaultdict from typing import Any as _Any from typing import...
548
25,535
hypercorn
src/hypercorn/protocol/h3.py
.py
from __future__ import annotations from collections.abc import Awaitable, Callable from aioquic.h3.connection import H3Connection from aioquic.h3.events import DataReceived, HeadersReceived from aioquic.h3.exceptions import NoAvailablePushIDError from aioquic.quic.connection import QuicConnection from aioquic.quic.ev...
157
5,617
coremltools
coremltools/converters/mil/mil/ops/defs/iOS15/elementwise_unary.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 math import numpy as np from coremltools.converters.mil.mil import types from coremltools.co...
892
19,957
mlflow
tests/genai/scorers/test_aggregation.py
.py
import pytest from mlflow.entities.assessment import Feedback from mlflow.genai.evaluation.entities import EvalItem, EvalResult from mlflow.genai.judges.builtin import CategoricalRating from mlflow.genai.scorers.aggregation import ( _cast_assessment_value_to_float, compute_aggregated_metrics, ) from mlflow.gen...
121
4,220
openvino
tests/layer_tests/pytorch_tests/test_col2im.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import math from pytorch_layer_test_class import PytorchLayerTest class TestCol2Im(PytorchLayerTest): def _prepare_input(self, input_shape): return (self.random.randn(*input_shape),) def create_model(sel...
57
2,326
wandb
tests/system_tests/test_functional/wb_logging/test_wb_logging_last_resort.py
.py
import pathlib import subprocess def test_wb_logging_last_resort(): script = pathlib.Path(__file__).parent / "last_resort.py" output = subprocess.check_output( # Prevent warnings from 3rd party libraries from polluting the output. ["python", "-W", "ignore", str(script)], stderr=subpro...
18
473
mlflow
mlflow/entities/entity_type.py
.py
""" Entity type constants for MLflow's entity_association table. The entity_association table enables many-to-many relationships between different MLflow entities. It uses source and destination type/id pairs to create flexible associations without requiring dedicated junction tables for each relationship type. """ c...
18
594
clearml
clearml/binding/gradio_bind.py
.py
import sys import os from logging import getLogger from typing import Optional, Callable, Any from urllib.parse import urlparse from .frameworks import _patched_call # noqa from .import_bind import PostImportHookPatching from ..config import running_remotely class PatchGradio: _current_task = None __patched...
128
4,887
flit
tests/test_init.py
.py
import builtins from contextlib import contextmanager from pathlib import Path from tempfile import TemporaryDirectory from testpath import assert_isfile from unittest.mock import patch import pytest try: import tomllib except ImportError: import tomli as tomllib from flit import init @contextmanager def pa...
258
8,470
onnxruntime
tools/python/find_optimizer_opset_version_updates_required.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import glob import logging import os import re logging.basicConfig(format="[%(levelname)s] - %(message)s", level=logging.DEBUG) log = logging.getLogger() def parse_args(): parser ...
216
8,372
saleor
saleor/order/__init__.py
.py
from dataclasses import dataclass from typing import TYPE_CHECKING if TYPE_CHECKING: from ..page.models import Page from .models import FulfillmentLine class OrderStatus: DRAFT = "draft" # fully editable, not finalized order created by staff users UNCONFIRMED = ( "unconfirmed" # order creat...
351
13,584
sqlmap
tamper/sign.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...
50
1,354
saleor
saleor/graphql/product/tests/test_product_channel_listings_queries.py
.py
from decimal import Decimal from unittest import mock import graphene import pytest from ....tax import TaxCalculationStrategy from ....tax.models import TaxClassCountryRate, TaxConfigurationPerCountry from ....tax.utils import get_display_gross_prices from ....warehouse.models import Warehouse from ...tests.utils im...
511
15,998
beam
sdks/python/apache_beam/runners/portability/local_job_service_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...
137
4,609
httpie
httpie/cli/nested_json/parse.py
.py
from typing import Iterator from .errors import NestedJSONSyntaxError from .tokens import ( EMPTY_STRING, BACKSLASH, TokenKind, OPERATORS, SPECIAL_CHARS, LITERAL_TOKENS, Token, PathAction, Path, ) __all__ = [ 'parse', 'assert_cant_happen', ] def parse(source: str) -> Ite...
194
5,431
sphinx
tests/roots/test-ext-autodoc/target/typevar.py
.py
from __future__ import annotations from datetime import date from typing import NewType, TypeVar #: T1 T1 = TypeVar('T1') T2 = TypeVar('T2') # A TypeVar not having doc comment #: T3 T3 = TypeVar('T3', int, str) #: T4 T4 = TypeVar('T4', covariant=True) # NoQA: PLC0105 #: T5 T5 = TypeVar('T5', contravariant=True)...
33
495
pymc
tests/backends/test_mcbackend.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...
329
12,111
saleor
saleor/graphql/checkout/tests/test_checkout_line_problems.py
.py
import datetime from unittest import mock import pytest from django.utils import timezone from ....checkout.calculations import _fetch_checkout_prices_if_expired from ....checkout.fetch import fetch_checkout_lines from ....product.models import ProductChannelListing, ProductVariantChannelListing from ...core.utils im...
775
23,754
astropy
astropy/cosmology/_src/io/connect.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ( # classes "CosmologyFromFormat", "CosmologyRead", "CosmologyToFormat", "CosmologyWrite", ) from collections.abc import Mapping from typing import TYPE_CHECKING, Any, Literal, TypeVar, overload from astropy.cosmology._src....
370
12,683
django-cms
cms/wizards/forms.py
.py
from django import forms from cms.models import Page from cms.utils.urlutils import static_with_version from .wizard_pool import entry_choices, wizard_pool def step2_form_factory(mixin_cls, entry_form_class, attrs=None): """ Combines a form mixin with a form class, sets attrs to the resulting class. Thi...
98
3,249
saleor
saleor/graphql/meta/tests/mutations/test_shipping.py
.py
import graphene from . import PUBLIC_KEY, PUBLIC_VALUE from .test_delete_metadata import ( execute_clear_public_metadata_for_item, item_without_public_metadata, ) from .test_delete_private_metadata import ( execute_clear_private_metadata_for_item, item_without_private_metadata, ) from .test_update_meta...
212
5,778
eve
examples/security/roles.py
.py
# -*- coding: utf-8 -*- """ Auth-SHA1/HMAC-Roles ~~~~~~~~~~~~~~~~~~~~ Securing an Eve-powered API with Basic Authentication (RFC2617) and user roles. This script assumes that user accounts are stored in an 'accounts' MongoDB collection, that passwords are stored as SHA1/HMAC hashes and that u...
48
1,635
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/jupyterlab-slideshow_1441.py
.py
# --- # jupyter: # jupytext: # cell_markers: '{{{,}}}' # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # {{{ [markdown] @deathbeds/jupyterlab-fonts={"styles": {"": {"body[data-jp-deck-mode='presenting'] &": {"right": "0", "top": "30%", "width": "25%", "z-...
16
438
mlflow
examples/deployments/databricks/databricks.py
.py
""" Usage ----- databricks secrets create-scope <scope> databricks secrets put-secret <scope> openai-api-key --string-value $OPENAI_API_KEY python examples/deployments/databricks.py --secret <scope>/openai-api-key ----- """ import argparse import uuid from mlflow.deployments import get_deploy_client def parse_args(...
113
3,165
sqlmap
plugins/dbms/informix/fingerprint.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.common import Backend from lib.core.common import Format from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.e...
112
3,284
pyomo
examples/kernel/mosek/maximum_volume_cuboid.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...
134
4,006
black
tests/data/cases/annotations.py
.py
# regression test for #1765 class Foo: def foo(self): if True: content_ids: Mapping[ str, Optional[ContentId] ] = self.publisher_content_store.store_config_contents(files) # output # regression test for #1765 class Foo: def foo(self): if True: ...
17
460
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/kvswap.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");...
59
1,644
probability
tensorflow_probability/python/distributions/beta_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...
550
21,391
biopython
Tests/test_PDB_PDBIO.py
.py
# Copyright 2009-2011 by Eric Talevich. All rights reserved. # Revisions copyright 2009-2013 by Peter Cock. All rights reserved. # Revisions copyright 2013 Lenna X. Peterson. All rights reserved. # Revisions copyright 2020 Joao Rodrigues. All rights reserved. # # Converted by Eric Talevich from an older unit test cop...
546
21,170
sqlmap
plugins/dbms/oracle/takeover.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def osCmd(s...
31
1,100
mlflow
dev/clint/src/clint/rules/version_major_check.py
.py
import ast import re from typing import TYPE_CHECKING from clint.rules.base import Rule if TYPE_CHECKING: from clint.resolver import Resolver class MajorVersionCheck(Rule): def _message(self) -> str: return ( "Use `.major` field for major version comparisons instead of full version strin...
58
1,899
biopython
Bio/Align/bigpsl.py
.py
# Copyright 2022 by Michiel de Hoon. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.Align support fo...
614
23,410
coremltools
coremltools/converters/mil/mil/ops/tests/iOS14/test_control_flow.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 itertools import numpy as np import pytest from coremltools.converters.mil.mil import Builde...
616
19,842
biopython
Tests/test_SeqIO_Gfa.py
.py
"""Tests for SeqIO GFA module.""" import unittest from Bio import BiopythonWarning from Bio import SeqIO class TestRead(unittest.TestCase): def test_read_GFA1(self): """Test parsing valid GFA 1.x files.""" records = list(SeqIO.parse("GFA/seq.gfa", "gfa1")) self.assertEqual(len(records), ...
79
3,339
onnx
onnx/reference/ops/op_image_decoder.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import io import numpy as np from onnx.reference.op_run import OpRun class ImageDecoder(OpRun): def _run(self, encoded: np.ndarray, pixel_format="RGB") -> tuple[np.ndarray]: try: ...
34
1,077
mlflow
tests/store/artifact/test_uc_volumes_artifact_repo.py
.py
import posixpath from unittest import mock import pytest from databricks.sdk.service.files import DirectoryEntry from mlflow.entities.file_info import FileInfo from mlflow.exceptions import MlflowException from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository from mlflow.store.artifac...
148
5,404
sphinx
sphinx/ext/autodoc/typehints.py
.py
"""Generating content for autodoc using typehints""" from __future__ import annotations import re from typing import TYPE_CHECKING, cast from docutils import nodes from sphinx import addnodes from sphinx.ext.autodoc._dynamic._type_annotations import _record_typehints if TYPE_CHECKING: from collections.abc impo...
216
7,355
onnxruntime
orttraining/tools/ci_test/run_convergence_test.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import subprocess import sys import tempfile from compare_results import Comparisons, compare_results_files SCRIPT_DIR = os.path.realpath(os.path.dirname(__file__)) def par...
108
3,721
cvxpy
cvxpy/tests/nlp_tests/test_prod.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 ...
287
10,656
saleor
saleor/core/utils/tests/test_text.py
.py
from ..text import safe_truncate def test_safe_truncate(): assert safe_truncate("Hello, world!", 5) == "Hell…" assert safe_truncate("Hello, world!", 20) == "Hello, world!" assert safe_truncate("Hello, 世界!", 9) == "Hello, 世…" assert safe_truncate("Hello, 世界!", 15) == "Hello, 世界!" assert safe_trunca...
17
694
wagtail
wagtail/admin/tests/test_paginator.py
.py
from django.test import TestCase from wagtail.admin.paginator import WagtailPaginator class TestWagtailPaginator(TestCase): def test_elided_page_range(self): """ Test the get_elided_page_range method of WagtailPaginator. For example, if there are 10 pages, the output should be: A...
87
3,734
pyomo
pyomo/contrib/solver/common/util.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...
126
3,995
beam
sdks/python/apache_beam/examples/snippets/transforms/other/flatten.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");...
54
1,639