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_tests/test_tf_SplitV.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestSplitV(CommonTFLayerTest):
def create_splitv_net(self, value_shape, size_splits_values, axis_value):
tf.comp... | 43 | 1,922 |
wagtail | wagtail/admin/tests/pages/test_page_search.py | .py | from io import StringIO
from django.contrib.auth.models import Group, Permission
from django.core import management
from django.test import TransactionTestCase, tag
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.http import urlencode
from wagtail.admin.staticfiles im... | 443 | 17,468 |
mlflow | tests/gemini/test_gemini_autolog.py | .py | # Tests for the new Gemini Python SDK:
# https://github.com/googleapis/python-genai
import asyncio
import base64
import importlib.metadata
import re
from unittest.mock import patch
import pytest
from google import genai
from packaging.version import Version
import mlflow
from mlflow.entities import SpanLogLevel
from... | 747 | 24,934 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_matrix_nms.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# matrix_nms paddle model generator
#
import os
import numpy as np
import copy # deepcopy
import sys
from nms import NMS
def main(): # matrix_nms
test_case = [None] * 20
# case matrix_nms_one_batch
test_case[0] = { #... | 408 | 14,715 |
probability | tensorflow_probability/python/experimental/mcmc/nuts_autobatching.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... | 755 | 33,099 |
readthedocs.org | readthedocs/projects/tag_utils.py | .py | """Customizations to Django Taggit."""
import requests
from allauth.socialaccount.models import SocialApp
from django.db.models import Count
from django.utils.text import slugify
from taggit.models import Tag
from taggit.utils import _parse_tags
from .constants import GITHUB_REGEXS
def rtd_parse_tags(tag_string):
... | 86 | 2,417 |
sphinx | doc/usage/extensions/example_numpy.py | .py | """Example NumPy style docstrings.
This module demonstrates documentation as specified by the `NumPy
Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections
are created with a section header followed by an underline of equal length.
Example
-------
Examples can be given using either the ``Example``... | 352 | 9,737 |
pyomo | pyomo/contrib/pynumero/linalg/ma27.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... | 166 | 6,206 |
django-cms | cms/admin/placeholderadmin.py | .py | import json
import uuid
import warnings
from urllib.parse import parse_qsl, urlparse
from django.contrib import admin
from django.contrib.admin.helpers import AdminForm
from django.contrib.admin.utils import flatten_fieldsets, get_deleted_objects
from django.core.exceptions import PermissionDenied
from django.db impor... | 1,328 | 55,981 |
wandb | tests/unit_tests/test_step_upload.py | .py | from __future__ import annotations
import concurrent.futures
import queue
import random
import threading
import time
from collections.abc import Callable, Iterable, MutableSequence
from pathlib import Path
from typing import Any
from unittest.mock import DEFAULT, Mock
import pytest
from wandb.filesync import stats
fr... | 664 | 20,962 |
mlflow | mlflow/langchain/runnables.py | .py | from __future__ import annotations
import os
import re
import warnings
from pathlib import Path
from typing import TYPE_CHECKING
import cloudpickle
import yaml
from mlflow.exceptions import MlflowException
from mlflow.langchain.utils.logging import (
_BASE_LOAD_KEY,
_CONFIG_LOAD_KEY,
_MODEL_DATA_FOLDER_N... | 544 | 20,194 |
biopython | Tests/test_PDB_PDBParser.py | .py | # Copyright 2009-2011 by Eric Talevich. All rights reserved.
# Revisions copyright 2009-2013 by Peter Cock. All rights reserved.
# Revisions copyright 2013 Lenna X. Peterson. All rights reserved.
# Revisions copyright 2020 Joao Rodrigues. All rights reserved.
#
# Converted by Eric Talevich from an older unit test cop... | 651 | 29,499 |
pyomo | pyomo/contrib/appsi/solvers/tests/test_highs_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... | 192 | 6,763 |
beam | sdks/python/apache_beam/testing/benchmarks/cloudml/cloudml_benchmark_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... | 127 | 4,697 |
conda | conda/cli/install.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Conda package installation logic.
Core logic for `conda [create|install|update|remove]` commands.
See conda.cli.main_create, conda.cli.main_install, conda.cli.main_update, and
conda.cli.main_remove for the entry points into this module.
"""... | 613 | 22,519 |
pyomo | pyomo/solvers/tests/piecewise_linear/problems/concave_var.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... | 92 | 3,218 |
sqlmap | thirdparty/chardet/mbcssm.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... | 573 | 25,481 |
hydra | hydra/test_utils/example_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from omegaconf import DictConfig, OmegaConf
import hydra
@hydra.main(config_path="configs", config_name="db_conf")
def run_cli(cfg: DictConfig) -> None:
print(OmegaConf.to_yaml(cfg))
if __name__ == "__main__":
run_cli()
| 14 | 304 |
wandb | tests/unit_tests/test_data_types.py | .py | import io
import os
import platform
from pathlib import Path
from unittest import mock
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytest
import rdkit.Chem
import responses
import torch
import wandb
from bokeh.plotting import figure
from PIL import Image
from wandb import data_types, ... | 1,768 | 51,977 |
openvino | tools/ovc/openvino/tools/ovc/convert.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pathlib
from typing import Any
from openvino import Model # pylint: disable=no-name-in-module,import-error
from openvino.tools.ovc.cli_parser import get_all_cli_parser
from openvino.tools.ovc.convert_impl import _convert
from op... | 118 | 5,411 |
sqlmap | tamper/0eunion.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.HIGHEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces an integer follo... | 33 | 721 |
wagtail | wagtail/blocks/struct_block.py | .py | import collections
from typing import Union
from django import forms
from django.core import checks
from django.core.exceptions import ValidationError
from django.forms.utils import ErrorList
from django.template.loader import render_to_string
from django.utils.functional import cached_property
from django.utils.html ... | 643 | 24,316 |
textual | tests/input/test_input_properties.py | .py | from __future__ import annotations
from rich.highlighter import JSONHighlighter
from rich.text import Text
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.widgets import Input
from textual.widgets.input import Selection
class InputApp(App[None]):
TEST_TEXT = "Let... | 109 | 3,703 |
astropy | astropy/io/ascii/tests/test_read.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import locale
import pathlib
import platform
import re
from io import BytesIO, StringIO
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import table
from astropy.io import ascii
from astropy.io.ascii import core
fr... | 2,220 | 70,841 |
pdm | src/pdm/models/venv.py | .py | from __future__ import annotations
import dataclasses as dc
import sys
from functools import cached_property
from pathlib import Path
from pdm.models.in_process import get_sys_config_paths
from pdm.utils import find_python_in_path, get_venv_like_prefix
IS_WIN = sys.platform == "win32"
BIN_DIR = "Scripts" if IS_WIN e... | 84 | 2,642 |
clearml | clearml/backend_config/environment.py | .py | from os import getenv, environ
from typing import Callable, Union, Dict, Any
from .converters import text_to_bool
from .entry import Entry, NotSet
class EnvEntry(Entry):
@classmethod
def default_conversions(cls) -> Dict[Any, Callable[[str], Any]]:
conversions = super(EnvEntry, cls).default_conversion... | 39 | 1,224 |
coremltools | coremltools/converters/mil/mil/tests/test_block.py | .py | # Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import copy
import numpy as np
import pytest
from coremltools.converters.mil.mil import Builder as ... | 556 | 17,705 |
clearml | examples/frameworks/tensorflow/tensorboard_pr_curve.py | .py | # Copyright 2017 The TensorFlow 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
#
# Unless required by applica... | 282 | 9,925 |
mlflow | tests/store/analytics/test_trace_correlation.py | .py | import math
import pytest
from mlflow.store.analytics.trace_correlation import (
calculate_npmi_from_counts,
calculate_smoothed_npmi,
)
@pytest.mark.parametrize(
(
"joint_count",
"filter1_count",
"filter2_count",
"total_count",
"expected_npmi",
"expected_s... | 149 | 4,596 |
lemur | lemur/tests/vectors.py | .py | from lemur.common.utils import parse_certificate
VALID_USER_HEADER_TOKEN = {
"Authorization": "Basic "
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MjE2NTIwMjIsImV4cCI6MjM4NTY1MjAyMiwic3ViIjoiMSJ9.UQBQzJHyUJNgTVKQRHsBw3tz-plqRWAXiaSIYnOfY9g",
"Content-Type": "application/json",
}
VALID_ADMIN_HEADE... | 716 | 39,137 |
pyomo | examples/kernel/mosek/semidefinite.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... | 128 | 3,789 |
mlflow | mlflow/store/artifact/gcs_artifact_repo.py | .py | import datetime
import os
import posixpath
import urllib.parse
from typing import Any, NamedTuple
from packaging.version import Version
from mlflow.entities import FileInfo
from mlflow.entities.multipart_upload import (
CreateMultipartUploadResponse,
MultipartUploadCredential,
)
from mlflow.environment_variab... | 308 | 12,372 |
beam | learning/katas/python/Core Transforms/FlattenWith/FlattenWith/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... | 48 | 1,690 |
pyro | pyro/contrib/tracking/distributions.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
from torch.distributions import constraints
import pyro.distributions as dist
from pyro.contrib.tracking.extended_kalman_filter import EKFState
from pyro.contrib.tracking.measurements import PositionMeasurement
from p... | 103 | 3,577 |
sqlmap | plugins/dbms/virtuoso/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 | 978 |
astropy | astropy/coordinates/tests/test_representation.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import deepcopy
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy import units as u
from astropy.coordinates import Angle, Latitude, Longitude
from astropy.coordinates.distances import ... | 2,333 | 87,527 |
coremltools | coremltools/test/optimize/torch/quantization/test_post_training_quantization.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
import numpy as np
import pytest
import torch
ct = pytest.importorskip("coremltools")
pytest.import... | 384 | 11,769 |
hydra | tests/instantiate/positional_only.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Any
class PosOnlyArgsClass:
def __init__(self, a: Any, b: Any, /, **kwargs: Any) -> None:
assert isinstance(kwargs, dict)
self.a = a
self.b = b
self.kwargs = kwargs
def __repr__(self) -> ... | 22 | 638 |
clearml | clearml/errors.py | .py | from typing import List, Any
class UsageError(RuntimeError):
"""An exception raised for illegal usage of clearml objects"""
pass
class ArtifactUriDeleteError(ValueError):
def __init__(self, artifact: str, uri: str, remaining_uris: List[str]) -> None:
super(ArtifactUriDeleteError, self).__init__... | 21 | 656 |
saleor | saleor/core/telemetry/trace.py | .py | import logging
from collections.abc import Iterator, Mapping, Sequence
from contextlib import contextmanager
from opentelemetry import context as otel_context
from opentelemetry.propagate import extract, inject
from opentelemetry.trace import (
INVALID_SPAN,
INVALID_SPAN_CONTEXT,
Link,
Span,
SpanKi... | 261 | 8,892 |
astropy | astropy/visualization/wcsaxes/utils.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy import units as u
from astropy.coordinates import BaseCoordinateFrame, UnitSphericalRepresentation
__all__ = [
"select_step_degree",
"select_step_hour",
"select_step_scalar",
"transform_contour_set_inplace"... | 168 | 5,762 |
mlflow | mlflow/store/tracking/file_store.py | .py | from __future__ import annotations
import hashlib
import json
import logging
import os
import shutil
import sys
import time
import uuid
from collections import defaultdict
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, NamedTuple, TypedDict
from mlflow.entities import (
Assessment,
D... | 2,917 | 121,333 |
astropy | astropy/coordinates/transformations/graph.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""The class that implements the framework for defining graphs of transformations.
The fundamental idea is that each class is a node in the transformation graph,
and transitions from one node to another are defined as functions (or methods)
wrapped in tr... | 755 | 27,815 |
kafka | release/preferences.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... | 92 | 2,256 |
saleor | saleor/tests/e2e/promotions/utils/promotion_rule_create.py | .py | from ...utils import get_graphql_content
PROMOTION_RULE_CREATE_MUTATION = """
mutation promotionRuleCreate($input: PromotionRuleCreateInput!) {
promotionRuleCreate(input: $input) {
errors {
field
message
code
}
promotionRule {
id
name
description
rewardValueType
... | 44 | 884 |
hatch | tests/backend/version/source/test_env.py | .py | import pytest
from hatch.utils.structures import EnvVars
from hatchling.version.source.env import EnvSource
def test_no_variable(isolation):
source = EnvSource(str(isolation), {})
with pytest.raises(ValueError, match="option `variable` must be specified"):
source.get_version_data()
def test_variab... | 36 | 1,042 |
probability | tensorflow_probability/python/bijectors/blockwise.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... | 295 | 11,162 |
pyomo | examples/doc/samples/update.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... | 96 | 3,606 |
confluent-kafka-python | tests/avro/mock_registry.py | .py | #!/usr/bin/env python
#
# Copyright 2016 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 197 | 6,635 |
coremltools | coremltools/models/nearest_neighbors/builder.py | .py | # Copyright (c) 2019, 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
import coremltools
from coremltools import proto
from .. import datatypes
class ... | 665 | 21,165 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_StringLower.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import os
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
from common.utils.common_utils import generate_ir_ovc
from common.utils.tf_utils import run_in_jenkins
rng = np.... | 91 | 4,261 |
textual | src/textual/_box_drawing.py | .py | """
Box drawing utilities for Canvas.
The box drawing characters have zero to four lines radiating from the center of the glyph.
There are three line types: thin, heavy, and double. These are indicated by 1, 2, and 3 respectively (0 for no line).
This code represents the characters as a tuple of 4 integers, (<top>, <... | 367 | 8,159 |
saleor | saleor/core/models.py | .py | import datetime
from collections.abc import Iterable
from typing import Any, TypeVar
from django.contrib.postgres.indexes import GinIndex, PostgresIndex
from django.core.files.base import ContentFile
from django.db import models, transaction
from django.db.models import F, JSONField, Max, Q
from django.utils.crypto im... | 248 | 8,080 |
onnxruntime | onnxruntime/python/tools/quantization/cuda_quantizer.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""CUDA w... | 644 | 26,855 |
textual | tests/snapshot_tests/snapshot_apps/digits.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Digits
class DigitApp(App):
CSS = """
.left {
text-align: left;
}
.center {
text-align:center;
}
.right {
text-align:right;
}
.bold {
text-style: bold;
}
"""
def compose(... | 35 | 792 |
textual | docs/examples/styles/align.py | .py | from textual.app import App
from textual.widgets import Label
class AlignApp(App):
CSS_PATH = "align.tcss"
def compose(self):
yield Label("Vertical alignment with [b]Textual[/]", classes="box")
yield Label("Take note, browsers.", classes="box")
if __name__ == "__main__":
app = AlignApp(... | 16 | 336 |
wandb | tests/system_tests/test_functional/dspy/dspy_callback_no_program.py | .py | import dspy
import wandb
from dspy.evaluate.evaluate import EvaluationResult # type: ignore
class MinimalProgram(dspy.Module):
def __init__(self) -> None:
super().__init__()
self.predict = dspy.Predict("question: str -> answer: str")
def main() -> None:
from wandb.integration.dspy import Wa... | 36 | 1,137 |
sqlmap | plugins/dbms/sybase/enumeration.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.common import filterPairValues
from lib.core.common import isListLike
from lib.core.common import isTechniqueAvailable
from lib.core.common import readInp... | 328 | 11,919 |
mlflow | tests/tracking/request_header/test_registry.py | .py | from importlib import reload
from unittest import mock
import pytest
import mlflow.tracking.request_header.registry
from mlflow.tracking.request_header.databricks_request_header_provider import (
DatabricksRequestHeaderProvider,
)
from mlflow.tracking.request_header.registry import (
RequestHeaderProviderRegi... | 164 | 5,720 |
metrics | tests/unittests/nominal/test_tschuprows.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... | 128 | 4,710 |
pyomo | examples/pyomobook/python-ch/LineExample.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... | 23 | 869 |
mlflow | tests/genai/evaluate/test_utils.py | .py | import json
import sys
from typing import Any, Literal
from unittest.mock import MagicMock, Mock, patch
import pandas as pd
import pytest
import mlflow
from mlflow.entities.assessment_source import AssessmentSource
from mlflow.entities.span import SpanType
from mlflow.entities.trace import Trace
from mlflow.exception... | 637 | 21,914 |
saleor | saleor/app/types.py | .py | class AppType:
LOCAL = "local"
THIRDPARTY = "thirdparty"
CHOICES = [(LOCAL, "local"), (THIRDPARTY, "thirdparty")]
# Deprecated. Remove this enum in 3.24, when this field is dropped from AppExtension model
class DeprecatedAppExtensionHttpMethod:
"""HTTP methods available for app extensions.
Repre... | 26 | 758 |
saleor | saleor/core/management/commands/populatedb.py | .py | from io import StringIO
from django.apps import apps
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import connection
from ....account.tests.fixtures.user import dangerously_get_or_create_superuser
from ...utils.random_data import (
add_address_t... | 148 | 5,291 |
pyomo | pyomo/common/tests/dep_mod.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 | 847 |
wandb | wandb/sdk/internal/sender.py | .py | """sender."""
from __future__ import annotations
import contextlib
import glob
import gzip
import json
import logging
import os
import queue
import threading
import time
import traceback
from collections import defaultdict
from collections.abc import Generator
from datetime import datetime
from queue import Queue
fro... | 1,646 | 63,604 |
clearml | clearml/backend_interface/__init__.py | .py | """ High-level abstractions for backend API """
from .task import Task
__all__ = ["Task"]
| 5 | 91 |
openvino | tests/samples_tests/smoke_tests/test_throughput_benchmark.py | .py | """
Copyright (C) 2018-2026 Intel 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 applicable law or agreed to in w... | 32 | 1,321 |
probability | tensorflow_probability/python/experimental/distributions/multitask_gaussian_process.py | .py | # Copyright 2021 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... | 621 | 28,130 |
readthedocs.org | readthedocs/config/notifications.py | .py | """Notifications related to Read the Docs YAML config file."""
import textwrap
from django.utils.translation import gettext_noop as _
from readthedocs.notifications.constants import ERROR
from readthedocs.notifications.messages import Message
from readthedocs.notifications.messages import registry
from .exceptions ... | 511 | 16,431 |
textual | src/textual/document/_document.py | .py | from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from functools import lru_cache
from typing import TYPE_CHECKING, NamedTuple, Tuple, overload
from typing_extensions import Literal, get_args
if TYPE_CHECKING:
from tree_sitter import Node, Query
from textua... | 474 | 15,067 |
textual | tests/test_xterm_parser.py | .py | import itertools
import pytest
from textual._xterm_parser import XTermParser
from textual.events import (
Key,
MouseDown,
MouseMove,
MouseScrollDown,
MouseScrollLeft,
MouseScrollRight,
MouseScrollUp,
MouseUp,
Paste,
)
from textual.messages import TerminalSupportsSynchronizedOutput
... | 416 | 12,036 |
metrics | src/torchmetrics/text/bleu.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... | 159 | 5,884 |
openvino | tests/layer_tests/common/onnx_layer_test_class.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
from common.layer_test_class import CommonLayerTest
from common.layer_utils import BaseInfer
def save_to_onnx(onnx_model, path_to_saved_onnx_model):
import onnx
path = os.path.join(path_to_saved_onnx_model, 'model.on... | 55 | 1,902 |
biopython | Bio/PDB/vectors.py | .py | # Copyright (C) 2004, Thomas Hamelryck (thamelry@binf.ku.dk)
#
# 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.
"""Vector class, inc... | 730 | 20,140 |
pyomo | examples/doc/samples/scripts/s2/knapsack.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,410 |
onnxruntime | tools/python/ort_test_dir_utils.py | .py | import glob
import os
import shutil
import numpy as np
import onnx
import onnx_test_data_utils
from onnx import TensorProto, numpy_helper
import onnxruntime as ort
def _get_numpy_type(model_info, name) -> np.dtype:
for i in model_info:
if i.name == name:
type_name = i.type.WhichOneof("value"... | 267 | 10,896 |
django-cms | menus/base.py | .py | from typing import Any, Optional
from django.utils.encoding import smart_str
class Menu:
"""The base class for all menu-generating classes."""
namespace = None
def __init__(self, renderer):
"""
Initialize the Menu class.
Args:
renderer: The renderer associated with t... | 184 | 5,650 |
beam | sdks/python/apache_beam/examples/inference/pytorch_image_captioning.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... | 642 | 20,880 |
pyomo | examples/pyomobook/intro-ch/concrete1.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... | 18 | 898 |
cvxpy | cvxpy/reductions/solvers/conic_solvers/knitro_conif.py | .py | """
Copyright 2025 CVXPY 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 law or agreed to in writing, softwa... | 656 | 23,083 |
mlflow | tests/genai/evaluate/test_to_predict_fn.py | .py | import importlib.metadata
from unittest import mock
import pytest
import mlflow
from mlflow.entities.trace_info import TraceInfo
from mlflow.environment_variables import MLFLOW_ENABLE_ASYNC_TRACE_LOGGING
from mlflow.exceptions import MlflowException
from mlflow.genai.evaluation.base import to_predict_fn
from mlflow.g... | 602 | 22,727 |
mlflow | tests/tracing/processor/test_otel_metrics.py | .py | import time
import pytest
from opentelemetry import metrics
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import InMemoryMetricReader
import mlflow
@pytest.fixture
def metric_reader() -> InMemoryMetricReader:
"""Create an in-memory metric reader for testing."""
re... | 108 | 3,690 |
probability | tensorflow_probability/__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... | 27 | 1,222 |
biopython | Doc/examples/swissprot.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.
#
"""Example of connecting with exPASy and parsing SwissProt records."""
# biopython
from Bio import ExPASy
from Bio import SwissProt
# 'O23729', 'O... | 27 | 743 |
saleor | saleor/graphql/translations/mutations/product_variant_translate.py | .py | import graphene
from ....core.tracing import traced_atomic_transaction
from ....permission.enums import SitePermissions
from ....product import models as product_models
from ...core import ResolveInfo
from ...core.context import ChannelContext
from ...core.enums import LanguageCodeEnum
from ...core.types import Transl... | 59 | 2,370 |
openvino | tests/e2e_tests/common/decorators.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from collections import OrderedDict
def wrap_ord_dict(func):
"""Wrap values in OrderedDict."""
def wrapped(*args, **kwargs):
items = func(*args, **kwargs)
if isinstance(items, tuple):
return Ordered... | 25 | 759 |
pyomo | pyomo/contrib/doe/tests/test_utils.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 183 | 7,405 |
onnx | onnx/backend/test/case/node/softplus.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 Softplus(Base):
@staticmethod
def export() -> None:
no... | 31 | 835 |
mlflow | mlflow/genai/scorers/online/__init__.py | .py | """Online scoring subpackage for scheduled scorer execution."""
from mlflow.genai.scorers.online.entities import (
CompletedSession,
OnlineScorer,
OnlineScoringConfig,
)
from mlflow.genai.scorers.online.sampler import OnlineScorerSampler
from mlflow.genai.scorers.online.session_checkpointer import OnlineSe... | 26 | 958 |
hatch | tests/helpers/templates/wheel/standard_editable_pth_force_include.py | .py | from hatch.template import File
from hatch.utils.fs import Path
from hatchling.__about__ import __version__
from hatchling.metadata.spec import DEFAULT_METADATA_VERSION
from ..new.default import get_files as get_template_files
from .utils import update_record_file_contents
def get_files(**kwargs):
metadata_direc... | 50 | 1,517 |
textual | docs/examples/guide/testing/rgb.py | .py | from textual import on
from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Button, Footer
class RGBApp(App):
CSS = """
Screen {
align: center middle;
}
Horizontal {
width: auto;
height: auto;
}
"""
BINDIN... | 43 | 1,049 |
gunicorn | tests/requests/invalid/rfc9112_target_relative_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 3.2: request-target must be one of origin-form,
# absolute-form, authority-form, or asterisk-form. A relative reference
# like "foo/bar" matches none of these and must be rejected.
from gunicorn.... | 10 | 387 |
mlflow | tests/store/tracking/conftest.py | .py | import shutil
from pathlib import Path
import pytest
import sqlalchemy
from mlflow.environment_variables import MLFLOW_TRACKING_URI
from mlflow.store.db.db_types import MSSQL, MYSQL, POSTGRES, SQLITE
from mlflow.store.tracking.dbmodels.models import (
SqlDataset,
SqlEntityAssociation,
SqlEvaluationDataset... | 109 | 3,238 |
sphinx | tests/roots/test-ext-autodoc/target/partialfunction.py | .py | from functools import partial
def func1(a, b, c):
"""docstring of func1"""
pass
func2 = partial(func1, 1)
func3 = partial(func2, 2)
func3.__doc__ = 'docstring of func3'
func4 = partial(func3, 3)
| 13 | 207 |
textual | docs/examples/widgets/input.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Input
class InputApp(App):
def compose(self) -> ComposeResult:
yield Input(placeholder="First Name")
yield Input(placeholder="Last Name")
if __name__ == "__main__":
app = InputApp()
app.run()
| 14 | 295 |
django-cms | cms/test_utils/project/placeholder_relation_field_app/models.py | .py | from django.db import models
from django.urls import reverse
from cms.models.fields import PlaceholderRelationField
class FancyPoll(models.Model):
name = models.CharField(max_length=255)
template = models.CharField(max_length=255, default='fancy_poll_app/detail.html')
placeholders = PlaceholderRelationFi... | 20 | 531 |
textual | tests/input/test_input_messages.py | .py | from __future__ import annotations
from textual import on
from textual.app import App, ComposeResult
from textual.events import Paste
from textual.widgets import Input
class InputApp(App[None]):
def __init__(self, initial: str | None = None) -> None:
super().__init__()
self.messages: list[str] = ... | 76 | 2,706 |
python-dotenv | src/dotenv/__init__.py | .py | from typing import Any, Optional
from .main import dotenv_values, find_dotenv, get_key, load_dotenv, set_key, unset_key
def load_ipython_extension(ipython: Any) -> None:
from .ipython import load_ipython_extension
load_ipython_extension(ipython)
def get_cli_string(
path: Optional[str] = None,
acti... | 52 | 1,230 |
gunicorn | gunicorn/dirty/client.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
Dirty Client
Client for HTTP workers to communicate with the dirty worker pool.
Provides both sync and async APIs.
"""
import asyncio
import contextvars
import os
import socket
import threading
import time
im... | 755 | 24,300 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.