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
mlflow
tests/tracing/test_log_level.py
.py
import logging import pytest import mlflow from mlflow.entities import SpanLogLevel from mlflow.entities.span import Span, SpanType from mlflow.entities.span_event import SpanEvent from mlflow.exceptions import MlflowException from mlflow.tracing.constant import SpanAttributeKey from mlflow.tracing.utils.default_log_...
268
9,486
confluent-kafka-python
examples/protobuf_consumer.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...
85
3,040
astropy
astropy/io/fits/scripts/fitsdiff.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import argparse import glob import logging import os import sys from astropy import __version__ from astropy.io import fits from astropy.io.fits.util import fill log = logging.getLogger("fitsdiff") DESCRIPTION = """ Compare two FITS image files and rep...
439
14,061
mlflow
mlflow/tracing/otel/otel_archival.py
.py
""" Helpers for serializing archived trace spans as OTLP ``TracesData`` protobuf. """ from __future__ import annotations from typing import Any from google.protobuf.message import DecodeError from opentelemetry.proto.trace.v1.trace_pb2 import TracesData from mlflow.entities.span import Span from mlflow.exceptions i...
133
5,008
rich-cli
src/rich_cli/markdown.py
.py
from typing import Any from rich.console import Console, ConsoleOptions, RenderResult from rich.markdown import Markdown, TextElement from rich.padding import Padding from rich.syntax import Syntax class CodeBlock(TextElement): """A code block with syntax highlighting.""" style_name = "markdown.code_block" ...
33
993
beam
sdks/python/apache_beam/testing/benchmarks/cloudml/criteo_tft/criteo_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...
94
3,023
confluent-kafka-python
examples/fips/fips_consumer.py
.py
#!/usr/bin/env python # # Copyright 2023 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...
88
2,787
conda
tests/core/test_initialize.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import ntpath import os import sys from collections import namedtuple from contextlib import nullcontext from os.path import abspath, dirname, isfile, join, realpath, samefile from sysconfig import get_path fr...
1,553
53,470
django-cms
cms/menu_bases.py
.py
from django.core.exceptions import ValidationError from django.db.models import Q from cms.apphook_pool import apphook_pool from cms.models import Page from menus.base import Menu class CMSAttachMenu(Menu): """Base class that can be subclassed to allow your app to attach its own menus.""" cms_enabled = True ...
52
1,627
wagtail
wagtail/utils/file.py
.py
import hashlib from io import UnsupportedOperation HASH_READ_SIZE = 2**18 # 256k - matches `hashlib.file_digest` def hash_filelike(filelike): """ Compute the hash of a file-like object, without loading it all into memory. """ file_pos = 0 if hasattr(filelike, "tell"): file_pos = filelike...
36
1,019
beam
sdks/python/apache_beam/runners/interactive/display/display_manager.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...
187
6,938
gunicorn
gunicorn/config.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # Please remember to run "make -C docs html" after update "desc" attributes. import argparse import copy import grp import inspect import ipaddress import os import pwd import re import shlex import ssl import sys...
3,206
95,227
pyro
examples/cvae/util.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch from baseline import MaskedBCELoss from mnist import get_data from torch.utils.data import DataLoader from torchvision.utils ...
158
4,845
mlflow
dev/clint/src/clint/linter.py
.py
import ast import fnmatch import json import re import textwrap import tokenize from dataclasses import dataclass from pathlib import Path from typing import Any, Iterable, Iterator, TypeAlias from typing_extensions import Self from clint import rules from clint.comments import Noqa, iter_comments from clint.config i...
1,085
41,242
tablib
src/tablib/formats/_tsv.py
.py
""" Tablib - TSV (Tab Separated Values) Support. """ from ._csv import CSVFormat class TSVFormat(CSVFormat): title = 'tsv' extensions = ('tsv',) DEFAULT_DELIMITER = '\t'
12
186
luigi
test/conftest.py
.py
import multiprocessing import sys from typing import List import pytest import luigi.task_register if sys.version_info >= (3, 14): # Set the multiprocessing start method to "fork" for tests to avoid pickling issues. # Before 3.14, the default start method was "fork" on Unix-like systems, but it # changed...
45
1,765
sqlmap
tests/test_error_engine.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission The error-based extraction engine (lib/techniques/error/use.py _oneShotErrorUse). Error-based SQLi coaxes the DBMS into emitting the target value inside an error message, wrapped bet...
235
11,417
textual
docs/examples/widgets/text_area_custom_theme.py
.py
from rich.style import Style from textual._text_area_theme import TextAreaTheme from textual.app import App, ComposeResult from textual.widgets import TextArea TEXT = """\ # says hello def hello(name): print("hello" + name) # says goodbye def goodbye(name): print("goodbye" + name) """ MY_THEME = TextAreaThe...
43
1,113
pyomo
pyomo/core/base/instance2dat.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...
76
3,029
readthedocs.org
setup.py
.py
from setuptools import setup # Configuration is in setup.cfg setup()
6
71
sphinx
tests/test_builders/test_build_html_tocdepth.py
.py
"""Test the HTML builder and check output against XPath.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from tests.test_builders.xpath_html_util import _intradocument_hyperlink_check from tests.test_builders.xpath_util import check_xpath if TYPE_CHECKING: from collections....
137
5,492
wandb
tests/unit_tests/conftest.py
.py
import dataclasses import json import threading import unittest.mock import urllib.parse from collections.abc import Callable, Generator from datetime import timedelta from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path from queue import Queue import pytest import wandb from hy...
238
7,469
omegaconf
build_helpers/__init__.py
.py
# ruff: noqa: F401, I001 # Order of imports is important (see warning otherwise when running tests) import setuptools import distutils
6
136
onnxruntime
onnxruntime/test/testdata/clip_div_shared_initializer.py
.py
from onnx import TensorProto, checker, helper, save graph_proto = helper.make_graph( [ helper.make_node( "Clip", inputs=["input_0", "initializer_0", "initializer_1"], outputs=["clip_output"], name="clip", ), helper.make_node( "Div"...
34
936
openvino
tests/layer_tests/common/utils/common_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging import numpy as np import os import platform import shutil import subprocess import sys from pathlib import Path logger = logging.getLogger(__name__) def generate_ir(coverage=False, **kwargs): from openvino.tools.ov...
142
5,684
clearml
clearml/debugging/log.py
.py
""" Logging convenience functions and wrappers """ import argparse import inspect import logging import logging.handlers import os import sys from os import getenv from platform import system from typing import Optional, Union, TextIO, Any from pathlib2 import Path from six import BytesIO default_level = logging.INFO...
374
12,539
beam
playground/infrastructure/config.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 ...
124
3,695
pyro
pyro/contrib/tracking/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from pyro.contrib.tracking import assignment __all__ = [ "assignment", ]
9
167
wandb
wandb/sdk/launch/registry/azure_container_registry.py
.py
"""Implementation of AzureContainerRegistry class.""" from __future__ import annotations import re from typing import TYPE_CHECKING from wandb.sdk.launch.environment.azure_environment import AzureEnvironment from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.utils import AZURE_CONTAINER_REGISTRY_U...
127
4,550
pyro
tests/infer/test_compute_downstream_costs.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math from collections import defaultdict import pytest import torch import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.infer.tracegraph_elbo import TrackNonReparam, _compute_downstream_c...
788
29,962
pyomo
pyomo/contrib/gdpopt/oa_algorithm_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...
65
3,177
hatch
tests/cli/env/test_show.py
.py
import json import os import pytest from hatch.env.utils import get_env_var from hatch.project.core import Project from hatch.utils.structures import EnvVars from hatchling.utils.constants import DEFAULT_CONFIG_FILE @pytest.fixture(scope="module", autouse=True) def _terminal_width(): with EnvVars({"COLUMNS": "2...
511
18,892
mlflow
tests/keras/conftest.py
.py
import keras import pytest @pytest.fixture(autouse=True) def clear_keras_session(): # Reset Keras global state before each test so optimizer names aren't uniquified # across tests (a second Adam in the same session becomes "adam_1", which breaks # the optimizer_name assertions in test_autolog.py / test_ca...
14
492
mlflow
mlflow/tracking/context/databricks_command_context.py
.py
from mlflow.tracking.context.abstract_context import RunContextProvider from mlflow.utils import databricks_utils from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_NOTEBOOK_COMMAND_ID class DatabricksCommandRunContext(RunContextProvider): def in_context(self): return databricks_utils.get_job_group_id...
16
561
gunicorn
tests/test_pidfile.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import errno from unittest import mock import gunicorn.pidfile def builtin(name): return 'builtins.{}'.format(name) @mock.patch(builtin('open'), new_callable=mock.mock_open) def test_validate_no_file(_open...
50
1,500
biopython
Bio/NMR/__init__.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. # """Code for working with NMR data. This directory currently contains contributions from: - Bob Bussell <rgb2003@med.cornell.edu> -- NOEtools and xp...
12
332
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/DimensionValueType.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs class DimensionValueType(object): UNKNOWN = 0 VALUE = 1 PARAM = 2
9
166
coremltools
coremltools/proto/NeuralNetwork_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: NeuralNetwork.proto """Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_p...
2,169
163,166
sqlmap
tests/test_hash.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Password-hashing primitives (lib/utils/hash.py) used by the dictionary-attack cracker (-? / --passwords). These are pure functions; correctness here is what makes a cracked password a...
140
5,799
beam
sdks/python/apache_beam/ml/gcp/videointelligenceml_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...
207
7,813
beam
sdks/python/apache_beam/io/iobase.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,935
76,703
textual
docs/examples/guide/dom4.py
.py
from textual.app import App, ComposeResult from textual.containers import Container, Horizontal from textual.widgets import Button, Footer, Header, Static QUESTION = "Do you want to learn about Textual CSS?" class ExampleApp(App): CSS_PATH = "dom4.tcss" def compose(self) -> ComposeResult: yield Head...
28
695
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_shape.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # pool2d paddle model generator # import numpy as np from save_model import saveModel import sys def paddle_shape(name : str, x): import paddle paddle.enable_static() with paddle.static.program_guard(paddle.static.Progra...
42
1,099
astropy
astropy/utils/xml/tests/test_iterparse.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # LOCAL # SYSTEM import io import zlib from astropy.utils.xml.iterparser import _fast_iterparse # The C-based XML parser for VOTables previously used fixed-sized # buffers (allocated at __init__() time). This test will # only pass with the patch that a...
133
4,758
pyomo
pyomo/repn/tests/baron/test_baron_comparison.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...
91
3,190
probability
spinoffs/inference_gym/inference_gym/targets/vector_model.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...
248
8,900
coremltools
coremltools/converters/sklearn/_SVC.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 coremltools import proto from ... import SPECIFICATION_VERSION as _SPECIFICATION_VERSION from ..._...
134
4,012
textual
tests/snapshot_tests/snapshot_apps/auto_grid.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, Input from textual.containers import Container class GridApp(App): CSS = """ Screen { align: center middle; } Container { layout: grid; grid-size: 2; grid-columns: auto 1fr; grid-rows:...
53
1,093
pdm
src/pdm/installers/__init__.py
.py
from pdm.installers.base import BaseSynchronizer from pdm.installers.manager import InstallManager from pdm.installers.synchronizers import Synchronizer from pdm.installers.uv import UvSynchronizer __all__ = ["BaseSynchronizer", "InstallManager", "Synchronizer", "UvSynchronizer"]
7
282
metrics
src/torchmetrics/classification/group_fairness.py
.py
# Copyright The PyTorch 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 i...
327
13,784
openvino
tests/layer_tests/jax_tests/test_reduce.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from jax import numpy as jnp from jax_layer_test_class import JaxLayerTest rng = np.random.default_rng(3456834) class TestReduce(JaxLayerTest): def _prepare_input(self): if np.issubdtype(s...
51
1,877
wandb
wandb/analytics/sentry.py
.py
from __future__ import annotations import atexit import contextlib import functools import os import pathlib import sys import threading from collections.abc import Callable from types import TracebackType from typing import Any, Concatenate, Literal, TypeVar from urllib.parse import quote from typing_extensions impo...
310
9,329
beam
sdks/python/apache_beam/runners/portability/portable_metrics.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...
76
2,638
mlflow
mlflow/openai/__init__.py
.py
""" The ``mlflow.openai`` module provides an API for logging and loading OpenAI models. Credential management for OpenAI on Databricks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. warning:: Specifying secrets for model serving with ``MLFLOW_OPENAI_SECRET_SCOPE`` is deprecated. Use `secrets-based environ...
58
2,010
beam
sdks/python/container/license_scripts/pull_licenses_py.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...
200
6,782
sqlmap
lib/utils/library.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ # Library facade for programmatic (in-code) usage: 'import sqlmap; sqlmap.scan(...)'. # # This is the code-level sibling of the REST API (lib/utils/api.py): both drive the engine ...
191
7,887
gunicorn
tests/requests/valid/010.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "POST", "uri": uri("/post_chunked_all_your_base"), "version": (1, 1), "headers": [ ("TRANSFER-ENCODING", "chunked"), ], "body": b"all your base are belong to us...
14
324
pyro
examples/svi_lightning.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 # Distributed training via Pytorch Lightning. # # This tutorial demonstrates how to distribute SVI training across multiple # machines (or multiple GPUs on one or more machines) using the PyTorch Lightning # library. PyTorch Lightning ...
126
4,919
beam
sdks/python/apache_beam/ml/inference/gemini_inference_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...
111
3,652
textual
docs/examples/how-to/containers08.py
.py
from textual.app import App, ComposeResult from textual.containers import Center, Right from textual.widgets import Placeholder class Box(Placeholder): """Example widget.""" DEFAULT_CSS = """ Box { width: 16; height: 5; } """ class ContainerApp(App): """Simple app to...
37
732
mlflow
mlflow/genai/scorers/aggregation.py
.py
"""Generate the metrics logged into MLflow.""" import collections import logging import numpy as np from mlflow.entities.assessment import Feedback from mlflow.genai.evaluation.entities import EvalResult from mlflow.genai.judges.builtin import CategoricalRating from mlflow.genai.scorers.base import AggregationFunc, ...
116
4,049
ipython
docs/sphinxext/apigen.py
.py
"""Attempt to generate templates for module reference with Sphinx XXX - we exclude extension modules To include extension modules, first identify them as valid in the ``_uri2path`` method, then handle them in the ``_parse_module`` script. We get functions and classes by parsing the text of .py files. Alternatively w...
464
17,168
voila
tests/server/tree_test.py
.py
# test tree rendering import pytest @pytest.fixture def voila_args(notebook_directory, voila_args_extra): return ["--VoilaTest.root_dir=%r" % notebook_directory, *voila_args_extra] @pytest.fixture def jupyter_server_args_extra(): return [ '--VoilaConfiguration.extension_language_mapping={".xcpp": "C...
29
912
onnx
onnx/backend/test/case/node/scatterelements.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from collections.abc import Sequence import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.cas...
267
8,574
mlflow
mlflow/server/jobs/__init__.py
.py
import json import logging import os from dataclasses import dataclass from types import FunctionType from typing import Any, Callable, ParamSpec, TypeVar from mlflow.entities._job import Job as JobEntity from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException fr...
275
9,494
hatch
tests/helpers/templates/sdist/standard_default_vcs_mercurial_exclusion_files.py
.py
from hatch.template import File from hatch.utils.fs import Path from hatchling.metadata.spec import DEFAULT_METADATA_VERSION from ..new.feature_no_src_layout import get_files as get_template_files def get_files(**kwargs): relative_root = kwargs.get("relative_root", "") files = [File(Path(relative_root, f.pa...
40
861
beam
sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_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...
83
2,633
luigi
test/create_packages_archive_root/package/submodule.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...
19
622
mlflow
mlflow/models/flavor_backend_registry.py
.py
""" Registry of supported flavor backends. Contains a mapping of flavors to flavor backends. This mapping is used to select suitable flavor when deploying generic MLflow models. Flavor backend can deploy particular flavor locally to generate predictions, deploy as a local REST api endpoint, or build a docker image for...
54
2,094
openvino
tests/e2e_tests/common/comparator/dummy.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log from e2e_tests.common.table_utils import make_table from .provider import ClassProvider import sys class Dummy(ClassProvider): __action_name__ = "dummy" log.basicConfig( format="[ %(levelname)s ] ...
39
1,388
mlflow
tests/pyfunc/test_rag_model.py
.py
import json from dataclasses import asdict import mlflow from mlflow.models.model import Model from mlflow.models.rag_signatures import ( ChainCompletionChoice, ChatCompletionRequest, ChatCompletionResponse, Message, ) from mlflow.models.signature import ModelSignature from tests.helper_functions impo...
60
2,145
kombu
kombu/asynchronous/aws/__init__.py
.py
from __future__ import annotations from typing import Any from kombu.asynchronous.aws.sqs.connection import AsyncSQSConnection def connect_sqs( aws_access_key_id: str | None = None, aws_secret_access_key: str | None = None, **kwargs: Any ) -> AsyncSQSConnection: """Return async connection to Amazon ...
18
475
pyomo
examples/performance/dae/run_stochpdegas1_automatic.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...
151
3,938
coremltools
coremltools/converters/sklearn/_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 """ Defines the primary func...
162
5,890
onnxruntime
onnxruntime/test/python/quantization/test_quantizer_shape_inference.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
93
3,724
openvino
docs/optimization_guide/nncf/ptq/code/ptq_openvino.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [dataset] import nncf import torch calibration_loader = torch.utils.data.DataLoader(...) def transform_fn(data_item): images, _ = data_item return images.numpy() calibration_dataset = nncf.Dataset(calibration_loader, transf...
34
782
biopython
Bio/AlignIO/MsfIO.py
.py
# Copyright 2019, National Marrow Donor Program (NMPD). All rights reserved. # Written by Peter Cock, The James Hutton Institute, under contract to NMDP. # # 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 th...
334
14,209
sqlmap
tests/test_dns_server.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission The DNS server used for DNS-exfiltration (lib/request/dns.py): raw packet parsing (DNSQuery), fake A-record response crafting, the pop(prefix, suffix) accounting, and - importantly - ...
366
14,227
lemur
lemur/plugins/lemur_acme/powerdns.py
.py
import json import sys import time import lemur.common.utils as utils import lemur.dns_providers.util as dnsutil import requests from flask import current_app from sentry_sdk import capture_exception from lemur.extensions import metrics REQUIRED_VARIABLES = [ "ACME_POWERDNS_APIKEYNAME", "ACME_POWERDNS_APIKEY...
439
12,469
textual
src/textual/css/match.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, Iterable from textual.css.model import CombinatorType, Selector, SelectorSet if TYPE_CHECKING: from textual.dom import DOMNode def match(selector_sets: Iterable[SelectorSet], node: DOMNode) -> bool: """Check if a given node matches any of...
75
2,390
astropy
conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file is the main file used when running tests with pytest directly, # in particular if running e.g. ``pytest docs/``. import os import hypothesis from astropy import __version__ try: from pytest_astropy_header.display import PYTEST_HEADER_M...
73
2,585
openvino
src/bindings/python/src/openvino/frontend/pytorch/compressed_tensors.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import logging from typing import Any import torch from openvino.frontend.pytorch import ModuleExtension log = logging.getLogger(__name__) def build_extensions(for_export: b...
191
9,353
onnx
onnx/backend/test/case/node/add.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 Add(Base): @staticmethod def export() -> None: node = ...
61
2,244
saleor
saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_checkout_fully_paid.py
.py
import json from unittest.mock import patch import graphene from django.test import override_settings from ......core.models import EventDelivery from ......graphql.webhook.subscription_query import SubscriptionQuery from ......webhook.event_types import WebhookEventAsyncType from .....manager import get_plugins_mana...
248
7,442
mlflow
dev/benchmarks/tracing/conftest.py
.py
from collections.abc import Iterator from pathlib import Path import pytest from _data import SEED_SPANS_PER_TRACE, SEED_TRACES, seed_traces import mlflow from mlflow.store.tracking.sqlalchemy_store import SqlAlchemyStore @pytest.fixture(scope="session") def bench_dir(tmp_path_factory: pytest.TempPathFactory) -> Pa...
40
1,215
rq
rq/worker_pool.py
.py
from __future__ import annotations import contextlib import errno import logging import os import signal import time from collections.abc import Iterable from enum import Enum from multiprocessing import Process, get_context from multiprocessing.process import BaseProcess from typing import TYPE_CHECKING, NamedTuple f...
287
10,496
saleor
saleor/graphql/account/tests/queries/test_staff_users_filtering.py
.py
import graphene import pytest from .....account.models import User from .....account.search import update_user_search_vector from ....tests.utils import get_graphql_content @pytest.fixture def query_staff_users_with_filter(): query = """ query ($filter: StaffUserInput!, ) { staffUsers(first: 5, filte...
254
7,138
astropy
astropy/time/tests/test_parse_times_extension.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for the _parse_times C extension in astropy.time.""" import dataclasses from collections.abc import Mapping from typing import Any import numpy as np import pytest from astropy.time import TimeISO, TimeISOT, TimeYearDayTime, _parse_times @dat...
142
4,659
pyomo
pyomo/core/tests/unit/test_component.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
126
4,565
saleor
saleor/graphql/page/tests/queries/test_page.py
.py
import graphene import pytest from .....attribute.models import AttributeValue from .....attribute.tests.model_helpers import ( get_page_attribute_values, get_page_attributes, ) from .....attribute.utils import associate_attribute_values_to_instance from .....page.models import PageTranslation from .....tests....
760
22,207
conda
conda/common/serialize/yaml.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """YAML serialization utilities for conda.""" from __future__ import annotations from functools import cache from io import StringIO from pathlib import Path from typing import TYPE_CHECKING, overload from ...deprecations import deprecated i...
163
4,160
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_free_shipping_voucher_with_min_quantity_of_items.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
180
5,606
eve
eve/io/mongo/parser.py
.py
# -*- coding: utf-8 -*- """ eve.io.mongo.parser ~~~~~~~~~~~~~~~~~~~ This module implements a Python-to-Mongo syntax parser. Allows the MongoDB data-layer to seamlessly respond to a Python-like query. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ imp...
156
4,452
wandb
tests/system_tests/test_core/test_wandb_verify.py
.py
import unittest.mock import wandb import wandb.sdk.verify.verify as wandb_verify from wandb.apis import InternalApi def test_check_logged_in(user): internal_api = unittest.mock.MagicMock(spec=InternalApi) internal_api.api_key = None assert not wandb_verify.check_logged_in(internal_api, "localhost:8000") ...
16
439
sqlmap
plugins/dbms/firebird/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ try: import firebirdsql except: pass import logging from lib.core.common import getSafeExString from lib.core.data import conf from lib.core.data import logger from lib....
73
2,421
black
tests/data/cases/whitespace.py
.py
# output
7
27
biopython
Bio/KEGG/KGML/KGML_pathway.py
.py
# Copyright 2013 by Leighton Pritchard. 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. """Classes to repre...
858
27,600
mlflow
mlflow/genai/scorers/deepeval/scorers/__init__.py
.py
"""DeepEval metric scorers organized by category.""" from __future__ import annotations from typing import ClassVar from mlflow.genai.judges.builtin import _MODEL_API_DOC from mlflow.genai.scorers.deepeval import DeepEvalScorer from mlflow.genai.scorers.deepeval.scorers.agentic_metrics import ( ArgumentCorrectne...
236
5,896
trivy
pkg/fanal/analyzer/language/c/conan/testdata/cacheDir_v2/p/opens464b5c427ce9d/e/conanfile.py
.py
from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name, is_apple_os, XCRun from conan.tools.build import build_jobs from conan.tools.files import chdir, copy, get, rename, replace_in_file, rmdir, save from conan.tools.gnu import Autotoo...
676
29,741
onnxruntime
onnxruntime/python/tools/quantization/operators/pad.py
.py
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from __future__ import annotations from typing import Any import nump...
173
7,779