id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
6,100 | test merged components correct | from sys import version_info
from typing import TYPE_CHECKING, Any
import pytest
from pydantic import BaseModel, Field
from litestar import Litestar, get, post
from litestar.exceptions import ImproperlyConfiguredException
from litestar.openapi.config import OpenAPIConfig
from litestar.openapi.spec import Components, ... |
6,101 | test route | from unittest.mock import Mock
import pytest
from faust.web import Request, View, Web
from faust.web.exceptions import MethodNotAllowed
from tests.helpers import AsyncMock
@View.from_handler
async def foo(self, request):
return self, request
class Test_View:
@pytest.fixture
def web(self):
retu... |
6,102 | is compatible | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Create a toymodel event stream of array events
"""
import logging
from typing import Dict
import astropy.units as u
import numpy as np
from ..containers import (
ArrayEventContainer,
DL1CameraContainer,
EventIndexContainer,
Observatio... |
6,103 | control service | from _typeshed import Incomplete
from collections.abc import Iterable
import _win32typing
from win32.lib.pywintypes import error as error
def GetThreadDesktop(ThreadId) -> _win32typing.PyHDESK: ...
def EnumWindowStations() -> tuple[tuple[str, Incomplete], ...]: ...
def GetUserObjectInformation(Handle: int, _type) -> ... |
6,104 | presentation time range | # 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... |
6,105 | test mix adding removing tasks | from django.urls import reverse
from fiscal.forms import MembershipTaskForm
from fiscal.models import MembershipPersonRole, MembershipTask
from workshops.models import Membership
from workshops.tests.base import TestBase
class TestMembershipTaskFormLayout(TestBase):
def test_main_helper_layout(self):
for... |
6,106 | reduce metrics | # 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 metrics, utils
from fairseq.criterions import register_criterion
from .label_smoothed_cross_entropy import (... |
6,107 | primary key | # 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
__all__ =... |
6,108 | test random variable bcast | import numpy as np
import pytest
import aesara.tensor as at
from aesara import config, function
from aesara.gradient import NullTypeGradError, grad
from aesara.raise_op import Assert
from aesara.tensor.math import eq
from aesara.tensor.random.op import (
RandomState,
RandomVariable,
default_rng,
defaul... |
6,109 | to dense matrix | # The Uni-fold implementation is also open-sourced by the authors under Apache-2.0 license,
# and is publicly available at https://github.com/dptech-corp/Uni-Fold.
import copy as copy_lib
import functools
import gzip
import pickle
from typing import Any, Dict
import json
import numpy as np
from scipy import sparse as... |
6,110 | test call rpc crash handle generic | '''
Author: Ricardo Mateus <rmateus@suse.com>
'''
import pytest
from unittest.mock import MagicMock, patch, call
from . import mockery
mockery.setup_environment()
import sys
from ..modules import uyuni_config
from ..modules.uyuni_config import RPCClient, UyuniChannelsException, UyuniUsersException
class TestRPCCli... |
6,111 | preprocess uci adult | """
Utility functions to keep the example notebooks uncluttered with boilerplate.
"""
import re
from collections import OrderedDict
from pathlib import Path
from typing import Tuple
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix
DATA_DIR = Path(__file__).parent / "data"
UCI_ADULT... |
6,112 | test dont send maxpagesize | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
6,113 | test infrastructure required properties | import datetime as dt
import pytest
import pytz
import stix2
from .constants import FAKE_TIME, INFRASTRUCTURE_ID, INFRASTRUCTURE_KWARGS
EXPECTED_INFRASTRUCTURE = """{
"type": "infrastructure",
"spec_version": "2.1",
"id": "infrastructure--3000ae1b-784c-f03d-8abc-0a625b2ff018",
"created": "2017-01-01... |
6,114 | test schedule send | # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See LICENSE
from random import choice
from unittest.mock import MagicMock, PropertyMock, patch
import frappe
from frappe.email.doctype.newsletter.exceptions import (
NewsletterAlreadySentError,
NoRecipientFoundError,
)
from frappe.e... |
6,115 | push write | # Copyright 2012-2013 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" fil... |
6,116 | test run module bug1764407 | # Tests invocation of the interpreter with various command line arguments
# All tests are executed with environment variables ignored
# See test_cmd_line_script.py for testing of script execution
import test.test_support
import sys
import unittest
from test.script_helper import (
assert_python_ok, assert_python_fa... |
6,117 | test post no installation | from unittest.mock import patch
from django.db import router
from django.urls import reverse
from sentry.models.integrations.integration import Integration
from sentry.models.integrations.repository_project_path_config import RepositoryProjectPathConfig
from sentry.models.repository import Repository
from sentry.silo... |
6,118 | compute loss | import torch
import torch.nn as nn
import torch.nn.functional as F
from functorch import vmap, grad, combine_state_for_ensemble, make_functional_with_buffers
import functools
from .util import BenchmarkCase
class SimpleMLP(nn.Module):
def __init__(self):
super(SimpleMLP, self).__init__()
self.fc1... |
6,119 | test | """
Admonition extension for Python-Markdown
========================================
Adds rST-style admonitions. Inspired by [rST][] feature with the same name.
[rST]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions # noqa
See <https://Python-Markdown.github.io/extensions/admoniti... |
6,120 | test | import os
import csv
import random
import importlib
from ...utils.identifiers.arbitrary import ArbitraryIdentifier
from ...setup.requirements.compound import (
ChemblWebResourceClientRequirement,
RdkitRequirement,
)
from ... import logger
from ..shape import InputShapeSingle, InputShapeList, InputShapePairOfLi... |
6,121 | test colorbar | import unittest
import matplotlib.axes
import matplotlib.lines
import matplotlib.patches
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pyrolite.comp.codata import close
from pyrolite.util.plot.helpers import (
draw_vector,
init_spherical_octant,
nan_scatter,
plot_2dhull,
... |
6,122 | clear in memory account fields | ######################################################################
#
# File: b2sdk/account_info/in_memory.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from __future__ import... |
6,123 | fix input | import torch
from torch import Tensor
from torch_geometric.nn.models import LabelPropagation
from torch_geometric.typing import Adj, OptTensor
from torch_geometric.utils import one_hot
class CorrectAndSmooth(torch.nn.Module):
r"""The correct and smooth (C&S) post-processing model from the
`"Combining Label P... |
6,124 | 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
# --------------------------------... |
6,125 | test inf | import unittest
import os
import tempfile
from filecmp import cmp
import py_compile
from pvactools.lib.filter import Filter, FilterCriterion
from tests.utils import *
class FilterTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.filter_path = os.path.join(pvactools_directory(), "pvactool... |
6,126 | is custom emoji | # SPDX-License-Identifier: MIT
from __future__ import annotations
import re
from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union
from . import utils
from .asset import Asset, AssetMixin
__all__ = ("PartialEmoji",)
if TYPE_CHECKING:
from datetime import datetime
from typing_extensions import... |
6,127 | get pending lists | from datetime import datetime
from loguru import logger
from sqlalchemy import Boolean, Column, DateTime, Integer, Unicode, func, select
from sqlalchemy.orm import relationship
from sqlalchemy.sql.elements import and_
from sqlalchemy.sql.schema import ForeignKey
from flexget import db_schema
from flexget.db_schema im... |
6,128 | content | """
Parser for the .lang translation format.
"""
import codecs
import re
from parsimonious.exceptions import (
ParseError as ParsimoniousParseError,
VisitationError,
)
from parsimonious.grammar import Grammar
from parsimonious.nodes import NodeVisitor
from pontoon.sync.exceptions import ParseError
from pontoo... |
6,129 | experiment | import logging
from typing import Any, Dict, List, Optional
try:
from aim import Run, Text
except ModuleNotFoundError:
Run, Text = None, None
from llama_index.callbacks.base_handler import BaseCallbackHandler
from llama_index.callbacks.schema import CBEventType, EventPayload
logger = logging.getLogger(__name... |
6,130 | user id | from __future__ import annotations
import dataclasses
from collections.abc import Mapping
from rest_framework import status
from rest_framework.request import Request
from sentry import options
from sentry.services.hybrid_cloud.identity.model import RpcIdentity
from sentry.services.hybrid_cloud.identity.service impo... |
6,131 | backward hook | # Copyright (c) 2022, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
6,132 | remove torrent | # coding=utf-8
"""rTorrent Client."""
from __future__ import absolute_import, unicode_literals
import logging
from medusa import app
from medusa.clients.torrent.generic import GenericClient
from medusa.helper.exceptions import DownloadClientConnectionException
from medusa.logger.adapters.style import BraceAdapter
f... |
6,133 | test multi pack search index | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.search.documents.indexes.models import SearchIndex, RegexFlags, PatternAnalyzer, PatternTokenizer
from azure.search.documents.indexes._generated.models impor... |
6,134 | find matching domain | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2021 Bitergia
#
# 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.
#
# This ... |
6,135 | node ports creator cb | import logging
from pathlib import Path
from typing import Any, Callable, Coroutine
from models_library.api_schemas_storage import LinkType
from models_library.projects import ProjectIDStr
from models_library.projects_nodes_io import NodeIDStr
from models_library.users import UserID
from pydantic import BaseModel, Fie... |
6,136 | test data types | import doctest
import re
from collections import OrderedDict
from django.test import SimpleTestCase
import corehq.apps.app_manager.xform_builder
from corehq.apps.app_manager.tests.util import TestXmlMixin
from corehq.apps.app_manager.xform_builder import XFormBuilder
class XFormBuilderTests(SimpleTestCase, TestXmlM... |
6,137 | test ellipse major | import pytest
import json
import compas
from compas.geometry import close
from compas.geometry import allclose
from compas.geometry import Frame
from compas.geometry import Ellipse
from compas.geometry import Plane
def test_ellipse_create():
ellipse = Ellipse(major=1.0, minor=0.5)
assert close(ellipse.major... |
6,138 | traverse file tree | """Diagnostic tool for a localstack instance running in a container."""
import inspect
import os
import socket
from typing import Dict, List, Union
from localstack import config
from localstack.constants import DEFAULT_VOLUME_DIR
from localstack.services.lambda_.invocation.docker_runtime_executor import IMAGE_PREFIX
f... |
6,139 | test hook error | # SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
from __future__ import absolute_import
from __future__ import division
import importlib
import pytest
import six
from vdsm.common.exception import GeneralException, VdsmException
from vdsm.rpc.Bridge import DynamicBridge
from monke... |
6,140 | get list domains tr te | """
Base class for Task
"""
from abc import abstractmethod
import warnings
from domainlab.compos.pcr.p_chain_handler import AbstractChainNodeHandler
from domainlab.tasks.task_utils import parse_domain_id
from domainlab.utils.logger import Logger
class NodeTaskDG(AbstractChainNodeHandler):
"""
Domain Generali... |
6,141 | l2 loss | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Tuple, Union
import numpy as np
import torch
from mmengine.model import BaseModule
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weighted_loss
@weighted_loss
def METHOD_NAME(pred: Tensor, target: Tensor) -> ... |
6,142 | fun write file | # Tasks for testing
import time
import sys, shutil
import typing as ty
from pathlib import Path
import functools
import operator
import subprocess as sp
import pytest
from fileformats.generic import File
from ..core import Workflow
from ..submitter import Submitter
from ... import mark
need_docker = pytest.mark.skip... |
6,143 | start | #!/usr/bin/env python
__author__ = "Ole Weidner"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__ = "MIT"
""" This examples shows how to run a job on a remote SLURM cluster
using the 'SLURM' job adaptor.
More information about the radical.saga job API can be found at:
http://radi... |
6,144 | get action | # 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... |
6,145 | test gradient accumulator distribution strategy | # Copyright 2020 The HuggingFace Team. 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 applicabl... |
6,146 | to dict | import d20
from cogs5e.models.errors import InvalidSaveType
from utils import enums
from utils.functions import maybe_mod, reconcile_adv, verbose_stat
from . import Effect
from ..errors import AutomationException, NoSpellDC, TargetException
from ..results import SaveResult
from ..utils import stringify_intexpr
class... |
6,147 | execute operations | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
6,148 | get serializer | from django_filters import rest_framework as filters
from drf_spectacular.utils import extend_schema
from dry_rest_permissions.generics import DRYPermissions
from rest_framework import mixins
from rest_framework.decorators import action
from rest_framework.exceptions import ValidationError
from rest_framework.generics ... |
6,149 | get migration state | # Copyright 2021 Hathor Labs
#
# 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, s... |
6,150 | output | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
6,151 | recv | """
:codeauthor: Thomas Jackson <jacksontj.89@gmail.com>
"""
import hashlib
import logging
import pytest
import tornado.ioloop
import salt.crypt
import salt.transport.tcp
import salt.transport.zeromq
import salt.utils.stringutils
from tests.support.mock import MagicMock, patch
log = logging.getLogger(__name__)
... |
6,152 | test present absent fuzzy | """
Tests for the MySQL states
"""
import pytest
import salt.utils.path
from tests.support.case import ModuleCase
from tests.support.mixins import SaltReturnAssertsMixin
NO_MYSQL = False
try:
import MySQLdb # pylint: disable=import-error,unused-import
except ImportError:
NO_MYSQL = True
if not salt.utils.p... |
6,153 | test ordering display name success | # 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
# distributed under t... |
6,154 | get row size | #!/bin/env python
__author__ = 'dongyun.zdy'
import getopt
import sys
import math
def material_model_form(args):
(
Nrow,
Ncol,
) = args
Trow_col = 0.02674675
Trow_once = 0.07931677
total_cost = 0 #Tstartup
total_cost += Nrow * (Trow_once + Ncol * Trow_col)
return total_c... |
6,155 | test included messages | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import logging
import pytest
import win32evtlog
from . import common
pytestmark = [pytest.mark.integration]
@pytest.mark.parametrize('server', ['localhost', '127.0.0.1'])
def test_expected(aggregator,... |
6,156 | get test https policy | # Copyright 2019 New Vector 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 agreed to in writin... |
6,157 | get next | # 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... |
6,158 | num overlap neighbors | from PYB11Generator import *
@PYB11holder("std::shared_ptr")
@PYB11template("Dimension")
class FlatConnectivity:
PYB11typedefs = """
typedef typename %(Dimension)s::Vector Vector;
typedef typename std::array<int, %(Dimension)s::nDim> ArrayDim;
"""
def pyinit(self):
"Indexing for bilinear form"
... |
6,159 | test setting by value | import pytest
import sqlalchemy as sa
from flexmock import flexmock
from sqlalchemy_utils import Choice, ChoiceType, ImproperlyConfigured
from sqlalchemy_utils.compat import _select_args
from sqlalchemy_utils.types.choice import Enum
class TestChoice:
def test_equality_operator(self):
assert Choice(1, 1)... |
6,160 | method | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
6,161 | libcurve close | #!/usr/bin/env python
# -*- coding: utf8 -*-
from curvefs_python import curvefs
from config import config
from logger.logger import *
cbdClient = curvefs.CBDClient()
class LibCurve:
def __init__(self):
rc = cbdClient.Init(config.client_conf)
logger.info("init success.")
if rc != 0:
... |
6,162 | start | #
# We use a background thread for sharing fds on Unix, and for sharing sockets on
# Windows.
#
# A client which wants to pickle a resource registers it with the resource
# sharer and gets an identifier in return. The unpickling process will connect
# to the resource sharer, sends the identifier and its pid, and then ... |
6,163 | get test params | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Kinematic transformers."""
__author__ = ["fkiraly"]
import numpy as np
import pandas as pd
from sktime.transformations.base import BaseTransformer
class KinematicFeatures(BaseTransformer):
r"""Kinematic feature transformer - velocity, a... |
6,164 | users for order benchmarks | import random
from decimal import Decimal
import pytest
from prices import Money, TaxedMoney
from .....account.models import User
from .....order import OrderEvents, OrderStatus
from .....order.models import Fulfillment, FulfillmentLine, Order, OrderEvent, OrderLine
from .....payment import ChargeStatus
from .....pay... |
6,165 | ha relation joined | #!/usr/bin/env python
import sys
import os
import lib.utils as utils
import lib.ceph_utils as ceph
import lib.cluster_utils as cluster
from charmhelpers.contrib.peerstorage import (
peer_echo,
)
# CEPH
DATA_SRC_DST = '/var/lib/mysql'
SERVICE_NAME = os.getenv('JUJU_UNIT_NAME').split('/')[0]
POOL_NAME = SERVICE_N... |
6,166 | test gdal origin | """
Tests for resistivity model to geotiff.
"""
import pytest
import numpy as np
from mtpy.utils import convert_modem_data_to_geogrid as conv
def test_strip_padding():
grid_axis = [-2., -1., 0., 1., 2.]
test = conv._strip_padding(grid_axis, 1)
expected = [-1., 0., 1.]
np.testing.assert_array_equal(te... |
6,167 | test fail no service connection and overwrite | # Copyright 2021 Collate
# 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... |
6,168 | set up app | import uuid
from django.test import SimpleTestCase, TestCase
from couchdbkit import ResourceNotFound
from unittest.mock import patch
from corehq.apps.app_manager.models import Module
from corehq.apps.app_manager.tests.app_factory import AppFactory
from corehq.apps.app_manager.tests.util import patch_get_xform_resour... |
6,169 | write doc | #!/usr/bin/env python
import inspect
from pathlib import Path
from IPython.terminal.ipapp import TerminalIPythonApp
from ipykernel.kernelapp import IPKernelApp
from traitlets import Undefined
from collections import defaultdict
here = (Path(__file__)).parent
options = here / "source" / "config" / "options"
generated ... |
6,170 | test lesson loader missing icon | import os.path
from django.test import override_settings
from tests.BaseTestWithDB import BaseTestWithDB
from tests.at_a_distance.AtADistanceTestDataGenerator import AtADistanceTestDataGenerator
from at_a_distance.models import Lesson
from at_a_distance.management.commands._LessonLoader import AtADistanceLessonLoader
f... |
6,171 | command queue | from typing import Awaitable, Optional
from robot_server.robot.calibration.deck.user_flow import DeckCalibrationUserFlow
from robot_server.robot.calibration.deck.models import DeckCalibrationSessionStatus
from robot_server.service.session.errors import (
SessionCreationException,
CommandExecutionException,
)
f... |
6,172 | encode response output | from typing import Any, Union, Dict, Optional, List
from ..types import (
InferenceRequest,
InferenceResponse,
RequestInput,
RequestOutput,
ResponseOutput,
MetadataTensor,
Parameters,
)
from ..settings import ModelSettings
from .base import (
find_input_codec,
find_input_codec_by_pa... |
6,173 | execute driver | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This script automates the process of generating C test files using
the csmith tool.
The script will:
* generate a fresh C source file
* compile the C source
* execute the C executable
* translate the C source to Rust source
* compile the Rust source
* execute the Rust ... |
6,174 | test compute cells can depend on other | # These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/react/canonical-data.json
# File last updated on 2023-07-19
from functools import partial
import unittest
from react import (
InputCell,
ComputeCell,
)
class ReactTest(unittest.Test... |
6,175 | test count events | """Testing stats reporting."""
# Authors: Alex Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
import itertools
import pytest
import numpy as np
import mne
from mne.datasets import testing
from mne_bids import BIDSPath, write_raw_bids
from mne_bids.stats import count_events
from mne_bids.read impor... |
6,176 | is valid path | from __future__ import annotations
import glob
import os
from abc import ABC, abstractmethod
from pathlib import Path
from urllib.parse import urlparse
import smart_open
from airflow.hooks.base import BaseHook
from astro.constants import FileLocation
from astro.exceptions import DatabaseCustomError
from astro.option... |
6,177 | create source image | from virttest import storage, data_dir
from provider.blockdev_mirror_nowait import BlockdevMirrorNowaitTest
from provider.job_utils import get_event_by_condition
class BlockdevMirrorCancelReadyIOError(BlockdevMirrorNowaitTest):
"""
Cancel a ready job when target image is in error
"""
def __init__(se... |
6,178 | pre operations | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
6,179 | try decode | # Copyright 2016 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... |
6,180 | append address | """Illustrates a so-called "generic foreign key", in a similar fashion
to that of popular frameworks such as Django, ROR, etc. This
approach bypasses standard referential integrity
practices, in that the "foreign key" column is not actually
constrained to refer to any particular table; instead,
in-application logic is... |
6,181 | fake taxonomy | import base64
from datetime import datetime
from typing import Any
import falcon.testing
import pytest
from openfoodfacts.types import TaxonomyType
import robotoff.insights.importer
import robotoff.taxonomy
from robotoff.app.api import api
from robotoff.models import LogoAnnotation
from .models_utils import LogoAnno... |
6,182 | quote | #! /usr/bin/env python3
"""Conversions to/from quoted-printable transport encoding as per RFC 1521."""
# (Dec 1991 version).
__all__ = ["encode", "decode", "encodestring", "decodestring"]
ESCAPE = b'='
MAXLINESIZE = 76
HEX = b'0123456789ABCDEF'
EMPTYSTRING = b''
try:
from binascii import a2b_qp, b2a_qp
except ... |
6,183 | sync recipe | """
helper functions for managing recipes
"""
import sys
from collections import OrderedDict
import solvebio as sb
import ruamel.yaml as yaml
import click
def create_recipe(description):
fields = [description['fields']]
recipe_version = description['version']
recipe_name = description['name']
recipe_... |
6,184 | fit predict | # -*- coding: utf-8 -*-
"""Base class for clustering."""
__author__ = ["chrisholder", "TonyBagnall"]
__all__ = ["BaseClusterer"]
import time
from abc import ABC, abstractmethod
import numpy as np
from aeon.base import BaseCollectionEstimator
from aeon.utils.validation._dependencies import _check_estimator_deps
cla... |
6,185 | test exception in job not canceled | # -*- coding: utf-8 -*-
"""
Testing of Scheduler.
"""
__author__ = 'Marcin Usielski'
__copyright__ = 'Copyright (C) 2018, Nokia'
__email__ = 'marcin.usielski@nokia.com'
from moler.scheduler import Scheduler
from moler.exceptions import WrongUsage
from moler.util.moler_test import MolerTest
import time
import pytest
im... |
6,186 | remove labels | # Copyright 2021 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 ... |
6,187 | radix sort |
# Radix Sort
# 1. Identify the maximum number: Find the maximum number in the given list. This is necessary to determine the number of digits we need to consider
# during the sorting process.
# 2. Perform counting sort for each digit position: Starting from the least significant digit (ri... |
6,188 | transform audio | # 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... |
6,189 | build list request | # 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 ... |
6,190 | translate on populate x | # -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2020 OSMC (KodeKarnage)
This file is part of script.module.osmcsetting.updates
SPDX-License-Identifier: GPL-2.0-or-later
See LICENSES/GPL-2.0-or-later for more information.
"""
import os
import subprocess
from osmccommon import osmc_setting
from osmccom... |
6,191 | test color scheduled | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright 2006 - 2021, Tomas Babej, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated d... |
6,192 | whitespace | import re
from easy_thumbnails import processors
from .settings import FILER_SUBJECT_LOCATION_IMAGE_DEBUG, FILER_WHITESPACE_COLOR
try:
from PIL import Image, ImageDraw
except ImportError:
try:
import Image
import ImageDraw
except ImportError:
raise ImportError("The Python Imaging... |
6,193 | mktmp | from fud.stages import Stage, SourceType, Source
from fud.utils import shell, TmpDir
from fud.errors import MissingDynamicConfiguration
from pathlib import Path
# The temporary filename used for converting mrxl.data to verilog.data
_DATA_FILE = "data.json"
class MrXLStage(Stage):
"""
Stage that invokes the ... |
6,194 | assert execution failed | 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 METHOD_NAME(self, exec_result):
returncode, stdout, stderr = exec_r... |
6,195 | save slide | # type_audiovideocast.py
import threading
import logging
import datetime
import zipfile
import os
from xml.dom import minidom
from django.conf import settings
from django.template.defaultfilters import slugify
from django.core.files.base import ContentFile
from pod.video.models import Video
from pod.video_encode_tran... |
6,196 | get can parser | from cereal import car
from openpilot.common.conversions import Conversions as CV
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD, RAM_CARS
class C... |
6,197 | test from pennylane | # Copyright (C) Unitary Fund
#
# This source code is licensed under the GPL license (v3) found in the
# LICENSE file in the root directory of this source tree.
"""Unit tests for Pennylane <-> Cirq conversions."""
import cirq
import numpy as np
import pennylane as qml
import pytest
from mitiq.interface.mitiq_pennylan... |
6,198 | length group | import re
from statistics import mean
from . import tokenizer
def joinLine(columns):
return "\t".join(columns)
def unclump(s):
"""
Replacess $'s with spaces. The reverse of clumpFractions.
"""
return re.sub(r"\$", " ", s)
def getFeatures(token, index, tokens):
"""
Returns a list of fe... |
6,199 | extract addrs | # -*- coding: utf-8 -*-
# Copyright 2021 Google 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.