id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
4,700 | run git http | # Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
import os.path
import subprocess
from base64 import b64decode
from email import message_from_string
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.http.response import HttpRes... |
4,701 | header impl | load("//kythe/docs:asciidoc.bzl", "AsciidocInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:shell.bzl", "shell")
_AsciidocHeaderInfo = provider(
fields = {"header": "File with the asciidoc header."},
)
_SiteDocsInfo = provider()
def METHOD_NAME(target, ctx):
src = ctx.rule.file.s... |
4,702 | to constraint | # bluemira is an integrated inter-disciplinary design tool for future fusion
# reactors. It incorporates several modules, some of which rely on other
# codes, to carry out a range of typical conceptual fusion reactor design
# activities.
#
# Copyright (C) 2021-2023 M. Coleman, J. Cook, F. Franza, I.A. Maione, S. McInto... |
4,703 | sync skaled config with upstream | # -*- coding: utf-8 -*-
#
# This file is part of SKALE Admin
#
# Copyright (C) 2021 SKALE Labs
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... |
4,704 | run app | #!/usr/bin/env python
import os
import sys
import falcon
from db_orm import session, World, Fortune
from helpers import load_template, FortuneTuple, generate_ids, sanitize
from operator import attrgetter
from random import randint
from email.utils import formatdate
# -------------------------------------------------... |
4,705 | test can convert level set to mesh | ##########################################################################
#
# Copyright (c) 2017, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... |
4,706 | test get attestation | from unittest.mock import patch
import pytest
from eth_keys import keys
from eth_utils.conversions import to_bytes
from hexbytes import HexBytes
from solders.pubkey import Pubkey
from web3 import Web3
from integration_tests.queries.test_get_challenges import setup_db
from src.queries.get_attestation import (
ADD_... |
4,707 | test prepare inventory command | # -*- coding: utf-8 -*-
import os
import pytest
from ansible_runner.config.inventory import InventoryConfig
from ansible_runner.config._base import BaseExecutionMode
from ansible_runner.exceptions import ConfigurationError
from ansible_runner.utils import get_executable_path
def test_ansible_inventory_init_defaults... |
4,708 | c comment | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Convert plain qtest traces to C or Bash reproducers
Use this to help build bug-reports or create in-tree reproducers for bugs.
Note: This will not format C code for you. Pipe the output through
clang-format -style="{BasedOnStyle: llvm, IndentWidth: 4, ColumnLimit: 90... |
4,709 | from bitwidth | import enum
import numpy as np
from .abstract import Dummy, Hashable, Literal, Number, Type
from functools import total_ordering, cached_property
from numba.core import utils
from numba.core.typeconv import Conversion
from numba.np import npdatetime_helpers
class Boolean(Hashable):
def cast_python_value(self, ... |
4,710 | get render window | #import sys
from vtk import vtkCamera
#import vtk.util
#VTK_FLOAT = 1
#VTK_UNSIGNED_CHAR = 2
#VTK_UNSIGNED_SHORT = 3
#VTK_UNSIGNED_INT = 4
#VTK_VERSION = '7.1.1'
#class vtkLine:
#def __init__(self):
#pass
#class vtkTriangle:
#def __init__(self):
#pass
#class vtkQuad:
#def __init__(self):
... |
4,711 | test issue 1856 reverse | import textwrap
from parameterized import parameterized
import hedy
import hedy_translation
from tests.Tester import HedyTester
# tests should be ordered as follows:
# * Translation from English to Dutch
# * Translation from Dutch to English
# * Translation to several languages
# * Error handling
class TestsTransl... |
4,712 | check target | # 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... |
4,713 | check first stage | """
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from cfnlint.rules import CloudFormationLintRule, RuleMatch
class CodepipelineStages(CloudFormationLintRule):
"""Check if CodePipeline Stages are set up properly."""
id = "E2540"
shortdesc = "CodePip... |
4,714 | test probabilities negative exception | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
4,715 | stack | from __future__ import annotations
from dataclasses import dataclass
from typing import ClassVar, Callable, Optional, Union, cast
import numpy as np
from pandas import DataFrame
from seaborn._core.groupby import GroupBy
from seaborn._core.scales import Scale
from seaborn._core.typing import Default
default = Default... |
4,716 | test flush publishes request to inbox | # Copyright 2017 Workiva
# 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, software
#... |
4,717 | using positions and prices merged from fills | import numpy as np
import pandas as pd
from syscore.constants import arg_not_supplied
from systems.accounts.pandl_calculators.pandl_calculation import (
pandlCalculation,
apply_weighting,
)
from sysobjects.fills import ListOfFills, Fill
class pandlCalculationWithFills(pandlCalculation):
def __init__(sel... |
4,718 | get activated threads | # Copyright (C) 2007 Samuel Abels
#
# This file is part of SpiffWorkflow.
#
# SpiffWorkflow 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.0 of the License, or (at your option) any l... |
4,719 | filter task type | # mypy: ignore-errors
""" Core definition of a Q-Chem Task Document """
from typing import Any, Dict, List, Optional, Callable
from pydantic import BaseModel, Field
from pymatgen.core.structure import Molecule
from emmet.core.structure import MoleculeMetadata
from emmet.core.task import BaseTaskDocument
from emmet.c... |
4,720 | check scopes | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from itertools import groupby
from operator import itemgetter
from typing import Any, List, Mapping, Tuple
import pendulum
import requests
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.s... |
4,721 | inject view methods | from django.core.exceptions import ImproperlyConfigured
from django.urls import reverse
from django.utils.functional import cached_property
from wagtail.admin.menu import WagtailMenuRegisterable, WagtailMenuRegisterableGroup
class ViewSet(WagtailMenuRegisterable):
"""
Defines a viewset to be registered with ... |
4,722 | shared ciphers | import io
import socket
import ssl
from ..exceptions import ProxySchemeUnsupported
from ..packages import six
SSL_BLOCKSIZE = 16384
class SSLTransport:
"""
The SSLTransport wraps an existing socket and establishes an SSL connection.
Contrary to Python's implementation of SSLSocket, it allows you to cha... |
4,723 | write collateral | import json
import argparse
hMetals = {"metal%d" % i for i in range(2,6,2)}
vMetals = {"metal%d" % i for i in range(1,6,2)}
metals = ["metal%d" % i for i in range(1,6)]
vias = ["via%d" % i for i in range(1,5)]
def generateVia( tech, v, l, u, l_width, u_width, l_space, u_space):
halfSpace1 = "%.3f" % (l_sp... |
4,724 | recover | import sys
import typing as t
from rich.tree import Tree
from rich.panel import Panel
from rich.pretty import Pretty
from starwhale.utils import console, pretty_bytes
from starwhale.consts import CREATED_AT_KEY, DEFAULT_PAGE_IDX, DEFAULT_PAGE_SIZE
from starwhale.base.view import BaseTermView
from starwhale.base.uri.p... |
4,725 | exceeds cache size limit | import logging
import types
import weakref
from dataclasses import dataclass
from . import config
log = logging.getLogger(__name__)
"""
[Note on cache size limit]
Background - TorchDynamo cache is a linked list. Each cache entry is a
(check_fn, out_code, next pointer). These are stored on the f_code's co_extra
scrat... |
4,726 | init stubs | #!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... |
4,727 | convert nest | """
Convert weights from https://github.com/google-research/nested-transformer
NOTE: You'll need https://github.com/google/CommonLoopUtils, not included in requirements.txt
"""
import sys
import numpy as np
import torch
from clu import checkpoint
arch_depths = {
'nest_base': [2, 2, 20],
'nest_small': [2, 2... |
4,728 | test chemception classification | import os
import numpy as np
import tempfile
import pytest
from flaky import flaky
import deepchem as dc
from deepchem.feat import create_char_to_idx, SmilesToSeq, SmilesToImage
from deepchem.molnet.load_function.chembl25_datasets import CHEMBL25_TASKS
try:
from deepchem.models import Smiles2Vec, ChemCeption
... |
4,729 | test leeway global today | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of OpenDrift.
#
# OpenDrift 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, version 2
#
# OpenDrift is distributed in the hope that it will b... |
4,730 | tie average dcg | # 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... |
4,731 | test subtitle small numbers a4 | from django.http import QueryDict
from django.test import tag
from resources.generators.SortingNetworkCardsResourceGenerator import SortingNetworkCardsResourceGenerator
from tests.resources.generators.utils import BaseGeneratorTest
@tag("resource")
class SortingNetworkCardsResourceGeneratorTest(BaseGeneratorTest):
... |
4,732 | test post phase project archived | import pytest
import rules
from adhocracy4.projects.enums import Access
from adhocracy4.test.helpers import freeze_phase
from adhocracy4.test.helpers import freeze_post_phase
from adhocracy4.test.helpers import freeze_pre_phase
from adhocracy4.test.helpers import setup_phase
from adhocracy4.test.helpers import setup_u... |
4,733 | remove label at | from PyQt5.QtCore import QAbstractTableModel, Qt, QModelIndex, pyqtSignal
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import qApp
from urh import settings
from urh.signalprocessing.FieldType import FieldType
from urh.signalprocessing.MessageType import MessageType
from urh.signalprocessing.ProtocoLabel import P... |
4,734 | disk state paths iter | import os
from collections.abc import AsyncGenerator, Generator, Iterator
from functools import cached_property
from pathlib import Path
from fastapi import FastAPI
from models_library.projects_nodes import NodeID
from models_library.services import RunID
from servicelib.docker_constants import PREFIX_DYNAMIC_SIDECAR_... |
4,735 | log batch | from typing import Any, Dict, List, Optional
import torch
import wandb
from tango.common.exceptions import ConfigurationError
from tango.integrations.torch.train_callback import TrainCallback
from tango.integrations.torch.util import peak_gpu_memory
from .util import check_environment
from .workspace import WandbWor... |
4,736 | list | # 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 may ... |
4,737 | proxy | r"""
This code was generated by
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
Twilio - Studio
... |
4,738 | remove dirs | """Python script to build the OSX universal binaries.
Stolen with thankfulness from the numpy distribution
This is a simple script, most of the heavy lifting is done in bdist_mpkg.
To run this script: 'python build.py'
Installer is built using sudo so file permissions are correct when installed on
user system. Sc... |
4,739 | get field full config | #!/usr/bin/python3
"""
Config save in DB
===================
"""
import os
import sys
import redis
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib'))
from lib import ConfigLoader
config_loader = ConfigLoader.ConfigLoader()
r_serv_db = config_loader.get_redis_conn("_DB")
config_loader = None
#### TO PUT ... |
4,740 | update token | import asyncio
import contextlib
import json
from copy import copy
from pathlib import Path
from typing import TYPE_CHECKING, Mapping, Optional, Union
import aiohttp
from lavalink.rest_api import LoadResult
from red_commons.logging import getLogger
from redbot.core import Config
from redbot.core.bot import Red
from ... |
4,741 | is chat member | import logging
from typing import Optional, Tuple, Union
from telegram import Bot, InlineKeyboardMarkup, Message, ParseMode
from telegram.error import BadRequest, InvalidToken, Unauthorized
from telegram.utils.request import Request
from apps.alerts.models import AlertGroup
from apps.base.utils import live_settings
f... |
4,742 | reset | try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class SfpUtil(SfpUtilBase):
"""Platform specific SfpUtill class"""
_port_start = 1
_port_end = 54
_qsfp_port_start = 49
_ports_in_block = 5... |
4,743 | enable universal checkpoint | # Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0
# DeepSpeed Team
import os
import torch
import types
from .constants import (FP32_WEIGHT_KEY, PARAM, VOCAB_DIVISIBILITY_PADDING_TENSOR, CAT_DIM)
def load_hp_checkpoint_state(self, folder, tp_rank, tp_world_size):
hp_mapping = self._hp_... |
4,744 | test notify service owners | import mock
from kubernetes.client import V1DeleteOptions
from pysensu_yelp import Status
from paasta_tools.kubernetes.bin.kubernetes_remove_evicted_pods import (
evicted_pods_per_service,
)
from paasta_tools.kubernetes.bin.kubernetes_remove_evicted_pods import EvictedPod
from paasta_tools.kubernetes.bin.kubernete... |
4,745 | pause stop commands | # Copyright (c) 2017 The University of Manchester
#
# 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 ... |
4,746 | validate docker env | import logging
import os
import posixpath
import shutil
import subprocess
import tempfile
import urllib.parse
import urllib.request
import docker
from mlflow import tracking
from mlflow.environment_variables import MLFLOW_TRACKING_URI
from mlflow.exceptions import ExecutionException
from mlflow.projects.utils import M... |
4,747 | wrapped | import functools
import logging
import queue
import threading
import time
class _CallbackThread(threading.Thread):
"A queue-based callback dispatcher thread"
def __init__(
self,
name,
*,
dispatcher,
logger,
context,
stop_event,
timeout,
... |
4,748 | get nested columns | # -*- coding: utf-8 -*-
#
# Copyright (C) Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
4,749 | num boxes static | # Copyright 2020 Google Research. 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 applicable law... |
4,750 | change input | import sys
import math
import numpy as np
import Orange.data
from Orange.widgets.widget import OWWidget, Msg, Input, Output
from Orange.widgets import gui, settings
from AnyQt.QtWidgets import QFormLayout, QWidget
from orangecontrib.spectroscopy.data import getx
from orangecontrib.spectroscopy.preprocess import Inte... |
4,751 | test single color ciede94 | """Test for correctness of color distance functions"""
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal, assert_equal
from skimage._shared.testing import fetch
from skimage._shared.utils import _supported_float_type
from skimage.color.delta_e import (deltaE_cie76, deltaE... |
4,752 | test unmaskedarray | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pickle
import numpy as np
import pytest # noqa: F401
import awkward as ak
ak_Array = ak.highlevel.Array
ak_Record = ak.highlevel.Record
ak_to_buffers = ak.operations.to_buffers
ak_from_buffers = ak.operations.from_buffer... |
4,753 | start date | import datetime
from unittest.mock import MagicMock
import numpy as np
import pandas as pd
import pytest
from pandera import Check, Column, DataFrameSchema, DateTime, Float, Index, String
from ruamel.yaml import YAML
from deployer.billing import importers
yaml = YAML(typ="safe", pure=True)
@pytest.fixture
def clus... |
4,754 | maybe decode swap | import logging
from typing import TYPE_CHECKING, Callable, Optional
from rotkehlchen.accounting.structures.types import HistoryEventSubType, HistoryEventType
from rotkehlchen.assets.asset import EvmToken
from rotkehlchen.chain.ethereum.modules.aave.v1.decoder import DEFAULT_DECODING_OUTPUT
from rotkehlchen.chain.evm.d... |
4,755 | wireless security | """Connection object for Network Manager."""
import logging
from typing import Any
from dbus_fast import Variant
from dbus_fast.aio.message_bus import MessageBus
from ....const import ATTR_METHOD, ATTR_MODE, ATTR_PSK, ATTR_SSID
from ...const import DBUS_NAME_NM
from ...interface import DBusInterface
from ...utils imp... |
4,756 | build list 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... |
4,757 | parse args | #!/usr/bin/python3
# Copyright (c) 2021-2022, NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... |
4,758 | get paddle version | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
4,759 | we have type of keyring | # Copyright © 2012-2023 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import json
import os
import random
import shutil
import string
from datetime import datetime
from unittest.mock import MagicMock
from unittest.mock import patch
from xml.etree import ElementTree
from pytest_bdd import give... |
4,760 | test timeseries get config has all attributes | # Copyright 2020 The AutoKeras 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 agreed to i... |
4,761 | test calibration functions | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Satpy developers
#
# satpy 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 ... |
4,762 | test sliding pulses analysis | import unittest
import numpy as np
import pycqed as pq
import os
import matplotlib.pyplot as plt
from pycqed.analysis_v2 import measurement_analysis as ma
class Test_Cryoscope_analysis(unittest.TestCase):
@classmethod
def tearDownClass(self):
plt.close('all')
@classmethod
def setUpClass(self... |
4,763 | get run function | # Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import logging
import sys
import traceback
from dataclasses import dataclass
from typing import Callable
from typing import Union
from vdk.api.job_input import IJobInput
from vdk.internal.builtin_plugins.run.file_based_step import TYPE_PYTHON
fro... |
4,764 | test overwrite jp2 | """
Helioviewer Client tests
"""
import os
import urllib
from collections import OrderedDict
import pytest
from sunpy.net.helioviewer import HelioviewerClient
pytestmark = pytest.mark.filterwarnings('ignore:The HelioviewerClient class is deprecated')
@pytest.fixture()
def client():
"""
Fixture to create a ... |
4,765 | test link team identity does not exist | import responses
from rest_framework import status
from sentry.integrations.slack.webhooks.command import (
CHANNEL_ALREADY_LINKED_MESSAGE,
INSUFFICIENT_ROLE_MESSAGE,
LINK_FROM_CHANNEL_MESSAGE,
LINK_USER_FIRST_MESSAGE,
TEAM_NOT_LINKED_MESSAGE,
)
from sentry.models import OrganizationIntegration
fro... |
4,766 | wrapper | import os
import platform
from functools import wraps
from pathlib import PurePath, PurePosixPath
from typing import Any, NewType, Union
# Path _inputs_ should generally accept any kind of path. This is named the same and
# modeled after the hint defined in the Python standard library's `typeshed`:
# https://github.co... |
4,767 | determine next id | # This file is part of Korman.
#
# Korman 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.
#
# Korman is distributed i... |
4,768 | finalize options | """distutils.command.check
Implements the Distutils 'check' command.
"""
from distutils.core import Command
from distutils.errors import DistutilsSetupError
try:
# docutils is installed
from docutils.utils import Reporter
from docutils.parsers.rst import Parser
from docutils import frontend
from d... |
4,769 | test phonopy yaml read | """Tests of PhonopyYaml."""
from io import StringIO
from pathlib import Path
import numpy as np
import yaml
from phonopy import Phonopy
from phonopy.interface.phonopy_yaml import (
PhonopyYaml,
PhonopyYamlLoader,
load_phonopy_yaml,
read_cell_yaml,
read_phonopy_yaml,
)
from phonopy.interface.vasp i... |
4,770 | test opsscan abox uploads | from chemaboxwriters.app import write_abox
import pytest
import os
from chemaboxwriters.common.pipeline import Pipeline
import chemaboxwriters.common.assemble_pipeline as asp
from chemaboxwriters.ontocompchem.pipeline import OC_PIPELINE
from chemaboxwriters.ontospecies.pipeline import OS_PIPELINE
from chemaboxwriters.o... |
4,771 | test wait for status reply | """
Test the evennia launcher.
"""
import os
import pickle
from anything import Something
from mock import MagicMock, create_autospec, patch
from twisted.internet import reactor
from twisted.internet.base import DelayedCall
from twisted.trial.unittest import TestCase as TwistedTestCase
from evennia.server import ev... |
4,772 | test authenticate with username | """
Test of custom django-oauth-toolkit behavior
"""
# pylint: disable=protected-access
import datetime
from django.conf import settings
from django.test import RequestFactory, TestCase
from django.utils import timezone
from common.djangoapps.student.tests.factories import UserFactory
from openedx.core.djangolib.te... |
4,773 | initialize | # Copyright 2018 The Meson development 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 ... |
4,774 | gs callable | """
Subset Species
"""
#*****************************************************************************
# Copyright (C) 2008 Mike Hansen <mhansen@gmail.com>,
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT... |
4,775 | get cycle length | #
# DeepLabCut Toolbox (deeplabcut.org)
# © A. & M.W. Mathis Labs
# https://github.com/DeepLabCut/DeepLabCut
#
# Please see AUTHORS for contributors.
# https://github.com/DeepLabCut/DeepLabCut/blob/master/AUTHORS
#
# Licensed under GNU Lesser General Public License v3.0
#
""" Cosine Scheduler
Cosine LR schedule with w... |
4,776 | init data handler | import os
import re
import signal
import subprocess
import sys
from sonic_py_common import daemon_base, logger
from swsscommon.swsscommon import ConfigDBConnector, RestartWaiter
SYSLOG_IDENTIFIER = "containercfgd"
logger = logger.Logger(SYSLOG_IDENTIFIER)
# Table names
FEATURE_TABLE = 'FEATURE'
SYSLOG_CONFIG_FEATURE... |
4,777 | convert dtype | """This module contains actions (functions) that operate on layers.
Among other potential uses, these will populate the menu when you right-click
on a layer in the LayerList.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, List, cast
import numpy as np
from napari.layers import Image, Label... |
4,778 | test bincount minlength | import numpy
import pytest
from numpy.testing import assert_allclose
import dpnp
from .helper import get_all_dtypes
@pytest.mark.parametrize(
"dtype", get_all_dtypes(no_none=True, no_bool=True, no_complex=True)
)
@pytest.mark.parametrize("size", [2, 4, 8, 16, 3, 9, 27, 81])
def test_median(dtype, size):
a =... |
4,779 | dev interrupt hw config dev list | import logging
from itertools import product
from lnst.Common.Parameters import (
Param,
IntParam,
StrParam,
IPv4NetworkParam,
IPv6NetworkParam,
)
from lnst.Common.IpAddress import interface_addresses
from lnst.Controller import HostReq, DeviceReq, RecipeParam
from lnst.Recipes.ENRT.VirtualEnrtRecip... |
4,780 | test czi file read buffer | # pylint: disable=no-self-use
import math
import os.path
import shutil
from glob import glob
from io import BytesIO
import numpy as np
import pytest
import tifffile
import PartSegData
from PartSegImage import CziImageReader, GenericImageReader, Image, ObsepImageReader, OifImagReader, TiffImageReader
class TestImage... |
4,781 | get target mask | import math
import numpy as np
import scipy.special
import torch
from ..distances import CosineSimilarity
from ..utils import common_functions as c_f
from ..utils import loss_and_miner_utils as lmu
from .base_metric_loss_function import BaseMetricLossFunction
from .mixins import WeightRegularizerMixin
class LargeMa... |
4,782 | post | #!/usr/bin/env python
#
# Simple asynchronous HTTP proxy with tunnelling (CONNECT).
#
# GET/POST proxying based on
# http://groups.google.com/group/python-tornado/msg/7bea08e7a049cf26
#
# Copyright (C) 2012 Senko Rasic <senko.rasic@dobarkod.hr>
#
# Permission is hereby granted, free of charge, to any person obtaining a... |
4,783 | colo linear | from copy import deepcopy
from typing import Optional
import torch.nn.functional as F
from colossalai.tensor import ColoTensor, ColoTensorSpec, ComputePattern, ComputeSpec, ReplicaSpec, ShardSpec
from colossalai.tensor.op_wrapper import colo_op_impl
from colossalai.tensor.sharding_spec import ShardingSpec
from ._uti... |
4,784 | print operation | #!/usr/bin/python
# Copyright (c) 2018 Samsung Electronics Co., Ltd. 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
#
#... |
4,785 | get | # 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... |
4,786 | close | #-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import loggi... |
4,787 | test tabled4 | import unittest
import numpy as np
from pyNastran.bdf.bdf import BDF, BDFCard
from pyNastran.bdf.cards.bdf_tables import (
TABLED1, TABLED2, TABLED3, TABLED4,
TABLEM1, TABLEM2, TABLEM3, TABLEM4,
TABDMP1, #TABLES1, TABLEST, TABRND1, TABRNDG,
)
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNast... |
4,788 | stop ping servers | # -*- coding: utf-8 -*-
"""
threaded_ping_server.py
~~~~~~~~~~~~~~~~~~~~~~~
TCP server based on threads simulating ping output.
"""
__author__ = 'Grzegorz Latuszek'
__copyright__ = 'Copyright (C) 2018, Nokia'
__email__ = 'grzegorz.latuszek@nokia.com'
import logging
import select
import socket
import sys
import threa... |
4,789 | test provides request db as session | from unittest import mock
import pytest
from h.models import User
from h.services.group_members import GroupMembersService, group_members_factory
class TestMemberJoin:
def test_it_adds_user_to_group(self, group_members_service, factories):
user = factories.User()
group = factories.Group()
... |
4,790 | translated words | from robotframework_ls.impl.protocols import ICompletionContext, ILocalizationInfo
from typing import Optional
from robotframework_ls.impl.text_utilities import normalize_robot_name
class _Requisites(object):
def __init__(self, section, matcher, replace_from_col, replace_to_col, selection):
self.section =... |
4,791 | vts | # -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2014-2023 Greenbone AG
#
# SPDX-License-Identifier: AGPL-3.0-or-later
""" Classes for storing VTs
"""
import logging
import multiprocessing
from hashlib import sha256
import re
from copy import deepcopy
from typing import (
Dict,
Any,
Type,
Iterator,
... |
4,792 | get read stats | import glob
import os.path
import datetime
import sys
from typing import Any
from hdrh.histogram import HdrHistogram
from hdrh.log import HistogramLogReader
CS_HDR_FILE_WC = "*/cs_hdr_*.hdr"
TIME_INTERVAL = 300
def get_list_of_hdr_files(base_path: str) -> list[str]:
hdr_files = []
for hdr_file in glob.glo... |
4,793 | create integration gb | # -*- coding: utf-8 -*-
# Dioptas - GUI program for fast processing of 2D X-ray diffraction data
# Principal author: Clemens Prescher (clemens.prescher@gmail.com)
# Copyright (C) 2014-2019 GSECARS, University of Chicago, USA
# Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany
... |
4,794 | test frames to tensor and back to | #!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... |
4,795 | test delete requires auth | import pytest
from . import helper
from github3 import GitHubError
from github3.orgs import Team
url_for = helper.create_url_helper(
"https://api.github.com/organizations/1/team/1"
)
get_team_example_data = helper.create_example_data_helper("orgs_team_example")
class TestTeam(helper.UnitHelper):
described_... |
4,796 | log | import ctypes
import os
import pathlib
import platform
import json
from typing import Union, Dict, List, Any, Type, Optional
from enum import Enum, IntEnum, unique, auto
JSON = Union[Dict[str, Any], List[Any], int, str, float, bool, Type[None]]
class InstanceOptionType(IntEnum):
touch_type = 2
deployment_wi... |
4,797 | cache invalidate | # The MIT License
#
# Copyright (c) 2018 aio-libs team https://github.com/aio-libs/
# Copyright (c) 2017 Ocean S. A. https://ocean.io/
# Copyright (c) 2016-2017 WikiBusiness Corporation http://wikibusiness.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and assoc... |
4,798 | create grid | # Copyright (c) 2017 The University of Manchester
#
# 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 ... |
4,799 | test get input fields | import re
import pytest
from . import library # for the fixture to work
from . import TestFiles, temp_filename # noqa
def _escape_string(value: str) -> str:
to_escape = {"."}
values = []
for char in value:
if char in to_escape:
char = "\\\\" + oct(ord(char)).replace("o", "")
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.