id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
1,100 | fileout | # SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
import os
import glob
import codecs
import contextlib
from datetime import datetime
from .output import out
from .util import unquote... |
1,101 | test fan in metrics not called by | # Copyright 2018 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 agreed to in writing, ... |
1,102 | on ready | # This example builds on the concepts of the app_commands/basic.py example
# It's suggested to look at that one to understand certain concepts first.
from typing import Literal, Union, NamedTuple
from enum import Enum
import discord
from discord import app_commands
MY_GUILD = discord.Object(id=0) # replace with yo... |
1,103 | wenner src list | import numpy as np
import matplotlib.pyplot as plt
from . import receivers
from . import sources
from .survey import Survey
# Import geometric_factor to make it available through
# SimPEG.resistivity.utils.geometric_factor (to ensure backward compatibility)
from ..utils import geometric_factor # noqa: F401
def MET... |
1,104 | tasks common settings | # Copyright 2021-present, the Recognai S.L. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
1,105 | test load running | from datetime import timedelta
from typing import List, Dict, Tuple, Any
from pytest import fixture, mark
from resotocore.db.runningtaskdb import RunningTaskData, RunningTaskDb, RunningTaskStepInfo
from resotocore.ids import TaskId, SubscriberId, TaskDescriptorId
from resotocore.message_bus import ActionDone
from res... |
1,106 | test connect tls ok | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import copy
from typing import Callable # noqa: F401
import mock
import pytest
from datadog_checks.base.stubs.aggregator import AggregatorStub # noqa: F401
from datadog_checks.base.stubs.datadog_agent ... |
1,107 | instance cache metric wildcards | # This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x validate models -s <INTEGRATION_NAME>
from datadog_checks.base.utils.models.fields import get_default_field_value
d... |
1,108 | list videos | # -*- coding: utf-8 -*-
# Copyright: (c) 2018, SylvainCecchetto
# GNU General Public License v2.0+ (see LICENSE.txt or https://www.gnu.org/licenses/gpl-2.0.txt)
# This file is part of Catch-up TV & More
from __future__ import unicode_literals
from builtins import str
import re
from codequick import Listitem, Resolve... |
1,109 | delay response | # pylint: disable=protected-access
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=unused-variable
# pylint: disable=unused-variable
import asyncio
import logging
import time
from collections.abc import Coroutine
import pytest
import simcore_service_webserver
from aiohttp im... |
1,110 | tokenizer | # 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... |
1,111 | build model | # Copyright (c) 2023, 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... |
1,112 | remove rows | ######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# This file is part of Spine Toolbox.
# Spine Toolbox is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Gen... |
1,113 | push | import html.parser as base
import sys
from html.entities import entitydefs
__all__ = ["HTMLParser"]
omit_start = ["body", "tbody", "head", "html"]
single = [
"area",
"base",
"basefont",
"br",
"col",
"frame",
"hr",
"img",
"input",
"isindex",
"link",
"meta",
"param",... |
1,114 | update | import os
import shutil
import unittest
import numpy as np
from tensorflow import keras
from neural_compressor import mix_precision
from neural_compressor.config import MixedPrecisionConfig
from neural_compressor.data import DataLoader, Datasets
def build_sequential_model():
# Create Keras model
model = ker... |
1,115 | get pg lossless profiles | import logging
import pytest
import re
from tests.common.helpers.assertions import pytest_assert, pytest_require
from tests.common.utilities import wait_until
from tests.common.helpers.dut_utils import verify_orchagent_running_or_assert
from tests.generic_config_updater.gu_utils import apply_patch, expect_op_success
f... |
1,116 | get script | # -*- coding: UTF-8 -*-
#----------------------
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
from time import time
try:
from thread import start_new_thread, allocate_lock
except ImportError:
from _thread import start_new_thread, allocate_lock
from time import s... |
1,117 | set up | # -*- coding: utf-8
# pylint: disable=line-too-long
"""
Unit tests for the split_fasta function.
"""
import unittest as ut
import os
import anvio
from anvio.errors import FilesNPathsError
from anvio.utils import split_fasta
from anvio.fastalib import ReadFasta
__author__ = "Developers of anvi'o (see AUTHORS.txt)"
_... |
1,118 | test create person with departments | # -*- coding: UTF-8 -*-
from tests.base import ApiDBTestCase
from zou.app.models.department import Department
from zou.app.models.person import Person
from zou.app.utils import fields
from operator import itemgetter
class PersonTestCase(ApiDBTestCase):
def setUp(self):
super(PersonTestCase, self).setUp(... |
1,119 | teller1 | # 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... |
1,120 | format metadata | import os
import shlex
import subprocess
from pathlib import Path
import click
import requests
import yaml
import prefect_server
from prefect_server import config
HASURA_DIR = Path(prefect_server.__file__).parents[2] / "services" / "hasura"
@click.group()
def hasura():
"""
Commands for working with Hasura
... |
1,121 | colorize | #!/usr/bin/env python3
# Copyright (c) 2017 Kurt Jacobson
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... |
1,122 | list for each reverse | # Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: LGPL-2.1-or-later
"""
Linked Lists
------------
The ``drgn.helpers.linux.list`` module provides helpers for working with the
doubly-linked list implementations (``struct list_head`` and ``struct
hlist_head``) in :linux:`include/linux/list... |
1,123 | retrieve authorization token | from tapiriik.settings import WEB_ROOT, TRAINASONE_SERVER_URL, TRAINASONE_CLIENT_SECRET, TRAINASONE_CLIENT_ID
from tapiriik.services.service_base import ServiceAuthenticationType, ServiceBase
from tapiriik.services.service_record import ServiceRecord
from tapiriik.services.interchange import UploadedActivity, ActivityT... |
1,124 | test clean mediapackages harvest jobs pending and | """Tests for clean_mediapackages command."""
from io import StringIO
from unittest import mock
from django.core.management import call_command
from django.test import TestCase
from marsha.core.management.commands import clean_mediapackages
class CleanMediapackagesTest(TestCase):
"""Test clean_mediapackages comm... |
1,125 | timing | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
# Copyright 2021 deepset GmbH. 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.o... |
1,126 | test clean names strip underscores | import pandas as pd
import pytest
from janitor.errors import JanitorError
@pytest.mark.functions
def test_clean_names_method_chain(dataframe):
"""Tests clean_names default args in a method chain."""
df = dataframe.clean_names()
expected_columns = [
"a",
"bell_chart",
"decorated_el... |
1,127 | test next | import requests_mock
from django.test import SimpleTestCase
from corehq.apps.formplayer_api.smsforms.api import FormplayerInterface
from corehq.apps.formplayer_api.utils import get_formplayer_url
SESSION_ID = "SESSION_ID"
DOMAIN = "smsforms_domain"
USER_ID = "USER_ID"
QUESTION_RESPONSE = {
"event": {
"da... |
1,128 | test get user groups unknown dc | import pytest
import salt.utils.win_functions as win_functions
from tests.support.mock import MagicMock, patch
HAS_WIN32 = False
HAS_PYWIN = False
try:
import win32net
HAS_WIN32 = True
class WinError(win32net.error):
winerror = 0
except ImportError:
HAS_WIN32 = False
try:
import pywin... |
1,129 | guess format | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import mimetypes
from .widget_core import CoreWidget
from .domwidget import DOMWidget
from .valuewidget import ValueWidget
from .widget import register
from traitlets import Unicode, CUnicode, Bytes, Bool
from .trait_... |
1,130 | get delta try except | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2023 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import pytest
from numpy import array, allclose, isclose
import pandapower as pp
from pandapower.test.consistency_checks import c... |
1,131 | mogi | """Forward deformation models."""
############################################################
# Program is part of MintPy #
# Copyright (c) 2013, Zhang Yunjun, Heresh Fattahi #
# Author: Zhang Yunjun, 2018 #
##########################################... |
1,132 | process scan | #!/usr/bin/env python
"""Unprivileged memory RPC client code."""
import abc
from typing import TypeVar, Generic, Iterable
from grr_response_client.unprivileged import communication
from grr_response_client.unprivileged.proto import memory_pb2
class ConnectionWrapper:
"""Wraps a connection, adding protobuf seriali... |
1,133 | test nested ipaddr | import csv
import json
from socket import AF_INET
import pytest
from pr2test.context_manager import make_test_matrix, skip_if_not_supported
from pr2test.marks import require_root
from pyroute2.common import basestring
from pyroute2.ndb.objects import RTNL_Object
from pyroute2.ndb.report import Record, RecordSet
pyte... |
1,134 | process csv | __all__ = ['process_csv', 'process_from_web']
import csv
import logging
import requests
from hashlib import md5
from .processor import TasProcessor
from indra.util import read_unicode_csv
tas_data_url = 'https://bigmech.s3.amazonaws.com/indra-db/tas.csv'
tas_resource_md5 = '554ccba4617aae7b3b06a62893424c7f'
logger... |
1,135 | to dict | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
1,136 | clean br cpf | """
Clean and validate a DataFrame column containing CPF numbers, Brazilian national identifier.
"""
# pylint: disable=too-many-lines, too-many-arguments, too-many-branches
from typing import Any, Union
from operator import itemgetter
import dask.dataframe as dd
import numpy as np
import pandas as pd
from stdnum.br i... |
1,137 | input value | # -------------------------------------------------------------------------------
#
# Project: EOxServer <http://eoxserver.org>
# Authors: Bernhard Mallinger <bernhard.mallinger@eox.at>
#
# -------------------------------------------------------------------------------
# Copyright (C) 2022 EOX IT Services GmbH
#
# Perm... |
1,138 | test simple agg filter | from __future__ import annotations
import datetime
import ibis
from ibis.backends.base.sql.compiler import Compiler
from ibis.tests.sql.conftest import to_sql
from ibis.tests.util import assert_decompile_roundtrip
def test_union(union, snapshot):
snapshot.assert_match(to_sql(union), "out.sql")
assert_decomp... |
1,139 | reload | import re
import angr
from PySide6.QtCore import Qt
from PySide6.QtGui import QColor
from PySide6.QtWidgets import QAbstractItemView, QMenu, QTableWidget, QTableWidgetItem
from angrmanagement.ui.dialogs.new_state import NewState
from angrmanagement.utils.namegen import NameGenerator
class QStateTableItem(QTableWidg... |
1,140 | test wchar parm | import unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
dll = CDLL(_ctypes_test.__file__)
try:
CALLBACK_FUNCTYPE = WINFUNCTYPE
except NameError:
# fake to enable this test on Linux
CALLBACK_FUNCTYPE = CFUNCTYPE
class POINT(Structure):
_fields_ = [("x", c_int), ("y... |
1,141 | get report rows | """Import Stripe reports into BigQuery."""
import os
import sys
import warnings
from datetime import datetime, timezone
from pathlib import Path
from tempfile import TemporaryFile
from time import sleep
from typing import Any, Dict, List, Optional
import click
import requests
import stripe
import ujson
from dateutil.... |
1,142 | i n classa | # Generated by h2py from /usr/include/netinet/in.h
IPPROTO_IP = 0
IPPROTO_HOPOPTS = 0
IPPROTO_ICMP = 1
IPPROTO_IGMP = 2
IPPROTO_GGP = 3
IPPROTO_IPV4 = 4
IPPROTO_IPIP = IPPROTO_IPV4
IPPROTO_TCP = 6
IPPROTO_ST = 7
IPPROTO_EGP = 8
IPPROTO_PIGP = 9
IPPROTO_RCCMON = 10
IPPROTO_NVPII = 11
IPPROTO_PUP = 12
IPPROTO_ARGUS = 13
... |
1,143 | test lstm weight layout iofg | # 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,144 | show permanent help | from typing import Any
from AnyQt.QtWidgets import QTextBrowser
from AnyQt.QtGui import QStatusTipEvent, QWhatsThisClickedEvent
from AnyQt.QtCore import QObject, QCoreApplication, QEvent, QTimer, QUrl
from AnyQt.QtCore import pyqtSignal as Signal
class QuickHelp(QTextBrowser):
#: Emitted when the shown text cha... |
1,145 | construct nginx config | # -*- coding: utf-8 -*-
"""General purpose nginx test configuration generator."""
import getpass
from typing import Optional
import pkg_resources
def METHOD_NAME(nginx_root: str, nginx_webroot: str, http_port: int, https_port: int,
other_port: int, default_server: bool, key_path: Optional[... |
1,146 | test parse response with primary key | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from http import HTTPStatus
from unittest.mock import MagicMock
import pytest
import requests
from source_tplcentral.streams import TplcentralStream
@pytest.fixture
def config():
return {
"config": {
"authenticator": None,
... |
1,147 | annotate sse | # This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite.application.dssp"
__author__ = "Patrick Kunzmann"
__all__ = ["DsspApp"]
from tempfile import NamedTemporaryFile
from ..localapp import LocalApp... |
1,148 | test filter text | # Copyright 2006 Joe Wreschnig
# 2013 Christoph Reiter
# 2016-22 Nick Boultbee
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your o... |
1,149 | frontend looplift | import warnings
from numba.core import (errors, types, typing, funcdesc, config, pylowering,
transforms)
from numba.core.compiler_machinery import (FunctionPass, LoweringPass,
register_pass)
from collections import defaultdict
@register_pass(mutates_C... |
1,150 | grab | from typing import Optional
import qrcode
import qrcode.exceptions
from PyQt5.QtGui import QColor, QPen
import PyQt5.QtGui as QtGui
from PyQt5.QtCore import Qt, QRect
from PyQt5.QtWidgets import (
QApplication, QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QWidget,
QFileDialog,
)
from electrum.i18n impor... |
1,151 | del validity period start | # -*- coding: utf-8 -*-
#
# LinOTP - the open source solution for two factor authentication
# Copyright (C) 2010-2019 KeyIdentity GmbH
# Copyright (C) 2019- netgo software GmbH
#
# This file is part of LinOTP server.
#
# This program is free software: you can redistribute it and/or
# modify it und... |
1,152 | delete tasks id owners id with http | from _typeshed import Incomplete
from influxdb_client.service._base_service import _BaseService
class TasksService(_BaseService):
def __init__(self, api_client: Incomplete | None = None) -> None: ...
def delete_tasks_id(self, task_id, **kwargs): ...
def delete_tasks_id_with_http_info(self, task_id, **kwar... |
1,153 | test pickle serializer needs a sane pickler | import importlib
import sys
from pathlib import Path
from types import ModuleType
from typing import Generator
import pytest
from prefect.packaging.serializers import (
ImportSerializer,
PickleSerializer,
SourceSerializer,
)
def foo(return_val="foo"):
return return_val
@pytest.mark.parametrize(
... |
1,154 | reload unit registry | """Helper functions for converting between units."""
import logging
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
import pint
_unit_registry = None
logger = logging.getLogger('inventree')
def get_unit_registry():
"""Return a custom instance of the ... |
1,155 | save | from urllib.parse import urlparse
from django import forms
from django.utils.translation import gettext_lazy as _
from django.urls import resolve
from django.urls.exceptions import Resolver404
from tendenci.apps.site_settings.utils import get_setting
from tendenci.apps.directories.models import Directory, Category
fr... |
1,156 | disable keys | #!/usr/bin/env python3
"""
sorting_animation.py
A minimal sorting algorithm animation:
Sorts a shelf of 10 blocks using insertion
sort, selection sort and quicksort.
Shelfs are implemented using builtin lists.
Blocks are turtles with shape "square", but
stretched to rectangles by shapesize()
-------------... |
1,157 | sorted watt keys | import dataclasses
from collections import defaultdict
from typing import (
Any,
Collection,
Dict,
Iterator,
Mapping,
MutableSet,
Optional,
Protocol,
Sequence,
Type,
TypeVar,
)
from .k8sobject import KubernetesObject, KubernetesObjectKey
class Dependency(Protocol):
"""... |
1,158 | recalculate | # LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1
from __future__ import absolute_import, division, print_function
import wxtbx.plots
from libtbx.utils import Sorry
import wx
import os
import sys
def display_file_info(file_name, ob... |
1,159 | test finalize all | import pytest
from briefcase.config import AppConfig
from .conftest import DummyCommand
@pytest.fixture
def first_app():
return AppConfig(
app_name="first",
bundle="com.example",
version="0.0.1",
description="The first simple app",
sources=["src/first"],
)
@pytest.f... |
1,160 | test region equality | # Copyright (C) 2022 Open Source Robotics Foundation
#
# 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,161 | assert raises message with given cause | import contextlib
import re
import sys
def eq_(a, b, msg=None):
"""Assert a == b, with repr messaging on failure."""
assert a == b, msg or "%r != %r" % (a, b)
def ne_(a, b, msg=None):
"""Assert a != b, with repr messaging on failure."""
assert a != b, msg or "%r == %r" % (a, b)
def in_(a, b, msg=N... |
1,162 | test create with params | # Copyright 2019 DeepMind Technologies 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/LICENSE-2.0
#
# Unless required by applicable law or agr... |
1,163 | set up | import unittest
from unittest.mock import patch
import builtins
import rlcompleter
class CompleteMe:
""" Trivial class used in testing rlcompleter.Completer. """
spam = 1
_ham = 2
class TestRlcompleter(unittest.TestCase):
def METHOD_NAME(self):
self.stdcompleter = rlcompleter.Completer()
... |
1,164 | crowd api url | # coding=utf-8
import logging
from .rest_client import AtlassianRestAPI
log = logging.getLogger(__name__)
class Crowd(AtlassianRestAPI):
"""Crowd API wrapper.
Important to note that you will have to use an application credentials,
not user credentials, in order to access Crowd APIs"""
def __init__(... |
1,165 | std string | #!/usr/bin/env python
'''
$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $
'''
from datetime import datetime
from struct import unpack, calcsize
from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
from pytz.tzinfo import memorized_datetime, memorized_timedelta
def _byte_string(s):
"""Cast a s... |
1,166 | ankle2 | #!/usr/bin/env python3
# Copyright (C) 2013-2016 Florian Festi
#
# 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.... |
1,167 | to compas | import bpy
import bmesh
from compas.datastructures import Mesh
from compas.geometry import Point
from ._geometry import BlenderGeometry
class BlenderMesh(BlenderGeometry):
"""Wrapper for Blender meshes.
Attributes
----------
object : :blender:`bpy.types.Object`
The Blender scene object.
... |
1,168 | recv handle | import multiprocessing as mp
import os
from functools import partial
from queue import Empty as QueueIsEmpty
import numpy as np
import pytest
from ucp._libs import ucx_api
from ucp._libs.arr import Array
from ucp._libs.utils import get_address
from ucp._libs.utils_test import blocking_am_recv, blocking_am_send
mp = ... |
1,169 | make regression y | """Utility functions for generating panel data and learning task scenarios."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
__author__ = ["mloning", "fkiraly"]
__all__ = [
"make_classification_problem",
"make_regression_problem",
"make_transformer_problem",
]
import numpy as np
... |
1,170 | test how many dots | # Copyright (c) Ansible project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible_collections... |
1,171 | test help option | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy.io.fetcher import fetch_data, get_home, get_testing_files_dict
fetch_data(get_testing_files_dict(), keys=['btensor_testdata.zip'])
tmp_dir = tempfile.TemporaryDirectory()
def METHOD_NAME(script_runner):
ret = script_runner.run... |
1,172 | test pointgroup sa4 newton | #!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... |
1,173 | get strcols | """
Module for formatting output data in console (to string).
"""
from __future__ import annotations
from shutil import get_terminal_size
from typing import (
TYPE_CHECKING,
Iterable,
)
import numpy as np
from pandas.io.formats.printing import pprint_thing
if TYPE_CHECKING:
from pandas.io.formats.format... |
1,174 | test instant | #!/usr/bin/env python
import calendar
import datetime
import time
from saml2.time_util import add_duration
from saml2.time_util import after
from saml2.time_util import before
from saml2.time_util import f_quotient
from saml2.time_util import in_a_while
from saml2.time_util import instant
from saml2.time_util import ... |
1,175 | test calc rmsd rotational matrix | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... |
1,176 | is in list | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# CatUserBot #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Copyright (C) 2020-2023 by TgCatUB@Github.
# This file is part of: https://github.com/TgCatUB/catuserbot
# and is released under the "GNU v3.0 License Agreement".
# Please see: https://github.com/TgCatUB/catuserbot/blob/... |
1,177 | draw buttons |
import numpy as np
import bpy
from bpy.props import FloatProperty, EnumProperty, BoolProperty, IntProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode, zip_long_repeat, ensure_nesting_level
from sverchok.utils.curve import SvCurve
from sverchok.utils.curve.nurbs... |
1,178 | test threshold unstructured vtk multiblock output | # Copyright(C) 1999-2020 National Technology & Engineering Solutions
# of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
# NTESS, the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provide... |
1,179 | get ac status text | # A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2022 NV Access Limited, Rui Batista
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
"""
Tracking was introduced so that NVDA has a mechanism to announce changes to the power state.
When NVDA receives a power... |
1,180 | return 2 | # Copyright 2019 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,181 | to dict | from typing import List, Optional, Dict, Any, Union, BinaryIO, Literal, get_args, Sequence
import os
import json
import logging
from pathlib import Path
from haystack.preview.utils import request_with_retry
from haystack.preview import component, Document, default_to_dict, default_from_dict
logger = logging.getLogge... |
1,182 | color | from ...shader_base import Nodes
from ..source1_shader_base import Source1ShaderBase
class UnlitGeneric(Source1ShaderBase):
SHADER: str = 'unlittwotexture'
@property
def basetexture(self):
texture_path = self._vmt.get_string('$basetexture', None)
if texture_path is not None:
r... |
1,183 | test dataloader repeats | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
1,184 | write history file | import os.path
import sys
from warnings import warn
try:
_console = sys._jy_console
_reader = _console.reader
except AttributeError:
raise ImportError("Cannot access JLine2 setup")
try:
# jarjar-ed version
from org.python.jline.console.history import MemoryHistory
except ImportError:
# dev ver... |
1,185 | test equal operator modifying operand | import sys
from test import list_tests
from test.support import cpython_only
import pickle
import unittest
class ListTest(list_tests.CommonTest):
type2test = list
def test_basic(self):
self.assertEqual(list([]), [])
l0_3 = [0, 1, 2, 3]
l0_3_bis = list(l0_3)
self.assertEqual(l0_... |
1,186 | test descendant of | import pytest
from sqlalchemy_utils import Ltree
class TestLtree:
def test_init(self):
assert Ltree('path.path') == Ltree(Ltree('path.path'))
def test_constructor_with_wrong_type(self):
with pytest.raises(TypeError) as e:
Ltree(None)
assert str(e.value) == (
"... |
1,187 | test check constraints no warnings given warn | # bluemira is an integrated inter-disciplinary design tool for future fusion
# reactors. It incorporates several modules, some of which rely on other
# codes, to carry out a range of typical conceptual fusion reactor design
# activities.
#
# Copyright (C) 2021-2023 M. Coleman, J. Cook, F. Franza, I.A. Maione, S. McInto... |
1,188 | test nonce | #!/usr/bin/python3
import pytest
from brownie import compile_source
from brownie.exceptions import VirtualMachineError
from brownie.network.transaction import TransactionReceipt
code = """
pragma solidity ^0.6.0;
contract Foo {
fallback () external payable {}
}
"""
def test_to_string(accounts):
"""Can send... |
1,189 | saveconfig | from Components.config import config, configfile, ConfigSelection, ConfigSubList, ConfigSubsection
from Screens.MessageBox import MessageBox
from Screens.Setup import Setup
from Screens.Standby import TryQuitMainloop, QUIT_RESTART
from enigma import getPeerStreamingBoxes
try:
from urllib.parse import urlparse
except:... |
1,190 | post action log | from datetime import datetime
from typing import TYPE_CHECKING
from discord import Member, User
from discord.utils import format_dt
from .managerbase import BaseManager
if TYPE_CHECKING:
from typing import Optional
from . import OptionalMember
action_messages = {
'warn': ('\N{WARNING SIGN}', 'Warn', 'wa... |
1,191 | validate premiumsku capacity |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------------------------------------... |
1,192 | finish appoint | from datetime import datetime, timedelta
from Appointment.config import appointment_config as CONFIG
from Appointment.models import Appoint
from Appointment.appoint.judge import appoint_violate
from Appointment.utils.log import logger, get_user_logger
from Appointment.extern.wechat import MessageType, notify_appoint
... |
1,193 | main | #!/usr/bin/env python
"""
This is a convenience script for the conversion of MTpy-style time series data files to miniSeed.
It needs the location of a folder with TS data. The folder structure is mimicked and the TS converted into miniSeed. The folder structure is then put into the destination directory.
... |
1,194 | test on modified state | import pytest
from numpy.testing import assert_allclose
from iminuit import Minuit
from iminuit.testing import rosenbrock, rosenbrock_grad
import numpy as np
scopt = pytest.importorskip("scipy.optimize")
def fcn(a, b):
return a**2 + ((b - 1) / 2.0) ** 2 + 3
def grad(a, b):
return 2 * a, b - 1
def hess(a,... |
1,195 | process notification data | # Copyright 2016-2017 Tecnativa - Sergio Teruel
# Copyright 2019 Ignacio Ibeas <ignacio@acysos.com>
# Copyright 2020 Tecnativa - João Marques
# Copyright 2023 Planesnet - Luis Planes, Laia Espinosa, Raul Solana
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import base64
import json
import logging
im... |
1,196 | draw | #!/usr/bin/python
'''
This is a pseudo-server that sends predefined pattern to any connected client.
It is used to test transport behaviour and throughput.
If you want to use it with a sketch, connect your PC and Blynk-enabled device
into the same network and configure Blynk to connect to this pseudo-server:
I... |
1,197 | get static default value | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
"""
Create a new document with defaults set
"""
import copy
import frappe
import frappe.defaults
from frappe.core.doctype.user_permission.user_permission import get_user_permissions
from frappe.model import data_fieldtyp... |
1,198 | test audit login failed should set properties | from contextlib import contextmanager
from unittest.mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test import RequestFactory
from django.test.utils import override_settings
from testil import Config, eq
import corehq.apps.auditcare.models as mod
from corehq... |
1,199 | get biz dimension | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complia... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.