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
astropy
astropy/coordinates/erfa_astrom.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains a helper function to fill erfa.astrom struct and a ScienceState, which allows to speed up coordinate transformations at the expense of accuracy. """ import functools import warnings from typing import Final import erfa import num...
374
13,119
beam
sdks/python/apache_beam/tools/__init__.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
22
892
mlflow
mlflow/store/artifact/unity_catalog_models_artifact_repo.py
.py
import base64 from mlflow.environment_variables import MLFLOW_ENABLE_UC_NATIVE_MODEL_REGISTRY from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.protos.databricks_uc_registry_messages_pb2 import ( MODEL_VERSION_OPERATION_READ, GenerateTemp...
217
10,065
saleor
saleor/graphql/warehouse/mutations/warehouse_shipping_zone_assign.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from ....channel import models as channel_models from ....permission.enums import ProductPermissions from ....warehouse import models from ....warehouse.error_codes import WarehouseErrorCode from ....warehouse.valid...
123
4,859
pyomo
pyomo/contrib/pynumero/sparse/tests/test_intrinsics.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...
150
6,257
biopython
Bio/Emboss/Primer3.py
.py
# Copyright 2008 Michiel de Hoon. # Revisions copyright 2009 Leighton Pritchard. # Revisions copyright 2010 Peter Cock. # 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 fi...
184
5,576
saleor
saleor/graphql/page/tests/queries/pages_with_where/test_with_where_references_products.py
.py
import graphene import pytest from ......attribute import AttributeEntityType, AttributeInputType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from .....core.utils import to_global_id_or_none from .....tests.utils i...
303
9,315
wandb
wandb/sdk/wandb_sweep.py
.py
from __future__ import annotations import urllib.parse from collections.abc import Callable from typing import TYPE_CHECKING import wandb from wandb import env from . import wandb_login if TYPE_CHECKING: from wandb.wandb_controller import _WandbController def _get_sweep_url(api, sweep_id): """Return sweep...
125
3,993
onnxruntime
onnxruntime/test/testdata/test_shape_data_propagation_gather_topk.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # Regression fixture for the Shape -> Gather(1-D index) -> TopK rank-drop. # # The Gather index here is the 1-D constant [-1] (rank 1), so per ONNX Gather # semantics (output_rank = data_rank - 1 + indices_rank) the Gather ou...
55
2,395
coremltools
coremltools/test/neural_network/test_neural_networks.py
.py
# Copyright (c) 2021, 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 unittest import coremltools from coremltools import proto from coremltools.models.utils import _...
60
2,017
textual
src/textual/widgets/_list_view.py
.py
from __future__ import annotations from typing import ClassVar, Iterable, Optional from typing_extensions import TypeGuard from textual._loop import loop_from_index from textual.await_complete import AwaitComplete from textual.await_remove import AwaitRemove from textual.binding import Binding, BindingType from text...
397
14,297
probability
tensorflow_probability/python/math/bessel.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...
1,320
49,093
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combinevalues_side_inputs_singleton.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,987
kombu
t/unit/transport/test_azureservicebus.py
.py
from __future__ import annotations import base64 import json import random from collections import namedtuple from queue import Empty from unittest.mock import MagicMock, patch import pytest from kombu import Connection, Exchange, Queue, messaging pytest.importorskip("azure.servicebus") import azure.core.exceptions...
1,094
38,006
coveragepy
tests/test_cmdline.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 """Test cmdline.py for coverage.py.""" from __future__ import annotations import ast import os import pprint import re import sys import textwrap from collecti...
1,799
56,740
wagtail
wagtail/images/tests/test_api_v3/test_delete.py
.py
from django.contrib.auth.models import Group, Permission from django.urls import reverse from wagtail.images import get_image_model from wagtail.models import GroupCollectionPermission from .base import TestV3ImagesBase Image = get_image_model() class TestV3ImageDelete(TestV3ImagesBase): def delete(self, image...
76
2,875
beam
sdks/python/apache_beam/runners/interactive/testing/integration/notebook_executor.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...
164
5,686
probability
tensorflow_probability/python/version.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...
37
1,418
pyomo
pyomo/dataportal/plugins/csv_table.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,769
pymc
pymc/variational/inference.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...
800
31,191
saleor
saleor/graphql/page/tests/queries/pages_with_where/test_with_where_references_pages.py
.py
import pytest from ......attribute import AttributeEntityType, AttributeInputType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from ......page.models import Page from .....core.utils import to_global_id_or_none from...
334
10,546
biopython
Tests/test_Pathway.py
.py
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved. # Revisions copyright 2018 by Maximilian Greil. All rights reserved. # 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. # python unittest fram...
209
8,512
mlflow
mlflow/genai/optimize/optimizers/metaprompt_optimizer.py
.py
import json import logging import re from contextlib import nullcontext from typing import Any import mlflow from mlflow.entities.span import SpanType from mlflow.exceptions import MlflowException from mlflow.genai.optimize.optimizers.base import BasePromptOptimizer, _EvalFunc from mlflow.genai.optimize.types import E...
698
28,105
textual
tests/notifications/test_notifications.py
.py
from __future__ import annotations from time import sleep from textual.notifications import Notification, Notifications def test_empty_to_start_with() -> None: """We should have no notifications if we've not raised any.""" assert len(Notifications()) == 0 def test_many_notifications() -> None: """Addi...
79
2,364
mlflow
dev/clint/tests/rules/test_use_walrus_operator.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules import UseWalrusOperator def test_basic_walrus_pattern(index: SymbolIndex) -> None: code = """ def f(): a = func() if a: use(a) """ ...
418
10,262
confluent-kafka-python
tests/schema_registry/_async/test_api_client.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...
608
19,750
astropy
astropy/units/structured.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module defines structured units and quantities. """ # Standard library import operator from collections.abc import Collection from functools import cached_property from typing import Self import numpy as np from .core import UNITY, Unit, UnitBa...
581
20,710
sqlmap
plugins/dbms/maxdb/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...
29
982
mlflow
dev/clint/src/clint/rules/no_rst.py
.py
from clint.rules.base import Rule class NoRst(Rule): def _message(self) -> str: return "Do not use RST style. Use Google style instead."
7
151
beam
sdks/python/apache_beam/runners/worker/bundle_processor_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...
741
27,984
saleor
saleor/graphql/product/tests/queries/products_filtrations/test_over_unassigned_attribute.py
.py
import graphene import pytest from .....tests.utils import get_graphql_content PRODUCT_UNASSIGN_ATTR_MUTATION = """ mutation ProductAttributeUnassign($productTypeId: ID!, $attributeIds: [ID!]!) { productAttributeUnassign( productTypeId: $productTypeId, attributeIds: $attributeIds ) { ...
92
2,745
loguru
tests/exceptions/source/diagnose/source_multilines.py
.py
# fmt: off import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True) def bug_1(n): return ("""multi-lines """ + n / 0) def bug_2(a, b, c): return (1 / 0 + a + b + \ c) def bug_3(string): return min(10 ...
60
772
wagtail
wagtail/contrib/redirects/tests/test_redirects_api.py
.py
from django.test import TestCase from django.urls import reverse from wagtail.contrib.redirects.models import Redirect from wagtail.models import Site from wagtail.test.utils import Page class TestRedirectsAPI(TestCase): def setUp(self): self.example_home = Page.objects.get(slug="home").add_sibling( ...
107
3,284
wandb
tests/unit_tests/test_require_user.py
.py
"""require user tests.""" import pytest import wandb from wandb.sdk import wandb_require @pytest.fixture def mock_require(mocker): cleanup = [] def fn(require, func): cleanup.append(require) mocker.patch.object( wandb_require._Requires, "require_" + require, ...
69
1,820
luigi
test/contrib/opener_test.py
.py
import random import unittest import mock import pytest import luigi from luigi.contrib.opener import NoOpenerError, OpenerTarget from luigi.local_target import LocalTarget from luigi.mock import MockTarget @pytest.mark.contrib class TestOpenerTarget(unittest.TestCase): def setUp(self): MockTarget.fs.cl...
109
3,807
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_ZerosLike.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': ([None], [10])}, {'shape': ([None, 10], [1, 10])}, {'shape': ([1, 10, None], [1, 10, 10])}, {'shape': ([None, 2, 3, 4], [5, 2, 3, 4])}, {'shape': ([5, 2, None, 4], [5, 2, 3, 4...
42
1,479
coremltools
setup.py
.py
#!/usr/bin/env python # # Copyright (c) 2017, 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 importlib.util import os from sys import platform from setuptools import...
116
3,744
probability
tensorflow_probability/python/distributions/exp_gamma.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...
449
16,721
beam
sdks/python/apache_beam/transforms/periodicsequence_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...
373
13,275
onnxruntime
tools/ci_build/logger.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import logging def get_logger(name): logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s", level=logging.DEBUG) return logging.getLogger(name)
11
276
hydra
plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core_aws.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import os import tempfile from pathlib import Path from typing import Any, Dict, List, Sequence, Union, cast import cloudpickle # type: ignore from hydra.core.singleton import Singleton from hydra.core.utils import JobReturn, config...
225
7,890
astropy
astropy/coordinates/solar_system.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains convenience functions for retrieving solar system ephemerides from jplephem. """ import os.path import re from inspect import cleandoc from urllib.parse import urlparse import erfa import numpy as np from astropy import units as...
508
18,487
returns
returns/contrib/hypothesis/laws.py
.py
import dataclasses import inspect from collections.abc import Callable, Iterator from contextlib import ExitStack, contextmanager from typing import Any, Self, TypeVar, final, overload import pytest from hypothesis import given from hypothesis import settings as hypothesis_settings from hypothesis import strategies as...
317
9,930
beam
learning/katas/python/Streaming/Triggers/Event Time Triggers/generate_event.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...
58
4,385
astropy
astropy/units/function/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Function Units and Quantities.""" from abc import ABCMeta, abstractmethod from collections.abc import Collection from functools import cached_property from typing import Self import numpy as np from numpy._core import umath as np_umath from astropy.u...
837
31,017
pyro
pyro/contrib/gp/models/model.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from pyro.contrib.gp.parameterized import Parameterized def _zero_mean_function(x): return 0 class GPModel(Parameterized): r""" Base class for Gaussian Process models. The core of a Gaussian Proce...
228
9,145
luigi
luigi/contrib/azureblob.py
.py
# -*- coding: utf-8 -*- # # Copyright (c) 2018 Microsoft Corporation # # 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 appl...
321
13,932
scikit-bio
skbio/util/_testing.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. # --------------------------------------------...
793
25,381
pyomo
pyomo/contrib/solver/tests/solvers/instances.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...
38
1,504
omegaconf
omegaconf/listconfig.py
.py
import copy import operator from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, MutableSequence, Optional, Tuple, Type, Union, ) if TYPE_CHECKING: from .tupleconfig import TupleConfig from ._utils import ( ValueKind, _get_value...
688
24,976
hydra
tests/jupyter/a_module.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from pathlib import Path from hydra import initialize, initialize_config_dir, initialize_config_module def hydra_initialize() -> None: initialize(config_path="../../hydra/test_utils/configs") def hydra_initialize_config_dir() -> None: a...
18
555
toolz
bench/test_memoize.py
.py
from toolz import memoize def test_memoize_no_kwargs(): @memoize def f(x): return x for i in range(100000): f(3)
11
144
mlflow
mlflow/store/db_migrations/versions/7d34483879f0_add_model_version_tags_workspace_index.py
.py
"""Add indexes for relationship loading after workspace PK migration The workspace migration (1b5f0d9ad7c1) changed primary keys to include ``workspace`` as the leading column. SQLAlchemy's relationship loader joins on (workspace, name, version) for model_version_tags and (workspace, name) for registered_model_tags, ...
45
1,277
confluent-kafka-python
tests/integration/share_consumer/test_share_consumer_ack.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2026 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...
1,744
70,467
saleor
saleor/graphql/account/tests/mutations/account/test_account_address_create.py
.py
from unittest.mock import patch import graphene import pytest from django.test import override_settings from freezegun import freeze_time from ......account.error_codes import AccountErrorCode from ......account.models import Address from ......checkout import AddressType from ......webhook.event_types import Webhook...
385
12,645
openvino
src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # mypy: ignore-errors import os import logging from hashlib import sha256 import torch import torch.overrides from torch.fx import GraphModule from openvino.frontend import FrontEndManager from openvino.fronten...
149
4,642
openvino
tests/layer_tests/pytorch_tests/test_search_sorted.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest import numpy as np class TestSearchSorted(PytorchLayerTest): def _prepare_input(self): return (np.array(self.sorted).astype(self.sorted_type),np.array(sel...
47
1,957
metrics
tests/unittests/wrappers/test_tracker.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...
347
13,011
readthedocs.org
readthedocs/organizations/utils.py
.py
"""Utilities for organizations.""" import structlog from readthedocs.core.utils import send_email log = structlog.get_logger(__name__) def send_team_add_email(team_member, request): """Send an organization team add email.""" log.info( "Sending team add notification.", team=team_member.team...
31
895
hydra
plugins/hydra_submitit_launcher/setup.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # type: ignore from pathlib import Path from read_version import read_version from setuptools import find_namespace_packages, setup setup( name="hydra-submitit-launcher", version=read_version("hydra_plugins/hydra_submitit_launcher", "__ini...
36
1,319
astropy
astropy/units/equivalencies.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A set of standard astronomical equivalencies. The equivalency class and all equivalency functions defined here are also available in (and should be used through) the `astropy.units` namespace. """ import functools from typing import Final # THIRD-P...
911
30,761
wagtail
wagtail/admin/views/bulk_action/__init__.py
.py
from .base_bulk_action import BulkAction from .dispatcher import index __all__ = ["BulkAction", "index"]
5
106
sphinx
tests/roots/test-ext-autosummary-recursive/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['sphinx.ext.autosummary'] autosummary_generate = True
8
152
saleor
saleor/graphql/checkout/sorters.py
.py
from django.db.models import CharField, ExpressionWrapper, OuterRef, QuerySet, Subquery from ...payment.models import Payment from ..core.descriptions import DEPRECATED_LEGACY_PAYMENTS from ..core.doc_category import DOC_CATEGORY_CHECKOUT from ..core.types import BaseEnum, SortInputObjectType class CheckoutSortField...
55
1,973
beam
sdks/python/apache_beam/runners/worker/opcounters_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...
244
8,671
saleor
saleor/graphql/app/tests/mutations/test_app_install.py
.py
from unittest.mock import Mock, patch import graphene from .....app.models import App, AppInstallation from .....app.tasks import install_app_task from .....core import JobStatus from ....core.enums import AppErrorCode, PermissionEnum from ....tests.utils import get_graphql_content INSTALL_APP_MUTATION = """ mut...
262
8,463
beam
sdks/python/apache_beam/examples/snippets/snippets.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,899
64,319
pyro
tests/contrib/autoname/test_named.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch import pyro import pyro.distributions as dist from pyro import poutine from pyro.contrib.autoname import named def get_sample_names(tr): return set( [ name for name, site in tr.no...
117
3,676
flit
flit/vcs/__init__.py
.py
from pathlib import Path from . import hg from . import git def identify_vcs(directory: Path): directory = directory.resolve() for p in [directory] + list(directory.parents): # In a linked git worktree (`git worktree add ...`) or inside a # git submodule, `.git` is a regular file containing a ...
19
560
onnxruntime
onnxruntime/test/python/transformers/profile_qmoe_gemv.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Profiling script for the CUDA QMoE GEMV decode path. Usage: pyth...
129
5,146
pyfilesystem2
fs/enums.py
.py
"""Enums used by PyFilesystem. """ from __future__ import absolute_import, unicode_literals import os from enum import IntEnum, unique @unique class ResourceType(IntEnum): """Resource Types. Positive values are reserved, negative values are implementation dependent. Most filesystems will support o...
57
1,230
onnxruntime
onnxruntime/python/_ld_preload.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- # This file can be modified by setup.py when building a manylinux2010 wh...
8
406
sqlmap
plugins/generic/enumeration.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.common import Backend from lib.core.common import unArrayizeValue from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from l...
85
2,653
beam
sdks/python/apache_beam/ml/rag/utils.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...
221
7,892
textual
src/textual/style.py
.py
""" The Style class contains all the information needed to generate styled terminal output. You won't often need to create Style objects directly, if you are using [Content][textual.content.Content] for output. But you might want to use styles for more customized widgets. """ from __future__ import annotations from ...
538
15,973
lemur
lemur/certificates/cli.py
.py
""" .. module: lemur.certificate.cli :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> """ import sys from time import sleep import arrow import click from flask import current_ap...
1,347
49,999
mlflow
tests/tracing/processor/test_uc_table_processor.py
.py
from unittest import mock import pytest import mlflow import mlflow.tracking.context.default_context from mlflow.entities.span import LiveSpan from mlflow.entities.trace_location import TraceLocationType, UCSchemaLocation from mlflow.entities.trace_state import TraceState from mlflow.environment_variables import MLFL...
217
8,473
openvino
src/bindings/python/tests/test_runtime/test_core.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import sys import numpy as np import os from pathlib import Path from openvino import ( Model, Core, Tensor, PartialShape, CompiledModel, tensor_from_file, compile_model,...
537
17,871
probability
tensorflow_probability/python/distributions/__init__.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
307
16,668
astropy
astropy/utils/masked/tests/test_function_helpers.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test all functions covered by __array_function__. Here, run through all functions, with simple tests just to check the helpers. More complicated tests of functionality, including with subclasses, are done in test_functions. TODO: finish full coverage ...
1,771
63,774
wagtail
wagtail/tests/test_collection_model.py
.py
from django.test import TestCase from wagtail.models import Collection class TestCollectionTreeOperations(TestCase): def setUp(self): self.root_collection = Collection.get_first_root_node() self.holiday_photos_collection = self.root_collection.add_child( name="Holiday photos" ...
124
5,151
python-prompt-toolkit
examples/full-screen/scrollable-panes/with-completion-menu.py
.py
#!/usr/bin/env python """ A simple example of a scrollable pane. """ from prompt_toolkit.application import Application from prompt_toolkit.application.current import get_app from prompt_toolkit.completion import WordCompleter from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.key_binding.bindings....
122
2,826
pyro
tests/distributions/test_mvt.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import pytest import torch from torch.distributions import Gamma, MultivariateNormal, StudentT from pyro.distributions import MultivariateStudentT from tests.common import assert_equal def random_mvt(df_shape, loc_s...
187
5,652
astropy
astropy/nddata/flag_collection.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np __all__ = ["FlagCollection"] class FlagCollection(dict): """ The purpose of this class is to provide a dictionary for containing arrays of flags for the `NDData` class. Flags should be stored in Numpy arrays that hav...
45
1,491
hydra
plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/optuna_sweeper.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any, List, Optional from hydra.plugins.sweeper import Sweeper from hydra.types import HydraContext, TaskFunction from hydra.utils import instantiate from omegaconf import DictConfig class OptunaSweeper(Sweeper): """Class to...
60
1,559
mlflow
tests/llama_index/sample_code/basic_chat_engine.py
.py
""" Sample code to define a chat engine and save it with model-from-code logging. Ref: https://qdrant.tech/documentation/quickstart/ """ from llama_index.core import Document, VectorStoreIndex from llama_index.core.chat_engine.types import ChatMode import mlflow index = VectorStoreIndex.from_documents(documents=[Do...
17
506
ipython
IPython/testing/tools.py
.py
"""Generic testing tools. Authors ------- - Fernando Perez <Fernando.Perez@berkeley.edu> """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import annotations import os from pathlib import Path import re import sys import tempfile import unittes...
436
13,312
gunicorn
gunicorn/workers/gasgi.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI worker for gunicorn. Provides native asyncio-based ASGI support using gunicorn's own HTTP parsing infrastructure. """ import asyncio import os import signal import sys from gunicorn.workers import base ...
304
10,697
records
tests/test_transactions.py
.py
"""Test manipulating database table in various transaction scenarios. Varying conditions: - db for different database backends (see `db` fixture) - query run via - `db=records.Database(); db.query() - `conn=db.get_connection(); conn.query()` - transaction - not used at all - used and created in diff...
84
2,425
sphinx
tests/test_domains/test_domain_py_fields.py
.py
"""Tests the Python Domain""" from __future__ import annotations import pytest from docutils import nodes from sphinx import addnodes from sphinx.addnodes import ( desc, desc_addname, desc_annotation, desc_content, desc_name, desc_sig_keyword, desc_sig_punctuation, desc_sig_space, ...
612
18,255
mlflow
mlflow/store/artifact/mlflow_artifacts_repo.py
.py
import logging import os import re import threading from http import HTTPStatus from urllib.parse import urlparse, urlunparse from requests import HTTPError from mlflow.environment_variables import ( MLFLOW_ENABLE_PROXY_MULTIPART_DOWNLOAD, MLFLOW_ENABLE_PROXY_MULTIPART_UPLOAD, MLFLOW_MULTIPART_DOWNLOAD_CH...
230
9,673
wandb
tests/system_tests/test_functional/wb_logging/last_resort.py
.py
import logging if __name__ == "__main__": logger = logging.getLogger("wandb") # logging.lastResort by default outputs to stderr. Check that this is true. logger.warning("lastResort (before configuring)") # Import wandb to trigger wb_logging.configure_wandb_logger(). import wandb # noqa: F401 ...
20
754
beam
playground/infrastructure/fetch_scala_examples.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 ...
246
8,766
pyro
pyro/distributions/sine_bivariate_von_mises.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import math import warnings from math import pi import torch from torch.distributions import VonMises from torch.distributions.utils import broadcast_all, lazy_property from pyro.distributions import constraints from pyro.distributio...
331
12,255
openvino
tests/e2e_tests/test_utils/reshape_tests_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import copy import logging as log import re from collections import defaultdict from itertools import zip_longest from types import SimpleNamespace import numpy as np from e2e_tests.common.test_utils import name_aligner from e2e_tests....
321
13,624
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vscode_folding_markers/cat_variable.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- cat = 42
12
172
pymc
pymc/logprob/tensor.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...
736
29,373
saleor
saleor/payment/tests/test_gateways_utils.py
.py
import warnings import pytest from ..gateways.utils import get_supported_currencies from ..interface import GatewayConfig @pytest.fixture def gateway_config(): return GatewayConfig( gateway_name="Dummy", auto_capture=True, supported_currencies="", connection_params={"secret-key":...
54
1,393
onnx
onnx/reference/ops/op_einsum.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 Einsum(OpRun): def _run(self, *args, equation=None): if not isinstance(equation, str): raise TypeError(f"equati...
22
630
saleor
saleor/graphql/product/tests/queries/variants_where/test_over_references_variants.py
.py
import graphene import pytest from ......attribute import AttributeEntityType, AttributeInputType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from .....core.utils import to_global_id_or_none from .....tests.utils i...
323
10,763