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
python-prompt-toolkit
src/prompt_toolkit/output/conemu.py
.py
from __future__ import annotations import sys assert sys.platform == "win32" from typing import Any, TextIO from prompt_toolkit.data_structures import Size from .base import Output from .color_depth import ColorDepth from .vt100 import Vt100_Output from .win32 import Win32Output __all__ = [ "ConEmuOutput", ] ...
66
1,865
bazel
examples/py/bin.py
.py
from examples.py import lib print("Fib(5)=%d" % lib.Fib(5))
4
61
mlflow
tests/assistant/test_cli.py
.py
import os from unittest import mock import pytest from click.testing import CliRunner from mlflow.assistant.cli import commands from mlflow.assistant.config import ProviderConfig @pytest.fixture def runner(): return CliRunner() def test_assistant_help(runner): result = runner.invoke(commands, ["--help"]) ...
212
6,868
sphinx
tests/test_transforms/test_transforms_post_transforms.py
.py
"""Tests the post_transforms""" from __future__ import annotations import logging from typing import TYPE_CHECKING import pytest from docutils import nodes from sphinx import addnodes from sphinx.addnodes import SIG_ELEMENTS from sphinx.testing.util import SphinxTestApp, assert_node from sphinx.transforms.post_tran...
332
12,686
probability
tensorflow_probability/python/bijectors/pad.py
.py
# Copyright 2019 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...
345
13,047
onnxruntime
tools/ci_build/github/apple/package_release_tasks.py
.py
#!/usr/bin/env python3 # Note: This script is intended to be called from the CocoaPods package release pipeline or a similar context. from __future__ import annotations import argparse import glob import shlex import subprocess from enum import Enum from pathlib import Path class Task(Enum): upload_pod_archive...
105
3,212
saleor
saleor/app/management/commands/utils.py
.py
from django.core.management import CommandError from ....permission.enums import ( AppPermission, get_permissions, get_permissions_enum_list, ) def clean_permissions(required_permissions: list[str]): all_permissions = {perm[0]: perm[1] for perm in get_permissions_enum_list()} for perm in required...
29
1,155
saleor
saleor/graphql/warehouse/types.py
.py
import graphene from django.db.models import Q, Sum from django.db.models.functions import Coalesce from django.utils import timezone from ...permission.enums import OrderPermissions, ProductPermissions from ...warehouse import models from ...warehouse.reservations import is_reservation_enabled from ..account.dataload...
314
10,248
mlflow
mlflow/pyfunc/scoring_server/client.py
.py
import json import logging import tempfile import time import uuid from abc import ABC, abstractmethod from pathlib import Path from typing import Any import requests from mlflow.deployments import PredictionsResponse from mlflow.environment_variables import MLFLOW_SCORING_SERVER_REQUEST_TIMEOUT from mlflow.exception...
152
5,432
coremltools
deps/pybind11/noxfile.py
.py
from __future__ import annotations import argparse import nox nox.needs_version = ">=2024.3.2" nox.options.sessions = ["lint", "tests", "tests_packaging"] nox.options.default_venv_backend = "uv|virtualenv" @nox.session(reuse_venv=True) def lint(session: nox.Session) -> None: """ Lint the codebase (except f...
108
2,897
wandb
wandb/apis/reports/v1/__init__.py
.py
import wandb try: from wandb_workspaces.reports.v1 import * # noqa: F403 except ImportError: wandb.termerror( "Failed to import wandb_workspaces. To edit reports programmatically, please install it using `pip install wandb[workspaces]`." )
9
263
biopython
Bio/SearchIO/HmmerIO/hmmer2_text.py
.py
# Copyright 2012 by Kai Blin. 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.SearchIO parser for HMMER...
378
12,932
mlflow
mlflow/genai/scorers/online/session_processor.py
.py
"""Session-level online scoring processor for executing scorers on completed sessions.""" import logging from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import dataclass, field from mlflow.entities.assessment import Assessment from mlflow.environment_variables import MLFLOW_ONLINE_SCO...
343
14,714
returns
returns/pointfree/bind_awaitable.py
.py
from collections.abc import Awaitable, Callable from typing import TypeVar from returns.interfaces.specific.future import FutureLikeN from returns.primitives.hkt import Kinded, KindN, kinded _FirstType = TypeVar('_FirstType') _SecondType = TypeVar('_SecondType') _ThirdType = TypeVar('_ThirdType') _UpdatedType = TypeV...
64
1,784
saleor
saleor/graphql/page/tests/mutations/test_page_type_delete.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....attribute.models import AttributeValue from .....attribute.utils import associate_attribute_values_to_instance from .....core.utils.json_serializer impor...
287
8,646
probability
tensorflow_probability/python/mcmc/simple_step_size_adaptation.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
22,027
coremltools
coremltools/proto/WordEmbedding_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: WordEmbedding.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message fro...
42
1,692
kafka
tests/kafkatest/tests/core/produce_bench_test.py
.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
84
4,534
pyomo
pyomo/contrib/preprocessing/tests/test_zero_sum_propagate.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
4,849
probability
tensorflow_probability/python/internal/backend/numpy/deprecation.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...
56
1,644
saleor
saleor/warehouse/tests/webhooks/test_payloads.py
.py
import json from unittest.mock import ANY import graphene from .... import __version__ from ...webhooks.payloads import ( generate_product_variant_with_stock_payload, ) def test_generate_base_product_variant_payload(product_with_two_variants): stocks_to_serialize = [ variant.stocks.first() for varia...
61
2,124
confluent-kafka-python
tests/integration/integration_test.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # # Copyright 2016 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 req...
1,338
43,036
black
tests/data/cases/fmtskip3.py
.py
a = 3 # fmt: off b, c = 1, 2 d = 6 # fmt: skip e = 5 # fmt: on f = ["This is a very long line that should be formatted into a clearer line ", "by rearranging."] # output a = 3 # fmt: off b, c = 1, 2 d = 6 # fmt: skip e = 5 # fmt: on f = [ "This is a very long line that should be formatted into a...
21
362
beam
sdks/python/apache_beam/io/gcp/bigquery_io_read_pipeline.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...
99
3,134
returns
returns/context/requires_context_result.py
.py
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar, TypeAlias, TypeVar, final from returns.context import NoDeps from returns.interfaces.specific import reader_result from returns.primitives.container import BaseContainer from returns.primitives.hkt...
650
21,158
clearml
examples/hyperdatasets/legacy/data-ingestion/dataview_example_framegroup.py
.py
from allegroai import Task, DataView task = Task.init(project_name="examples", task_name="dataview example with masks") # simple query dataview = DataView(iteration_order='random') dataview.set_iteration_parameters(random_seed=123) dataview.add_query(dataset_name='sample-dataset-masks', version_name='Current') # p...
30
1,096
hatch
backend/src/hatchling/builders/constants.py
.py
DEFAULT_BUILD_DIRECTORY = "dist" EXCLUDED_DIRECTORIES = frozenset(( # Python bytecode "__pycache__", # Single virtual environment ".venv", # Git ".git", # Mercurial ".hg", # Hatch ".hatch", # tox ".tox", # nox ".nox", # Ruff ".ruff_cache", # pytest ...
46
905
mlflow
tests/utils/test_string_utils.py
.py
import pytest from mlflow.utils.string_utils import ( format_table_cell_value, is_string_type, mslex_quote, strip_prefix, strip_suffix, ) @pytest.mark.parametrize( (("original", "prefix", "expected")), [("smoketest", "smoke", "test"), ("", "test", ""), ("", "", ""), ("test", "", "test")],...
95
2,956
black
tests/data/cases/line_ranges_exceeding_end.py
.py
# flags: --line-ranges=6-1000 # NOTE: If you need to modify this file, pay special attention to the --line-ranges= # flag above as it's formatting specifically these lines. def foo1(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass def foo2(parameter_1, parameter_2, parame...
37
1,276
black
tests/data/cases/line_ranges_two_passes.py
.py
# flags: --line-ranges=9-11 # NOTE: If you need to modify this file, pay special attention to the --line-ranges= # flag above as it's formatting specifically these lines. # This is a specific case for Black's two-pass formatting behavior in `format_str`. # The second pass must respect the line ranges before the first ...
28
1,065
saleor
saleor/graphql/payment/tests/mutations/test_transaction_request_refund_for_granted_refund.py
.py
from decimal import Decimal from unittest.mock import patch import graphene import pytest from .....giftcard.const import GIFT_CARD_PAYMENT_GATEWAY_ID from .....order import OrderGrantedRefundStatus from .....payment import TransactionAction, TransactionEventType from .....payment.interface import TransactionActionDa...
1,047
32,965
biopython
Bio/AlignIO/MauveIO.py
.py
# Copyright 2015-2015 by Eric Rasche. 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.AlignIO support...
344
13,300
probability
tensorflow_probability/python/distributions/batch_concat.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...
514
19,806
beam
sdks/python/apache_beam/ml/anomaly/detectors/zscore.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...
127
4,757
scikit-optimize
skopt/optimizer/dummy.py
.py
"""Random search.""" from .base import base_minimize def dummy_minimize(func, dimensions, n_calls=100, initial_point_generator="random", x0=None, y0=None, random_state=None, verbose=False, callback=None, model_queue_size=None, init_point_gen_kwargs=None): ...
121
5,067
saleor
saleor/graphql/shipping/mutations/shipping_price_delete.py
.py
from typing import cast import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_SHIPPING from ...core.mutations import BaseMutation from ...core.types i...
54
1,943
coveragepy
tests/test_results.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 coverage.py's results analysis.""" from __future__ import annotations import math from typing import cast from collections.abc import Iterable im...
194
6,372
onnx
onnx/backend/test/case/node/reshape.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 def reshape_reference_implementation( data: np.ndarray, shape: np.ndarra...
83
2,889
wagtail
wagtail/api/v3/routers/whoami.py
.py
from ninja import Router, Schema from wagtail.api.v3.auth import BearerTokenAuth router = Router(tags=["auth"]) class WhoAmIUserSchema(Schema): id: str username: str email: str first_name: str last_name: str is_superuser: bool class WhoAmIProfileSchema(Schema): avatar_url: str | None ...
53
1,348
coremltools
coremltools/converters/mil/mil/passes/defs/lower_complex_dialect_ops.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 """ This file contains a pass for lowering complex dialect ops into core ops. Steps for adding a new...
652
23,884
lemur
lemur/plugins/lemur_digicert/tests/test_digicert.py
.py
import ipaddress import json from unittest import mock from unittest.mock import patch, Mock import arrow import pytest import requests from cryptography import x509 from freezegun import freeze_time from lemur.plugins.lemur_digicert import plugin from lemur.tests.vectors import CSR_STR _base_config = { "DIGICERT...
310
11,487
probability
tensorflow_probability/python/distributions/mvn_full_covariance_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...
190
7,342
textual
src/textual/_debug.py
.py
""" Functions related to debugging. """ from __future__ import annotations from textual import constants def get_caller_file_and_line() -> str | None: """Get the caller filename and line, if in debug mode, otherwise return `None`: Returns: Path and file if `constants.DEBUG==True` """ if no...
27
614
mkdocs
mkdocs/plugins.py
.py
"""Implements the plugin API for MkDocs.""" from __future__ import annotations import logging import sys from typing import TYPE_CHECKING, Any, Callable, Generic, Literal, MutableMapping, TypeVar, overload if sys.version_info >= (3, 10): from importlib.metadata import EntryPoint, entry_points else: from impo...
698
25,265
mlflow
tests/gateway/providers/test_ai21labs.py
.py
from unittest import mock import pytest from aiohttp import ClientTimeout from fastapi.encoders import jsonable_encoder from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS from mlflow.exceptions import MlflowException from mlflow.gateway.config import EndpointConfig from mlflow.gateway.excep...
190
6,045
coremltools
deps/pybind11/tests/test_operator_overloading.py
.py
from __future__ import annotations import pytest from pybind11_tests import ConstructorStats from pybind11_tests import operators as m def test_operator_overloading(): v1 = m.Vector2(1, 2) v2 = m.Vector(3, -1) v3 = m.Vector2(1, 2) # Same value as v1, but different instance. assert v1 is not v3 ...
154
4,368
onnx
onnx/backend/test/case/model/stringnormalizer.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.model import expect if TYPE_CHECKING: from collections.abc ...
206
6,219
saleor
saleor/graphql/order/mutations/order_mark_as_paid.py
.py
from typing import TYPE_CHECKING, Optional, cast import graphene from django.core.exceptions import ValidationError from ....account.models import User from ....channel import MarkAsPaidStrategy from ....order import models as order_models from ....order.actions import ( clean_mark_order_as_paid, mark_order_a...
142
4,941
beam
sdks/python/apache_beam/runners/interactive/interactive_environment_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...
388
16,306
kafka
tests/kafkatest/services/trogdor/consume_bench_workload.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 ...
56
2,456
probability
tensorflow_probability/python/internal/samplers_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...
182
7,064
coremltools
coremltools/converters/mil/mil/ops/tests/iOS17/test_elementwise_unary.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 from unittest.mock import patch import numpy as np import pytest import coremltool...
200
7,570
probability
spinoffs/inference_gym/inference_gym/internal/array_to_source_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...
43
1,240
beam
sdks/python/apache_beam/internal/code_object_pickler.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...
509
18,279
confluent-kafka-python
tests/schema_registry/_async/test_avro.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
307
11,648
readthedocs.org
readthedocs/filetreediff/__init__.py
.py
""" Module for the file tree diff feature (FTD). This feature is used to compare the files of two versions of a project. The process is as follows: - A build is triggered for a version. - A task is triggered after the build has succeeded to generate a manifest of the files of the version. Currently, we only cons...
205
7,931
returns
returns/methods/__init__.py
.py
from returns.methods.cond import cond as cond from returns.methods.partition import partition as partition from returns.methods.unwrap_or_failure import ( unwrap_or_failure as unwrap_or_failure, )
6
201
probability
tensorflow_probability/python/internal/backend/numpy/sets_lib.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...
44
1,397
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_assign_value.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from save_model import saveModel import sys def paddle_assign_value(name, test_x): import paddle paddle.enable_static() main_program = paddle.static.Program() startup_program = paddle.static.Program()...
58
1,786
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/xexp_canon.py
.py
""" Copyright 2022, 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, soft...
33
1,219
python-prompt-toolkit
src/prompt_toolkit/document.py
.py
""" The `Document` that implements all the text operations/querying. """ from __future__ import annotations import bisect import re import string import weakref from collections.abc import Callable, Iterable from re import Pattern from typing import NoReturn, cast from .clipboard import ClipboardData from .filters i...
1,184
40,568
pyomo
pyomo/solvers/plugins/solvers/KNITROAMPL.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...
88
3,522
mlflow
docs/api_reference/source/conf.py
.py
# # MLflow documentation build configuration file, created by # cookiecutter pipproject # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values t...
467
15,924
coremltools
coremltools/proto/Normalizer_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: Normalizer.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from g...
39
1,561
wandb
tests/system_tests/test_launch/test_agent.py
.py
import json import os import wandb from wandb.cli import cli def test_agent_queues_config(runner, monkeypatch, user): run = wandb.init(project="model-registry") run.finish() monkeypatch.setattr( wandb.sdk.launch._launch, "LAUNCH_CONFIG_FILE", os.path.join("./config/wandb/launch-co...
31
904
voila
tests/app/execute_cpp_test.py
.py
import os import pytest TEST_XEUS_CPP = os.environ.get("VOILA_TEST_XEUS_CPP", "") == "1" NOTEBOOK_PATH = "print.xcpp" @pytest.fixture def cpp_file_url(base_url, preheat_mode): return base_url + f"voila/render/{NOTEBOOK_PATH}" @pytest.fixture def voila_args_extra(): return [ '--VoilaConfiguration.e...
34
908
mlflow
tests/gateway/providers/test_fallback.py
.py
from typing import Any from unittest import mock import pytest from fastapi import HTTPException from mlflow.entities.gateway_endpoint import FallbackStrategy from mlflow.gateway.config import EndpointConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import FallbackPro...
321
10,296
cvxpy
cvxpy/reductions/solvers/conic_solvers/pdlp_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 ...
233
9,309
onnxruntime
orttraining/orttraining/python/training/ortmodule/_training_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...
467
23,149
scikit-bio
skbio/stats/distance/_bioenv.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. # --------------------------------------------...
236
9,374
colorama
demos/demo05.py
.py
#!/usr/bin/python # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. # Demonstrate the difference between colorama initialized with wrapping on and off. # The point of the demonstration is to show how the ANSI wrapping on Windows can be disabled. # The unwrapped cases will be interpreted with A...
22
945
pymc
pymc/logprob/arithmetic.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...
82
3,146
conda
conda/cli/main_env_list.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda-env list`, now aliased to `conda info --envs`. Lists available conda environments. """ from argparse import ArgumentParser, _SubParsersAction def configure_parser(sub_parsers: _SubParsersAction, **kwargs) -> ...
54
1,332
sqlmap
tamper/halfversionedmorekeywords.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.data import kb from lib.core.enums import DBMS from lib.core.enums import PRIORITY from lib.co...
56
1,852
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_EmbeddingLookup.py
.py
import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest np.random.seed(42) test_params = [ {'shape': [10, 5], 'indices_shape': [3]}, {'shape': [20, 8], 'indices_shape': [1, 5]}, {'shape': [15, 10, 7], 'indices_shape': [4]}, {'shape': [8, 6, ...
40
1,456
probability
tensorflow_probability/python/experimental/bayesopt/acquisition/probability_of_improvement.py
.py
# Copyright 2023 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...
239
8,694
pyro
tests/ops/test_gamma_gaussian.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import pytest import torch from torch.nn.functional import pad import pyro.distributions as dist from pyro.distributions.util import broadcast_shape from pyro.ops.gamma_gaussian import ( GammaGaussian, gamma_a...
359
12,357
onnxruntime
onnxruntime/test/python/quantization/test_op_relu.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
229
8,231
probability
tensorflow_probability/python/bijectors/blockwise_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...
338
13,835
astropy
astropy/units/required_by_vounit.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines SI prefixed units that are required by the VOUnit standard but that are rarely used in practice and liable to lead to confusion (such as ``msolMass`` for milli-solar mass). The units here are enabled so, e.g., ``Unit('msolMass')`` ...
30
1,198
openvino
tests/layer_tests/onnx_tests/test_abs.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model from unit_tests.utils....
181
6,046
python-prompt-toolkit
examples/prompts/input-validation.py
.py
#!/usr/bin/env python """ Simple example of input validation. """ from prompt_toolkit import prompt from prompt_toolkit.validation import Validator def is_valid_email(text): return "@" in text validator = Validator.from_callable( is_valid_email, error_message="Not a valid e-mail address (Does not conta...
37
750
astropy
astropy/coordinates/builtin_frames/supergalactic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, base_doc, ) from astropy.utils.decorators import format_doc from .galac...
69
2,589
saleor
saleor/graphql/giftcard/mutations/gift_card_resend.py
.py
import graphene from django.core.exceptions import ValidationError from django.core.validators import validate_email from ....account.models import User from ....giftcard.error_codes import GiftCardErrorCode from ....giftcard.notifications import send_gift_card_notification from ....permission.enums import GiftcardPer...
109
3,713
textual
examples/merlin.py
.py
from __future__ import annotations import random from datetime import timedelta from time import monotonic from textual import events from textual.app import App, ComposeResult from textual.containers import Grid from textual.reactive import var from textual.renderables.gradient import LinearGradient from textual.wid...
178
4,694
pyro
examples/minipyro.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ This example demonstrates the functionality of `pyro.contrib.minipyro`, which is a minimal implementation of the Pyro Probabilistic Programming Language that was created for didactic purposes. """ import argparse import torch...
76
2,971
coremltools
coremltools/optimize/torch/quantization/modules/conv_transpose.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 # Original implementation from https://github.com/pytorch/pytorch/blob/main/torch/ao/nn/qat/modules/c...
404
13,078
astropy
astropy/constants/iau2015.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants in SI units. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ import numpy as np from .config import codata from .constant import Constant # ASTRONOMICAL CONSTANTS class I...
183
3,555
pyomo
pyomo/repn/__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...
31
1,272
saleor
saleor/tests/e2e/product/test_create_product_with_restricted_reference_attributes.py
.py
import pytest from ..attributes.utils import attribute_create, attribute_update from ..pages.utils import create_page, create_page_type from ..utils import assign_permissions from .utils import ( create_category, create_product, create_product_type, create_product_variant, raw_create_product, u...
209
7,561
pyomo
examples/pyomo/core/block1.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...
19
746
textual
tests/option_list/test_option_list_mouse_click.py
.py
from __future__ import annotations from textual import on from textual.app import App, ComposeResult from textual.widgets import OptionList from textual.widgets.option_list import Option class OptionListApp(App[None]): messages: list[str] = [] def compose(self) -> ComposeResult: yield OptionList( ...
46
1,483
metrics
src/torchmetrics/classification/hinge.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...
381
15,828
probability
tensorflow_probability/python/math/gradient.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...
522
20,400
pyomo
pyomo/contrib/mpc/examples/cstr/tests/test_openloop.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...
142
3,669
sqlmap
tamper/hex2char.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.convert import decodeHex from lib.core.convert import getOrds from lib.core.enums import DBMS ...
50
1,380
wagtail
wagtail/contrib/styleguide/tests.py
.py
from django.test import TestCase from django.urls import reverse from wagtail.admin.staticfiles import versioned_static from wagtail.test.utils import WagtailTestUtils class TestStyleGuide(WagtailTestUtils, TestCase): def setUp(self): self.login() def test_styleguide(self): response = self.c...
59
2,007
wandb
wandb/apis/workspaces/__init__.py
.py
import wandb try: from wandb_workspaces.workspaces import * # noqa: F403 except ImportError: wandb.termerror( "Failed to import wandb_workspaces. To edit workspaces programmatically, please install it using `pip install wandb[workspaces]`." )
9
265
wandb
wandb/sdk/launch/builder/build.py
.py
import hashlib import json import logging import os import pathlib import re import shlex import shutil from typing import Any import wandb import wandb.env from wandb import docker from wandb.apis.internal import Api from wandb.sdk.launch.loader import ( builder_from_config, environment_from_config, regis...
325
11,898
jupyterlab
jupyterlab/extensions/readonly.py
.py
"""Extension manager without installation capabilities.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import sys from jupyterlab_server.translation_utils import translator from .manager import ActionResult, ExtensionManager, ExtensionManagerMetadata, Extensi...
85
2,895