id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
2,600 | set mkl envs | #!/usr/bin/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import sys
import subprocess as sp
DEFAULT_SEASTAR_PORT="3333"
JEMALLOC_244 = "libjemalloc.so.2.4.4"
JEMALLOC_251 = "libjemalloc.so.2.5.1"
def gen_cluster_info(worksp... |
2,601 | forward | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from fairseq import utils
from fairseq.logging import metrics
from fairseq.criterions import register_criterion
from .label_smoo... |
2,602 | list experiment | """
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... |
2,603 | gen kjt | from collections import namedtuple
from functools import partial
import torch
from torchrec.models import deepfm, dlrm
from torchrec.modules.embedding_configs import EmbeddingBagConfig
from torchrec.modules.embedding_modules import EmbeddingBagCollection
from torchrec.sparse.jagged_tensor import KeyedJaggedTensor, Key... |
2,604 | test api no valid parameters | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2022, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
import pytest
from wetterdienst.exceptions import NoParametersFound
from wetterdienst.provider.dwd.observation import (
DwdObservationDataset,
DwdObservationRequest,
... |
2,605 | get standard fx prices | """
Spot fx prices
"""
import numpy as np
import pandas as pd
import datetime
from sysdata.base_data import baseData
from syscore.pandas.merge_data_keeping_past_data import SPIKE_IN_DATA
from syslogging.logger import *
from sysobjects.spot_fx_prices import fxPrices, get_fx_tuple_from_code, DEFAULT_CURRENCY
DEFAULT_... |
2,606 | test gen export chunk filename | import builtins
import gzip
import itertools
import glob
import os
from unittest import TestCase
from pipelinewise.fastsync.commons import split_gzip
DATA_WITH_100_BYTES = b"""0,12345678
1,12345678
2,12345678
3,12345678
4,12345678
5,12345678
6,12345678
7,12345678
8,12345678
9,12345678
"""
def unlink(filename):
... |
2,607 | perform create | from django.db import transaction
from django.utils.translation import gettext_lazy as _
import django_filters
import reversion
from rest_framework import exceptions, serializers, viewsets
from resources.api.base import NullableDateTimeField, TranslatedModelSerializer, register_view
from .models import CateringProdu... |
2,608 | test update by | #
# Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
#
import time
import unittest
from pyarrow import csv
from pydeephaven import DHError, agg
from pydeephaven.updateby import ema_tick, cum_prod
from tests.testbase import BaseTestCase
class QueryTestCase(BaseTestCase):
def test_tail_update_stati... |
2,609 | start | """Websockets Transport classes and functions."""
import asyncio
import logging
from typing import Optional
from aiohttp import WSMessage, WSMsgType, web
from ...messaging.error import MessageParseError
from ..error import WireFormatParseError
from .base import BaseInboundTransport, InboundTransportSetupError
LOGG... |
2,610 | test system importer file csv upload get | import urllib.parse
from django.contrib.auth.models import User
from django.contrib.messages import get_messages
from django.test import TestCase
from dfirtrack_main.tests.system_importer.config_functions import (
set_csv_import_username,
set_csv_skip_existing_system,
)
class SystemImporterFileCsvUploadGetM... |
2,611 | port to eeprom mapping | try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
class SfpUtil(SfpUtilBase):
"""Platform specific SfpUtill class"""
_port_start = 0
_port_end = ... |
2,612 | from text | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and ... |
2,613 | ref maximum2 | # Copyright 2017,2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... |
2,614 | quaternion canonize | """
This module contains functions that operate on and/or return quaternions.
Notes
-----
The default convention to represent a quaternion :math:`q` in this module is by four real values **w**, **x**, **y**, **z**.
The first value **w** is the scalar (real) part, and **x**, **y**, **z** form the vector (complex, imagi... |
2,615 | make undirected | import os
import pickle
import random
import time
import dgl
import numpy as np
import scipy.sparse as sp
import torch
from dgl.data.utils import (
_get_dgl_url,
download,
extract_archive,
get_download_dir,
)
from torch.utils.data import DataLoader
def ReadTxtNet(file_path="", undirected=True):
... |
2,616 | connect | # This file is part of HEPData.
# Copyright (C) 2016 CERN.
#
# HEPData 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 2 of the
# License, or (at your option) any later version.
#
# HEPData is d... |
2,617 | test ensure rgb from provider | import pytest
import numpy as np
import tensorflow as tf
from sleap.nn.system import use_cpu_only
use_cpu_only() # hide GPUs for test
from sleap.nn.data import normalization
from sleap.nn.data import providers
def test_ensure_min_image_rank():
assert normalization.ensure_min_image_rank(tf.zeros([2, 2])).shape ... |
2,618 | forward | # Tencent is pleased to support the open source community by making ncnn available.
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the... |
2,619 | test read | import os
import unittest
from lammps.formats import LogFile, AvgChunkFile
has_yaml = False
try:
import yaml
has_yaml = True
try:
from yaml import CSafeLoader as Loader, CSafeDumper as Dumper
except ImportError:
from yaml import SafeLoader, SafeDumper
except:
pass
EXAMPLES_DIR=os.p... |
2,620 | correct shares | """ Priority corrector for the group and in-group shares
"""
from DIRAC import gLogger, S_OK, S_ERROR
from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.WorkloadManagementSystem.private.correctors.BaseCorrector import BaseCorr... |
2,621 | test digester | # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the dandi package for the
# copyright and license terms.
#
# ## ### ### ... |
2,622 | send mynt from multisig to fee sharing | from brownie import *
import json
from scripts.utils import *
import scripts.contractInteraction.config as conf
def getBalance(contractAddress, acct):
contract = Contract.from_abi("Token", address=contractAddress, abi=LoanToken.abi, owner=conf.acct)
balance = contract.balanceOf(acct)
print(balance/1e18)
... |
2,623 | emulator | #!/usr/bin/env python
#
# Copyright (C) 2015 GNS3 Technologies 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, or
# (at your option) any later version.
#
... |
2,624 | get shard range | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# https://github.com/pytorch/fairseq/blob/265df7144c79446f5ea8d835bda6e727f54dad9d/LICENSE
import logging
from pathlib import Path
from typing import Optional, Tuple, Union
impo... |
2,625 | metadatas | import types
import typing
from _typeshed import Incomplete
from collections.abc import Generator
from dataclasses import Field
from mashumaro.config import (
ADD_DIALECT_SUPPORT as ADD_DIALECT_SUPPORT,
ADD_SERIALIZATION_CONTEXT as ADD_SERIALIZATION_CONTEXT,
BaseConfig as BaseConfig,
SerializationStrate... |
2,626 | test hop 2 2 forwards | import pandas as pd
from common import NoAuthTestCase
from functools import lru_cache
from graphistry.tests.test_compute import CGFull
@lru_cache(maxsize=1)
def hops_graph():
nodes_df = pd.DataFrame([
{'node': 'a'},
{'node': 'b'},
{'node': 'c'},
{'node': 'd'},
{'node': 'e'... |
2,627 | test approve testing | # Copyright © 2016-2019 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
# 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 2
# of the License, or (at your option) any lat... |
2,628 | test equality same object | # (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... |
2,629 | setup | """
Move with a Sprite Animation
Simple program to show basic sprite usage.
Artwork from https://kenney.nl
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.sprite_move_animation
"""
from __future__ import annotations
import arcade
import random
SCREE... |
2,630 | decode state | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import binascii
from base64 import b64decode, b64encode
from typing import Optional, Tuple, cast
import urllib3.... |
2,631 | handle group change | """
core node services
"""
import tkinter as tk
from tkinter import messagebox, ttk
from typing import TYPE_CHECKING, Optional
from core.api.grpc.wrappers import Node
from core.gui.dialogs.dialog import Dialog
from core.gui.dialogs.serviceconfig import ServiceConfigDialog
from core.gui.themes import FRAME_PAD, PADX, P... |
2,632 | append path | from typing import Any, Optional
class Context:
def __init__(self, target: Any) -> None: ...
def get_target(self): ...
def save(self) -> None: ...
def restore(self) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ...
def push_group... |
2,633 | disassemble to gtirb | import contextlib
from pathlib import Path
import os
import subprocess
import tempfile
import typing
import gtirb
class SnippetTestException(Exception):
"""
Custom exceptions raised by snippet tests
"""
@contextlib.contextmanager
def assemble_snippet(
snippet: str, arch=gtirb.Module.ISA
) -> typing... |
2,634 | test fake lvcreate non zeroed | import unittest
import unittest.mock as mock
import lvmlib
class ExecResultMixIn(object):
def assertExecutionSucceeded(self, exec_result):
returncode, stdout, stderr = exec_result
self.assertEqual(0, returncode)
def assertExecutionFailed(self, exec_result):
returncode, stdout, stder... |
2,635 | test lf source lf patch | # Copyright (C) 2014 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from pathlib import Path
from subprocess import CalledProcessError
from textwrap import dedent
from types import SimpleNamespace
import pytest
from conda_build.source import (
_ensure_CRLF,
_ensure_L... |
2,636 | schedule | import os
import argparse
from functools import partial
import numpy as np
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from tensorflow.keras import callbacks as cb
from paz.models import ProtoEmbedding, ProtoNet
from paz.utils import build_directory, write_dictionary, write_weights
from paz.d... |
2,637 | system data | # 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... |
2,638 | redraw view | from PyQt5.QtCore import QTimer, pyqtSlot, Qt, pyqtSignal
from PyQt5.QtGui import QIcon, QKeySequence, QWheelEvent, QCursor, QContextMenuEvent
from PyQt5.QtWidgets import QAction, QMenu
from urh.ui.painting.SceneManager import SceneManager
from urh.ui.views.SelectableGraphicView import SelectableGraphicView
from urh.u... |
2,639 | test script | # 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... |
2,640 | get group count | # rhndb.py -- Database functions
# Copyright (C) 2007 NC State University
# Written by Jack Neely <jjneely@ncsu.edu>
#
# 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 2 of the Lic... |
2,641 | test dict order parallel | import pytest
import numpy as np
from firedrake import *
@pytest.fixture(scope="module")
def m():
return UnitIntervalMesh(2)
@pytest.fixture
def f(m):
cg = FunctionSpace(m, "CG", 1)
dg = FunctionSpace(m, "DG", 0)
c = Function(cg)
d = Function(dg)
return c, d
@pytest.fixture
def f_mixed(m... |
2,642 | test can mix fixture and positional strategy | # This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Copyright the Hypothesis Authors.
# Individual contributors are listed in AUTHORS.rst and the git log.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the... |
2,643 | set up | """Tests for certbot.plugins.storage.PluginStorage"""
import json
import sys
from typing import Iterable
from typing import List
from typing import Optional
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certb... |
2,644 | start | import asyncio
import json
import socket
import time
from typing import Tuple
from app.utility.base_world import BaseWorld
from plugins.manx.app.c_session import Session
class Contact(BaseWorld):
def __init__(self, services):
self.name = 'tcp'
self.description = 'Accept beacons through a raw TC... |
2,645 | test gen poll url text | # Copyright (c) 2021 elParaguayo
#
# 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, modify, merge, publish, distrib... |
2,646 | test bad data4 | from unittest import mock # noqa
import pytest
from awx.api.versioning import reverse
"""
def run_test_ad_hoc_command(self, **kwargs):
# Post to list to start a new ad hoc command.
expect = kwargs.pop('expect', 201)
url = kwargs.pop('url', reverse('api:ad_hoc_command_list'))
data... |
2,647 | build allocate ip data | #!/usr/bin/env python3
"""
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" BASI... |
2,648 | report | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Teachers that wrap around other teachers, for instance, to modify message fields while
keeping the examples/episodes ... |
2,649 | user data | import jwt
from social_core.backends.oauth import BaseOAuth2
class KeycloakOAuth2(BaseOAuth2): # pylint: disable=abstract-method
"""Keycloak OAuth2 authentication backend
This backend has been tested working with a standard Keycloak installation,
but you might have to specialize it and tune the paramet... |
2,650 | is buffer empty | import logging
from typing import Union, Dict
import numpy as np
from .abstract_recorder import *
class VideoRecorder(Recorder):
"""
Writes video streams (.mjpeg/.h264/.hevc) or directly to mp4/avi container.
"""
def __init__(self, lossless: bool = False):
self.path = None
self._str... |
2,651 | load state 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... |
2,652 | test configure crc ranges | import array
from tests.QtTestCase import QtTestCase
from urh.controller.widgets.ChecksumWidget import ChecksumWidget
from urh.controller.dialogs.ProtocolLabelDialog import ProtocolLabelDialog
from urh.signalprocessing.ChecksumLabel import ChecksumLabel
from urh.signalprocessing.FieldType import FieldType
from urh.sig... |
2,653 | data arrays to quantities | from typing import Hashable, Mapping, MutableMapping, Set
import cftime
import pace.util
import fv3gfs.wrapper
import fv3gfs.wrapper._properties
import numpy as np
import xarray as xr
from runtime.names import DELP, PHYSICS_PRECIP_RATE, TIME_KEYS
from runtime.types import State
from toolz import dissoc
from vcm import... |
2,654 | make d bconnection | # If Hecke eigenfield is in the LMFDB, expresses eigenvalues in terms of listed integral basis
# TODO: Integrate with LLL-reduced basis? (see NotImplementedError below)
import pymongo, hashlib
from sage.all import PolynomialRing, QQ, preparse, gp, NumberField, matrix, vector
#from sage.all import *
#P = subprocess.Po... |
2,655 | test falls back to fallback if termios | import getpass
import os
import unittest
from io import BytesIO, StringIO, TextIOWrapper
from unittest import mock
from test import support
try:
import termios
except ImportError:
termios = None
try:
import pwd
except ImportError:
pwd = None
@mock.patch('os.environ')
class GetpassGetuserTest(unittest.... |
2,656 | panic | # SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
import errno
import threading
import sanlock
import pytest
from vdsm.common.units import MiB
from vdsm.storage import clusterlock
from vdsm.storage import exception as se
from vdsm.storage import spwd
class WatchdogCallback:
d... |
2,657 | test version metadata | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import copy
from typing import Callable # noqa: F401
import pytest
import requests
from datadog_checks.azure_iot_edge import AzureIoTEdgeCheck
from datadog_checks.azure_iot_edge.types import Instance #... |
2,658 | gaussian1d moments | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The module contains tools for centroiding sources using Gaussians.
"""
import warnings
import numpy as np
from astropy.modeling.fitting import LevMarLSQFitter
from astropy.modeling.models import Const1D, Const2D, Gaussian1D, Gaussian2D
from astropy.u... |
2,659 | test alter column | from unittest import TestCase
from piccolo.apps.migrations.auto import MigrationManager, SchemaSnapshot
class TestSchemaSnaphot(TestCase):
def test_add_table(self):
"""
Test adding tables.
"""
manager_1 = MigrationManager()
manager_1.add_table(class_name="Manager", tablena... |
2,660 | remotes | # This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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 2
... |
2,661 | stop test run | """Test result object"""
import os
import sys
import traceback
from StringIO import StringIO
from . import util
from functools import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'failfast', False):
self.stop()
retur... |
2,662 | queryset | from django.conf import settings
from django.contrib import admin
from django.core.exceptions import ObjectDoesNotExist
from django.urls import NoReverseMatch
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from geotrek.common.mixins.actions import MergeActionMixin
fro... |
2,663 | action | # 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... |
2,664 | test mask cube 2d in place | # Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Test function :func:`iris.util.mask_cube"""
# Import iris.tests first so that some things can be initialised before
# impor... |
2,665 | get watchers | # -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2021-present Kaleidos Ventures SL
from django.core.exceptions import ObjectDoe... |
2,666 | validate schema | from datasets.arrow_dataset import Batch
from transformers import BatchEncoding
from datasets import Dataset
from typing import Tuple, List
import torch
from primeqa.mrc.processors.preprocessors.abstract import AbstractPreProcessor
class ELI5FiDPreprocessor(AbstractPreProcessor):
_ignore_pad_token_for_loss =... |
2,667 | test source serializer needs a file module | import importlib
import sys
from pathlib import Path
from types import ModuleType
from typing import Generator
import pytest
from prefect.packaging.serializers import (
ImportSerializer,
PickleSerializer,
SourceSerializer,
)
def foo(return_val="foo"):
return return_val
@pytest.mark.parametrize(
... |
2,668 | create programmer | #
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2023 Charles-Henri Mousset <ch.mousset@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
# The Colorlight 5A-75B PCB and IOs have been documented by @miek and @smunaut:
# https://github.com/q3k/c... |
2,669 | create loss | # 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... |
2,670 | disarm | #!/usr/bin/env python
#############################################################################
#
# Watchdog contains an implementation of SONiC Platform Base Watchdog API
#
#############################################################################
import fcntl
import os
import array
try:
from sonic_platf... |
2,671 | add sort | import logging
from django.utils.safestring import mark_safe
from elasticsearch_dsl import A
from elasticsearch_dsl.query import Q
logger = logging.getLogger(__name__)
def _make_values_lists(kwargs):
return {k: v if isinstance(v, (list, tuple)) else [v] for k, v in kwargs.items()}
class EmtpyResponse(list):
... |
2,672 | sort ies | #!/usr/bin/env python3
# Allow direct execution
import os
import shutil
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from inspect import getsource
from devscripts.utils import get_filename_args, read_file, write_file
NO_ATTR = object()
STATIC_CLASS_PROPERTIES = [
... |
2,673 | test zeroconf custom addresses | """Test suit for pairing process with Apple TV."""
import ipaddress
from unittest.mock import MagicMock
import pytest
import pytest_asyncio
from pyatv.conf import AppleTV, ManualService
from pyatv.const import Protocol
from pyatv.core import create_core
from pyatv.protocols.dmap import pairing, parser, tag_definitio... |
2,674 | test require group | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Tests `requires_provides.py`.
"""
import unittest
from antlir.compiler.requires_provides import (
_normalize... |
2,675 | handle connect | # this code based on Daniel Krech's RDFLib HTTP client code (see rdflib.dev)
import sys
import socket
from supervisor.compat import as_bytes
from supervisor.compat import as_string
from supervisor.compat import encodestring
from supervisor.compat import PY2
from supervisor.compat import urlparse
from supervisor.medus... |
2,676 | assert correct yesno call | """Tests for certbot._internal.eff."""
import datetime
import sys
import unittest
from unittest import mock
import josepy
import pytest
import pytz
import requests
from acme import messages
from certbot._internal import account
from certbot._internal import constants
import certbot.tests.util as test_util
_KEY = jos... |
2,677 | test arithmetic drops references | import sys
import os
import mmap
import pytest
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryFile
from numpy import (
memmap, sum, average, prod, ndarray, isscalar, add, subtract, multiply)
from numpy import arange, allclose, asarray
from numpy.testing import (
assert_, assert_equ... |
2,678 | test reschedule public from other user | # -*- coding: utf-8 -*-
"""
Akvo RSR is covered by the GNU Affero General Public License.
See more details in the license.txt file located at the root folder of the Akvo RSR module.
For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
"""
from unittest.mock import ANY
from ... |
2,679 | with is active | """
Copyright 2022 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... |
2,680 | test on stop | # 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.
# ---------------------------------------------------------------------... |
2,681 | test str repr returns expected string | # -------------------------------------------------------------------------------------------------
# Copyright (C) 2015-2023 Nautech Systems Pty Ltd. All rights reserved.
# https://nautechsystems.io
#
# Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
# You may not use this file ex... |
2,682 | test add season membership | # Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Test the coordinate categorisation functions.
"""
# import iris tests first so that some things can be initialised before ... |
2,683 | test python recall | # Copyright (c) Recommenders contributors.
# Licensed under the MIT License.
import numpy as np
import pandas as pd
import pytest
from sklearn.preprocessing import minmax_scale
from recommenders.utils.constants import (
DEFAULT_USER_COL,
DEFAULT_ITEM_COL,
DEFAULT_RATING_COL,
DEFAULT_PREDICTION_COL,
... |
2,684 | get unicode category | '''
unicode_data.py
---------------
Python's unicodedata module uses an outdated spec (Unicode 5.2) and since
e.g. unicode categories are used in tokenization, we'd like to keep this
as up-to-date as possible with the latest standard.
'''
import csv
import os
import sys
from collections import defaultdict, namedtuple
... |
2,685 | name | # 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 . imp... |
2,686 | generate bias | # Copyright (c) 2021 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... |
2,687 | copy | # 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... |
2,688 | set iio attr | # Copyright (C) 2019-2023 Analog Devices, Inc.
#
# SPDX short identifier: ADIBSD
import re
def get_numbers(s):
v = re.findall(r"[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?", s)
v = [float(i) for i in v]
if len(v) == 1:
v = v[0]
if int(v) == v:
v = int(v)
return v
... |
2,689 | with encoder | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from typing import Union
import torch
from mmengine.model.base_model import BaseModel
from mmocr.utils import (OptConfigType, OptMultiConfig, OptRecSampleList,
RecForwardResults, RecSampleList)
class Bas... |
2,690 | optional arg decorator | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Name: common/decorators.py
# Purpose: Decorators for functions
#
# Authors: Michael Scott Asato Cuthbert
# Christopher Ariza
#
# Copyright: Copyright © 2009-2015 Michael Scott As... |
2,691 | before case | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Any
from assertpy import assert_that
from lisa import (
Logger,
Node,
TestCaseMetadata,
TestSuite,
TestSuiteMetadata,
simple_requirement,
)
from lisa.base_tools import Cat
from lisa.operating_system imp... |
2,692 | find source files | import os
from enum import Enum
from pathlib import Path
from typing import List
from strictdoc.core.file_tree import File, FileFinder
from strictdoc.core.project_config import ProjectConfig
from strictdoc.core.source_tree import SourceTree
from strictdoc.helpers.auto_described import auto_described
class SourceFile... |
2,693 | test scale global to worker tpu | # Copyright 2020 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... |
2,694 | new timer | import ctypes
import signal
import threading
class BaseTimeoutException(Exception):
"""Base exception for timeouts."""
pass
class JobTimeoutException(BaseTimeoutException):
"""Raised when a job takes longer to complete than the allowed maximum
timeout value.
"""
pass
class HorseMonitorTi... |
2,695 | class builder | """Test for the invalid-name warning."""
# pylint: disable=unnecessary-pass, unnecessary-comprehension, unused-private-member
# pylint: disable=unnecessary-lambda-assignment
import abc
import collections
import typing
from enum import Enum
from typing import ClassVar
GOOD_CONST_NAME = ''
bad_const_name = 0 # [invalid... |
2,696 | test copy batch kms | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
2,697 | generic 3d check | import numpy as np
from .crop_zero_planes import CropExternalZeroplanes
from .non_zero_normalize import NonZeroNormalizeOnMaskedRegion
from .threshold_and_clip import (
threshold_transform,
clip_transform,
)
from .normalize_rgb import (
normalize_by_val_transform,
normalize_imagenet_transform,
norm... |
2,698 | test attack comparator with preproc | #!/usr/bin/env python3
import collections
from typing import List
import torch
from captum.robust import AttackComparator, FGSM
from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
from tests.helpers.basic_models import BasicModel, BasicModel_MultiLayer
from torch import Tensor
def float_metric(model_ou... |
2,699 | type | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.