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
probability
tensorflow_probability/python/util/seed_stream.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...
258
9,734
mlflow
examples/multistep_workflow/load_raw_data.py
.py
""" Downloads the MovieLens dataset and saves it as an artifact """ import os import tempfile import zipfile import click import requests import mlflow @click.command( help="Downloads the MovieLens dataset and saves it as an mlflow artifact " "called 'ratings-csv-dir'." ) @click.option("--url", default="ht...
44
1,292
astropy
astropy/cosmology/units.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Cosmological units and equivalencies.""" __all__ = ( # redshift equivalencies "dimensionless_redshift", "littleh", "redshift", "redshift_distance", "redshift_hubble", "redshift_temperature", # other equivalencies "wi...
45
1,281
probability
tensorflow_probability/python/experimental/distribute/__init__.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...
34
1,775
mlflow
examples/sktime/train.py
.py
import json import flavor import pandas as pd from sktime.datasets import load_longley from sktime.forecasting.model_selection import temporal_train_test_split from sktime.forecasting.naive import NaiveForecaster from sktime.performance_metrics.forecasting import ( mean_absolute_error, mean_absolute_percentage...
83
2,809
mlflow
dev/pypi/src/pypi/_models.py
.py
from __future__ import annotations from dataclasses import dataclass from datetime import datetime from typing import Any from packaging.specifiers import InvalidSpecifier, SpecifierSet from packaging.version import InvalidVersion, Version def _parse_upload_time(value: str | None) -> datetime | None: if not val...
89
3,004
pyomo
pyomo/contrib/appsi/tests/test_ipopt.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...
40
1,458
readthedocs.org
readthedocs/core/admin.py
.py
"""Django admin interface for core models.""" from datetime import timedelta from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from django.urls import reverse from django.utils import timezone from django.utils.html import format_html from dja...
132
4,412
gunicorn
gunicorn/http2/__init__.py
.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ HTTP/2 support for Gunicorn. This module provides HTTP/2 protocol support using the hyper-h2 library. HTTP/2 requires TLS with ALPN negotiation. """ H2_MIN_VERSION = (4, 1, 0) _h2_avail...
87
2,228
pyomo
pyomo/solvers/tests/checks/test_CBCplugin.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...
461
18,593
pyro
examples/cvae/baseline.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import copy from pathlib import Path import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from tqdm import tqdm class BaselineNet(nn.Module): def __init__(self, hidden_1, hidden_2): super...
118
3,456
hatch
src/hatch/cli/status/__init__.py
.py
import click @click.command(short_help="Show information about the current environment") @click.pass_obj def status(app): """Show information about the current environment.""" def display_pair(key, value, display_func=None, link=None): app.display_info("[", end="") app.display_success(key, en...
28
1,082
mlflow
mlflow/store/tracking/sqlalchemy_workspace_store.py
.py
from __future__ import annotations import logging import sqlalchemy import sqlalchemy.sql.expression as sql from sqlalchemy.exc import IntegrityError from sqlalchemy.future import select from mlflow.entities import ( Experiment, ) from mlflow.entities.entity_type import EntityAssociationType from mlflow.entities...
581
22,620
onnx
onnx/reference/ops/op_batch_normalization.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun def _batchnorm_test_mode( x: np.ndarray, s: np.ndarray, bias: np.ndarray, mean: np.ndarray, var: np.ndarray, epsilon:...
102
3,018
beam
sdks/python/apache_beam/ml/rag/ingestion/postgres.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...
208
8,111
pdm
tests/fixtures/projects/demo/demo.py
.py
import os import chardet print(os.name)
6
42
sqlmap
lib/utils/paraminer.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import difflib from lib.core.compat import xrange from lib.core.common import getFileItems from lib.core.common import paramToDict from lib.core.common import randomStr from lib....
201
7,222
mlflow
examples/pmdarima/train.py
.py
import json import numpy as np from pmdarima import auto_arima, model_selection from pmdarima.datasets import load_wineind import mlflow from mlflow.models import infer_signature ARTIFACT_PATH = "model" def calculate_cv_metrics(model, endog, metric, cv): cv_metric = model_selection.cross_val_score(model, endog...
64
1,842
astropy
docs/nddata/examples/cutout2d_tofits.py
.py
# Download an example FITS file, create a 2D cutout, and save it to a # new FITS file, including the updated cutout WCS. from astropy.io import fits from astropy.nddata import Cutout2D from astropy.utils.data import download_file from astropy.wcs import WCS def download_image_save_cutout(url, position, size): # D...
37
1,092
saleor
saleor/tests/e2e/account/staff/test_create_and_update_staff_with_metadata.py
.py
import pytest from ...utils import assign_permissions from ..utils import create_staff, update_staff @pytest.mark.e2e def test_create_and_update_staff_with_metadata_core_1515( e2e_staff_api_client, permission_manage_staff, ): # Before permissions = [ permission_manage_staff, ] assign_...
55
1,563
conda
conda/cli/main_env_create.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda-env create`. Creates new conda environments with the specified packages. """ from argparse import ( ArgumentParser, _SubParsersAction, ) def epilog() -> str: """Build ``conda env create`` epilog (...
119
3,563
wandb
tests/unit_tests/test_launch/test_builder/test_context_manager.py
.py
"""Tests for the BuildContextManager class in the builder module.""" import pathlib from unittest.mock import MagicMock import pytest from wandb.sdk.launch.builder.context_manager import BuildContextManager @pytest.fixture def mock_git_project(mocker, tmp_path): mock_project = MagicMock() mock_project.proje...
150
6,190
beam
sdks/python/apache_beam/testing/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 us...
496
17,210
saleor
saleor/graphql/shop/tests/queries/test_shop_allow_storefront_traffic.py
.py
from ....tests.utils import get_graphql_content SHOP_ALLOW_STOREFRONT_TRAFFIC_QUERY = """ query { shop { allowStorefrontTraffic } } """ def test_shop_allow_storefront_traffic_defaults_to_true(api_client, site_settings): # given: freshly created site settings (default) # then: the model defaul...
36
1,168
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/AttributeType.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs class AttributeType(object): UNDEFINED = 0 FLOAT = 1 INT = 2 STRING = 3 TENSOR = 4 GRAPH = 5 FLOATS = 6 INTS = 7 STRINGS = 8 TENSORS = 9 GRAPHS = 10 SPARSE_TENSOR = 11 SPARSE_TENSO...
19
328
pymc
pymc/plots/__init__.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...
40
1,251
pyomo
pyomo/network/arc.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...
422
15,319
pyro
pyro/infer/svgd.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math from abc import ABCMeta, abstractmethod import torch from torch.distributions import biject_to import pyro from pyro import poutine from pyro.distributions import Delta from pyro.distributions.util import copy_docs_fr...
333
12,959
mlflow
mlflow/tracking/default_experiment/registry.py
.py
import logging import warnings from mlflow.tracking import get_tracking_uri from mlflow.tracking.default_experiment import DEFAULT_EXPERIMENT_ID from mlflow.tracking.default_experiment.databricks_notebook_experiment_provider import ( DatabricksNotebookExperimentProvider, ) from mlflow.utils.plugins import get_entr...
75
3,024
probability
tensorflow_probability/python/bijectors/frechet_cdf_test.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 or...
99
4,305
pyro
tests/infer/reparam/test_strategies.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro import pyro.distributions as dist from pyro import poutine from pyro.infer import SVI, Predictive, Trace_ELBO from pyro.infer.autoguide import AutoNormal from pyro.infer.reparam import AutoRepara...
342
10,119
hydra
plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/config.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass, field from typing import Optional from hydra.core.config_store import ConfigStore from omegaconf import II @dataclass class RedisConf: # host address via REDIS_HOST environment variable, default: localhost ...
63
2,695
onnxruntime
orttraining/orttraining/python/training/ortmodule/_torch_module_factory.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # _torch_module_factory.py from logging import Logger from ._fallback import _FallbackManager from ._torch_module_ort import TorchModuleORT from .options import DebugOptions class TorchModuleFactory: def __call__(self,...
17
563
pyomo
examples/pyomobook/scripts-ch/value_expression.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...
24
902
beam
examples/multi-language/python/addprefix.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...
99
3,367
coremltools
coremltools/test/pipeline/test_model_updatable.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 os import shutil import tempfile import unittest import numpy as _np import coremltools.models....
797
28,313
coremltools
coremltools/converters/mil/mil/ops/defs/iOS15/elementwise_binary.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 operator import numpy as np from coremltools.converters.mil.mil import ( InputSpec, O...
630
15,055
openvino
tests/e2e_tests/common/ir_provider/model_optimizer_runner.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.tools.mo.utils.cli_parser import parse_input_value from openvino.tools.ovc.cli_parser import split_inputs from e2e_tests.test_utils.test_utils import log_timestamp from e2e_tests.test_utils.path_utils import resolve_file_p...
144
6,708
conda
conda/cli/main_notices.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI implementation for `conda notices`. Manually retrieves channel notifications, caches them and displays them. """ from argparse import ArgumentParser, Namespace, _SubParsersAction def configure_parser(sub_parsers: _SubParsersAction, **...
65
1,665
ipython
IPython/core/magic_arguments.py
.py
'''A decorator-based method of constructing IPython magics with `argparse` option handling. New magic functions can be defined like so:: from IPython.core.magic_arguments import (argument, magic_arguments, parse_argstring) @magic_arguments() @argument('-o', '--option', help='An optional argument....
312
9,749
astropy
astropy/coordinates/tests/test_velocity_corrs.py
.py
import numpy as np import pytest from astropy import units as u from astropy.constants import c as speed_of_light from astropy.coordinates import Distance, EarthLocation, SkyCoord from astropy.coordinates.sites import _GREENWICH from astropy.table import Table from astropy.tests.helper import assert_quantity_allclose ...
344
16,570
metrics
src/torchmetrics/functional/retrieval/fall_out.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...
65
2,671
openvino
src/bindings/python/src/openvino/exceptions.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openvino exceptions hierarchy. All exceptions are descendants of OVError.""" class OVError(Exception): """Base class for OV exceptions.""" class UserInputError(OVError): """User provided unexpected ...
18
402
voila
voila/server_extension.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
217
7,034
wagtail
wagtail/contrib/redirects/wagtail_hooks.py
.py
from django.contrib.auth.models import Permission from django.urls import include, path, reverse from django.utils.translation import gettext_lazy as _ from wagtail import hooks from wagtail.admin.admin_url_finder import ( ModelAdminURLFinder, register_admin_url_finder, ) from wagtail.admin.menu import MenuIte...
55
1,480
openvino
tests/layer_tests/pytorch_tests/test_arange.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np from pytorch_layer_test_class import PytorchLayerTest, skip_check, skip_if_export import torch class TestArange(PytorchLayerTest): def _prepare_input(self, start=None, end=None, step=None, ref_valu...
352
16,914
textual
src/textual/_slug.py
.py
"""Provides a utility function and class for creating Markdown-friendly slugs. The approach to creating slugs is designed to be as close to GitHub-flavoured Markdown as possible. However, because there doesn't appear to be any actual documentation for this 'standard', the code here involves some guesswork and also som...
141
4,392
hatch
scripts/set_release_version.py
.py
import os from utils import get_latest_release def main(): version, _ = get_latest_release("hatch") parts = version.split(".") with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as f: f.write(f"HATCH_DOCS_VERSION={parts[0]}.{parts[1]}\n") if __name__ == "__main__": main()
16
311
wandb
wandb/integration/kfp/wandb_log_v2.py
.py
from __future__ import annotations import os from collections.abc import Callable from functools import wraps from inspect import signature from typing import Any import kfp.dsl from kfp.dsl.types.type_annotations import ( InputPath, OutputPath, is_artifact_wrapped_in_Input, is_artifact_wrapped_in_Out...
262
8,656
kafka
tests/kafkatest/services/zookeeper.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 ...
294
12,940
pyomo
pyomo/contrib/pynumero/linalg/scipy_interface.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
120
4,231
wagtail
wagtail/images/forms.py
.py
import json from django import forms from django.conf import settings from django.db import models from django.forms.models import modelform_factory from django.utils.functional import cached_property from django.utils.text import capfirst from django.utils.translation import gettext as _ from wagtail.admin.forms.col...
271
9,662
textual
tests/snapshot_tests/snapshot_apps/quickly_change_tabs.py
.py
"""Regression test for https://github.com/Textualize/textual/issues/2229.""" from textual.app import App, ComposeResult from textual.widgets import TabbedContent, TabPane, Tabs, Label class QuicklyChangeTabsApp(App[None]): def compose(self) -> ComposeResult: with TabbedContent(): with TabPane(...
25
712
probability
tensorflow_probability/python/experimental/vi/automatic_structured_vi.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...
593
26,568
deap
examples/ga/evosn.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 ...
145
4,982
black
tests/data/cases/remove_for_brackets.py
.py
# Only remove tuple brackets after `for` for (k, v) in d.items(): print(k, v) # Don't touch tuple brackets after `in` for module in (core, _unicodefun): if hasattr(module, "_verify_python3_env"): module._verify_python3_env = lambda: None # Brackets remain for long for loop lines for (why_would_anyone_...
49
1,460
wandb
tests/unit_tests/test_torch.py
.py
import pytest import torch import torch.nn as nn from wandb.integration.torch import wandb_torch def test_nested_shape(): shape = wandb_torch.nested_shape([2, 4, 5]) assert shape == [[], [], []] shape = wandb_torch.nested_shape( [ torch.ones((2, 3), requires_grad=True), to...
106
3,302
beam
sdks/python/apache_beam/examples/inference/pytorch_image_segmentation.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...
256
7,029
coremltools
deps/protobuf/python/docs/generate_docs.py
.py
#!/usr/bin/env python # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are...
193
5,938
biopython
Bio/Phylo/_cdao_owl.py
.py
# Copyright (C) 2013 by Ben Morris (ben@bendmorris.com) # # 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 support Com...
2,890
109,367
mlflow
mlflow/tracing/otel/translation/genai_semconv.py
.py
""" Translation utilities for GenAI (Generic AI) semantic conventions. Reference: https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/ """ import json from typing import Any from mlflow.entities.span import SpanType from mlflow.tracing.otel.translation.base import OtelSchemaTranslator class GenA...
133
5,079
scikit-bio
skbio/util/_misc.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
210
5,491
pyro
tests/contrib/epidemiology/test_quant.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pyro.contrib.epidemiology.util import compute_bin_probs @pytest.mark.parametrize("num_quant_bins", [2, 4, 8, 12, 16]) def test_quantization_scheme(num_quant_bins, num_samples=1000 * 1000): min, ma...
30
925
wandb
wandb/apis/public/sweeps.py
.py
"""W&B Public API for Sweeps. This module provides classes for interacting with W&B hyperparameter optimization sweeps. Example: ```python from wandb.apis.public import Api # Get a specific sweep sweep = Api().sweep("entity/project/sweep_id") # Access sweep properties print(f"Sweep: {sweep.name}") print(f"State: {s...
631
19,981
saleor
saleor/graphql/checkout/tests/benchmark/test_checkout.py
.py
import pytest from ....core.utils import to_global_id_or_none from ....tests.utils import get_graphql_content CHECKOUT_DETAILS_QUERY = """ query checkout($id: ID){ checkout( id:$id ) { shippingMethods{ active message } lines{ id variant{ product{ name } } totalPrice{ gros...
75
1,056
mlflow
tests/__init__.py
.py
from mlflow.utils.logging_utils import _configure_mlflow_loggers _configure_mlflow_loggers(root_module_name=__name__)
4
119
pyomo
pyomo/repn/plugins/gams_writer_v2.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...
659
23,955
saleor
saleor/graphql/page/tests/queries/pages_with_where/test_with_where_attributes_date.py
.py
import datetime import pytest from ......attribute import AttributeInputType, AttributeType from ......attribute.models import Attribute from ......attribute.utils import associate_attribute_values_to_instance from .....tests.utils import get_graphql_content from .shared import QUERY_PAGES_WITH_WHERE @pytest.mark.p...
101
3,087
wandb
wandb/proto/v7/wandb_sync_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_sync.proto # Protobuf Python Version: 7.34.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_...
58
4,242
beam
sdks/python/apache_beam/yaml/programming_guide_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...
425
13,608
conda
conda/common/path/directories.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Common directory utilities.""" from __future__ import annotations from functools import reduce from itertools import accumulate, chain from logging import getLogger from os.path import join from typing import TYPE_CHECKING if TYPE_CHECKING...
59
1,675
wagtail
wagtail/images/views/bulk_actions/add_to_collection.py
.py
from django import forms from django.utils.translation import gettext_lazy as _ from django.utils.translation import ngettext from wagtail.images import get_image_model from wagtail.images.views.bulk_actions.image_bulk_action import ImageBulkAction from wagtail.permissions import policy_registry class CollectionForm...
59
2,251
deap
tests/test_logbook.py
.py
import unittest from deap import tools class LogbookTest(unittest.TestCase): def setUp(self): self.logbook = tools.Logbook() print() def test_multi_chapters(self): self.logbook.record(gen=0, evals=100, fitness={'obj 1': {'avg': 1.0, 'max': 10}, ...
42
1,732
pyomo
examples/pyomobook/overview-ch/wl_abstract.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...
56
1,624
beam
sdks/python/apache_beam/io/external/xlang_kafkaio_it_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...
241
8,297
wagtail
wagtail/test/benchmark.py
.py
import time import tracemalloc class Benchmark: repeat = 10 def test(self): timings = [] memory_usage = [] tracemalloc.start() for i in range(self.repeat): before_memory = tracemalloc.take_snapshot() start_time = time.time() self.bench() ...
44
1,052
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/DeprecatedKernelCreateInfos.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() # deprecated: no longer using kernel def hashes class DeprecatedKernelCreateInfos(object): __slots__ = ['_tab'] @classmethod def GetRoo...
121
4,528
biopython
Bio/PDB/FragmentMapper.py
.py
# Copyright (C) 2002, 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. """Classify protein ...
324
9,621
conda
tests/plugins/test_previews.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Unit tests for conda.plugins.previews.""" from __future__ import annotations from typing import TYPE_CHECKING from unittest.mock import MagicMock import conda.plugins.previews as previews from conda._preview.env_setup import PREVIEW_LABEL ...
134
4,146
pyomo
pyomo/contrib/pynumero/examples/tests/test_examples.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
2,262
mlflow
mlflow/rfunc/__init__.py
.py
"""Export and import of generic R models. This module defines generic filesystem format for R models and provides utilities for saving and loading to and from this format. The format is self contained in the sense that it includes all necessary information for anyone to load it and use it. Dependencies are either stor...
43
1,138
saleor
saleor/account/search.py
.py
from typing import TYPE_CHECKING from django.db.models import Value, prefetch_related_objects from ..core.postgres import FlatConcatSearchVector, NoValidationSearchVector if TYPE_CHECKING: from .models import Address, User USER_SEARCH_FIELDS = [ "email", "first_name", "last_name", ] def update_use...
144
4,615
wandb
tests/unit_tests/test_launch/test_environment/test_gcp.py
.py
import os from unittest.mock import MagicMock import pytest from google.api_core.exceptions import Forbidden, GoogleAPICallError, NotFound from google.auth.exceptions import DefaultCredentialsError, RefreshError from wandb.sdk.launch.environment.gcp_environment import ( GCP_REGION_ENV_VAR, GcpEnvironment, ...
221
7,760
saleor
saleor/graphql/discount/tests/mutations/test_sale_delete.py
.py
from unittest.mock import patch import graphene import pytest from .....discount.error_codes import DiscountErrorCode from .....discount.models import Promotion, PromotionRule from .....product.models import ProductChannelListing from ....tests.utils import get_graphql_content from ...utils import ( convert_migra...
130
4,156
pyomo
examples/doc/samples/scripts/s1/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...
37
1,156
saleor
saleor/graphql/product/tests/benchmark/test_variant_stocks.py
.py
from unittest.mock import patch import graphene import pytest from .....warehouse.models import Stock, Warehouse from ....tests.utils import get_graphql_content @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) @patch( "saleor.graphql.product.bulk_mutations." "product_variant_stocks_create.ge...
540
16,708
coremltools
coremltools/test/sklearn_tests/test_k_neighbors_classifier.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 unittest from scipy import sparse from coremltools._deps import _HAS_SKLEARN if _HAS_SKLEARN: ...
278
11,433
onnxruntime
orttraining/orttraining/python/training/ortmodule/torch_cpp_extensions/cuda/fused_ops/setup.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import fileinput # noqa: F401 import os import sys # noqa: F401 from ...
33
1,198
saleor
saleor/graphql/translations/tests/mutations/test_page_translate.py
.py
import graphene from .....page.models import PageTranslation from ....core.enums import LanguageCodeEnum from ....tests.utils import get_graphql_content PAGE_TRANSLATE_MUTATION = """ mutation ( $id: ID!, $languageCode: LanguageCodeEnum!, $input: PageTranslationInput! ) { pageTra...
189
4,814
probability
tensorflow_probability/python/distributions/negative_binomial_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...
408
16,611
probability
tensorflow_probability/python/bijectors/correlation_cholesky.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...
236
9,098
onnxruntime
onnxruntime/python/tools/quantization/operators/pooling.py
.py
import onnx from ..quant_utils import TENSOR_NAME_QUANT_SUFFIX, QuantizedValue, QuantizedValueType, attribute_to_kwarg, ms_domain from .base_operator import QuantOperatorBase class QLinearPool(QuantOperatorBase): def __init__(self, onnx_quantizer, onnx_node): super().__init__(onnx_quantizer, onnx_node) ...
68
2,218
astropy
astropy/io/ascii/basic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """An extensible ASCII table reader and writer. basic.py: Basic table read / write functionality for simple character delimited files with various options for column header definition. :Copyright: Smithsonian Astrophysical Observatory (2011) :Author:...
442
12,363
saleor
saleor/tests/e2e/sales/utils/sale_channel_listing.py
.py
from ...utils import get_graphql_content SALE_CREATE_CHANNEL_LISTING_MUTATION = """ mutation SaleUpdate($id: ID!, $input: SaleChannelListingInput!) { saleChannelListingUpdate(id: $id, input: $input) { errors { field message code } sale { id name channelListings { ...
72
1,469
saleor
saleor/graphql/shop/tests/mutations/test_return_settings_update.py
.py
import graphene from .....page.models import PageType from .....site.error_codes import ReturnSettingsErrorCode from ....tests.utils import assert_no_permission, get_graphql_content RETURN_SETTINGS_UPDATE_MUTATION = """ mutation returnSettingsUpdate($input: ReturnSettingsUpdateInput!) { returnSettingsUpda...
271
8,467
readthedocs.org
readthedocs/rtd_tests/tests/test_projects_tasks.py
.py
import datetime from unittest.mock import patch from django.test import TestCase from django.utils import timezone from django_dynamic_fixture import get from readthedocs.builds.constants import ( BUILD_STATUS_SUCCESS, BUILD_STATE_CLONING, BUILD_STATE_CANCELLED, BUILD_STATE_TRIGGERED, EXTERNAL, )...
108
3,735
sphinx
tests/test_directives/test_directive_option.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from sphinx.testing.util import SphinxTestApp @pytest.mark.sphinx( 'html', testroot='root', confoverrides={'option_emphasise_placeholders': True}, ) def test_option_emphasise_placeholders(app: Sphinx...
65
2,455
onnxruntime
onnxruntime/test/testdata/transform/model_parallel/bart_self_attention_megatron_basic_test.py
.py
import numpy as np import onnx from onnx import OperatorSetIdProto, TensorProto, helper, numpy_helper batch = 6 hidden_size = 4 attention_head = 2 hidden_per_attention = 2 relative_attention_num_buckets = 32 input_len = 8 output_len = 8 X = helper.make_tensor_value_info("input", TensorProto.FLOAT, [batch, input_len,...
253
9,100
probability
tensorflow_probability/python/util/seed_stream_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...
84
3,677
clearml
clearml/backend_interface/datasets/hyper_dataset.py
.py
from typing import Optional, List, Dict, Any, Sequence, Union from ...backend_api.services import datasets from ...backend_api import Session from ..base import IdObjectBase from ..util import exact_match_regex from ..session import SendError from ...task import Task from .save_frames_request_no_validate_wrapped impor...
667
25,459