id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
12,900 | close connection | #!/usr/bin/env python3
"""Modul für einfache Modbus-Operationen.
Das Modul baut eine Modbus-TCP-Verbindung auf. Es gibt verschiedene Funktionen, um die gelesenen Register zu
formatieren.
"""
import logging
import struct
from enum import Enum
from typing import Callable, Iterable, Union, overload, List
import pymodbus... |
12,901 | test number min value | # Mixins for testing number entities
from ..helpers import assert_device_properties_set
class BasicNumberTests:
def setUpBasicNumber(
self,
dps,
subject,
max,
min=0,
step=1,
mode="auto",
scale=1,
unit=None,
testdata=None,
devi... |
12,902 | test aliases of yes and no | #!/usr/bin/env python
#
# Copyright 2008, 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... |
12,903 | dynamic related ticket search | """
Moves the status to open and then launches the Dynamic playbooks for Reputation Analysis, Attribute Lookup, and Related Tickets.
"""
import phantom.rules as phantom
import json
from datetime import datetime, timedelta
@phantom.playbook_block()
def on_start(container):
phantom.debug('on_start() called')
... |
12,904 | create elasticsearch query | from rest_framework.response import Response
from rest_framework.views import APIView
from collections import OrderedDict
from elasticsearch_dsl import Q as ES_Q, A
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.common.elasticsearch.search_wrappers import TransactionSearch
from... |
12,905 | get model | #!/usr/bin/env python
#
# Name: thermal.py, version: 1.0
#
# Description: Module contains the definitions of SONiC platform APIs
#
try:
import os
import logging
from sonic_platform_base.thermal_base import ThermalBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
... |
12,906 | can serialize operation | # Copyright 2019 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 ... |
12,907 | test make zip archive | import zipfile
import pytest
from pyodide_build.common import (
check_wasm_magic_number,
environment_substitute_args,
extract_wheel_metadata_file,
find_missing_executables,
get_num_cores,
make_zip_archive,
parse_top_level_import_name,
repack_zip_archive,
)
@pytest.mark.parametrize(
... |
12,908 | get last modified user id | # -*- coding: utf-8 -*-
from django.db import models, migrations
from django.contrib.admin.models import LogEntry, DELETION
APPROVED_CODE = 'A'
RSR_SYSTEM_USER = {
'email': 'admin@akvo.org',
'is_admin': True,
'is_superuser': True,
'first_name': 'RSR System',
'last_name': 'User',
'is_active'... |
12,909 | pkginfo | """
Common functions for working with RPM packages
"""
import collections
import datetime
import logging
import platform
import subprocess
import salt.utils.path
import salt.utils.stringutils
log = logging.getLogger(__name__)
# These arches compiled from the rpmUtils.arch python module source
ARCHES_64 = ("x86_64", ... |
12,910 | create config for email | import re
from datetime import datetime, timedelta
from urllib.parse import unquote
from django.conf import settings
from django.http import HttpRequest
from django.utils.translation import gettext as _
import six
from celery.schedules import crontab
from couchdbkit import ResourceNotFound
from dimagi.utils.django.e... |
12,911 | values | from __future__ import annotations
import json
from copy import deepcopy
from typing import TYPE_CHECKING, Optional, Union
import fastapi
from gradio_client.documentation import document, set_documentation_group
from gradio import utils
from gradio.data_classes import PredictBody
from gradio.exceptions import Error
... |
12,912 | private link service connection state | # 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... |
12,913 | extract default | #!/usr/bin/env python
import argparse
import io
import os
import re
max_name_len = 60
re_name = re.compile(r'^[a-z][a-z0-9_]*$')
re_group = re.compile(r'//BEGIN')
re_option = re.compile(r'extern (Bounded)?Option<[^>]+>')
re_default = re.compile(r' *// *= *(.*)')
groups = []
root = os.path.dirname(os.path.dirname(os... |
12,914 | clean text | """
Greynir: Natural language processing for Icelandic
News query response module
Copyright (C) 2023 Miðeind ehf.
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, e... |
12,915 | handle deconnect | # -*- coding: utf-8; -*-
#
# (c) 2007-2009 Mandriva, http://www.mandriva.com/
#
# $Id$
#
# This file is part of Pulse 2, http://pulse2.mandriva.org
#
# Pulse 2 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; e... |
12,916 | add authfactor2 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: proto
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class HelloNew(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatb... |
12,917 | test lineno | """
Test the API of the symtable module.
"""
import symtable
import unittest
from test import support
TEST_CODE = """
import sys
glob = 42
class Mine:
instance_var = 24
def a_method(p1, p2):
pass
def spam(a, b, *var, **kw):
global bar
bar = 47
x = 23
glob
def internal():
... |
12,918 | send event emails | """Management command for handling of automatic emails.
This is run via a scheduled task every hour and checks if there are any emails that need sending.
"""
import logging
from smtplib import SMTPException
import djclick as click
from django.conf import settings
from django.core.mail import send_mail
from django.db... |
12,919 | wrapper | import asyncio
import os
import uuid
from functools import wraps
from typing import Any, Callable, Set
import aiohttp
from aiohttp import web
import tomodachi
data_uuid = str(uuid.uuid4())
class MessageEvent:
def __init__(self, data: Any, topic: str, sns_message_id: str = "") -> None:
self.data = data
... |
12,920 | test post not trigger bind | import json
import pytest
from django.http import HttpResponse
from django.test import override_settings
from iommi.struct import Struct
from iommi import (
Field,
Form,
html,
Page,
Part,
Table,
)
from iommi.declarative.with_meta import with_meta
from iommi.endpoint import (
find_target,
... |
12,921 | create test file | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed ... |
12,922 | test clear bgplu | #!/usr/bin/env python
# SPDX-License-Identifier: ISC
#
# test_bgp_lu.py
# Part of NetDEF Topology Tests
#
# Copyright (c) 2020 by Volta Networks
#
"""
test_bgp_lu.py: Test BGP LU label allocation
"""
import os
import sys
import json
from functools import partial
import pytest
# Save the Current Working Directory to... |
12,923 | print types info txt | """I/O functions."""
import json
import re
from .json_types import convert_enums_to_type_for_json
from .json_types import convert_func_types_to_type_for_json
from .json_types import convert_structs_to_type_for_json
from .json_types import convert_typedefs_to_type_for_json
from .json_types import convert_unions_to_typ... |
12,924 | upsert model | from typing import Any, Dict, Optional
from sqlmodel import Session, SQLModel, create_engine, select
from nannyml._typing import Result
from nannyml.exceptions import WriterException
from nannyml.io.base import Writer, WriterFactory
from nannyml.io.db.entities import Model, Run
from nannyml.io.db.mappers import Mappe... |
12,925 | yes | """
Key binding handlers for displaying completions.
"""
from __future__ import annotations
import asyncio
import math
from typing import TYPE_CHECKING
from prompt_toolkit.application.run_in_terminal import in_terminal
from prompt_toolkit.completion import (
CompleteEvent,
Completion,
get_common_complete_... |
12,926 | main | """
TestCase: Alluxio dynamic changes mountpoints
DDC Engine: Alluxio
Steps:
1. create Dataset(WebUFS) & Runtime with two mountpoint
2. check if dataset is bound
3. check if persistentVolumeClaim & PV is created
4. check alluxioruntime mountpoint and data
5. change dataset mountpoint and update
6. check dataset is boun... |
12,927 | test tcp without parameters | # 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
from ansible_collections.community.gene... |
12,928 | name | import logging
from abc import ABC, abstractmethod
from typing import Dict, Optional
import numpy as np
from great_expectations.compatibility.typing_extensions import override
from great_expectations.core.domain import Domain
from great_expectations.core.util import convert_to_json_serializable
from great_expectation... |
12,929 | get live url | # -*- coding: utf-8 -*-
# Copyright: (c) 2017, 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 json
import time
import re
from codequick ... |
12,930 | child | ######################################################################################################################
# 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... |
12,931 | validate | from pysys.basetest import BaseTest
import time
import re
import json
"""
Validate tedge-mapper-collectd messages that are published
on tedge/measurements
Given a configured system
When we start the collectd with sudo in the background
When we start the tedge-mapper-collectd with sudo in the background
When we star... |
12,932 | check send webhook fixture message | import os
from contextlib import suppress
from typing import TYPE_CHECKING, Any, Dict, List, Optional
import orjson
from django.http import HttpRequest, HttpResponse
from django.http.response import HttpResponseBase
from django.shortcuts import render
from django.test import Client
from zerver.lib.exceptions import J... |
12,933 | get timing signal 1d | import math
import torch
from torch.nn import functional as F
def init_weights(m, mean=0.0, std=0.01):
classname = m.__class__.__name__
if classname.find("Conv") != -1:
m.weight.data.normal_(mean, std)
def get_padding(kernel_size, dilation=1):
return int((kernel_size * dilation - dilation) / 2)... |
12,934 | get dataset and collection metadata | import json
import logging
from typing import Union
import requests
from flask import current_app
from server.common.config.app_config import AppConfig
from server.common.errors import DatasetAccessError, DatasetMetadataError, TombstoneError
from server.common.utils.utils import path_join
def log_error_response_fro... |
12,935 | 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 . imp... |
12,936 | k value | # Copyright (c) 2012-2022 by the GalSim developers team on GitHub
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simulation toolkit.
# https://github.com/GalSim-developers/GalSim
#
# GalSim is free software: redistribution and use in source and binary forms,
# with or w... |
12,937 | load class names | import sys
import os
import time
import math
import numpy as np
import itertools
import struct # get_image_size
import imghdr # get_image_size
def sigmoid(x):
return 1.0 / (np.exp(-x) + 1.)
def softmax(x):
x = np.exp(x - np.expand_dims(np.max(x, axis=1), axis=1))
x = x / np.expand_dims(x.sum(axis=1),... |
12,938 | test execute | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/
# or in the "LICENSE.txt" file accompa... |
12,939 | get onnx input name | # 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... |
12,940 | test ldap chpass extop | """ SSSD LDAP provider tests
:requirement: IDM-SSSD-REQ : LDAP Provider
:casecomponent: sssd
:subsystemteam: sst_idm_sssd
:upstream: yes
:status: approved
"""
import pytest
from sssd.testlib.common.utils import sssdTools
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
@pytes... |
12,941 | pyinit1 | #-------------------------------------------------------------------------------
# GridCellIndex template
#-------------------------------------------------------------------------------
from PYB11Generator import *
@PYB11template("Dimension")
class GridCellIndex:
PYB11typedefs = """
typedef GridCellPlane<%(D... |
12,942 | test stop chars | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# --------------------------------------------... |
12,943 | get firmware update notification | #############################################################################
# Celestica
#
# Component contains an implementation of SONiC Platform Base API and
# provides the components firmware management function
#
#############################################################################
import os.path
import ... |
12,944 | test dynamic decode rnn one max iter | # 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... |
12,945 | contains | """Miscellaneous utilities related to logging."""
import sys
import logging
# If any method that creates handlers is called twice (e.g., setup reconfigure or during tests),
# then we need to prevent another one from being created. Since we have multiple loggers now, we
# store them in a dictionary.
_loggers = {}
de... |
12,946 | repository | # Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. This file is
# licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
12,947 | run | # Copyright 2023 The DLRover 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 applicable law o... |
12,948 | test algebraic rule free null | #
# @file TestAlgebraicRule.py
# @brief AlgebraicRule unit tests
#
# @author Akiya Jouraku (Python conversion)
# @author Ben Bornstein
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generated automatically by converting the file lo... |
12,949 | test sso with expiry expired | from datetime import datetime, timedelta, timezone
from sentry.models import AuthIdentity, AuthProvider
from sentry.testutils.cases import AuthProviderTestCase
from sentry.utils.auth import SSO_EXPIRY_TIME, SsoSession
# TODO: move these into the tests/sentry/auth directory and remove deprecated logic
class Authentic... |
12,950 | test run onboarding data assistant action returns | from unittest.mock import MagicMock
import pytest
from great_expectations.agent.actions import (
CreatedResource,
RunOnboardingDataAssistantAction,
)
from great_expectations.agent.models import (
RunOnboardingDataAssistantEvent,
)
from great_expectations.data_context import CloudDataContext
from great_exp... |
12,951 | call deprecated function | # Copyright 2021 The NetKet 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 applicable ... |
12,952 | format to text | """Functions to help generate a text representation of a dataflow plan."""
from __future__ import annotations
import logging
import textwrap
import jinja2
from dbt_semantic_interfaces.pretty_print import pformat_big_objects
from metricflow.dag.mf_dag import DagNode, DagNodeVisitor
logger = logging.getLogger(__name_... |
12,953 | object info | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... |
12,954 | get includes dashboards | # Copyright 2022 Collate
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software... |
12,955 | test import button | # Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from .common import TestCommon
PARSED_CATALOG = {
"date": "2016-08-01",
"doc_type": "catalogue",
"products": [
{
"barcode": "1234567890924",
"code": "998000924",
"cur... |
12,956 | custom functions | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
12,957 | badpos in fibermap | #!/usr/bin/env python
"""Find exposures with a significant fraction of bad positioners.
time desi_find_badpos --reduxdir /global/cfs/cdirs/desi/spectro/redux/everest --mp 32 -o badpos-everest.fits
time desi_find_badpos --reduxdir /global/cfs/cdirs/desi/spectro/redux/daily --mp 32 -o badpos-daily-20220123.fits
To cro... |
12,958 | test module name | # Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
12,959 | uniq | ###############################################################
# Copyright 2020 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-Identifier: LGPL-3.0
####... |
12,960 | main | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Application window of RIXS GUI
==============================
"""
from silx.gui import qt
from larch.utils.logging import getLogger
from larch.qtlib.console import InternalIPyKernel
from larch.qtlib.model import HeaderSection
from larch.qtlib.delegates import ComboBoxD... |
12,961 | draw | import unittest
from copy import copy
from test import bootstrap
from meerk40t.core.cutplan import CutPlan
from meerk40t.fill.fills import eulerian_fill, scanline_fill
from meerk40t.svgelements import Matrix, Rect
def METHOD_NAME(fill, w, h, filename="test.png"):
from PIL import Image, ImageDraw
im = Image.... |
12,962 | test normal quad |
from mathutils import Vector, Matrix
from sverchok.utils.testing import *
from sverchok.utils.geom import *
from sverchok.utils.curve.primitives import SvCircle
class GeometryTests(SverchokTestCase):
def test_center_trivial(self):
input = [(0, 0, 0)]
output = center(input)
expected_outp... |
12,963 | pearson corr | import json
from datetime import datetime
from pprint import pprint
from statistics import mean
import numpy as np
import pandas as pd
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import accuracy_score, f1_score
from transformers.data.metrics.squad_metrics import compute_exact, compute_f1
from sim... |
12,964 | get steps count | # Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text.
# Copyright (c) 2020, Janssen Project
#
# Author: Yuriy Zabrovarnyy
#
from io.jans.model.custom.script.type.uma import UmaClaimsGatheringType
from io.jans.service.cdi.util import CdiUtil
from io.... |
12,965 | assert not close | from .parallel import *
from ..core import Scaffold as _Scaffold
from ..storage import (
Storage as _Storage,
get_engine_node as _get_engine_node,
Chunk as _Chunk,
)
from ..config import Configuration as _Configuration
from ..exceptions import FixtureError
import numpy as _np
import glob as _glob
import os ... |
12,966 | prepare frontend | # Copyright 2015 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... |
12,967 | list workspaces | """Handles incoming amp requests, invokes methods, returns responses."""
import json
from moto.core.responses import BaseResponse
from .models import amp_backends, PrometheusServiceBackend
from typing import Any
from urllib.parse import unquote
class PrometheusServiceResponse(BaseResponse):
"""Handler for Promet... |
12,968 | create wedge | import abc
import typing
from nion.swift import Undo
from nion.swift.model import DisplayItem
from nion.swift.model import DocumentModel
from nion.swift.model import Graphics
from nion.swift.model import Persistence
from nion.ui import CanvasItem
from nion.ui import UserInterface
from nion.utils import Geometry
clas... |
12,969 | imports for multiapi | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typin... |
12,970 | load pcba | """
PCBA dataset loader.
"""
import os
import deepchem as dc
from deepchem.molnet.load_function.molnet_loader import TransformerGenerator, _MolnetLoader
from deepchem.data import Dataset
from typing import List, Optional, Tuple, Union
PCBA_URL = "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/%s"
PCBA_TASKS ... |
12,971 | register plugin | import os
import time
from urllib.parse import quote
from loguru import logger
from flexget import plugin
from flexget.event import event
from flexget.utils.pathscrub import pathscrub
from flexget.utils.tools import parse_timedelta
logger = logger.bind(name='convert_magnet')
class ConvertMagnet:
"""Convert mag... |
12,972 | install package | # -*- coding: utf-8 -*-
# FLEDGE_BEGIN
# See: http://fledge-iot.readthedocs.io/
# FLEDGE_END
import asyncio
import json
from typing import List
import pkg_resources
from aiohttp import web
from fledge.common.audit_logger import AuditLogger
from fledge.common.logger import FLCoreLogger
from fledge.services.core impor... |
12,973 | test prepend prolog with roles in sections | """Tests sphinx.util.rst functions."""
from docutils.statemachine import StringList
from jinja2 import Environment
from sphinx.util.rst import append_epilog, escape, heading, prepend_prolog, textwidth
def test_escape():
assert escape(':ref:`id`') == r'\:ref\:\`id\`'
assert escape('footnote [#]_') == r'footn... |
12,974 | like etag | from contextlib import suppress
from typing import Set
from boltons import urlutils
from flask import g
from sqlalchemy import BigInteger, Column, ForeignKey, Sequence, UniqueConstraint
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import backref, relationship, validates
from ereuse_devicehub.db... |
12,975 | test empty task raises operational error | import logging
from contextlib import contextmanager
import pytest
from flask import Flask
from kombu.exceptions import OperationalError
from hades_logs import HadesLogs, hades_logs
from hades_logs.exc import HadesOperationalError
@contextmanager
def assert_unconfigured(caplog, level=logging.WARNING):
with pyt... |
12,976 | test basic | import socket
import struct
import pytest
from pr2test.marks import require_root
pytestmark = [require_root()]
def test_flush_rules(context):
ifaddr1 = context.new_ipaddr
ifaddr2 = context.new_ipaddr
init = len(context.ipr.get_rules(family=socket.AF_INET))
assert len(context.ipr.get_rules(priority=l... |
12,977 | wrap exception | import base64
from contextlib import closing
import http.client
import json
import socket
import threading
import time
import urllib.request
import urllib.parse
import urllib.error
from .rest_client import RestClient, RestClientException
from .file_util import tar_gzip_directory
from codalab.common import URLOPEN_TIME... |
12,978 | remove move | import builtins
import operator
import types
import unittest
from _typeshed import IdentityFunction, Unused, _KT_contra, _VT_co
from builtins import next as next
from collections.abc import Callable, ItemsView, Iterable, Iterator as _Iterator, KeysView, Mapping, ValuesView
from functools import wraps as wraps
from impo... |
12,979 | get input specification | # Copyright 2017 Battelle Energy Alliance, 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 t... |
12,980 | check ready for jaw move | from typing import Optional
import logging
from opentrons.types import Point
from .instrument_calibration import (
GripperCalibrationOffset,
load_gripper_calibration_offset,
)
from opentrons.hardware_control.dev_types import GripperDict
from opentrons.hardware_control.types import (
CriticalPoint,
Grip... |
12,981 | get high critical threshold | #!/usr/bin/env python
#############################################################################
# Quanta IX7_BDE
#
# Module contains an implementation of SONiC Platform Base API and
# provides the Thermal information
#
#############################################################################
import logging
im... |
12,982 | test run circuit | # Copyright 2022 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 ... |
12,983 | as niggli matrix | from __future__ import absolute_import, division, print_function
from cctbx import uctbx
from scitbx import matrix
from six.moves import zip
class gruber_parameterization(object):
def __init__(self, unit_cell, relative_epsilon=None):
if (relative_epsilon is None): relative_epsilon = 1.e-5
sym_mat3 = unit_ce... |
12,984 | clean de stnr | """
Clean and validate a DataFrame column containing German tax numbers (STNRs).
"""
# pylint: disable=too-many-lines, too-many-arguments, too-many-branches
from typing import Any, Union
from typing import Optional
from operator import itemgetter
import dask.dataframe as dd
import numpy as np
import pandas as pd
from... |
12,985 | build backend model | # Copyright (c) OpenMMLab. All rights reserved.
import os
from copy import deepcopy
from typing import Dict, Optional, Sequence, Tuple, Union
import mmengine
import numpy as np
import torch
from mmdet3d.structures import get_box_type
from mmengine import Config
from mmengine.dataset import Compose, pseudo_collate
from... |
12,986 | tear down | # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
12,987 | test recorder puts recorded data item under | # standard libraries
import contextlib
import unittest
# third party libraries
import numpy
# local libraries
from nion.swift import Application
from nion.swift import Facade
from nion.swift import RecorderPanel
from nion.swift.model import DataItem
from nion.swift.test import TestContext
from nion.ui import TestUI
... |
12,988 | forward | #!./.mnist-pytorch/bin/python
import collections
import json
import math
import os
import docker
import fire
import torch
from fedn.utils.pytorchhelper import PytorchHelper
NUM_CLASSES = 10
def _get_data_path():
""" For test automation using docker-compose. """
# Figure out FEDn client number from containe... |
12,989 | parse incoming data references | # Copyright (C) 2023 Sartography
#
# This file is part of SpiffWorkflow.
#
# SpiffWorkflow is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any la... |
12,990 | stack size | """Drop-in replacement for the thread module.
Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.
Suggested usage is::
try:
import thread
except ImportError:
import dummy_thread as thread
"""
# Exports onl... |
12,991 | test component variable data type automatically set | from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.test import TestCase
from openforms.variables.constants import FormVariableDataTypes, FormVariableSources
from openforms.variables.tests.factories import ServiceFetchConfigurationFactory
from ..factories import FormFac... |
12,992 | test empty choices | from __future__ import annotations
import pytest
from django.core.exceptions import ValidationError
from django.core.management import call_command
from django.db import connection
from django.db import models
from django.db.utils import DataError
from django.test import override_settings
from django.test import TestC... |
12,993 | type | # 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... |
12,994 | build | from django.db import transaction
from sponsors import notifications
from sponsors.models import Sponsorship, Contract, SponsorContact, SponsorEmailNotificationTemplate, SponsorshipBenefit, \
SponsorshipPackage
from sponsors.pdf import render_contract_to_pdf_file, render_contract_to_docx_file
class BaseUseCaseWi... |
12,995 | start exporting | import base64
import datetime
import hashlib
import io
import json
import logging
import uuid
from scrapy.exporters import JsonItemExporter
from scrapy.utils.misc import walk_modules
from scrapy.utils.python import to_bytes
from scrapy.utils.spider import iter_spider_classes
from locations.settings import SPIDER_MODU... |
12,996 | from dict | from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Sequence, Union
from mlflow.data.dataset_source import DatasetSource
from mlflow.utils.annotations import experimental
if TYPE_CHECKING:
import datasets
@experimental
class HuggingFaceDatasetSource(DatasetSource):
"""
Represents the source ... |
12,997 | action2 | import toga
from toga.style.pack import COLUMN, Pack
def button_handler(widget):
print("button handler")
for i in range(0, 10):
print("hello", i)
yield 1
print("done", i)
def action0(widget):
print("action 0")
def action1(widget):
print("action 1")
def METHOD_NAME(widget):
... |
12,998 | prepare | # Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
12,999 | test get field | # This file is part of the Trezor project.
#
# Copyright (C) 2012-2022 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distrib... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.