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
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Unary.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from functools import partial import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest from common.utils.tflite_utils import parametrize_tests np.random.seed(42) test_ops = [ ...
74
3,257
python-prompt-toolkit
src/prompt_toolkit/formatted_text/utils.py
.py
""" Utilities for manipulating formatted text. When ``to_formatted_text`` has been called, we get a list of ``(style, text)`` tuples. This file contains functions for manipulating such a list. """ from __future__ import annotations from collections.abc import Iterable from typing import cast from prompt_toolkit.uti...
104
3,071
onnxruntime
onnxruntime/python/tools/transformers/models/stable_diffusion/test/check_image.py
.py
import argparse import os import cv2 import open_clip import torch from PIL import Image from sentence_transformers import util def arg_parser(): parser = argparse.ArgumentParser(description="Options for Compare 2 image") parser.add_argument("--image1", type=str, help="Path to image 1") parser.add_argume...
79
2,600
pyomo
pyomo/core/base/objective.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...
616
20,658
probability
tensorflow_probability/python/distributions/spherical_uniform.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...
239
9,043
openvino
tests/layer_tests/jax_tests/test_stop_gradient.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import jax import numpy as np import pytest from jax import numpy as jnp from jax_layer_test_class import JaxLayerTest rng = np.random.default_rng(233454) class TestStopGradient(JaxLayerTest): def _prepare_input(self): if...
49
1,601
pyomo
pyomo/contrib/mpc/interfaces/tests/test_interface.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...
645
25,298
mlflow
mlflow/tracing/export/span_batcher.py
.py
import atexit import logging import threading from collections import defaultdict from queue import Queue from typing import Callable from mlflow.entities.span import Span from mlflow.environment_variables import ( MLFLOW_ASYNC_TRACE_LOGGING_MAX_INTERVAL_MILLIS, MLFLOW_ASYNC_TRACE_LOGGING_MAX_SPAN_BATCH_SIZE, ...
123
4,682
coremltools
coremltools/converters/mil/mil/ops/defs/iOS17/scatter_gather.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 numpy as np from coremltools.converters.mil.mil import types from coremltools.converters.mil....
477
18,780
wandb
wandb/docker/__init__.py
.py
from __future__ import annotations import json import logging import os import shutil import subprocess from typing import Any from wandb.docker import names from wandb.errors import Error class DockerError(Error): """Raised when attempting to execute a docker command.""" def __init__( self, ...
289
8,529
wandb
wandb/sdk/lib/filesystem.py
.py
from __future__ import annotations import contextlib import ctypes import dataclasses import errno import logging import os import platform import re import shutil import tempfile import threading from collections.abc import Generator, Iterable from pathlib import Path, PurePath from typing import IO, Any, BinaryIO, L...
570
20,182
probability
tensorflow_probability/python/mcmc/kernel.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...
165
5,802
openvino
tests/layer_tests/tensorflow_tests/test_tf_Identity.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 OPS = { 'tf.raw_ops.Identity': tf.raw_ops.Identity, 'tf.raw_ops.PreventGradient': tf.raw_ops.PreventGradient, 'tf.raw_ops.Snapsh...
45
1,574
toolz
toolz/curried/__init__.py
.py
""" Alternate namespace for toolz such that all functions are curried Currying provides implicit partial evaluation of all functions Example: Get usually requires two arguments, an index and a collection >>> from toolz.curried import get >>> get(0, ('a', 'b')) 'a' When we use it in higher order ...
104
2,700
ipython
tests/test_ipstruct.py
.py
"""Tests for IPython.utils.ipstruct.Struct""" import pytest from IPython.utils.ipstruct import Struct def test_init_empty(): s = Struct() assert s == {} def test_init_kwargs(): s = Struct(a=1, b=2) assert s["a"] == 1 assert s.a == 1 def test_init_from_dict(): s = Struct({"x": 10, "y": 20})...
144
2,888
mlflow
mlflow/gateway/providers/databricks.py
.py
from collections.abc import AsyncIterable from typing import Any from mlflow.gateway.base_models import ConfigModel from mlflow.gateway.config import EndpointConfig, EndpointType from mlflow.gateway.providers.base import PassthroughAction from mlflow.gateway.providers.openai_compatible import ( OpenAICompatibleAda...
167
6,518
saleor
saleor/core/tests/commands/test_clean_editorjs_fields.py
.py
# ruff: noqa: UP031 # printf-style string formatting are more readable for JSON import random import re from copy import deepcopy from io import StringIO from unittest import mock import pytest from django.core.management import call_command from django.core.management.base import CommandError from ....attribute.mode...
251
7,758
pdm
tests/models/test_requirements.py
.py
from __future__ import annotations import os import pytest from pdm.models.requirements import RequirementError, filter_requirements_with_extras, parse_requirement from tests import FIXTURES FILE_PREFIX = "file:///" if os.name == "nt" else "file://" REQUIREMENTS = [ ("requests", None), ("requests<2.21.0,>=...
132
3,895
mlflow
mlflow/store/artifact/hdfs_artifact_repo.py
.py
import os import posixpath import urllib.parse from contextlib import contextmanager try: from pyarrow.fs import FileSelector, FileType, HadoopFileSystem except ImportError: pass from mlflow.entities import FileInfo from mlflow.environment_variables import ( MLFLOW_KERBEROS_TICKET_CACHE, MLFLOW_KERBER...
211
7,989
bazel
src/test/py/bazel/bazel_tools_proto_test.py
.py
# pylint: disable=g-bad-file-header # Copyright 2026 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
84
2,488
saleor
saleor/graphql/warehouse/tests/bulk_mutations/test_stock_bulk_update.py
.py
from unittest.mock import patch import graphene from .....warehouse.error_codes import StockBulkUpdateErrorCode from ....tests.utils import get_graphql_content STOCKS_BULK_UPDATE_MUTATION = """ mutation StockBulkUpdate($stocks: [StockBulkUpdateInput!]!){ stockBulkUpdate(stocks: $stocks){ resu...
494
15,293
openvino
tests/layer_tests/pytorch_tests/test_getitem.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestGetItem(PytorchLayerTest): def _prepare_input(self, input_shape): return (self.random.randn(*input_shape),) def create_model(s...
103
3,231
mlflow
tests/store/_unity_catalog/model_registry/test_unity_catalog_oss_rest_store.py
.py
import json from unittest import mock import pytest from mlflow.protos.unity_catalog_messages_pb2 import ( AwsCredentials, CreateRegisteredModel, DeleteModelVersion, DeleteRegisteredModel, FinalizeModelVersion, GetModelVersion, GetRegisteredModel, ListModelVersions, ListRegisteredM...
275
8,283
pyomo
pyomo/contrib/preprocessing/tests/test_zero_term_removal.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...
75
2,882
textual
docs/examples/guide/widgets/counter02.py
.py
from textual.app import App, ComposeResult, RenderResult from textual.reactive import reactive from textual.widgets import Footer, Static class Counter(Static, can_focus=True): """A counter that can be incremented and decremented by pressing keys.""" BINDINGS = [ ("up,k", "change_count(1)", "Incremen...
36
851
cvxpy
cvxpy/reductions/solvers/solving_chain_utils.py
.py
from cvxpy.settings import ( COO_CANON_BACKEND, CPP_CANON_BACKEND, SCIPY_CANON_BACKEND, ) from cvxpy.utilities.warn import warn def get_canon_backend(problem, canon_backend: str) -> str: """ This function checks if the problem has expressions of dimension greater than 2 or if it lacks C++ supp...
55
2,110
pyro
pyro/distributions/testing/gof.py
.py
# Copyright (c) 2014, Salesforce.com, Inc. All rights reserved. # Copyright (c) 2015, Gamelan Labs, Inc. # Copyright (c) 2016, Google, Inc. # Copyright (c) 2019, Gamalon, Inc. # Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause # Redistribution and use in source and bi...
293
10,761
wandb
tests/system_tests/test_functional/console_capture/deadlocks.py
.py
"""Exits with code 0 if no deadlock occurs, and hangs otherwise.""" from __future__ import annotations import concurrent.futures import sys from wandb.sdk.lib import console_capture def _info(msg: str) -> None: sys.stderr.write(msg + "\n") def _main() -> None: reset = console_capture.capture_stdout(_chec...
41
1,106
wagtail
wagtail/admin/tests/viewsets/test_chooser_viewset.py
.py
import json from django.test import TestCase, override_settings from django.urls import reverse from wagtail.admin import widgets from wagtail.models import Locale from wagtail.test.snippets.models import TranslatableSnippet from wagtail.test.testapp.models import Advert from wagtail.test.testapp.views import AdvertC...
109
4,210
mlflow
dev/validate_release_version.py
.py
import argparse from packaging.version import Version def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser() parser.add_argument( "--version", help="Release version to validate, e.g., '1.2.3'", required=True ) return parser.parse_args() def main() -> None: args = par...
26
580
saleor
saleor/webhook/observability/__init__.py
.py
from .buffers import get_buffer from .exceptions import ObservabilityError from .payloads import concatenate_json_events, dump_payload from .tracing import otel_trace from .utils import ( WebhookData, get_buffer_name, get_webhooks, pop_events_with_remaining_size, report_api_call, report_event_de...
33
770
saleor
saleor/app/tests/fixtures/__init__.py
.py
from .app import * # noqa: F403 from .app_extension import * # noqa: F403 from .app_installation import * # noqa: F403 from .app_problem import * # noqa: F403 from .webhooks.payment_app import * # noqa: F403 from .webhooks.shipping_app import * # noqa: F403 from .webhooks.tax_app import * # noqa: F403
8
310
colorama
demos/demo09.py
.py
# https://www.youtube.com/watch?v=F5a8RLY2N8M&list=PL1_riyn9sOjcKIAYzo7f8drxD-Yg9La-D&index=61 # Generic colorama demo using command line arguments # By George Ogden from colorama import Fore, Back, Style, init import argparse parser = argparse.ArgumentParser("colorama demo") def format(module): return list(map(la...
21
893
mlflow
dev/clint/src/clint/rules/tempfile_in_test.py
.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class TempfileInTest(Rule): def _message(self) -> str: return ( "Do not use `tempfile` in tests. Use the `tmp_path` fixture instead " "(https://docs.pytest.org/en/stable/reference/reference.html#tmp-p...
24
683
qutip
qutip/solver/sode/itotaylor.py
.py
from . import _sode from .sode import _Explicit_Simple_Integrator, _Implicit_Simple_Integrator from ..stochastic import StochasticSolver, SMESolver __all__ = [ "EulerSODE", "Milstein_SODE", "Taylor1_5_SODE", "Explicit1_5_SODE", "Implicit_Milstein_SODE", "Implicit_Taylor1_5_SODE" ] class EulerSODE(_Explicit_...
171
5,193
pyomo
pyomo/solvers/tests/checks/test_amplfunc_merge.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
6,312
cvxpy
cvxpy/interface/matrix_utilities.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...
416
11,663
pyomo
pyomo/contrib/mindtpy/tests/online_doc_example.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...
48
1,680
saleor
saleor/graphql/page/tests/queries/test_page_types_sorting_and_filtering.py
.py
import graphene import pytest from .....page.models import PageType from ....tests.utils import get_graphql_content PAGE_TYPES_QUERY = """ query PageTypes($filter: PageTypeFilterInput, $sortBy: PageTypeSortingInput) { pageTypes(first: 10, filter: $filter, sortBy: $sortBy) { edges { ...
138
3,687
mlflow
mlflow/pyspark/optuna/study.py
.py
import datetime import logging import tempfile import traceback from collections.abc import Callable, Iterable, Sequence from dataclasses import dataclass from pathlib import Path from typing import Any import optuna import pandas as pd from optuna import exceptions, pruners, samplers, storages from optuna.study impor...
431
17,775
beam
sdks/python/apache_beam/yaml/yaml_transform.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...
1,538
55,251
mlflow
dev/proto_to_graphql/schema_autogeneration.py
.py
import ast from autogeneration_utils import ( DUMMY_FIELD, INDENT, INDENT2, SCHEMA_EXTENSION, SCHEMA_EXTENSION_MODULE, get_descriptor_full_pascal_name, get_method_name, method_descriptor_to_generated_pb2_file_name, ) from google.protobuf.descriptor import FieldDescriptor from string_uti...
226
8,889
pyomo
pyomo/contrib/solver/solvers/scip/scip_persistent.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...
419
15,069
readthedocs.org
readthedocs/subscriptions/tests/test_tasks.py
.py
from datetime import timedelta from unittest import mock import django_dynamic_fixture as fixture from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.utils import timezone from django_dynamic_fixture import get from djstripe import models as djstripe from djstrip...
126
3,943
wandb
wandb/apis/_generated/create_project.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/api/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import CreatedProjectFragment class CreateProject(GQLResult): result: CreateProjectResult | None class CreateProjectResult(GQLResult): project: Crea...
23
481
sqlmap
tamper/modsecurityversioned.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os from lib.core.common import randomInt from lib.core.common import singleTimeWarnMessage from lib.core.enums import DBMS from lib.core.enums import PRIORITY __priority_...
52
1,291
astropy
astropy/io/fits/fitstime.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import re import warnings from collections import OrderedDict, defaultdict import numpy as np from astropy import units as u from astropy.coordinates import EarthLocation from astropy.table import Column, MaskedColumn from astropy.table.column import co...
664
24,593
deap
examples/ga/onemax_island.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
155
5,253
mlflow
mlflow/utils/_unity_catalog_utils.py
.py
import logging from typing import Callable from mlflow.entities.logged_model_parameter import LoggedModelParameter as ModelParam from mlflow.entities.metric import Metric from mlflow.entities.model_registry import ( ModelVersion, ModelVersionDeploymentJobState, ModelVersionTag, RegisteredModel, Reg...
497
19,713
black
tests/data/cases/comments8.py
.py
# The percent-percent comments are Spyder IDE cells. # Both `#%%`` and `# %%` are accepted, so `black` standardises # to the latter. #%% # %% # output # The percent-percent comments are Spyder IDE cells. # Both `#%%`` and `# %%` are accepted, so `black` standardises # to the latter. # %% # %%
16
298
beam
sdks/python/apache_beam/runners/worker/data_plane.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...
947
33,458
django-cms
cms/test_utils/project/objectpermissionsapp/backends.py
.py
from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.db.models import Model class ObjectPermissionBackend: def has_perm(self, user_obj, perm, obj=None): if user_obj and user_obj.is_superuser: return True elif obj is No...
42
1,637
saleor
saleor/schedulers/models.py
.py
import importlib from typing import TYPE_CHECKING, Union from celery.schedules import BaseSchedule from django.core.exceptions import SuspiciousOperation, ValidationError from django.db import models from django.db.models import signals from django_celery_beat import models as base_models from . import customschedule...
143
5,142
beam
sdks/python/apache_beam/runners/dataflow/dataflow_exercise_streaming_metrics_pipeline_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...
173
6,843
pyomo
examples/pyomobook/optimization-ch/ConcreteH.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...
46
1,395
python-prompt-toolkit
tests/test_memory_leaks.py
.py
from __future__ import annotations import gc from prompt_toolkit.shortcuts.prompt import PromptSession def _count_prompt_session_instances() -> int: # Run full GC collection first. gc.collect() # Count number of remaining referenced `PromptSession` instances. objects = gc.get_objects() return l...
33
872
wagtail
wagtail/admin/urls/collections.py
.py
from django.urls import path from wagtail.admin.views import collection_privacy, collections app_name = "wagtailadmin_collections" urlpatterns = [ path("", collections.Index.as_view(), name="index"), path("add/", collections.Create.as_view(), name="add"), path("<int:pk>/", collections.Edit.as_view(), name...
17
532
beam
sdks/python/apache_beam/testing/benchmarks/chicago_taxi/process_tfma.py
.py
# Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
191
6,265
astropy
astropy/nddata/tests/test_blocks.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.nddata import block_reduce, block_replicate, reshape_as_blocks class TestReshapeAsBlocks: def test_1d(self): data = np.arange(16) reshaped = reshape_as_blocks(data, 2) assert res...
174
5,977
probability
tensorflow_probability/python/experimental/auto_batching/xla.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...
52
1,963
clearml
clearml/automation/optimization.py
.py
import json from copy import copy, deepcopy from datetime import datetime from itertools import product from logging import getLogger from threading import Thread, Event from time import time from typing import ( List, Set, Union, Sequence, Optional, Mapping, Callable, Tuple, Generat...
2,720
112,698
onnxruntime
onnxruntime/test/testdata/transform/fusion/matmul_integer_to_float.py
.py
import onnx from onnx import TensorProto, helper def MakeSubGraph(suffix, has_bias): # noqa: N802 mul_bottom_output = "mul_output" + suffix if has_bias else "output" + suffix nodes = [ helper.make_node( "MatMulInteger", ["a_quantized", "b_quantized" + suffix, "a_zp", "b_zp" + ...
106
3,309
biopython
Tests/test_translate.py
.py
# This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests of the transcription and translation methods of Seq objects.""" import unittest from Bio import Seq class TestTranscriptionTranslation(un...
93
3,286
beam
learning/tour-of-beam/learning-content/windowing/motivating-challenge/python-challenge/task.py
.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); y...
70
2,115
pyomo
doc/OnlineDocs/src/data/import6.tab.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
722
biopython
Bio/Graphics/Distribution.py
.py
# Copyright 2001 by Brad Chapman. 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. """Display information dis...
253
9,301
wandb
wandb/integration/sagemaker/auth.py
.py
from __future__ import annotations import os from typing import Any from wandb import env from wandb.sdk import wandb_setup from wandb.sdk.lib import wbauth def sagemaker_auth( overrides: dict[str, Any] | None = None, path: str = ".", api_key: str | None = None, ) -> None: """Write a secrets.env fil...
41
1,124
sqlmap
thirdparty/chardet/gb2312prober.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
47
1,754
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/KernelTypeStrResolver.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class KernelTypeStrResolver(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encod...
79
2,789
wandb
wandb/sdk/artifacts/_generated/fetch_org_info_from_entity.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import OrgInfoFragment class FetchOrgInfoFromEntity(GQLResult): entity: FetchOrgInfoFromEntityEntity | None class FetchOrgInfoFromEntityEntity(GQL...
27
649
lemur
lemur/certificates/schemas.py
.py
""" .. module: lemur.certificates.schemas :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 flask import current_app from flask_restful import inputs from flask_restful.re...
504
19,161
luigi
test/dict_parameter_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
142
5,457
hydra
tests/test_apps/app_exception/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra @hydra.main() def my_app(_: DictConfig) -> None: 1 / 0 if __name__ == "__main__": my_app()
14
221
mlflow
tests/genai/scorers/test_scorer.py
.py
from collections import defaultdict from unittest.mock import call, patch import pandas as pd import pytest import mlflow from mlflow.entities import Assessment, AssessmentSource, AssessmentSourceType, Feedback from mlflow.entities.assessment_error import AssessmentError from mlflow.genai import Scorer, scorer from m...
547
18,263
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_bidirectional.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 TestKerasBidirectional(CommonTF2LayerTest): def create_keras_bidirectional_net(self, n_units, RNN_layer, input_names, input_sha...
52
2,450
saleor
saleor/graphql/product/bulk_mutations/product_variant_bulk_update.py
.py
from collections import defaultdict from typing import cast import graphene from django.core.exceptions import ValidationError from django.db.models import F, Subquery from django.utils import timezone from graphene.utils.str_converters import to_camel_case from ....core.tracing import traced_atomic_transaction from ...
914
34,571
mlflow
tests/genai/judges/utils/test_tool_calling_utils.py
.py
import json from dataclasses import dataclass from unittest import mock import pytest from mlflow.entities.trace import Trace from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.trace_state import TraceState from mlflow.genai.judges.tools.get_...
253
9,455
probability
tensorflow_probability/python/internal/backend/numpy/errors.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...
35
945
onnx
onnx/backend/test/case/node/matmul.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 class MatMul(Base): @staticmethod def export() -> None: node...
63
2,040
saleor
saleor/graphql/order/mutations/order_discount_common.py
.py
import graphene from django.core.exceptions import ValidationError from prices import Money from ....order import models from ....order.error_codes import OrderErrorCode from ...core import ResolveInfo from ...core.doc_category import DOC_CATEGORY_ORDERS from ...core.mutations import BaseMutation from ...core.scalars ...
70
2,436
beam
sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner_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...
2,722
98,519
saleor
saleor/channel/exceptions.py
.py
class ChannelNotDefined(Exception): def __init__(self, msg=None): if msg is None: msg = "More than one channel exists. Specify which channel to use." super().__init__(msg) class NoDefaultChannel(Exception): def __init__(self, msg=None): if msg is None: msg = "A ...
13
383
saleor
saleor/graphql/channel/mutations/channel_delete.py
.py
import graphene from django.core.exceptions import ValidationError from ....channel import models from ....channel.error_codes import ChannelErrorCode from ....checkout.models import Checkout from ....core.tracing import traced_atomic_transaction from ....order.models import Order from ....permission.enums import Chan...
152
6,050
textual
src/textual/scroll_view.py
.py
""" `ScrollView` is a base class for [Line API](/guide/widgets#line-api) widgets. """ from __future__ import annotations from rich.console import RenderableType from textual._animator import EasingFunction from textual._types import AnimationLevel, CallbackType from textual.containers import ScrollableContainer from...
197
6,447
qutip
qutip/tests/test_about.py
.py
import qutip def test_qutip_about(capsys): qutip.about() outerr = capsys.readouterr() out = outerr.out.splitlines() assert out[:3] == [ "", "QuTiP: Quantum Toolbox in Python", "================================", ] assert out[-3:] == [ "Please cite QuTiP in your ...
19
557
qutip
qutip/tests/solver/test_lindblad_matrix_form.py
.py
""" Tests for LindbladMatrixForm class. """ import numpy as np import pytest from numpy.testing import assert_allclose import qutip from qutip.core.cy.lindblad_matrix_form import LindbladMatrixForm from qutip.core.cy.qobjevo import QobjEvo from qutip.core.data import dense class TestLindbladMatrixFormInit: """Te...
173
5,419
pynacl
src/nacl/bindings/crypto_secretstream.py
.py
# Copyright 2013-2018 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
360
11,223
toolz
doc/source/conf.py
.py
# Toolz documentation build configuration file, created by # sphinx-quickstart on Sun Sep 22 18:06:00 2013. # # 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...
286
9,190
mlflow
tests/langchain/test_langchain_databricks_dependency_extraction.py
.py
from collections import Counter, defaultdict from unittest import mock import langchain import pytest from databricks.vector_search.client import VectorSearchIndex from packaging.version import Version from mlflow.langchain.databricks_dependencies import ( _detect_databricks_dependencies, _extract_databricks_...
537
21,272
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_deformable_conv.py
.py
# # pool2d paddle model generator # import numpy as np import sys from save_model import saveModel # helpers def pdpd_attr_to_list(s, p, d): if isinstance(s, int): strides = [s, ]*2 elif isinstance(s, tuple): strides = list(s) elif isinstance(s, list): strides = s else: ...
323
11,681
openvino
tests/layer_tests/pytorch_tests/test_sort.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSortConstants(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor,) def create_model(sel...
93
3,489
textual
tests/css/test_scalar.py
.py
from textual.css.scalar import Scalar, Unit def test_copy_with_value(): old = Scalar(1, Unit.HEIGHT, Unit.CELLS) new = old.copy_with(value=2) assert new == Scalar(2, Unit.HEIGHT, Unit.CELLS) def test_copy_with_unit(): old = Scalar(1, Unit.HEIGHT, Unit.CELLS) new = old.copy_with(unit=Unit.WIDTH) ...
20
562
flit
flit_core/tests_core/samples/module1.py
.py
"""Example module""" __version__ = '0.1'
4
42
probability
tensorflow_probability/examples/logistic_regression.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...
227
8,687
astropy
astropy/io/misc/tests/test_pandas.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from io import StringIO import numpy as np import pytest from astropy import units as u from astropy.coordinates import SkyCoord from astropy.io import ascii from astropy.io.misc.pandas import connect from astropy.table import QTable, Table from astropy...
123
3,643
coremltools
coremltools/test/optimize/torch/quantization/test_quantizer.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from collections import OrderedDict import cattrs import pytest import torch import torch.ao.quantiz...
701
25,621
tqdm
tqdm/asyncio.py
.py
""" Asynchronous progress bar decorator for iterators. Includes a default `range` iterator printing to `stderr`. Usage: >>> from tqdm.asyncio import trange, tqdm >>> async for i in trange(10): ... ... """ import asyncio from sys import version_info from .std import tqdm as std_tqdm __author__ = {"github.com/": [...
104
3,196
onnxruntime
tools/python/util/__init__append.py
.py
# appended to the __init__.py in the onnxruntime module's 'tools' folder from /tools/python/util/__init__append.py import importlib.util have_torch = importlib.util.find_spec("torch") if have_torch: from .pytorch_export_helpers import infer_input_info # noqa: F401
7
271
pyomo
pyomo/contrib/pyros/tests/test_grcs.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...
5,653
203,097
flit
flit_core/tests_core/test_config.py
.py
import logging import re import sys from pathlib import Path import pytest from flit_core import config samples_dir = Path(__file__).parent / 'samples' def test_load_toml(): inf = config.read_flit_config(samples_dir / 'module1-pkg.toml') assert inf.module == 'module1' def test_load_toml_ns(): inf = con...
411
15,983