id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
1,200 | zip frames | from os import remove
from os.path import join
from shutil import copyfile, rmtree
from tempfile import mkdtemp
from threading import Event
from zipfile import ZipFile
try:
from urllib import urlretrieve
except ImportError:
from urllib.request import urlretrieve
from kivy.tests.common import GraphicUnitTest, e... |
1,201 | get empty | # Copyright (C) 2023 CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from dateutil import parser
import cvat.apps.dataset_manager as dm
from cvat.apps.analytics_report.models import (
BinaryOperatorType,
GranularityChoice,
TransformOperationType,
ViewChoice,
)
from cvat.apps.analytics_report.repo... |
1,202 | input | """Preprocess a C source file using gcc and convert the result into
a token stream
Reference is C99:
* http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf
"""
__docformat__ = "restructuredtext"
import os
import re
import sys
import subprocess
from ctypesgen.parser import pplexer, lex
from ctypesgen.pars... |
1,203 | test debian | # This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... |
1,204 | name | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... |
1,205 | method not found | # -*- test-case-name: twisted.web.test.test_soap -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
SOAP support for twisted.web.
Requires SOAPpy 0.10.1 or later.
Maintainer: Itamar Shtull-Trauring
Future plans:
SOAPContext support of some kind.
Pluggable method lookup policies.
"""
#... |
1,206 | test function import quantize fx | # Owner(s): ["oncall: quantization"]
from .common import AOMigrationTestCase
class TestAOMigrationQuantizationFx(AOMigrationTestCase):
def METHOD_NAME(self):
function_list = [
'_check_is_graph_module',
'_swap_ff_with_fxff',
'_fuse_fx',
'QuantizationTracer',
... |
1,207 | convert spiketrains | # 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 ... |
1,208 | default costing method | #################################################################################
# WaterTAP Copyright (c) 2020-2023, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National Laboratory,
# National Renewable Energy Laboratory, and National Energy Technology
# Labo... |
1,209 | get n params | # ***************************************************************************
# * Copyright (c) 2020 three_d *
# * Copyright (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * *
# * Th... |
1,210 | test gather purloviatest pgd | import pytest
from ark.gathering import gather_dcsc_properties
from ark.types import PrimalDinoCharacter, PrimalDinoStatusComponent, PrimalGameData
from ue.gathering import gather_properties
from ue.hierarchy import inherits_from
from ue.proxy import UEProxyStructure
from .common import * # noqa: F401,F403 # needed... |
1,211 | test new module success | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2023, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
1,212 | render | # -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager 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 License, or
# (at your option) any ... |
1,213 | update settings for use of model based | # SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ
# SPDX-FileCopyrightText: 2021 Janek Groehl
# SPDX-License-Identifier: MIT
import numpy as np
from simpa.core.device_digital_twins import DetectionGeometryBase
from simpa.utils import Settings, Tags
class PlanarArrayDetectionGeometry(Detect... |
1,214 | run compiler | import os
import sys
import shutil
import subprocess
# Clear all incremental stuff
def clear_stuff():
if os.path.exists('objc'):
shutil.rmtree('objc')
if os.path.exists('object'):
shutil.rmtree('object')
if os.path.exists('flowc.debug'):
os.remove('flowc.debug')
if os.path.exists('flowc.bytecode'):
os.remo... |
1,215 | write | """
pygments.formatters.other
~~~~~~~~~~~~~~~~~~~~~~~~~
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments.util import get_choice_... |
1,216 | accept | from __future__ import annotations
from typing import TYPE_CHECKING, Any, AsyncGenerator, Generic, cast
from litestar._multipart import parse_content_header, parse_multipart_form
from litestar._parsers import parse_url_encoded_form_data
from litestar.connection.base import (
ASGIConnection,
AuthT,
StateT,... |
1,217 | test qvm run pqer | import numpy as np
import pytest
from pyquil import Program
from pyquil.api import QVM
from pyquil.api._errors import QVMError
from pyquil.api._qvm import validate_noise_probabilities, validate_qubit_list, prepare_register_list
from pyquil.api import QCSClientConfiguration
from pyquil.gates import MEASURE, X
from pyqu... |
1,218 | nested | # util/compat.py
# Copyright (C) 2005-2016 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
"""Handle Python version/platform incompatibilities."""
import sys
try:
import ... |
1,219 | load schema | import logging
import sys
from dataclasses import dataclass
from typing import Union
import click
from linkml_runtime.linkml_model import SchemaDefinition
from linkml_runtime.utils.schemaview import SchemaView
from rdflib import Graph
from SPARQLWrapper import JSON, SPARQLWrapper
from linkml._version import __version... |
1,220 | voucher and user client | # pylint: disable=redefined-outer-name
"""
Fixtures for voucher tests
"""
from datetime import datetime
from types import SimpleNamespace
import pytest
import pytz
import factory
from django.http import HttpRequest
from faker import Faker
from courses.factories import CourseRunFactory
from ecommerce.factories import ... |
1,221 | launch torpedo | #!/usr/bin/env python3
import numpy as np
import rospy
from gazebo_msgs.msg import ContactsState, ModelState
from gazebo_msgs.srv import (
ApplyJointEffort,
ApplyJointEffortRequest,
GetModelState,
JointRequest,
JointRequestRequest,
SetModelState,
)
from geometry_msgs.msg import Twist
from mil_ro... |
1,222 | example test 2 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
1,223 | test shows enhydris version | import datetime as dt
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from bs4 import BeautifulSoup
from model_mommy import mommy
from enhydris.models import Station
from enhydris.telemetry.models import Telemetry, TelemetryLogMessage
class TelemetryLogViewTestCase(T... |
1,224 | get generator supported types | #!/usr/bin/env python3
#
# This is a tool to generate the bitonic sorter code that is used for small arrays.
#
# usage: bitonic_gen.py [-h] [--vector-isa VECTOR_ISA [VECTOR_ISA ...]]
# [--break-inline BREAK_INLINE] [--output-dir OUTPUT_DIR]
#
# the files in src/coreclr/gc/vxsort/smallsort that are c... |
1,225 | collect list dbs | # This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... |
1,226 | account read | # -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2017 University of Tuebingen, CERN, CSC, KTH.
#
# B2Share 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... |
1,227 | t | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import opengate as gate
import itk
from scipy.spatial.transform import Rotation
if __name__ == "__main__":
paths = gate.get_default_test_paths(__file__, "")
# create the simulation
sim = gate.Simulation()
# main options
ui = sim.user_info
ui.g4_... |
1,228 | test sections absent | """
Test cases for salt.states.ini_manage
"""
import copy
import os
import pytest
import salt.modules.ini_manage as mod_ini_manage
import salt.states.ini_manage as ini_manage
from salt.utils.odict import OrderedDict
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules()... |
1,229 | tear down | #!/usr/bin/env python3
import os
import random
import unittest
import warnings
from math import exp, pi
import torch
from torch import optim
import gpytorch
from gpytorch.distributions import MultivariateNormal
from gpytorch.kernels import GridInterpolationKernel, RBFKernel, ScaleKernel
from gpytorch.likelihoods imp... |
1,230 | data | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from math import pi, cos, sin
from compas.geometry import Point
from compas.geometry import Vector
from compas.geometry import Frame
from compas.geometry import Circle
from .surface import Surface
PI2 = 2 * p... |
1,231 | async callable | from functools import partial
from typing import Any, AsyncGenerator, Generator
import pytest
from litestar.di import Provide
from litestar.exceptions import ImproperlyConfiguredException, LitestarWarning
from litestar.types import Empty
def generator_func() -> Generator[float, None, None]:
yield 0.1
async de... |
1,232 | init applet drawer ui | ###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... |
1,233 | mask path | """ Contains ADE dataset for semantic segmentation tasks """
import os
from io import BytesIO
from zipfile import ZipFile
import tempfile
from PIL import Image
import tqdm
import requests
from . import ImagesOpenset
class ADESegmentation(ImagesOpenset):
""" Contains 20210 images and masks for training and 2000... |
1,234 | test property decorator baseclass | # Test case for property
# more tests are in test_descr
import sys
import unittest
from test.test_support import run_unittest
class PropertyBase(Exception):
pass
class PropertyGet(PropertyBase):
pass
class PropertySet(PropertyBase):
pass
class PropertyDel(PropertyBase):
pass
class BaseClass(object... |
1,235 | x open | from __future__ import annotations
import sys
from itertools import count
from unittest.mock import MagicMock, Mock, patch
import pytest
from kombu import Connection
from kombu.transport import pyamqp
def test_amqps_connection():
conn = Connection('amqps://')
assert conn.transport # evaluate transport, do... |
1,236 | tolist | import sys
from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite
from collections.abc import Iterable
# pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence
from typing import Any, Generic, MutableSequence, TypeVar, overload # noqa: Y022
from typing_exten... |
1,237 | gross | from os import listdir, remove, rmdir
from os.path import join
from indigo import IndigoObject
from indigo.bingo import Bingo, BingoException
from ..constants import DB_BINGO
from ..helpers import indigo_iterator
from ..logger import logger
from .base import NoSQLAdapter, catch_indigo_exception
class BingoNoSQL(NoS... |
1,238 | ocio configs switcher enum | from pydantic import Field, validator
from ayon_server.settings import (
BaseSettingsModel,
ensure_unique_names,
)
def METHOD_NAME():
return [
{"value": "nuke-default", "label": "nuke-default"},
{"value": "spi-vfx", "label": "spi-vfx"},
{"value": "spi-anim", "label": "spi-anim"},
... |
1,239 | check spec time | """
Lets you set restrictions on spectators.
Original documentation:
This script will hopefully give server owners some control over what
spectators do on there server. As of now since the release of v0.75,
Goon Haven has had issues with spectators idling and using global chat
to send information to a team so that th... |
1,240 | guess exception source | # Copyright (c) 2015, Maxwell Morais and contributors
# License: MIT. See LICENSE
import functools
import inspect
import re
from collections import Counter
from contextlib import suppress
import frappe
EXCLUDE_EXCEPTIONS = (
frappe.AuthenticationError,
frappe.CSRFTokenError, # CSRF covers OAuth too
frappe.Securi... |
1,241 | test get home dir | import unittest
import EXOSIMS.util.get_dirs as gd
import os
from unittest.mock import *
import numpy as np
import sys
class TestGetDirs(unittest.TestCase):
"""
Tests the get_dir tool.
Sonny Rappaport, Cornell, July 2021
"""
def METHOD_NAME(self):
"""
Tests that get_home_dir work... |
1,242 | test append | import pytest
pytestmark = [
pytest.mark.windows_whitelisted,
]
FIRST_IF_CONTENTS = """\
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
"""
SECOND_IF_CONTENTS = """\
# enabl... |
1,243 | apply overwrites to inputs | """Utilities mainly used in helping `modes` like replay and others."""
import json
from ruamel.yaml import YAML
from ruamel.yaml.composer import ComposerError
import os
import logging
from tackle.exceptions import (
ContextDecodingException,
UnsupportedBaseFileTypeException,
TackleImportError,
)
from tackl... |
1,244 | close | # -*- coding: utf-8 -*-
# Copyright 2023 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... |
1,245 | test failure invalid days string | import unittest
import hcl2
from checkov.terraform.checks.resource.azure.NetworkWatcherFlowLogPeriod import check
from checkov.common.models.enums import CheckResult
class TestNetworkWatcherFlowLogPeriod(unittest.TestCase):
def test_failure(self):
hcl_res = hcl2.loads("""
resource "azurerm_... |
1,246 | test get default | #!/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 (... |
1,247 | fix path | # Copyright 2020-2022 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
#
# SkyTemple 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 y... |
1,248 | test | # Copyright 2018-2021 The Matrix.org Foundation C.I.C.
#
# 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... |
1,249 | delete marker version id | # -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage, (C)
# 2020 MinIO, 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/lic... |
1,250 | get pending payment transactions ids | import datetime
import logging
from decimal import Decimal
import sqlalchemy as sa
from aiohttp import web
from aiopg.sa.result import ResultProxy
from models_library.api_schemas_webserver.wallets import PaymentID
from models_library.basic_types import IDStr
from models_library.emails import LowerCaseEmailStr
from mod... |
1,251 | entry status | # --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2019, Red Hat inc,
# Copyright (C) 2018, William Brown <william@blackhats.net.au>
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
import json
import ldap
from lib389.idm.role import (
... |
1,252 | supports auto limit | import logging
from redash.query_runner import (
BaseSQLQueryRunner,
JobTimeoutException,
register,
)
from redash.query_runner.mssql import types_map
from redash.utils import json_dumps, json_loads
logger = logging.getLogger(__name__)
try:
import pyodbc
enabled = True
except ImportError:
ena... |
1,253 | test with revealed submissions | import json
import pytest
from rest_framework import status
from usaspending_api.awards.models import Award
from usaspending_api.idvs.tests.data.idv_test_data import PARENTS, IDVS, AWARD_COUNT
AGGREGATE_ENDPOINT = "/api/v2/idvs/funding_rollup/"
CURRENT_YEAR = 2020
def _generate_expected_response(award_id):
""... |
1,254 | create glossary | # Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Generated by Django 3.1.4 on 2021-02-01 14:12
import os
from django.conf import settings
from django.db import migrations
from django.utils.text import slugify
from translate.misc.xml_helpers import valid_chars_only
from... |
1,255 | process | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... |
1,256 | test throw on failure env var | #!/usr/bin/env python
#
# Copyright 2009, Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
1,257 | test select words output | import unittest
import numpy as np
from AnyQt.QtCore import QItemSelectionModel
from Orange.widgets.tests.base import WidgetTest
from Orange.data import StringVariable, Domain
from scipy.sparse import csr_matrix
from orangecontrib.text.corpus import Corpus
from orangecontrib.text.topics import Topic
from orangecontri... |
1,258 | set | #A* -------------------------------------------------------------------
#B* This file contains source code for the PyMOL computer program
#C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
#D* -------------------------------------------------------------------
#E* It is unlawful to modify or remove t... |
1,259 | parse mixed kwargs | # Copyright 2019-2022 The ASReview 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 appl... |
1,260 | getbalance | # -*- coding: utf-8 -*-
#
# BitcoinLib - Python Cryptocurrency Library
# Chain.so client
# © 2017-2022 October - 1200 Web Development <http://1200wd.com/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publish... |
1,261 | make suggestion list | import warnings
import pytest
from ert.config import ConfigWarning, ErtConfig
from ert.config.parsing.config_schema_deprecations import (
JUST_REMOVE_KEYWORDS,
REPLACE_WITH_GEN_KW,
RSH_KEYWORDS,
USE_QUEUE_OPTION,
)
from ert.config.parsing.deprecation_info import DeprecationInfo
def test_is_angle_bra... |
1,262 | visit primitive literal | # Generated from stix_shifter_utils/stix_translation/src/patterns/grammar/STIXPattern.g4 by ANTLR 4.8
from antlr4 import *
if __name__ is not None and "." in __name__:
from .STIXPatternParser import STIXPatternParser
else:
from STIXPatternParser import STIXPatternParser
# This class defines a complete generic ... |
1,263 | test asarray chkfinite | import unittest
import pytest
import numpy
import cupy
from cupy import testing
class TestKind(unittest.TestCase):
@testing.for_orders('CFAK')
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal()
def METHOD_NAME(self, xp, dtype, order):
a = [0, 4, 0, 5]
return xp.asarray_chkf... |
1,264 | client | # Copyright © 2019 Province of British Columbia
#
# 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 agr... |
1,265 | source | #!/usr/bin/env python3
#
"""
一般椭圆方程的任意次有限元方法。
作者:西安交通大学数学与统计学院 杨迪
说明:FEALPy短课程第三次作业
版本:1.0
日期:31/07/2020
"""
import argparse
import numpy as np
from scipy.sparse.linalg import spsolve
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from fealpy.decorator import cartesian, barycentric
f... |
1,266 | run job | from . import helpers
def METHOD_NAME(config):
config["general"]["relevant_filetypes"] = [
"log",
"mon",
"outdata",
"restart_out",
"bin",
"config",
"forcing",
"input",
"restart_in",
"ignore",
]
helpers.evaluate(config, "datapr... |
1,267 | test timeout overflow | # Test case for the select.devpoll() function
# Initial tests are copied as is from "test_poll.py"
import os
import random
import select
import unittest
from test.support import cpython_only
if not hasattr(select, 'devpoll') :
raise unittest.SkipTest('test works only on Solaris OS family')
def find_ready_match... |
1,268 | test update bc b month | # Copyright 2019 Akretion - Renato Lima <renato.lima@akretion.com.br>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from datetime import datetime
from os import environ
from unittest import mock
from dateutil.relativedelta import relativedelta
from decorator import decorate
from odo... |
1,269 | release | """
Copyright (c) 2018-2023 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
1,270 | get framework config for customer | """Framework Configuration utilities"""
import configparser
import time
import os
import random
import string
import datetime
import threading
from processor.helper.file.file_utils import exists_file, exists_dir
FRAMEWORKDIR = None
FRAMEWORKCONFIG = None
CURRENTDATA = None
DATABASE = 'MONGODB'
TESTS = 'TESTS'
DBTESTS ... |
1,271 | hostname or filename | import jinja2
from dateutil import parser
from h.presenters.document_html import DocumentHTMLPresenter
class AnnotationHTMLPresenter:
"""Wraps Annotation model objects and adds some HTML properties."""
def __init__(self, annotation):
self.annotation = annotation
if self.annotation.document:
... |
1,272 | url | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
1,273 | acquire | import inspect
from ..utils.common import get_current_user
from ..common.trex_api_annotators import client_api
from ..common.trex_client import TRexClient
from ..common.trex_ctx import TRexCtx
from ..common.trex_logger import ScreenLogger
class DummyConnection():
"""
A dummy connection for compatability o... |
1,274 | ftp | import os
import subprocess
import sys
import time
import pytest
import fsspec
from fsspec import open_files
from fsspec.implementations.METHOD_NAME import FTPFileSystem
ftplib = pytest.importorskip("ftplib")
here = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture()
def METHOD_NAME():
pytest.importor... |
1,275 | setup | import logging
import random
from discord import Embed
from discord.ext import commands
from bot.bot import Bot
from bot.constants import Colours, NEGATIVE_REPLIES, Tokens
log = logging.getLogger(__name__)
class ScaryMovie(commands.Cog):
"""Selects a random scary movie and embeds info into Discord chat."""
... |
1,276 | get params | #!/usr/bin/env python3
from cereal import car
from panda import Panda
from openpilot.selfdrive.car import get_safety_config
from openpilot.selfdrive.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
class CarInterface(CarInterfaceBa... |
1,277 | load graph | # 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... |
1,278 | test rb prev | # Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: LGPL-2.1-or-later
import collections
from drgn import NULL
from drgn.helpers import ValidationError
from drgn.helpers.linux.rbtree import (
RB_EMPTY_NODE,
RB_EMPTY_ROOT,
rb_find,
rb_first,
rb_last,
rb_next,
rb_... |
1,279 | update current contact | #!/usr/bin/env python3
from asciimatics.widgets import Frame, ListBox, Layout, Divider, Text, \
Button, TextBox, Widget
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.exceptions import ResizeScreenError, NextScene, StopApplication
import sys
import sqlite3
class Contac... |
1,280 | get queue | import boto3
import itertools
import json
from toolz import dicttoolz
from typing import Any, Iterable, Mapping, Optional
def redrive_queue(
queue_name: str,
to_queue_name: Optional[str] = None,
limit: Optional[int] = None,
dryrun: bool = False,
max_wait: int = 5,
messages_per_request: int = 1... |
1,281 | prepare git | import salt.exceptions
import logging
import os
from tempfile import mkdtemp
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
log = logging.getLogger(__name__)
# valid prefixes taken from Docker-CE to be compatible
valid_git_prefixes = ['http://', 'https://', 'git://',... |
1,282 | html zip | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Tests for qutebrowser.utils.resources."""
import os.path
import zipfile
import pytest
from qutebrowser.utils import utils, resources
@pytest.mark.usefixtures('freezer')
class TestReadFile:... |
1,283 | render mc2 | import abc
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Self
from passlib.ifc import PasswordHash
from passlib.utils.binary import BASE64_CHARS, HASH64_CHARS, LOWER_HEX_CHARS, PADDED_BASE64_CHARS, UPPER_HEX_CHARS
H64_CHARS = HASH64_CHARS
B64_CHARS = BASE64_CHARS
PADD... |
1,284 | payload image | import json
import cv2
import base64
import threading
import time
from datetime import datetime
from websocket_server import WebsocketServer
# Graphical User Interface Class
class GUI:
# Initialization function
# The actual initialization
def __init__(self, host):
t = threading.Thread(target=self.... |
1,285 | te matmul | # 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... |
1,286 | chebyshevu | """Efficient functions for generating orthogonal polynomials."""
from ..core import Dummy
from ..domains import QQ, ZZ
from .constructor import construct_domain
from .polytools import Poly, PurePoly
def _jacobi(n, a, b, K):
"""Low-level implementation of Jacobi polynomials."""
ring = K.poly_ring('_0')
x ... |
1,287 | check tensor parallel rank | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from pathlib import Path
import pytest
import torch
from colossalai import launch
from colossalai.context import reset_seeds
from colossalai.context.parallel_mode import ParallelMode
from colossalai.core import global_context as gpc
from colossalai.global_variables imp... |
1,288 | test flow with header | from unittest import mock
import pytest
import requests
from settings import TEST_DATA
from suite.utils.resources_utils import ensure_response_from_backend, wait_before_test
from suite.utils.vs_vsr_resources_utils import patch_virtual_server_from_yaml
resp_1 = mock.Mock()
resp_2 = mock.Mock()
resp_3 = mock.Mock()
d... |
1,289 | test uninstalled non existing | import pytest
import salt.states.win_wusa as wusa
from salt.exceptions import SaltInvocationError
from tests.support.mock import MagicMock, patch
@pytest.fixture
def kb():
return "KB123456"
@pytest.fixture
def configure_loader_modules():
return {wusa: {"__opts__": {"test": False}, "__env__": "base"}}
def... |
1,290 | stack | """pytorch backend implementation"""
from packaging.version import Version
import torch
if Version(torch.__version__) < Version("1.9.0"):
raise RuntimeError("DeepXDE requires PyTorch>=1.9.0.")
# To write device-agnostic (CPU or GPU) code, a common pattern is to first determine
# torch.device and then use it for... |
1,291 | downgrade | # 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... |
1,292 | reference deployment | import os
import shutil
import subprocess
import pytest
import yaml
from dagster import file_relative_path
pytest_plugins = ["dagster_test.fixtures"]
@pytest.fixture
def docker_context(test_id, monkeypatch, tmpdir):
# Docker contexts are stored in $HOME/.docker/contexts
# Buildkite doesn't have $HOME set by... |
1,293 | test representation | from unittest.mock import Mock
from unittest.mock import patch
import numpy as np
import tensorflow as tf
from keras_core import backend
from keras_core import ops
from keras_core import testing
from keras_core.backend.common import keras_tensor
class KerasTensorTest(testing.TestCase):
def test_attributes(self)... |
1,294 | control registers | # Copyright 2023 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 ... |
1,295 | battle 0 | from .campaign_base import CampaignBase
from module.map.map_base import CampaignMap
from module.map.map_grids import SelectedGrids, RoadGrids
from module.logger import logger
from .d1 import Config as ConfigBase
MAP = CampaignMap('D3')
MAP.shape = 'N10'
MAP.camera_data = ['G6', 'F3', 'H4']
MAP.camera_data_spawn_point ... |
1,296 | collect data | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from __future__ import annotations
from collections import defaultdict
import functools
import logging
from typing import Callable, Dict, List, Literal, Tuple, overload
import torch
from .tools import _METRICS, _MASKS, norm_metrics, generate_s... |
1,297 | test nacl | """Tests for displacements."""
from copy import deepcopy
import numpy as np
from phonopy import Phonopy
def METHOD_NAME(ph_nacl: Phonopy):
"""Test displacements of NaCl 2x2x2."""
dataset = deepcopy(ph_nacl.dataset)
disp_ref = [[0, 0.01, 0.0, 0.0], [32, 0.01, 0.0, 0.0]]
np.testing.assert_allclose(ph_... |
1,298 | get private link for azure ad | # 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__ ... |
1,299 | test 02 class methods | """
This test file tests the lib.tokens.yubicotoken
This depends on lib.tokenclass
"""
from .base import MyTestCase
from privacyidea.lib.tokens.yubicotoken import (YubicoTokenClass, YUBICO_URL)
from privacyidea.models import Token
import responses
import json
from privacyidea.lib.config import set_privacyidea_config
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.