label stringlengths 1 61 | code stringlengths 4k 8k |
|---|---|
test spectral model | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_allclose
import astropy.units as u
from gammapy.catalog import SourceCatalog1LHAASO
from gammapy.modeling.models import (
GaussianSpatialModel,
PointSpatialModel,
PowerLawNormSpe... |
update dynamic services | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
libs | # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
from spack.package import *
class Mesa18(AutotoolsPackage):
"""Mesa is an open-source implementation of ... |
all interfaces | #!/usr/bin/env python3
# Copyright (c) 2014-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Linux network utilities.
Roughly based on http://voorloopnul.com/blog/a-python-netstat-in-less-than-10... |
test args | import contextlib
import sys
import os
import unittest
from test import support
import time
resource = support.import_module('resource')
# This test is checking a few specific problem spots with the resource module.
class ResourceTest(unittest.TestCase):
def METHOD_NAME(self):
self.assertRaises(TypeErro... |
process classlist | from docutils.parsers.rst import Directive
from docutils import nodes
import pdb
from collections import defaultdict
from sphinx import addnodes
from pathlib import Path
class classlist(nodes.General, nodes.Element):
pass
class ClasslistDirective(Directive):
def run(self):
return [classlist('')]
de... |
fake authz key file |
from Utils.Utilities import encodeUnicodeToBytes
from future.utils import viewitems, viewvalues, listitems
import os, hmac, hashlib, cherrypy
from tempfile import NamedTemporaryFile
from Utils.PythonVersion import PY3
from WMCore.REST.Main import RESTMain
from WMCore.REST.Auth import authz_canonical
from WMCore.Con... |
run | import os
import shutil
import attr
import plistlib
from packaging import version
import tempfile
from drawBot.drawBotSettings import __version__
from drawBot.scriptTools import ScriptRunner
from drawBot.drawBotDrawingTools import _drawBotDrawingTool
"""
DrawBot support for .drawbot packages.
* Read and build packag... |
get info | """This is the main component of the game, the core of the game that squishes
everything together and make the game work. Usually user can just import this
module and use the beat() function and everything will be fine, but will there
be any certain things that can't be accomplished that way, the user may also
freely i... |
run | import logging
import os
from avocado.utils import process
from virttest import libvirt_version
from virttest import virt_vm, utils_misc
from virttest.libvirt_xml import vm_xml, xcepts
from virttest.utils_test import libvirt
from virttest.utils_libvirt import libvirt_disk
LOG = logging.getLogger('avocado.' + __nam... |
get selected filter options | import platform
from os.path import expanduser
from PySide6 import QtWidgets, QtGui
from src.Controller.PathHandler import resource_path
import logging
class SelectSubgroupOptions(QtWidgets.QWidget):
"""
Select subgroup options for batch processing.
"""
def __init__(self):
"""
Initial... |
format plotly | import pandas as pd
import streamlit as st
import yfinance
from openbb_terminal.core.plots.plotly_helper import OpenBBFigure
from openbb_terminal.core.session.current_system import set_system_variable
from openbb_terminal.dashboards.stream import streamlit_helpers as st_helpers
pd.options.plotting.backend = "plotly"
... |
resolve available attributes | from typing import List
import graphene
from ...attribute import models as attribute_models
from ...page import models
from ...permission.enums import PagePermissions, PageTypePermissions
from ..attribute.filters import AttributeFilterInput, AttributeWhereInput
from ..attribute.types import Attribute, AttributeCounta... |
profile gen | import os, sys
import time
import random
import string
from .astf_general_test import CASTFGeneral_Test, CTRexScenario
from nose.tools import assert_raises
from trex.astf.api import *
from trex.stl.trex_stl_packet_builder_scapy import ip2int, int2ip
class ASTFResilience_Test(CASTFGeneral_Test):
"""Checking stabil... |
test dict | # Copyright (c) MONAI Consortium
# 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, so... |
write file | from __future__ import annotations
import logging
import os
import pathlib
import shutil
import struct
import tempfile
import zipfile
from typing import cast
from comicapi.archivers import Archiver
logger = logging.getLogger(__name__)
class ZipArchiver(Archiver):
"""ZIP implementation"""
def __init__(sel... |
test get usage for trial services | from datetime import date, datetime
import pytest
from freezegun import freeze_time
from app.errors import InvalidRequest
from app.models import EMAIL_TYPE, SMS_TYPE
from app.platform_stats.rest import validate_date_range_is_within_a_financial_year
from tests.app.db import (
create_ft_notification_status,
cre... |
ok | # Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
test image | from recipe_scrapers.saveur import Saveur
from tests import ScraperTest
class TestSaveurScraper(ScraperTest):
scraper_class = Saveur
def test_host(self):
self.assertEqual("saveur.com", self.harvester_class.host())
def test_author(self):
self.assertEqual(None, self.harvester_class.author... |
get metadata | import json
import sys
if sys.version_info >= (3,0):
import urllib.parse
dku_quote_fn = urllib.parse.quote
else:
import urllib
dku_quote_fn = urllib.quote
class DSSObjectDiscussions(object):
"""
A handle to manage discussions on a DSS object.
.. important::
Do not create this class direct... |
test turbomole num hessian | import numpy as np
import pytest
import qcelemental
from qcelemental.testing import compare_values
import qcengine as qcng
from qcengine.programs.turbomole.harvester import parse_hessian
from qcengine.testing import using
@pytest.fixture
def h2o():
mol = qcelemental.models.Molecule.from_data(
"""
... |
on 200 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------... |
target selectors | import datetime
import random
import uuid
import factory
from sqlalchemy import orm
from h import models
from h.db.types import URLSafeUUID
from h.models.document import update_document_metadata
from .base import FAKER, ModelFactory
from .document import Document, DocumentMeta, DocumentURI
class Annotation(ModelFa... |
test set log level error | # Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
get mro | """
Patch recently added ABCs into the standard lib module
``collections.abc`` (Py3) or ``collections`` (Py2).
Usage::
import backports_abc
backports_abc.patch()
or::
try:
from collections.abc import Generator
except ImportError:
from backports_abc import Generator
"""
try:
impo... |
operation group two | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
flush | # Copyright 2017 PerfKitBenchmarker 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 appli... |
get class | import numpy as np
import pytest
from aspire.image import Image
from aspire.utils import gaussian_2d, utest_tolerance
from aspire.utils.coor_trans import grid_2d
from aspire.utils.random import randn
from aspire.volume import Volume
# Parameter combinations for testing 2D bases
# Each tuple represents (resolution in ... |
test branch change already on branch | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe and Contributors
# See license.txt
import unittest
from unittest.mock import patch
import frappe
from frappe.core.utils import find
from press.press.doctype.app.app import App
from press.press.doctype.app.test_app import create_test_app
from press.press.doctype.app... |
test user revoke invalid certified | # Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS
from __future__ import annotations
import pytest
import trio
from quart.testing.connections import WebsocketDisconnectError
from parsec._parsec import (
DateTime,
UserProfile,
)
from parsec.api.data import RevokedUserCertific... |
test boltzmann typo deprecation | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... |
register all arguments | import argparse
import os
import sys
from collections.abc import Callable
from typing import IO
from xdsl.backend.riscv import riscv_scf_to_asm
from xdsl.backend.riscv.lowering import (
convert_arith_to_riscv,
convert_func_to_riscv_func,
convert_memref_to_riscv,
convert_scf_to_riscv_scf,
reduce_reg... |
make app | import os
import uuid
from unittest import mock
from pyramid import testing
from kinto.core import initialization
from kinto.core.events import ACTIONS, ResourceChanged, ResourceRead
from kinto.core.listeners import ListenerBase
from kinto.core.testing import unittest
UID = str(uuid.uuid4())
class ViewSet:
def... |
restore backup from xml file | # coding: utf-8
from datetime import datetime
import errno
import os
import shutil
import sys
import tempfile
import zipfile
from time import sleep
from onadata.apps.logger.import_tools import django_file
from onadata.apps.logger.models import Instance
from onadata.libs.utils.logger_tools import create_instance
from o... |
always iterable | import sys, os
from glob import glob
from shutil import copyfile
import fnmatch
import yaml, pprint
import subprocess
import jinja2
from itertools import *
import concurrent.futures
def ParseAruments() -> (dict, dict):
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('configPath')
... |
eval func | import os
import time
import argparse
from datasets import load_dataset
from transformers import WhisperForConditionalGeneration, WhisperProcessor
import torch
from evaluate import load
parser = argparse.ArgumentParser()
parser.add_argument('--int8', dest='int8', action='store_true')
parser.add_argument('--tune', dest... |
test json gather array | import csv
import json
from io import StringIO
from urllib import parse
import numpy as np
from webtest import TestApp
import tangos
import tangos.testing.simulation_generator
import tangos.web
from tangos import testing
def setup_module():
testing.init_blank_db_for_testing()
creator = tangos.testing.simul... |
test duplicated params | # Owner(s): ["module: inductor"]
import copy
import functools
import unittest
import torch
import torch._export
import torch._inductor
import torch.fx._pytree as fx_pytree
from torch._dynamo.testing import same
from torch.testing._internal.common_utils import IS_FBCODE, TEST_WITH_ROCM, TestCase
from torch.testing._i... |
test link only | import os
import pandas as pd
import pyspark.sql.functions as f
import pytest
from pyspark.sql.types import StringType, StructField, StructType
import splink.spark.comparison_level_library as cll
import splink.spark.comparison_library as cl
from splink.spark.linker import SparkLinker
from .basic_settings import get_... |
test storage mock api | # Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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 a... |
state bar | from logging import DEBUG
import pytest
from mitmproxy.proxy import commands
from mitmproxy.proxy import events
from mitmproxy.proxy import layer
from mitmproxy.proxy.context import Context
from test.mitmproxy.proxy import tutils
class TestLayer:
def test_continue(self, tctx: Context):
class TLayer(laye... |
seeds | import pytest
from dbt.tests.util import run_dbt
models__sample_model_sql = """
select * from {{ source("raw", "sample_seed") }}
"""
models__schema_yml = """
version: 2
sources:
- name: raw
database: "{{ target.database }}"
schema: "{{ target.schema }}"
tables:
- name: sample_seed
columns... |
id | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . im... |
clear markers | """
interface interactor.
"""
from .config import interface_color, pick_radius
from .interactor import BaseInteractor
from .util import clip, setpar
MAX_ROUGH=1
class InterfaceInteractor(BaseInteractor):
"""
Control the roughness of the layers.
"""
def __init__(self, profile):
BaseInteractor... |
test longer | # (C) Copyright 2005-2023 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... |
print dict | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019, Myrtle Software Limited. 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
#
# ... |
cleanup | #!/usr/bin/env python
import sys
from direct.showbase.ShowBase import ShowBase
from direct.showbase.InputStateGlobal import inputState
from panda3d.core import AmbientLight
from panda3d.core import DirectionalLight
from panda3d.core import LPoint3
from panda3d.core import TransformState
from panda3d.core import BitM... |
start django | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
import pytest
from tests import code, debug, log, net, test_data
from tests.debug import runners, targets
from tests.patterns import some
pytestmark = pytest.mark.t... |
test mcol gga ab ks | #!/usr/bin/env python
# Copyright 2022 The PySCF Developers. 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... |
delete | # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... |
test run builder | import shutil
from datetime import datetime
from pathlib import Path
import pytest
from click.testing import CliRunner
from maggma.builders import CopyBuilder
from maggma.cli import run
from maggma.stores import MemoryStore, MongoStore
from monty.serialization import dumpfn
@pytest.fixture()
def mongostore():
st... |
hull convex | #!BPY
"""
Name: 'Hull'
Blender: 244
Group: 'MESH'
Submenu: 'Box' box
Submenu: 'Sphere' sphere
Submenu: 'Convex' convex
Tooltip: 'Hull Selected Objects'
"""
#Submenu: 'Cylinder' cylinder
# --------------------------------------------------------------------------
# Hull 1.1 by Amorilia
# ----------------------------... |
teardown | # Copyright 2019 ARM Limited
#
# 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... |
on touch move | """
Drag Behavior
=============
The :class:`~kivy.uix.behaviors.drag.DragBehavior`
`mixin <https://en.wikipedia.org/wiki/Mixin>`_ class provides Drag behavior.
When combined with a widget, dragging in the rectangle defined by the
:attr:`~kivy.uix.behaviors.drag.DragBehavior.drag_rectangle` will drag the
widget.
Examp... |
clear reactions | import logging
import re
import sys
import os
from difflib import get_close_matches
from enum import IntEnum
from logging.handlers import RotatingFileHandler
from string import Formatter
import discord
from discord.ext import commands
import _string
try:
from colorama import Fore, Style
except ImportError:
F... |
wrap py func | # 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... |
sku | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . im... |
add | """
Manage groups on Solaris
.. important::
If you feel that Salt should be using this module to manage groups on a
minion, and it is using a different module (or gives an error similar to
*'group.info' is not available*), see :ref:`here
<module-provider-override>`.
"""
import logging
try:
import... |
wait on systemd | import queue
import subprocess
import threading
from steps.common import debug
class Podman:
def __init__(self, context, container_name):
self.context = context
self.container_name = container_name
self.container = None
debug(self.context, "Podman.__init__()")
self.new_co... |
l2 norm scale | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2017-2019, NVIDIA CORPORATION. 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
#
# htt... |
up | import os
import click
from aimcore.cli.utils import set_log_level, start_uvicorn_app
from aimcore.cli.ui.utils import build_db_upgrade_command, get_free_port_num
from aimcore.web.configs import (
AIM_UI_BASE_PATH,
AIM_UI_DEFAULT_HOST,
AIM_UI_DEFAULT_PORT,
AIM_UI_MOUNTED_REPO_PATH,
AIM_UI_TELEMETRY... |
train forward | # Copyright (c) 2020 PaddlePaddle 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 appli... |
get config settings | # Copyright 2015 Red Hat Inc.
#
# SPDX-License-Identifier: Apache-2.0
"""Bandit is a tool designed to find common security issues in Python code."""
import argparse
import importlib
import logging
import os
import sys
import yaml
from bandit.core import extension_loader
PROG_NAME = "bandit_conf_generator"
LOG = logg... |
test future cancel no underlying future | import os
import concurrent.futures as cf
import pytest
from parsl.app.errors import AppException
from parsl.executors.flux.executor import (
FluxExecutor,
FluxFutureWrapper,
_complete_future,
)
try:
import flux.job.executor # noqa: F401
except ImportError:
FLUX_AVAIL = False
else:
FLUX_AVAI... |
set | """
Support for Debconf
"""
import logging
import os
import re
import salt.utils.files
import salt.utils.path
import salt.utils.stringutils
import salt.utils.versions
log = logging.getLogger(__name__)
__func_alias__ = {"set_": "set"}
# Define the module's virtual name
__virtualname__ = "debconf"
def __virtual__(... |
setup | """ Substitution of osparc variables and secrets
"""
import logging
from collections.abc import Callable, Mapping
from copy import deepcopy
from typing import Any
from fastapi import FastAPI
from models_library.projects import ProjectID
from models_library.projects_nodes_io import NodeID
from models_library.services ... |
finalize submodules | from collections.abc import Iterable
from ..._utils import flatten, deprecated
from ...hdl import dsl, ir
__all__ = ["Module", "FinalizeError"]
def _flat_list(e):
if isinstance(e, Iterable):
return list(flatten(e))
else:
return [e]
class CompatFinalizeError(Exception):
pass
Finalize... |
import success message | """Display information to help diagnose install issues.
Currently shows
- OS info
- Python info
- Gtk3 availability (gi.repository vs pgi)
This can be complemented by running the unittests.
"""
import os
import platform
import sys
import traceback
from collections import namedtuple
COL_WIDTH = 10
AvailableModule... |
rebuild ctype | #
# Module which supports allocation of ctypes objects from shared memory
#
# multiprocessing/sharedctypes.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... |
test default realizations | from argparse import Namespace
from uuid import UUID
import pytest
from ert.cli import model_factory
from ert.libres_facade import LibresFacade
from ert.run_models import (
EnsembleExperiment,
EnsembleSmoother,
IteratedEnsembleSmoother,
MultipleDataAssimilation,
SingleTestRun,
)
@pytest.mark.par... |
run | """Support for OK-formatted test files"""
import os
import io
import doctest
import warnings
import pathlib
from contextlib import redirect_stderr, redirect_stdout
from textwrap import dedent
from .abstract_test import TestFile, TestCase, TestCaseResult
from ..utils import hide_outputs
def run_doctest(name, doctes... |
biosample characterization | import pytest
@pytest.fixture
def biosample_characterization_no_review(testapp, award, lab, biosample, attachment):
item = {
'characterizes': biosample['@id'],
'award': award['@id'],
'lab': lab['@id'],
'attachment': attachment,
}
return testapp.post_json('/biosample_charact... |
target positive classification loss | import numpy as np
import pytest
from paz.optimization.losses.multi_box_loss import MultiBoxLoss
@pytest.fixture
def loss():
return MultiBoxLoss()
@pytest.fixture
def y_true():
y_true = np.array(
[[38.38629, 48.666668, 10.362101, 11.512976, 0., 1.,
0., 0., 0., 0., 0., 0.,
0.,... |
get eeprom dom raw | # Platform-specific SFP transceiver interface for SONiC
# This plugin supports QSFP and SFP.
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil cl... |
impute inactive | from __future__ import annotations
from abc import abstractmethod
from typing import Any
import numpy as np
import sklearn.gaussian_process
from ConfigSpace import ConfigurationSpace
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Kernel, KernelOperator
from... |
get video url | # -*- coding: utf-8 -*-
# Copyright: (c) 2017, SylvainCecchetto
# GNU General Public License v2.0+ (see LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt)
# This file is part of Catch-up TV & More
from __future__ import unicode_literals
from builtins import str
import re
from codequick import Listitem, Resolve... |
getpwent r | #
# Module for simulation of utility "getent passwd -s sss" from coreutils
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License,... |
run patten check | # -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... |
dense strategy rocm | # 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 u... |
test calibration repr | # Copyright 2019 The Cirq 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
test pluto verify underflow | import pytest
hardware = ["pluto", "pluto_rev_c"]
classname = "adi.Pluto"
#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize(
"attr, start, stop, step, tol, repeats",
[
("tx_hardwaregain_chan0", -... |
get num psus | #
# psuutil.py
# Platform-specific PSU status interface for SONiC
#
import logging
import os.path
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
HWMON_PATH =... |
update compute cost | import copy
from typing import List
from colossalai.auto_parallel.tensor_shard.sharding_strategy import MemoryCost, ShardingStrategy, TrainCycleItem
from .strategy_generator import FollowingStrategyGenerator
__all__ = ['UnaryElementwiseGenerator']
class UnaryElementwiseGenerator(FollowingStrategyGenerator):
""... |
send error | import os
import signal
import subprocess
import sys
from contextlib import contextmanager
from io import TextIOWrapper
from subprocess import Popen
from time import sleep
from typing import Any, Iterator, NamedTuple, Optional, Sequence, Tuple
import dagster._check as check
from dagster._core.errors import DagsterErro... |
arn | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... |
properties | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . im... |
test get zone normal | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.modules.win_timezone as win_timezone
from salt.exceptions import CommandExecutionError
from tests.support.mock import MagicMock, patch
pytestmark = [
pytest.mark.skipif(not win_timezone.HAS_PYTZ, reason="This test requires py... |
prepare request | # pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... |
publish | import asyncio
import pickle
try: # pragma: no cover
from redis import asyncio as aioredis
from redis.exceptions import RedisError
except ImportError: # pragma: no cover
try:
import aioredis
from aioredis.exceptions import RedisError
except ImportError:
aioredis = None
... |
test withdraw twice | # These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/bank-account/canonical-data.json
# File last updated on 2023-07-20
import unittest
from bank_account import (
BankAccount,
)
class BankAccountTest(unittest.TestCase):
def test_newly... |
add publication trustlevels | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: proto
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class SubscriberFeatures(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode... |
send signal | import os
import re
import pwd, grp
from . import interfaces
import tuned.logs
import tuned.consts as consts
from inspect import ismethod
import socket
import json
import select
log = tuned.logs.get()
class UnixSocketExporter(interfaces.ExporterInterface):
"""
Export method calls through Unix Domain Socket Interfa... |
test sythesize sequences | import datetime
import pandas as pd
from deepecho import load_demo
from sdv.datasets.demo import download_demo
from sdv.metadata import SingleTableMetadata
from sdv.sequential import PARSynthesizer
def _get_par_data_and_metadata():
date = datetime.datetime.strptime('2020-01-01', '%Y-%m-%d')
data = pd.DataFr... |
from server address and domain | # -*- test-case-name: twisted.names.test.test_names -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
__all__ = ["SecondaryAuthority", "SecondaryAuthorityService"]
from twisted.application import service
from twisted.internet import defer, task
from twisted.names import client, common, dns,... |
test policy state spec is empty | # coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
build list by location request | # pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... |
perform http01 | """Example ACME-V2 API for HTTP-01 challenge.
Brief:
This a complete usage example of the python-acme API.
Limitations of this example:
- Works for only one Domain name
- Performs only HTTP-01 challenge
- Uses ACME-v2
Workflow:
(Account creation)
- Create account key
- Register account and a... |
check single value default metric | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... |
test last | # Licensed under the GPLv3 - see LICENSE
import sys
from importlib import reload
from importlib.metadata import EntryPoint, entry_points
import pytest
from .. import io as bio, vdif, base
class TestExistingIOFormat:
def setup_method(self):
dir(bio) # Ensure entries are loaded.
self.vdif_entry =... |
create module obj | # ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.