id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
15,700 | eval fn | # Copyright 2021 Xilinx 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 agreed to in writing, ... |
15,701 | test filename | # Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The Universal Permissive License (UPL), Version 1.0
#
# Subject to the condition set forth below, permission is hereby granted to any
# person obtaining a copy of this softw... |
15,702 | test login by token | import json
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.urls import reverse
from allauth.account import app_settings as account_settings
from allauth.account.models import EmailAddress
from allauth.socialaccount import providers
from allauth.socialaccount.... |
15,703 | test localtime epoch notz daylight false | import datetime
from email import utils
import test.support
import time
import unittest
import sys
import os.path
class DateTimeTests(unittest.TestCase):
datestring = 'Sun, 23 Sep 2001 20:10:55'
dateargs = (2001, 9, 23, 20, 10, 55)
offsetstring = ' -0700'
utcoffset = datetime.timedelta(hours=-7)
t... |
15,704 | parse gcov report | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from __future__ import print_function
import optparse
import re
import sys
# the gcov report follows certain pattern. Each file will have two lines
# of report, from which we can extract the file name, total lines and cover... |
15,705 | 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 . im... |
15,706 | create device ids array | # Copyright 2022 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... |
15,707 | test synchronous rl zero lag | import shutil
from os.path import isdir
from typing import Callable, Optional
import pytest
from sample_factory.algo.utils.misc import ExperimentStatus
from sample_factory.train import make_runner
from sample_factory.utils.typing import Config
from sample_factory.utils.utils import log
from sf_examples.envpool.envpoo... |
15,708 | test admin login url | import re
from datetime import timedelta
from unittest import mock
from django.conf import settings
from django.core import mail
from django.urls import URLResolver, reverse
import pytest
from mfa.models import MFAKey
@pytest.fixture
def mfa_user(dummy_user):
MFAKey.objects.create(user=dummy_user, method="recov... |
15,709 | etcd client mock | """
Test case for the etcd SDB module
"""
import logging
import pytest
import salt.sdb.etcd_db as etcd_db
import salt.utils.etcd_util as etcd_util
from tests.support.mock import MagicMock, create_autospec, patch
log = logging.getLogger(__name__)
@pytest.fixture
def configure_loader_modules():
return {
... |
15,710 | vdk exit | # Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
from typing import List
from typing import Optional
import click
from vdk.api.plugin.hook_markers import hookspec
from vdk.api.plugin.plugin_registry import IPluginRegistry
from vdk.internal.builtin_plugins.run.execution_results import ExecutionR... |
15,711 | idwt3 d | import numpy as np
from dipy.denoise import nlmeans_block
"""
Functions for Wavelet Transforms in 3D domain
Code adapted from
WAVELET SOFTWARE AT POLYTECHNIC UNIVERSITY, BROOKLYN, NY
http://taco.poly.edu/WaveletSoftware/
"""
def cshift3D(x, m, d):
"""3D Circular Shift
Parameters
----------
x :... |
15,712 | main | """
This script is part of the pytest release process which is triggered manually in the Actions
tab of the repository.
The user will need to enter the base branch to start the release from (for example
``6.1.x`` or ``main``) and if it should be a major release.
The appropriate version will be obtained based on the g... |
15,713 | get chunks | from typing import (
Any,
Sequence,
Mapping,
List,
Union,
Dict,
Optional,
MutableMapping,
)
from typing_extensions import Protocol
import cftime
import logging
import pace.util
import xarray as xr
import dataclasses
from .fortran import FortranFileConfig
from .time import TimeConfig, T... |
15,714 | contributors old | import json
import logging
from datetime import date, timedelta
from django.conf import settings
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404, render
from django.utils.translation import gettext as _
from django.views.decorators.http import require_... |
15,715 | test dev null | #!/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.
import time
from mcrouter.test.MCProcess import Memcached
from mcrouter.test.McrouterTestCase import McrouterTestCa... |
15,716 | onnx2mlir | # Copyright (c) 2022 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... |
15,717 | start | from backup.config import Config, Setting
from backup.file import JsonFileSaver
from backup.worker import Worker
from backup.exceptions import SupervisorFileSystemError
from .harequests import HaRequests
from injector import inject, singleton
from backup.time import Time
from backup.logger import getLogger
from datetim... |
15,718 | test full tokenizer | # Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
# 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.... |
15,719 | remove some supplier4 agmts | # --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2022 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
#
import logging
import pytest
import os
import time
import random
import threading
from lib389._constants import DEFAULT_... |
15,720 | get short be | """Routines to help recognizing sound files.
Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.
The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- nu... |
15,721 | filter empty lines | #
# 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... |
15,722 | test describe internet gateway | from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, InternetGateway
class TestDescribeInternetGateway(AWSMockServiceTestCase):
connection_class = VPCConnection
def default_body(self):
return b"""
<DescribeInternetGatewaysResp... |
15,723 | arrays to lists | '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2021 Caleb Bell <Caleb.Andrew.Bell@gmail.com>
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 ... |
15,724 | test hash empty input | import numpy as np
import pytest
from numpy.testing import assert_array_equal
from sklearn.feature_extraction import FeatureHasher
from sklearn.feature_extraction._hashing_fast import transform as _hashing_transform
def test_feature_hasher_dicts():
feature_hasher = FeatureHasher(n_features=16)
assert "dict" ... |
15,725 | get issues | # Copyright 2020 Google LLC
#
# 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, ... |
15,726 | start monitor | """
Pytest configuration that spins up a single localstack instance that is shared across test modules.
See: https://docs.pytest.org/en/6.2.x/fixture.html#conftest-py-sharing-fixtures-across-multiple-files
It is thread/process safe to run with pytest-parallel, however not for pytest-xdist.
"""
import logging
import mu... |
15,727 | get vector state symbols | # -*- coding: utf-8 -*-
#
# ast_neuron.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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
... |
15,728 | peak finding | # Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# 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 right... |
15,729 | collate inputs | # Author: Robin Ru @ University of Oxford
# This is an implementation of learning curve extrapolation method based on:
# B. Baker et al. 2017, “Accelerating neural architecture search using
# performance prediction,” arXiv preprint arXiv:1705.10823.
from sklearn.svm import NuSVR
from sklearn.linear_model import Bayesi... |
15,730 | maintenance window | # 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... |
15,731 | content disposition | import sys
import types
from collections.abc import Iterable, Mapping
from datetime import datetime as _datetime
from email._header_value_parser import (
AddressList,
ContentDisposition,
ContentTransferEncoding,
ContentType,
MIMEVersion,
TokenList,
UnstructuredTokenList,
)
from email.errors ... |
15,732 | disconnect | from channels.db import database_sync_to_async
from channels.generic.websocket import AsyncJsonWebsocketConsumer
from baserow.ws.registries import page_registry
class CoreConsumer(AsyncJsonWebsocketConsumer):
async def connect(self):
await self.accept()
user = self.scope["user"]
web_sock... |
15,733 | is program valid | # 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... |
15,734 | is infra error | #!/usr/bin/env python3
# Copyright (C) 2018, 2019 Collabora Limited
# Author: Guillaume Tucker <guillaume.tucker@collabora.com>
#
# This module 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 ve... |
15,735 | test render not combined | #!/usr/bin/env python3
###############################################################
# Copyright 2022 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#
# This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
#
# SPDX-License-Id... |
15,736 | math dec inline | from extended_precision_data_types.requirements import *
from extended_precision_data_types.common import *
funcs = [
('exp(', 3, 0),
('log(', 0, 0),
('ln(', 0, 0),
('exp2(', 2, 0),
('log2(', 0, 0),
('exp10(', 10, 0),
('log10(', 0, 0),
('sqrt(', 1, 0),
('cbrt(', 1, 0),
('erf(', ... |
15,737 | analyser osmosis full | #!/usr/bin/env python
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frédéric Rodrigo 2011-2014 ##
## ... |
15,738 | test api 500 no answer | import responses
from urllib.parse import urlencode
from flask_testing import TestCase
from webapp.app import create_app
class GetEmbeddedCardTest(TestCase):
render_templates = False
snap_payload = {
"snap-id": "id",
"name": "snapName",
"default-track": None,
"snap": {
... |
15,739 | save | import dill
from typing import Optional, Dict
from transformers.tokenization_utils_base import PreTrainedTokenizerBase
class TransformersTokenizerNER(object):
"""Args:
hf_tokenizer
Must be able to return token offsets.
max_len:
Max sequence length, if longer it will be spli... |
15,740 | test inv block | #!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""
Test transaction download behavior
"""
from test_framework.messages import (
CInv,
CTransaction,
... |
15,741 | test missing cpus | # Copyright 2017 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
15,742 | test lpt matter 1loop | import numpy as np
import pyccl as ccl
import pytest
COSMO = ccl.Cosmology(
Omega_c=0.27, Omega_b=0.045, h=0.67, sigma8=0.8, n_s=0.96,
transfer_function='bbks', matter_power_spectrum='linear')
TRS = {'TG': ccl.nl_pt.PTNumberCountsTracer(b1=2.0, b2=2.0, bs=2.0, bk2=2.0),
'TM': ccl.nl_pt.PTMatterTracer()... |
15,743 | column count | from qtpy.QtCore import QAbstractTableModel, Qt, QVariant
from qtpy.QtGui import QBrush
from .baseplot import BasePlotCurveItem
class BasePlotCurvesModel(QAbstractTableModel):
name_for_symbol = {v: k for k, v in BasePlotCurveItem.symbols.items()}
name_for_line = {v: k for k, v in BasePlotCurveItem.lines.items... |
15,744 | test transform cell level parameterized | import numpy as np
import pandas as pd
import pytest
from giskard import slicing_function, Dataset, SlicingFunction
from giskard.ml_worker.testing.registry.transformation_function import transformation_function
@slicing_function(name="slice with parenthesis")
def filter_with_parenthesis(x: pd.Series) -> bool:
re... |
15,745 | ping | #!/usr/bin/env python
"""
Enable wxPython to be used interacive by setting PyOS_InputHook.
based on inputhook.py and inputhookwx.py from IPython,
which has several authors, including
Robin Dunn, Brian Granger, Ondrej Certik
tweaked by M Newville for larch
"""
import sys
import time
import signal
from select impor... |
15,746 | set status led | #!/usr/bin/env python
########################################################################
# DellEMC Z9100
#
# Module contains an implementation of SONiC Platform Base API and
# provides the PSUs' information which are available in the platform
#
####################################################################... |
15,747 | build subactuators | # Module 'panel'
#
# Support for the Panel library.
# Uses built-in module 'pnl'.
# Applications should use 'panel.function' instead of 'pnl.function';
# most 'pnl' functions are transparently exported by 'panel',
# but dopanel() is overridden and you have to use this version
# if you want to use callbacks.
from warnin... |
15,748 | destroy | """Views for events app."""
from uuid import UUID
from rest_framework.response import Response
from rest_framework import viewsets
from django.shortcuts import get_object_or_404
from events.prioritizer import get_fresh_prioritized_events
from events.prioritizer import get_prioritized
from events.serializers import Even... |
15,749 | test success redirect honour redirect post parameter | from django.test import TestCase, override_settings
from django.urls import reverse
from wagtail.admin.forms.auth import PasswordResetForm
from wagtail.admin.tests.test_forms import CustomPasswordResetForm
from wagtail.models import Page
from wagtail.test.utils import WagtailTestUtils
class TestLoginView(WagtailTest... |
15,750 | get state | ##########################################################################
#
# Copyright (c) 2013, 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... |
15,751 | name | """Sync LDAP Users and groups into authentik"""
from typing import Any, Generator, Optional
from django.db.models import Q
from ldap3 import SUBTREE
from authentik.core.models import Group, User
from authentik.sources.ldap.auth import LDAP_DISTINGUISHED_NAME
from authentik.sources.ldap.models import LDAPSource
from a... |
15,752 | timestamp | # -*- coding: utf-8 -*-
import logging
from datetime import datetime
import hashlib
import os
import re
import socket
import struct
import requests
from requests.exceptions import SSLError
from six.moves.xmlrpc_client import ProtocolError
from .exceptions import ServiceUnavailable
logger = logging.getLogger(__name_... |
15,753 | construct undefined | from collections.abc import Callable, Hashable
from datetime import date
from re import Pattern
from typing import Any, ClassVar, TypeVar
from typing_extensions import TypeAlias
from yaml.error import MarkedYAMLError
from yaml.nodes import MappingNode, Node, ScalarNode, SequenceNode
from .cyaml import _CLoader
from .... |
15,754 | phonemize gruut | import importlib
from typing import List
import gruut
from gruut_ipa import IPA
from TTS.tts.utils.text.phonemizers.base import BasePhonemizer
from TTS.tts.utils.text.punctuation import Punctuation
# Table for str.translate to fix gruut/TTS phoneme mismatch
GRUUT_TRANS_TABLE = str.maketrans("g", "ɡ")
class Gruut(B... |
15,755 | in other limits | # Copyright 2019 Xilinx 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 agreed to in writing, ... |
15,756 | func | # 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 ... |
15,757 | update | #!/usr/bin/env python3
# Copyright (c) Megvii Inc. All rights reserved.
# Copyright © Alibaba, Inc. and its affiliates.
import math
import time
from copy import deepcopy
import torch
import torch.nn as nn
from thop import profile
from torch.nn.parallel import DistributedDataParallel as DDP
__all__ = [
'fuse_conv... |
15,758 | get items | """A dummy backend for use in tests.
This backend implements the backend API in the simplest way possible. It is
used in tests of the frontends.
"""
import pykka
from mopidy import backend
from mopidy.models import Playlist, Ref, SearchResult
def create_proxy(config=None, audio=None):
return DummyBackend.sta... |
15,759 | calc global num faces | from __future__ import unicode_literals
from builtins import object
from builtins import zip
from builtins import range
__docformat__ = 'restructuredtext'
__all__ = []
import itertools
from fipy.tools.dimensions.physicalField import PhysicalField
from fipy.tools import numerix
from functools import reduce
class _Ab... |
15,760 | vineyard rpc client | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... |
15,761 | write spack yaml file | # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Bootstrap non-core Spack dependencies from an environment."""
import glob
import hashlib
import os
import pathlib
import... |
15,762 | get col width | # Copyright The IETF Trust 2013-2022, All Rights Reserved
# -*- coding: utf-8 -*-
from django import template
from django.urls import reverse
register = template.Library()
# returns the a dictioary's value from it's key.
@register.filter(name='lookup')
def lookup(dict, index):
if index in dict:
return... |
15,763 | test conformer layer | # Copyright 2021 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... |
15,764 | test conv3d transpose regularizers | # Copyright 2018 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... |
15,765 | tear down | import datetime
from django.contrib.auth import get_user_model
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import timezone
from oauth2_provider.models import get_access_token_model, get_application_model, get_refresh_token_model
Application = get_application_mo... |
15,766 | set up | # 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... |
15,767 | after epoch | from logging import getLogger
from typing import Optional
from aim._sdk.run import Run
from aim._ext.system_info import DEFAULT_SYSTEM_TRACKING_INT
try:
from fastai.learner import Callback
from fastcore.basics import store_attr, detuplify, ignore_exceptions
from fastai.callback.hook import total_params
ex... |
15,768 | get server version info | # firebird/kinterbasdb.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: firebird+kinterbasdb
:name: kinterbasdb
:dbapi: kin... |
15,769 | test source metadata or source | # -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to ... |
15,770 | test mixup empty data | # MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2022
#
# 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
# r... |
15,771 | get colors | #!/usr/bin/env python3
# coding: utf-8
import numpy as np
from math import sqrt
import scipy.io as sio
import matplotlib.pyplot as plt
from .ddfa import reconstruct_vertex
from .estimate_pose import matrix2angle, angle2matrix, P2sRt
__author__ = 'cleardusk'
__all__ = ['matrix2angle', 'angle2matrix']
def get_5lmk_fr... |
15,772 | register dummy chunkmanager | from __future__ import annotations
from typing import Any
import numpy as np
import pytest
from xarray.core.daskmanager import DaskManager
from xarray.core.parallelcompat import (
ChunkManagerEntrypoint,
get_chunked_array_type,
guess_chunkmanager,
list_chunkmanagers,
)
from xarray.core.types import T... |
15,773 | populate bucket | from datetime import datetime, timedelta
from typing import List, Tuple
from app_analytics.analytics_db_service import ANALYTICS_READ_BUCKET_SIZE
from django.conf import settings
from django.db.models import Count, Q, Sum
from django.utils import timezone
from environments.models import Environment
from task_processo... |
15,774 | test bare ident | import pytest
from xdsl.utils.exceptions import ParseError
from xdsl.utils.lexer import Input, Lexer, Token
def get_token(input: str) -> Token:
file = Input(input, "<unknown>")
lexer = Lexer(file)
token = lexer.lex()
return token
def assert_single_token(
input: str, expected_kind: Token.Kind, e... |
15,775 | forward helper clip | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
15,776 | serialize signature | # stdlib
import inspect
from inspect import Parameter
from inspect import Signature
from inspect import _ParameterKind
from inspect import _signature_fromstr
import re
from typing import Callable
from typing import Optional
# relative
from .deserialize import _deserialize
from .recursive import recursive_serde_registe... |
15,777 | test wrong type one input | # Copyright 2015 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... |
15,778 | check resolution | import os
import stat
import unittest
from avocado.core import resolver
from avocado.plugins.resolvers import (
AvocadoInstrumentedResolver,
ExecTestResolver,
PythonUnittestResolver,
)
from avocado.utils import script
from selftests.utils import BASEDIR
#: What is commonly known as "0664" or "u=rw,g=rw,o=... |
15,779 | test test client calls teardown handlers | # -*- coding: utf-8 -*-
"""
flask.testsuite.testing
~~~~~~~~~~~~~~~~~~~~~~~
Test client and more.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
from flask._compat import text_type
c... |
15,780 | xor | import sys
from _typeshed import SupportsGetItem
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
from typing import Any, AnyStr, Generic, Protocol, SupportsAbs, TypeVar, overload
from typing_extensions import ParamSpec, SupportsIndex, TypeAlias, final
_R = TypeVar("... |
15,781 | verify bitserial conv2d nhwc | # 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... |
15,782 | test root logger | import logging
from typing import TYPE_CHECKING, Any, Dict
from unittest.mock import Mock, patch
import pytest
from litestar import Request, get
from litestar.logging.config import LoggingConfig, _get_default_handlers, default_handlers, default_picologging_handlers
from litestar.logging.picologging import QueueListen... |
15,783 | get error | import os
import shlex
import shutil
import subprocess
import tempfile
from buildtest.exceptions import BuildTestError
from buildtest.utils.file import read_file
class Capturing:
"""capture output from stdout and stderr into capture object.
This is based off of github.com/vsoch/gridtest but modified
to w... |
15,784 | rand str | """
Small script used to generate mock data to test the UI.
"""
import argparse
import itertools
import random
import string
from random import random as rand
import mlflow
from mlflow import MlflowClient
def log_metrics(metrics):
for k, values in metrics.items():
for v in values:
mlflow.log... |
15,785 | on menu selection | # SPDX-License-Identifier: GPL-3.0
# Copyright (c) 2014-2023 William Edwards <shadowapex@gmail.com>, Benjamin Bean <superman2k5@gmail.com>
from __future__ import annotations
from typing import Generator, List
import pygame
from tuxemon import tools
from tuxemon.locale import T
from tuxemon.menu.interface import Menu... |
15,786 | extract data | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
import sys
from typing import AsyncIter... |
15,787 | welch | # -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2014-2020)
#
# This file is part of GWpy.
#
# GWpy 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)... |
15,788 | test conv1 d 11 padding 1 | # 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 applic... |
15,789 | get delay maximum | # 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 ... |
15,790 | test pga run | #!/usr/bin/env python3
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
class TestPGA(TestCase):
output = "pga_output"
result = "result"
@classmethod
def setUpClass(cls):
cls.use_temp_region()
cls.runModule("g.region", raster="lsat7_2002_30@PERMANENT")... |
15,791 | test fsk 10db center detection | import unittest
import numpy as np
from tests.test_util import get_path_for_data_file
from urh.ainterpretation.AutoInterpretation import detect_center
from urh.cythonext.signal_functions import afp_demod
from urh.signalprocessing.Filter import Filter, FilterType
from urh.signalprocessing.Signal import Signal
class... |
15,792 | replace lambda | import six
from future import standard_library
standard_library.install_aliases()
from builtins import map
from builtins import filter
from builtins import object
# coding=utf-8
from io import BytesIO, StringIO
from vcr.cassette import Cassette
from requests import Session
import inspect
import functools
import re
imp... |
15,793 | test valid header partial | import json
import os
import unittest
from buildpack.core import nginx
class TestCaseCustomHeaderConfig(unittest.TestCase):
def test_valid_header_xfrmaeOption(self):
os.environ["HTTP_RESPONSE_HEADERS"] = json.dumps(
{"X-Frame-Options": "allow-from https://mendix.com"}
)
os.env... |
15,794 | retrieve cadvisor metrics | # (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from __future__ import division
import logging
import numbers
from fnmatch import fnmatch
import requests
from six import iteritems
from six.moves.urllib.parse import urlparse
from datadog_checks.base.utils.t... |
15,795 | test parse timespan value | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import sys
import unittest
from benchexec.util import ProcessExitCode
import tempfile
impo... |
15,796 | fetch result | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (... |
15,797 | compile report | # -*- coding: utf-8 -*-
"""Analysis plugin to gather information about Chrome extensions."""
import re
import requests
from plaso.analysis import interface
from plaso.analysis import logger
from plaso.analysis import manager
from plaso.containers import analysis_results
class ChromeExtensionPlugin(interface.Analys... |
15,798 | test input parameter error with all source | from .base import TestCase
from graphite.errors import InputParameterError
class ErrorTest(TestCase):
def test_input_parameter_error_basic(self):
e = InputParameterError('exception details')
self.assertEqual(
str(e),
'Invalid parameters (exception details)',
)
... |
15,799 | from raws and root | """The DepthMap class is an enriched sequence of raw segments."""
import logging
from dataclasses import dataclass
from typing import FrozenSet, List, Sequence, Tuple, Type, Dict
from sqlfluff.core.parser import BaseSegment
from sqlfluff.core.parser.segments.base import PathStep
from sqlfluff.core.parser.segments.raw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.