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
returns
returns/pointfree/bind_async_context_future_result.py
.py
from collections.abc import Awaitable, Callable from typing import TYPE_CHECKING, TypeVar from returns.interfaces.specific.reader_future_result import ( ReaderFutureResultLikeN, ) from returns.primitives.hkt import Kinded, KindN, kinded if TYPE_CHECKING: from returns.context import ReaderFutureResult # noqa:...
88
2,537
coremltools
coremltools/converters/libsvm/_libsvm_converter.py
.py
# 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 coremltools as ct from coremltools import __version__ as ct_version from coremltools import proto...
200
7,189
mamba
libmambapy/tests/test_version.py
.py
import libmambapy def test_version(): assert isinstance(libmambapy.__version__, str) assert libmambapy.version.__version__ == libmambapy.__version__
7
159
mlflow
tests/assistant/test_config.py
.py
from unittest.mock import patch import pytest from mlflow.assistant.config import AssistantConfig, PermissionsConfig from mlflow.assistant.providers import OllamaProvider from mlflow.assistant.providers.base import clear_config_cache @pytest.fixture(autouse=True) def config_file(tmp_path): config_path = tmp_pat...
95
3,271
textual
docs/examples/widgets/tabbed_content_label_color.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, TabbedContent, TabPane class ColorTabsApp(App): CSS = """ TabbedContent #--content-tab-green { color: green; } TabbedContent #--content-tab-red { color: red; } """ def compose(self) -> ComposeRe...
26
574
sphinx
tests/roots/test-html_entity/conf.py
.py
html_theme = 'classic' exclude_patterns = ['_build']
3
53
onnxruntime
onnxruntime/python/tools/transformers/fusion_base.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from collections import defaultdict from collections.abc import Sequence...
142
5,825
wagtail
wagtail/admin/views/bulk_action/base_bulk_action.py
.py
from abc import ABC, abstractmethod from django import forms from django.db import transaction from django.shortcuts import get_list_or_404, redirect from django.utils.functional import classproperty from django.views.generic import FormView from wagtail import hooks from wagtail.admin import messages from wagtail.ad...
169
5,368
kombu
kombu/utils/limits.py
.py
"""Token bucket implementation for rate limiting.""" from __future__ import annotations from collections import deque from time import monotonic __all__ = ('TokenBucket',) class TokenBucket: """Token Bucket Algorithm. See Also -------- https://en.wikipedia.org/wiki/Token_Bucket Most o...
88
2,551
pyro
tests/distributions/test_binomial.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro.distributions as dist from pyro.contrib.epidemiology.distributions import ( set_approx_log_prob_tol, set_approx_sample_thresh, ) from tests.common import assert_close @pytest.mark.param...
68
2,014
qutip
qutip/core/energy_restricted.py
.py
from .dimensions import Space from .states import state_number_enumerate from . import data as _data from . import Qobj, qdiags import numpy as np import scipy.sparse from .. import settings import math import numbers import itertools import warnings __all__ = ['enr_state_dictionaries', 'enr_nstates', 'enr_...
552
19,003
coremltools
coremltools/test/optimize/torch/palettization/test_efficient_kmeans.py
.py
# Copyright (c) 2026, 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 torch from coremltools.optimize.torch.palettization._efficient_kmeans import _EfficientKMeans...
39
1,360
saleor
saleor/graphql/translations/mutations/category_translate.py
.py
import graphene from ....permission.enums import SitePermissions from ....product import models as product_models from ...core.enums import LanguageCodeEnum from ...core.types import TranslationError from ...product.types import Category from .utils import BaseTranslateMutationWithSlug, TranslationInput class Catego...
32
1,118
pyomo
examples/pyomobook/nonlinear-ch/react_design/ReactorDesign.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...
61
2,052
wandb
wandb/errors/util.py
.py
from __future__ import annotations from wandb.proto import wandb_internal_pb2 as pb from . import AuthenticationError, CommError, Error, UnsupportedError, UsageError to_exception_map = { pb.ErrorInfo.UNKNOWN: Error, pb.ErrorInfo.COMMUNICATION: CommError, pb.ErrorInfo.AUTHENTICATION: AuthenticationError, ...
58
1,713
astropy
docs/wcs/examples/planetary_wcs.py
.py
# Create a planetary WCS structure from astropy import units as u from astropy.coordinates import BaseBodycentricRepresentation, BaseCoordinateFrame from astropy.wcs.utils import celestial_frame_to_wcs class MARSCustomBodycentricRepresentation(BaseBodycentricRepresentation): _equatorial_radius = 3399190.0 * u.m ...
24
682
lemur
lemur/plugins/bases/tls.py
.py
""" .. module: lemur.plugins.bases.tls :platform: Unix :copyright: (c) 2021 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Sayali Charhate <scharhate@netflix.com> """ from lemur.plugins.base import Plugin class TLSPlugin(Plugin): """ This i...
21
510
python-prompt-toolkit
src/prompt_toolkit/completion/filesystem.py
.py
from __future__ import annotations import os from collections.abc import Callable, Iterable from prompt_toolkit.completion import CompleteEvent, Completer, Completion from prompt_toolkit.document import Document __all__ = [ "PathCompleter", "ExecutableCompleter", ] class PathCompleter(Completer): """ ...
119
3,958
coremltools
coremltools/test/optimize/torch/palettization/palettization_utils.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 coremltools.optimize.torch.palettization._supported_modules import DKMPalettizerModulesRegistry ...
29
1,196
pymc
tests/logprob/test_switch.py
.py
# Copyright 2026 - 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...
76
2,585
kafka
tests/kafkatest/directory_layout/kafka_path.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 ...
144
5,787
saleor
saleor/graphql/app/tests/mutations/test_app_problem_create_critical.py
.py
import datetime from django.utils import timezone from .....app.models import AppProblem from ....tests.utils import get_graphql_content APP_PROBLEM_CREATE_MUTATION = """ mutation AppProblemCreate($input: AppProblemCreateInput!) { appProblemCreate(input: $input) { appProblem { ...
224
6,285
saleor
saleor/graphql/app/tests/mutations/test_app_create.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....app.error_codes import AppErrorCode from .....app.models import App from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event...
318
9,584
astropy
astropy/coordinates/angles/angle_parsetab.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/coordinates/angles # # You can then commi...
76
6,516
clearml
examples/frameworks/click/click_single_cmd.py
.py
import click from clearml import Task @click.command() @click.option( "--count", default=1, help="Number of greetings.", ) @click.option( "--name", prompt="Your name", help="The person to greet.", ) def hello(count, name): Task.init( project_name="examples", task_name="Clic...
31
531
onnx
onnx/reference/ops/op_bitwise_xor.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunBinary class BitwiseXor(OpRunBinary): def _run(self, x, y): return (np.bitwise_xor(x, y),)
14
282
textual
tests/snapshot_tests/snapshot_apps/scoped_css.py
.py
from textual.app import App, ComposeResult from textual.widget import Widget from textual.widgets import Label class MyWidget(Widget): DEFAULT_CSS = """ MyWidget { height: auto; border: magenta; } Label { border: solid green; } """ def compose(self) -> ComposeResul...
35
669
onnxruntime
orttraining/orttraining/python/training/optim/_multi_tensor_apply.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # multi_tensor_apply.py # This file has been adapted from microsoft/DeepSpeed """ Copyright 2020 The Microsoft DeepSpeed Team Copyright NVIDIA/apex This file is adapted from NVIDIA/apex, commit a109f85 """ class MultiTenso...
20
543
coremltools
deps/protobuf/python/google/__init__.py
.py
try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: __path__ = __import__('pkgutil').extend_path(__path__, __name__)
5
150
astropy
astropy/coordinates/tests/test_frames_with_velocity.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy import units as u from astropy.coordinates import builtin_frames as bf from astropy.coordinates import galactocentric_frame_defaults from astropy.coordinates import representation as r from astropy.coordinate...
342
12,739
gunicorn
tests/test_http2_integration.py
.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Integration tests for HTTP/2 with full request/response cycles.""" import pytest from io import BytesIO # Check if h2 is available try: import h2.connection import h2.config i...
643
21,571
onnx
onnx/backend/test/case/node/gelu.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import math import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Gelu(Base): @staticmethod def export_gelu_tanh() ...
53
1,806
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_products_on_fixed_promotion.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_default_shop from ....utils import assign_permissions ...
129
4,430
sphinx
tests/test_writers/test_writer_latex.py
.py
"""Test the LaTeX writer""" from __future__ import annotations import pytest from sphinx.writers.latex import rstdim_to_latexdim def test_rstdim_to_latexdim() -> None: # Length units docutils supported # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#length-units assert rstdim_to_la...
31
1,154
pymc
tests/stats/test_log_density.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...
209
8,085
wagtail
wagtail/images/tests/test_admin_views.py
.py
import datetime import json import urllib import warnings from http import HTTPStatus from unittest.mock import patch from django.conf import settings from django.contrib.auth import get_permission_codename from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.models import ContentT...
4,979
188,697
kafka
tests/kafkatest/services/kafka/util.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 ...
51
2,297
saleor
saleor/webhook/tests/test_tasks.py
.py
import json from decimal import Decimal from unittest import mock import pytest from django.utils import timezone from freezegun import freeze_time from graphene import Node from requests_hardened import HTTPSession from ...core import EventDeliveryStatus from ...core.models import EventDelivery, EventPayload from .....
1,155
35,997
hydra
plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import math from typing import ( Any, Dict, List, MutableMapping, MutableSequence, Optional, Tuple, Union, ) import nevergrad as ng from hydra._internal.deprecation_warning import deprecation_warning f...
241
9,164
wagtail
wagtail/snippets/tests/test_unpublish_view.py
.py
from unittest import mock from django.contrib.admin.utils import quote from django.contrib.auth.models import Permission from django.http import HttpRequest, HttpResponse from django.test import TestCase from django.urls import reverse from wagtail.signals import unpublished from wagtail.test.testapp.models import Dr...
229
8,516
mlflow
tests/server/jobs/helpers.py
.py
"""Shared test helpers for job execution tests.""" import os import time from contextlib import contextmanager from pathlib import Path import pytest from mlflow.entities._job_status import JobStatus from mlflow.server import ( ARTIFACT_ROOT_ENV_VAR, BACKEND_STORE_URI_ENV_VAR, HUEY_STORAGE_PATH_ENV_VAR, ...
105
3,582
probability
tensorflow_probability/python/bijectors/sigmoid_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...
187
6,713
pyro
pyro/distributions/transforms/utils.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 def clamp_preserve_gradients(x, min, max): # This helper function clamps gradients but still passes through the gradient in clamped regions return x + (x.clamp(min, max) - x).detach()
8
282
deap
deap/benchmarks/__init__.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 ...
737
25,820
biopython
Tests/test_SeqFeature.py
.py
# Copyright 2001 by Brad Chapman. All rights reserved. # Revisions copyright 2011-2013 by Peter Cock. All rights reserved. # Copyright 2015-2017 by Kai Blin. 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 include...
383
15,441
saleor
saleor/graphql/shop/tests/mutations/test_gift_card_settings_update.py
.py
from .....core import TimePeriodType from .....site import GiftCardSettingsExpiryType from .....site.error_codes import GiftCardSettingsErrorCode from ....core.enums import TimePeriodTypeEnum from ....tests.utils import assert_no_permission, get_graphql_content from ...enums import GiftCardSettingsExpiryTypeEnum GIFT_...
219
6,597
beam
sdks/python/apache_beam/io/iobase_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...
266
10,739
pyomo
pyomo/contrib/multistart/multi.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
261
9,896
pyomo
examples/doc/samples/case_studies/deer/DeerProblem.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...
102
2,587
metrics
src/torchmetrics/functional/image/uqi.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...
172
6,566
biopython
Tests/test_PopGen_GenePop_nodepend.py
.py
# Copyright 2007 by Tiago Antao <tiagoantao@gmail.com>. 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. """Tests for PopGen GenePop nodepend module.""" import os import tempfi...
215
7,420
clearml
clearml/debugging/timer.py
.py
""" Timing support """ import time from typing import Callable, Optional, Dict, List, Any class Timer: """A class implementing a simple timer, with a reset option""" def __init__(self) -> None: self._start_time = 0.0 self._diff = 0.0 self._total_time = 0.0 self._average_time =...
116
3,568
probability
tensorflow_probability/python/layers/internal/distribution_tensor_coercible.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...
237
9,108
omegaconf
omegaconf/resolvers/__init__.py
.py
from omegaconf.resolvers import oc __all__ = [ "oc", ]
6
60
probability
tensorflow_probability/python/distributions/ordered_logistic.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...
365
13,640
conda
conda/env/specs/explicit.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Define explicit spec.""" from __future__ import annotations from ...base.constants import EXPLICIT_MARKER from ...base.context import context from ...exceptions import CondaValueError, PluginError from ...gateways.disk.read import yield_lin...
76
2,463
pyro
pyro/contrib/oed/search.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import queue import pyro.poutine as poutine from pyro.infer.abstract_infer import TracePosterior ################################### # Search borrowed from RSA example ################################### class Search(TracePoste...
31
867
beam
sdks/python/apache_beam/ml/inference/onnx_inference.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...
180
7,062
pyro
tests/ops/test_special.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from scipy.special import iv from torch import tensor from torch.autograd import grad from pyro.ops.special import get_quad_rule, log_beta, log_binomial, log_I1, safe_log from tests.common import assert_equa...
104
2,760
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_sam2.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging from fusion_attention_sam2 import FusionMultiHeadAttent...
138
4,844
mlflow
mlflow/genai/judges/tools/types.py
.py
""" Shared types for MLflow GenAI judge tools. This module provides common data structures and types that can be reused across multiple judge tools for consistent data representation. """ from dataclasses import dataclass from typing import Any from mlflow.entities.assessment import FeedbackValueType from mlflow.ent...
83
1,848
mlflow
tests/genai/optimize/test_util.py
.py
from typing import Any, Union import pytest from pydantic import BaseModel from mlflow.entities.assessment import Feedback from mlflow.exceptions import MlflowException from mlflow.genai.judges import CategoricalRating from mlflow.genai.optimize.util import ( create_metric_from_scorers, infer_type_from_value,...
224
6,850
readthedocs.org
readthedocs/projects/urls/private.py
.py
"""Project URLs for authenticated users.""" from django.contrib.auth.decorators import login_required from django.urls import path from django.urls import re_path from django.views.generic.base import RedirectView from readthedocs.core.views import PageNotFoundView from readthedocs.projects.backends.views import Impo...
410
14,082
coremltools
coremltools/converters/sklearn/_LinearSVR.py
.py
# 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 from ..._deps import _HAS_SKLEARN from ...models import MLModel as _MLModel if _HAS_SKLEARN: import...
54
1,405
beam
sdks/python/apache_beam/ml/anomaly/transforms_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...
615
21,296
biopython
Bio/Graphics/Comparative.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. """Plots to compare inform...
182
6,632
beam
sdks/python/apache_beam/yaml/yaml_join.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...
308
10,973
qutip
qutip/tests/core/test_direct_sum.py
.py
import pytest from qutip import ( Qobj, QobjEvo, basis, fock_dm, qzero, qzero_like, sigmax, sigmay, spre, operator_to_vector, vector_to_operator ) from qutip.core.dimensions import Dimensions, SumSpace from qutip.core.direct_sum import ( direct_sum, direct_sum_sparse, direct_component, set_direct_comp...
379
14,783
pymc
tests/model/transform/test_basic.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...
52
1,869
sqlmap
tamper/space2randomblank.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import random from lib.core.compat import xrange from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOW def dependencies(): pass def tamper(payload, **kwargs): ...
68
1,740
biopython
Scripts/xbbtools/xbb_utils.py
.py
#!/usr/bin/env python # Copyright 2000 by Thomas Sicheritz-Ponten. # Copyright 2016 by Markus Piotrowski. # 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. # Created: Thu Jul 13 ...
53
1,849
openvino
tests/layer_tests/onnx_tests/test_concat.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....
291
10,219
beam
sdks/python/apache_beam/runners/portability/fn_api_runner/translations.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,175
84,027
wandb
wandb/automations/_inputs.py
.py
from __future__ import annotations from collections.abc import Collection from typing import Annotated, Any, Final, Protocol, TypedDict from pydantic import Field from typing_extensions import Self, Unpack from wandb._filters import MongoLikeFilter from wandb._pydantic import GQLId, GQLInput, computed_field, model_v...
276
9,878
probability
tensorflow_probability/python/bijectors/permute.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...
189
6,656
pyomo
pyomo/solvers/tests/models/MILP_unused_vars.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...
209
7,232
wagtail
wagtail/admin/viewsets/base.py
.py
from django.core.exceptions import ImproperlyConfigured from django.urls import reverse from django.utils.functional import cached_property from wagtail.admin.menu import WagtailMenuRegisterable, WagtailMenuRegisterableGroup class ViewSet(WagtailMenuRegisterable): """ Defines a viewset to be registered with ...
153
5,482
saleor
saleor/tests/e2e/orders/discounts/test_order_voucher_free_shipping.py
.py
import pytest from .....product.tasks import recalculate_discounted_price_for_products_task from ... import DEFAULT_ADDRESS from ...product.utils.preparing_product import prepare_product from ...shop.utils.preparing_shop import prepare_shop from ...taxes.utils import update_country_tax_rates from ...utils import assig...
231
8,128
astropy
astropy/coordinates/tests/test_representation_methods.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy import units as u from astropy.coordinates import ( Latitude, Longitude, SphericalDifferential, SphericalRepresentation, UnitSphericalRepresentation, ) from .test_representation import r...
455
18,765
saleor
saleor/order/tests/test_base_order_line_total.py
.py
from prices import TaxedMoney from .. import base_calculations from ..interface import OrderTaxedPricesData def test_base_order_line_total(order_with_lines): # given line = order_with_lines.lines.all().first() # when order_total = base_calculations.base_order_line_total(line) # then base_li...
29
896
textual
src/textual/drivers/_writer_thread.py
.py
from __future__ import annotations import threading from queue import Queue from typing import IO from typing_extensions import Final MAX_QUEUED_WRITES: Final[int] = 30 class WriterThread(threading.Thread): """A thread / file-like to do writes to stdout in the background.""" def __init__(self, file: IO[st...
69
1,733
wandb
wandb/sdk/launch/agent/run_queue_item_file_saver.py
.py
"""Implementation of the run queue item file saver class.""" from __future__ import annotations import os from typing import Literal import wandb FileSubtypes = Literal["warning", "error"] class RunQueueItemFileSaver: def __init__( self, agent_run: wandb.Run | None, run_queue_item_id: ...
42
1,320
readthedocs.org
readthedocs/api/v3/tests/test_environmentvariables.py
.py
import django_dynamic_fixture as fixture from django.urls import reverse from django_dynamic_fixture import get from readthedocs.projects.models import EnvironmentVariable from readthedocs.projects.validators import MAX_SIZE_ENV_VARS_PER_PROJECT from .mixins import APIEndpointMixin class EnvironmentVariablessEndpoi...
260
9,113
onnx
onnx/backend/test/case/node/leakyrelu.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 LeakyRelu(Base): @staticmethod def export() -> None: n...
40
1,276
ipython
IPython/terminal/shortcuts/filters.py
.py
""" Filters restricting scope of IPython Terminal shortcuts. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import ast import re import signal import sys from collections.abc import Callable from prompt_toolkit.application.current import get_app from prompt_t...
323
11,053
wagtail
wagtail/users/views/bulk_actions/__init__.py
.py
from .assign_role import AssignRoleBulkAction from .delete import DeleteBulkAction from .set_active_state import SetActiveStateBulkAction __all__ = ["AssignRoleBulkAction", "DeleteBulkAction", "SetActiveStateBulkAction"]
6
222
httpie
docs/contributors/generate.py
.py
""" Generate snippets to copy-paste. """ import sys from jinja2 import Template from fetch import HERE, load_awesome_people TPL_FILE = HERE / 'snippet.jinja2' HTTPIE_TEAM = { 'claudiatd', 'jakubroztocil', 'jkbr', 'isidentical' } BOT_ACCOUNTS = { 'dependabot-sr' } IGNORE_ACCOUNTS = HTTPIE_TEAM ...
54
1,110
wagtail
wagtail/contrib/forms/wagtail_hooks.py
.py
from django.urls import include, path, reverse from django.utils.translation import gettext_lazy as _ from wagtail import hooks from wagtail.admin.menu import MenuItem from wagtail.contrib.forms import urls from wagtail.contrib.forms.utils import get_forms_for_user @hooks.register("register_admin_urls") def register...
32
876
onnx
onnx/backend/test/case/node/blackmanwindow.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 BlackmanWindow(Base): @staticmethod def export() -> None: ...
57
1,539
mlflow
examples/llama_index/workflow/workflow/prompts.py
.py
# Prompt to transform user query to the web search query format TRANSFORM_QUERY_TEMPLATE = """\ Your task is to refine a query to ensure it is highly effective for retrieving relevant search results. Analyze the given input to grasp the core semantic intent or meaning. Original Query: ------------------- {query} Your...
27
921
probability
tensorflow_probability/python/math/psd_kernels/rational_quadratic_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...
187
7,235
saleor
saleor/graphql/webhook/dataloaders/models.py
.py
from collections import defaultdict from ....core.models import EventPayload from ....webhook.event_types import WebhookEventAsyncType from ....webhook.models import Webhook, WebhookEvent from ....webhook.utils import ( calculate_webhooks_for_multiple_events, ) from ...app.dataloaders import ActiveAppByIdLoader fr...
145
5,257
onnx
tests/python/version_converter/automatic_conversion_test_base.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import string from typing import TYPE_CHECKING, Any, cast import pytest import onnx from onnx import TensorProto, ValueInfoProto, helper, shape_inference, version_converter if TYPE_CHECKING: from ...
161
7,115
luigi
examples/elasticsearch_index.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...
116
3,370
pdm
tests/cli/test_python.py
.py
import platform import sys from pathlib import Path import pytest from pbs_installer import PythonVersion from pdm.models.python import PythonInfo from pdm.utils import parse_version @pytest.fixture def mock_install(mocker): if (arch := platform.machine().lower()) not in ("arm64", "aarch64", "amd64", "x86_64"):...
219
8,820
hydra
tests/test_apps/app_with_no_chdir_override/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra @hydra.main(config_path=".") def my_app(_: DictConfig) -> None: pass if __name__ == "__main__": my_app()
14
235
textual
docs/examples/how-to/containers05.py
.py
from textual.app import App, ComposeResult from textual.containers import HorizontalGroup from textual.widgets import Placeholder class Box(Placeholder): """Example widget.""" DEFAULT_CSS = """ Box { width: 16; height: 8; } """ class ContainerApp(App): """Simple app ...
40
784
mlflow
tests/tracing/conftest.py
.py
import random import subprocess import tempfile import time from unittest import mock import pytest import mlflow from mlflow.environment_variables import ( MLFLOW_ENABLE_ASYNC_LOGGING, MLFLOW_ENABLE_ASYNC_TRACE_LOGGING, ) from mlflow.tracing.fluent import _flush_pending_async_trace_writes @pytest.fixture(a...
123
3,529
tqdm
tqdm/_tqdm.py
.py
from warnings import warn from .std import * # NOQA from .std import __all__ # NOQA from .std import TqdmDeprecationWarning warn("This function will be removed in tqdm==5.0.0\n" "Please use `tqdm.std.*` instead of `tqdm._tqdm.*`", TqdmDeprecationWarning, stacklevel=2)
10
283
conda
conda/common/_os/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from logging import getLogger from ..compat import on_win if on_win: from .windows import get_free_space_on_windows as get_free_space from .windows import is_admin_on_windows as is_admin else: from .unix import get_free_space_on_un...
16
436