id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
10,100 | setup optimize configuration | import logging
from typing import Any, Dict
from freqtrade import constants
from freqtrade.configuration import setup_utils_configuration
from freqtrade.enums import RunMode
from freqtrade.exceptions import OperationalException
from freqtrade.misc import round_coin_value
logger = logging.getLogger(__name__)
def ME... |
10,101 | export func | """
Testing 3D vertical diffusion of tracers against analytical solution.
"""
from thetis import *
from scipy import stats
import pytest
def run(refinement, **model_options):
print_output('--- running refinement {:}'.format(refinement))
implicit = model_options.pop('implicit', False)
# domain dimensions ... |
10,102 | test missing section | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import unittest
from ..load import load_all_manifests, patch_loader
from ..manifest import ManifestParser
class ManifestTest(... |
10,103 | bkmkfile | ## @file
# This file hooks file and directory creation and removal
#
# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
'''
File hook
'''
import os
import stat
import time
import zipfile
from time import sleep
from Library import GlobalData
__b... |
10,104 | match write2 matrix | import multiprocessing as mp
from ontomatch.alignment import Alignment
import pathos.multiprocessing as mpp
import sqlite3
import numpy
import time
'''
matcher that compares entities pair by pair
'''
class ElementMatcher(object):
def __init__(self, es, pairIterator):
self.S, self.T = es
self.pairI... |
10,105 | test subtopics | from django.conf import settings
from django.core.cache import cache
from pyquery import PyQuery as pq
from kitsune.products.models import HOT_TOPIC_SLUG
from kitsune.products.tests import ProductFactory, TopicFactory
from kitsune.questions.models import QuestionLocale
from kitsune.search.tests import Elastic7TestCase... |
10,106 | postscript rule10 | # Leo colorizer control file for postscript mode.
# This file is in the public domain.
# Properties for postscript mode.
properties = {
"lineComment": "%",
}
# Attributes dict for postscript_main ruleset.
postscript_main_attributes_dict = {
"default": "null",
"digit_re": "",
"escape": "\\",
"highl... |
10,107 | run module tests | import time
from unittest import TestResult, TestLoader
from pyrevit.coreutils.logger import get_logger
from pyrevit.output import get_output
#pylint: disable=W0703,C0302,C0103
mlogger = get_logger(__name__)
DEBUG_OKAY_RESULT = 'PASSED'
DEBUG_FAIL_RESULT = 'FAILED'
RESULT_TEST_SUITE_START = '<div class="unittest ... |
10,108 | tear down | # 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... |
10,109 | test xml data element with attributes | ###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2023, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...xmlwriter import XMLwriter
class TestXMLwriter(unittest.T... |
10,110 | create border | import io
import threading
from collections import namedtuple
from itertools import chain
from queue import Queue
from typing import Optional
import moderngl
import numpy as np
from PIL import Image
from shapely.geometry import CAP_STYLE, JOIN_STYLE, Polygon
from shapely.ops import unary_union
from c3nav.mapdata.rend... |
10,111 | test eigh | #!/usr/bin/env python3
import unittest
import torch
from linear_operator.operators import DenseLinearOperator, TriangularLinearOperator
from linear_operator.test.linear_operator_test_case import LinearOperatorTestCase
# TODO: create test suite for square, but non-symmetric/PSD linear operators
class TestTriangular... |
10,112 | init weight | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
10,113 | send request | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
10,114 | test get fields returns correct model | # -*- coding: utf-8 -*-
from unittest import mock
from django.db import models
from django.test import TestCase
from tests.testapp.models import (
DummyRelationModel, InheritedFromPostWithUniqField, PostWithUniqField,
ReverseModel, SecondDummyRelationModel, ThirdDummyRelationModel,
)
from django_extensions.db... |
10,115 | get publishers | # -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 option) any later v... |
10,116 | check config | # copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
10,117 | test connection folder add from config | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
10,118 | explainer check policy | # Copyright 2020 The Forseti Security 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 ap... |
10,119 | close | # This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
"""
Module wrapper for loading HDF5 files.
"""
import re
from collections import OrderedDict
import numpy as np
try:
import h5py # noqa
have_h5py = True
except ImportError:
have_h5py = False
from g... |
10,120 | unicode to decimal ncr | import json
import re
from datetime import datetime
from django.conf import settings
import pytz
import requests
from corehq.apps.sms.models import SMS, SQLSMSBackend
from corehq.apps.sms.util import strip_plus
from corehq.messaging.smsbackends.airtel_tcl.exceptions import (
AirtelTCLError,
InvalidDestinatio... |
10,121 | test init | #-----------------------------------------------------------------------------
# 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.
#-------------------------------------------------------------------... |
10,122 | test convert crlf to lf mixed | # test_line_ending.py -- Tests for the line ending functions
# Copyright (C) 2018-2019 Boris Feld <boris.feld@comet.ml>
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; version 2.0
# or (at your option) any later version. ... |
10,123 | debugger add hw breakpoint | # XXX - execute until line number/cursor
# XXX - more memory printing he thumping
from talon import Context, Module
mod = Module()
mod.tag("debugger", desc="Tag for enabling generic debugger commands")
ctx = Context()
ctx.matches = r"""
tag: debugger
"""
x86_registers = {
"air": "eax",
"bat": "ebx",
"ca... |
10,124 | execute | from copy import deepcopy
from typing import Callable
import numpy as np
import pytensor
from pytensor.graph import fg
from pytensor.graph.basic import Apply, Constant, Variable, clone
from pytensor.graph.op import Op
from pytensor.graph.type import Type
from pytensor.link.basic import Container, Linker, PerformLinke... |
10,125 | test state with model weights success | # Copyright 2018, The TensorFlow Federated Authors.
#
# 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... |
10,126 | check | # -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2014-2023 Greenbone AG
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=unused-argument
# pylint: disable=disallowed-name
import time
from unittest.mock import Mock
from xml.etree import ElementTree as et
from ospd.ospd import OSPDaemon
def asser... |
10,127 | test global graph new full | """
Copyright 2020 The OneFlow 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 or agr... |
10,128 | export esi | # =============================================================================
# Copyright (C) 2014 Ryan Holmes
#
# This file is part of pyfa.
#
# pyfa 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 v... |
10,129 | get pointer | import numpy as np
from pykeops.numpy import Genred, KernelSolve
from pykeops.numpy.cluster import swap_axes as np_swap_axes
import pykeops.config
class numpytools:
norm = np.linalg.norm
arraysum = np.sum
exp = np.exp
log = np.log
Genred = Genred
KernelSolve = KernelSolve
swap_axes = np_s... |
10,130 | copy owned | """Copy and paste data based on an element's `save()` and `load()` methods.
The `copy()` function will return all values serialized, either as string
values or reference id's.
The `paste_link()` function will resolve those values and place instances of
them on the diagram using the same defining element.
The `paste_f... |
10,131 | subject id | # 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... |
10,132 | auth mechanism | # Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
from vdk.internal.core.config import ConfigurationBuilder
IMPALA_HOST = "IMPALA_HOST"
IMPALA_PORT = "IMPALA_PORT"
IMPALA_DATABASE = "IMPALA_DATABASE"
IMPALA_TIMEOUT = "IMPALA_TIMEOUT"
IMPALA_USE_SSL = "IMPALA_USE_SSL"
IMPALA_CA_CERT = "IMPALA_CA_... |
10,133 | test string | # -*- coding: utf-8 -*-
import sys
import mathics.core.atoms as atoms
import mathics.core.systemsymbols as system_symbols
from mathics.core.atoms import (
Complex,
Integer,
Integer1,
Integer2,
MachineReal,
MachineReal0,
Rational,
RationalOneHalf,
Real,
String,
)
from mathics.c... |
10,134 | is number | import numbers
from pyrsistent import pmap
import attr
from jsonschema.compat import int_types, str_types
from jsonschema.exceptions import UndefinedTypeCheck
def is_array(checker, instance):
return isinstance(instance, list)
def is_bool(checker, instance):
return isinstance(instance, bool)
def is_integ... |
10,135 | test amber energy | import MDAnalysis
import numpy as np
import parmed
import pytest
from openff.toolkit import ForceField, Molecule
from openff.units import unit
from openff.utilities import (
get_data_file_path,
has_executable,
has_package,
skip_if_missing,
)
from openff.interchange import Interchange
from openff.interc... |
10,136 | reconstruct alias | from __future__ import annotations
import sys
import types
from collections.abc import Generator, Iterable, Iterator
from typing import (
Any,
ClassVar,
NoReturn,
TypeVar,
TYPE_CHECKING,
)
import numpy as np
__all__ = ["_GenericAlias", "NDArray"]
_T = TypeVar("_T", bound="_GenericAlias")
def _... |
10,137 | tokenize | import logging
import os
import random
import pickle
import time
import json
import tensorflow_hub as tfhub
import tensorflow as tf
import tensorflow_text
import numpy as np
import re
from flask import Flask, request, jsonify
from flasgger import Swagger, swag_from
import sentry_sdk
tensorflow_text.__name__
SENTRY_D... |
10,138 | normals | from abc import ABC
from pathlib import Path
from typing import List, Union
import numpy as np
from ...shared.content_providers.content_manager import ContentManager
from ...utils.path_utilities import find_vtx_cm
from ..mdl.structs.bone import Bone
from ..mdl.structs.model import ModelV36
from ..mdl.v36.mdl_file imp... |
10,139 | show quality | #!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
Quality of unstructured meshes
==============================
**Problem:**
Accurate numerical solutions require high quality meshes. In the case of
unstructured triangular meshes (or tetrahedral meshes in 3D), relatively
large and small angles can lead t... |
10,140 | set dirichlet | from ngsolve.la import InnerProduct
from math import sqrt
from ngsolve import Projector, Norm
from .utils import TimeFunction
class NewtonSolver:
def __init__(self, a, u, rhs=None, freedofs=None,
inverse="umfpack", solver=None):
self.a, self.u, self.inverse = a, u, inverse
self.w =... |
10,141 | add streaming get route | import inspect
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Union
from jina import DocumentArray, Document
from jina._docarray import docarray_v2
from jina.importer import ImportExtensions
from jina.serve.networking.sse import EventSourceResponse
from jina.types.request.data import DataRequest
if... |
10,142 | verify that the subscription is stored in | # -*- coding: utf-8 -*-
"""
Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U
This file is part of Orion Context Broker.
Orion Context Broker 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,... |
10,143 | resolve run launcher | import sys
import dagster._check as check
import graphene
from dagster._core.instance import DagsterInstance
from dagster._core.launcher.base import RunLauncher
from dagster._core.storage.captured_log_manager import CapturedLogManager
from dagster._daemon.asset_daemon import get_auto_materialize_paused
from dagster._d... |
10,144 | shred | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... |
10,145 | display | #!/usr/bin/python3
## Printing troubleshooter
## Copyright (C) 2008, 2009, 2010, 2012, 2014 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
## 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 ... |
10,146 | get clamav conf | # Copyright (C) 2000-2014 Bastian Kleineidam
#
# 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 option) any later version.
#
# This program is distr... |
10,147 | read phys mem | # CHIPSEC: Platform Security Assessment Framework
# Copyright (c) 2023, Intel Corporation
#
# 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; Version 2.
#
# This program is distributed in the hope... |
10,148 | test trying to omit mandatory field | from unittest.mock import patch
import pytest
from szurubooru import api, db, errors, model
from szurubooru.func import comments
@pytest.fixture(autouse=True)
def inject_config(config_injector):
config_injector(
{"privileges": {"comments:score": model.User.RANK_REGULAR}}
)
def test_simple_rating(
... |
10,149 | speech dicts dir | # A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2022-2023 NV Access Limited
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
import os
import sys
import time
import winreg
import globalVars
cl... |
10,150 | cli assignment list | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
10,151 | build schema on 200 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------... |
10,152 | clip | from typing import Tuple
from typing import List
from typing import Any
from typing_extensions import Literal
from matplotlib.lines import Line2D
from compas.geometry import Point, Line
from compas.geometry import intersection_line_box_xy
from compas.artists import PrimitiveArtist
from .artist import PlotterArtist
C... |
10,153 | test default values | import unittest
import pytest
import os
import yaml
from FreeTAKServer.core.configuration.MainConfig import MainConfig
from pathlib import PosixPath, WindowsPath
from unittest import mock
class Test_MainConfig(unittest.TestCase):
# Need to re-initialize the singleton after each test
def teardown_method(self,... |
10,154 | test from legacy | # ----------------------------------------------------------------------------
# - Open3D: www.open3d.org -
# ----------------------------------------------------------------------------
# Copyright (c) 2018-2023 www.open3d.org
# SPDX-License-Identifier: MIT
# ---------... |
10,155 | set api port | import asyncio
import logging
import ssl
import traceback
from typing import Optional
from aiohttp import web
from aiohttp.web_exceptions import HTTPNotFound, HTTPRequestEntityTooLarge
from aiohttp_apispec import AiohttpApiSpec
from apispec.core import VALID_METHODS_OPENAPI_V2
from tribler.core.components.reporter.ex... |
10,156 | set test value | from functools import partial
from typing import Callable, Iterable, Optional
import numpy as np
import pytest
from pytensor.compile.function import function
from pytensor.compile.mode import get_mode
from pytensor.compile.sharedvalue import SharedVariable, shared
from pytensor.configdefaults import config
from pyten... |
10,157 | tabs | #!/usr/bin/env python3
#
# Authors: Christoph Lehner 2022
#
import gpt as g
import numpy as np
rng = g.random("test")
n = 8
# first regress binary ops against double versions
def add(a, b):
return a + b
def mul(a, b):
return a * b
def div(a, b):
return a / b
def sub(a, b):
return a - b
binari... |
10,158 | main | #!/usr/local/bin/python3
"""
Copyright (c) 2021 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the abo... |
10,159 | users can add content | """How the Enhydris object-level permissions system works.
django.contrib.auth has some provisions (but not actual support) for object-level
permissions. You can use either ``user.has_perm("enhydris.change_station")`` or
``user.has_perm("enhydris.change_station", some_station_object)``; the first version is
for model-... |
10,160 | burg fun | #!/usr/bin/env python
"""
Burgers equation in 1D solved using discontinous Galerkin method
"""
import argparse
import sys
sys.path.append('.')
from os.path import join as pjoin
import numpy as nm
from sfepy.examples.dg.example_dg_common import \
clear_folder, get_gen_1D_mesh_hook
from sfepy.examples.dg.dg_plot_1D... |
10,161 | align point clouds | import numpy as np
from pydrake.common.value import Value
from pydrake.math import RigidTransform
from pydrake.perception import BaseField, Fields, PointCloud
from pydrake.systems.framework import LeafSystem
def _TransformPoints(points_Ci, X_CiSi):
# Make homogeneous copy of points.
points_h_Ci = np.vstack((... |
10,162 | test feed publishers | # Copyright (c) 2001-2022, Hove and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Hove (www.hove.com).
# Help us simplify mobility and open public transport:
#... |
10,163 | prepare local | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
10,164 | attention | # Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0
# DeepSpeed Team
from .base import *
from .features.meta_tensor import MetaTensorContainer
from .features.hybrid_engine import HybridEngineContainer
from deepspeed.model_implementations.transformers.ds_bloom import DeepSpeedBloomInference
fr... |
10,165 | test readonly metadata broadcast sets readonly flag | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
# @author Simon Heybrock
import numpy as np
import pytest
import scipp as sc
def assert_variable_writable(var):
assert var.values.flags['WRITEABLE']
if var.variances is not None:
assert var.vari... |
10,166 | is single | #
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia, 2015
# Copyright by UWA (in the framework of the ICRAR)
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser G... |
10,167 | test strategies consistent | from __future__ import print_function, absolute_import, division
import warnings
from distutils.version import LooseVersion
import pytest
import numpy as np
import astropy
from astropy.wcs import WCS
from astropy import units as u
from astropy.io import fits
from ..spectral_cube import SpectralCube, VarianceWarning... |
10,168 | test iterable | from test import test_support
from test.test_collections import ABCTestCase
from collections import (
Hashable, Iterable, Iterator,
Sized, Container, Callable,
Set, MutableSet,
Mapping, MutableMapping,
Sequence, MutableSequence)
import sys
import java
class TestJavaInterfaces(ABCTestCase):
d... |
10,169 | on dock location changed | # SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
from pathlib import Path
from typing import Optional, Union
from PySide2 import QtCore, QtGui, QtWidgets
from ..constants import ICON_SIZE_BUTTON, BORDER_COLOR_ROLE
from ..style import apply_top_tool_bar_style
from ..utils i... |
10,170 | get bld sig win32 | #! /usr/bin/env python
# encoding: utf-8
"""
Windows-specific optimizations
This module can help reducing the overhead of listing files on windows
(more than 10000 files). Python 3.5 already provides the listdir
optimization though.
"""
import os
from waflib import Utils, Build, Node, Logs
try:
TP = '%s\\*'.decode... |
10,171 | get color | """Model for the ScanTheCode that tracks its own color."""
from __future__ import division
import cv2
import numpy as np
from mil_misc_tools.text_effects import fprint
___author___ = "Tess Bianchi"
class ColorFinder:
"""Class the represents Scan The Code Model."""
def __init__(self):
"""Initialize ... |
10,172 | test smem args | import numpy as np
import ctypes
from .context import skip_if_no_pyhip
from collections import OrderedDict
import pytest
import kernel_tuner
from kernel_tuner import tune_kernel
from kernel_tuner.backends import hip as kt_hip
from kernel_tuner.core import KernelSource, KernelInstance
try:
from pyhip import hip, ... |
10,173 | get objective | #
# Copyright (C) 1997-2016 JDE Developers Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program... |
10,174 | is object path valid | import re
from .errors import InvalidBusNameError, InvalidInterfaceNameError, InvalidMemberNameError, InvalidObjectPathError
_bus_name_re = re.compile(r"^[A-Za-z_-][A-Za-z0-9_-]*$")
_path_re = re.compile(r"^[A-Za-z0-9_]+$")
_element_re = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$")
def is_bus_name_valid(name: str) -> bo... |
10,175 | read settings | """
********************************************************************************
* Name: settings_commands.py
* Author: Scott Christensen
* Created On: 2019
* Copyright: (c) Brigham Young University 2014
* License: BSD 2-Clause
********************************************************************************
"""
fro... |
10,176 | read le us | # Copyright 2008-2020 pydicom authors. See LICENSE file for details.
"""Hold DicomFile class, which does basic I/O for a dicom file."""
from io import BytesIO
from struct import unpack, pack
from types import TracebackType
from typing import BinaryIO, cast, TextIO, Any
from collections.abc import Callable
try:
fr... |
10,177 | parse args | # 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... |
10,178 | get lists | from Components.config import config
from Components.Converter.Converter import Converter
from Components.Element import cached
from enigma import eServiceCenter, eServiceReference, iServiceInformation
from xml.etree.ElementTree import parse
class ExtendedServiceInfo(Converter):
SERVICENAME = 0
SERVICENUMBER = 1
O... |
10,179 | check if push successful | """Treescript git functions."""
import logging
import os
from git import Actor, PushInfo, Repo
from scriptworker_client.github import extract_github_repo_ssh_url
from scriptworker_client.utils import get_single_item_from_sequence, makedirs
from treescript.exceptions import PushError, TaskVerificationError
from treesc... |
10,180 | construct edge ids | """
Keeps XRay event definitions
"""
import json
import operator
from typing import List, Optional
from samcli.lib.observability.observability_info_puller import ObservabilityEvent
from samcli.lib.utils.hash import str_checksum
start_time_getter = operator.attrgetter("start_time")
class XRayTraceEvent(Observability... |
10,181 | reset parameters | import click
import nni
import nni.retiarii.evaluator.pytorch.lightning as pl
import torch.nn as nn
import torchmetrics
from nni.retiarii import model_wrapper, serialize
from nni.retiarii.experiment.pytorch import RetiariiExperiment, RetiariiExeConfig
from nni.retiarii.nn.pytorch import NasBench101Cell
from nni.retiari... |
10,182 | gen test rego | # Copyright (C) 2022 CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
NAME = "invitations"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictReader(f)... |
10,183 | default config | import json
import logging
import pickle
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass
from pathlib import Path
import pandas as pd
import torch
import torchaudio
from omegaconf import MISSING
from s3prl.dataio.dataset import FrameLabelDataset, get_info
from s3prl.dat... |
10,184 | auth | """Views"""
from django.conf import settings
from django.http import HttpResponseRedirect, HttpResponse, \
HttpResponseServerError
from django.urls import reverse
from django.db import transaction
from django.contrib.METHOD_NAME import login, REDIRECT_FIELD_NAME
from django.contrib.METHOD_NAME.d... |
10,185 | convert to string | from io import BytesIO
from translate.convert import po2txt, test_convert
class TestPO2Txt:
ConverterClass = po2txt.po2txt
def _convert(
self,
input_string,
template_string=None,
include_fuzzy=False,
output_threshold=None,
encoding="utf-8",
wrap=None,
... |
10,186 | test custom command configurator | import textwrap
import requests
from localstack.utils.bootstrap import (
Container,
ContainerConfigurators,
configure_container,
get_gateway_url,
)
from localstack.utils.common import external_service_ports
from localstack.utils.container_utils.container_client import VolumeBind
def test_common_cont... |
10,187 | shutdown | import logging
from sfxmonitor import datapoint
from sfxrunner.scheduler.simple import SimpleScheduler
# Optional logger that you can use if you want to log messages back to the
# agent. You can also use plain `print` statements, but they will go to the
# agent's ERROR log level, so logger is better for non-error me... |
10,188 | is valid formula adduct | from typing import overload, Optional, List, Tuple
import cpyMSpec
import numpy as np
import pandas as pd
from msi_recal.params import AnalyzerType
def weighted_stddev(values, weights):
average = np.average(values, weights=weights)
stddev = np.sqrt(np.average((values - average) ** 2, weights=weights))
r... |
10,189 | test map to grid dist roi | """ Unit Tests for Py-ART's map/gates_to_grid.py. """
import numpy as np
import pytest
from numpy.testing import assert_almost_equal
import pyart
EXPECTED_CENTER_SLICE = [40, 30, 20, 10, 0, 0, 10, 20, 30, 40]
COMMON_MAP_TO_GRID_ARGS = {
"grid_shape": (3, 9, 10),
"grid_limits": ((-400.0, 400.0), (-900.0, 900... |
10,190 | delete | import logging
from django.urls import path
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework import status, serializers
from rest_framework.pagination import LimitOffsetPagination
import karrio.server.openapi as openapi
from karrio.server.core.views.api impor... |
10,191 | provisioning 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 . imp... |
10,192 | test unfold | import pytest
import torch
from common_utils import assert_equal, get_list_of_videos
from torchvision import io
from torchvision.datasets.video_utils import unfold, VideoClips
class TestVideo:
def METHOD_NAME(self):
a = torch.arange(7)
r = unfold(a, 3, 3, 1)
expected = torch.tensor(
... |
10,193 | get method function | 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... |
10,194 | translate graph error | import os
from contextlib import contextmanager
from typing import (
TYPE_CHECKING,
Dict,
Iterator,
List,
NamedTuple,
Optional,
Tuple,
Union,
)
from dvc.exceptions import (
CacheLinkError,
DvcException,
OutputDuplicationError,
OutputNotFoundError,
OverlappingOutputPa... |
10,195 | start | # -*- coding: utf-8 -*-
# daemon/runner.py
#
# Copyright © 2009 Ben Finney <ben+python@benfinney.id.au>
# Copyright © 2007–2008 Robert Niederreiter, Jens Klein
# Copyright © 2003 Clark Evans
# Copyright © 2002 Noah Spurrier
# Copyright © 2001 Jürgen Hermann
#
# This is free software: you may copy, modify, and/or distr... |
10,196 | test detect usage metrics turned off | import asyncio
from typing import List
from jsons import DeserializationError
from pytest import mark, raises
from resotocore.analytics import AnalyticsEvent, CoreEvent
from resotocore.config import ConfigHandler, ConfigEntity
from resotocore.config.core_config_handler import CoreConfigHandler
from resotocore.core_co... |
10,197 | status link | import datetime
import time
import core.exceptions as ex
import core.status
import drivers.array.necism as array_driver
from .. import Sync, notify
from core.objects.svcdict import KEYS
DRIVER_GROUP = "sync"
DRIVER_BASENAME = "necismsnap"
KEYWORDS = [
{
"keyword": "array",
"required": True,
... |
10,198 | test links to review photos permission | import re
from candidates.tests.auth import TestUserMixin
from candidates.tests.dates import templates_after, templates_before
from candidates.tests.factories import (
BallotPaperFactory,
MembershipFactory,
PostFactory,
)
from candidates.tests.helpers import TmpMediaRootMixin
from candidates.tests.uk_examp... |
10,199 | test ncdhw to ndhwc | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.