id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
19,400 | replace atomic | import contextlib
import io
import os
import sys
import tempfile
try:
import fcntl
except ImportError:
fcntl = None
# `fspath` was added in Python 3.6
try:
from os import fspath
except ImportError:
fspath = None
__version__ = '1.4.0'
PY2 = sys.version_info[0] == 2
text_type = unicode if PY2 else s... |
19,401 | parse args | #!/usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/monitoring-plugins/blob/main/CONTRIBUTING.... |
19,402 | render | import warnings
from django import forms
from django.contrib.admin.sites import site
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.template.loader import render_to_string
from django.urls import reverse
from... |
19,403 | get domains as dict | from __future__ import annotations
from typing import TYPE_CHECKING, Dict, List, Optional
import great_expectations.exceptions as gx_exceptions
from great_expectations.core.domain import Domain # noqa: TCH001
from great_expectations.rule_based_profiler.parameter_container import (
ParameterContainer,
)
if TYPE_... |
19,404 | find mounts | import os
import core.exceptions as ex
from core.resource import Resource
def find_mount(rs, dir):
"""Sort mounts from deepest to shallowest and return the
first mount whose 'mount_point' is matching 'dir'
"""
for m in sorted(rs.resources, reverse=True):
if m.is_disabled():
co... |
19,405 | test construct shortest path | from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from pytest import raises as assert_raises
from scipy.sparse.csgraph import (shortest_path, dijkstra, johnson,
bellman_ford, construct_dist_matrix, NegativeCyc... |
19,406 | test camel case flag | import unittest
import copy
from global_config import GlobalConfigParametersReader, DefaultConfigParameter
class GlobalConfigUnittests(unittest.TestCase):
def setUp(self):
self.processable_parameters = ['--connection-pre-test', 'False', '--destinationTableAutoCreate']
def test_flag_must_start_with_do... |
19,407 | download file | import logging
import os
from hdfs import InsecureClient, HdfsError
from base_hook import BaseHook
_kerberos_security_mode = None # TODO make confugration file for this
if _kerberos_security_mode:
try:
from hdfs.ext.kerberos import KerberosClient
except ImportError:
logging.error("Could not ... |
19,408 | print timeline | from __future__ import annotations
import pathlib
import tracemalloc
from dataclasses import dataclass, field
from functools import lru_cache
from subprocess import check_call
from sys import stdout
from typing import Dict, List, Optional, Set
import click
from colorama import Back, Fore, Style, init
@dataclass
cla... |
19,409 | ping6 | #!/usr/bin/env python3
# Copyright (C) 2019 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import subprocess
import sys
import time
from testrunner import run
from testrunner imp... |
19,410 | request validator | import json
from calendar import timegm
from datetime import datetime, timedelta
from unittest import mock
import jwt
import pytest
from oauthlib.common import Request as OAuthRequest
from oauthlib.oauth2.rfc6749 import errors
from h.services.oauth._jwt_grant import JWTAuthorizationGrant
from h.services.oauth._valida... |
19,411 | verify1d | from lpython import i32, f64, f32
from numpy import empty, sinh, cosh, reshape, int32, float32, float64, sin
def METHOD_NAME(array: f32[:], result: f32[:], size: i32):
i: i32
eps: f32 = f32(1e-6)
for i in range(size):
assert abs(sinh(sinh(array[i])) - result[i]) <= eps
def verifynd(array: f64[:, ... |
19,412 | handler | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
19,413 | test 2017 | # python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2... |
19,414 | localization | import math
from operator import attrgetter
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Q
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.views.generic.detail import DetailV... |
19,415 | test observed | # python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2... |
19,416 | key down | from __future__ import annotations
import typing as t
from abc import abstractmethod
from dataclasses import dataclass
from rich import console
from rich.text import Text
from rich.style import Style
from rich.table import box, Table
from textual.app import Reactive
from textual.widget import Widget
from starwhale.u... |
19,417 | test hvac mode | from homeassistant.components.climate.const import ClimateEntityFeature, HVACMode
from homeassistant.const import UnitOfTemperature
from ..const import KOGAN_KAWFPAC09YA_AIRCON_PAYLOAD
from ..helpers import assert_device_properties_set
from ..mixins.climate import TargetTemperatureTests
from .base_device_tests import ... |
19,418 | test signed response first sig should fail | from unittest.mock import Mock
from unittest.mock import patch
from pathutils import dotname
from pathutils import full_path
from pytest import raises
from saml2.config import config_factory
from saml2.response import authn_response
from saml2.sigver import SignatureError
SIGNED_XSW_ASSERTION_WRAPPER = full_path("x... |
19,419 | method | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
19,420 | validate | from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration, ConanException
import functools
import os
required_conan_version = ">=1.43.0"
class MagnumIntegrationConan(ConanFile):
name = "magnum-integration"
description = "Integration libraries for the Magnum C++11/C++14 gr... |
19,421 | test static plugins | from datasette.app import Datasette
from datasette.utils import PrefixedUrlString
import pytest
@pytest.fixture(scope="module")
def ds():
return Datasette([], memory=True)
@pytest.mark.parametrize(
"base_url,path,expected",
[
("/", "/", "/"),
("/", "/foo", "/foo"),
("/prefix/", "... |
19,422 | close | # 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 ... |
19,423 | url | from asdf._helpers import validate_version
from asdf.extension import ExtensionProxy
class SerializationContext:
"""
Container for parameters of the current (de)serialization.
This class should not be instantiated directly and instead
will be created by the AsdfFile object and provided to extension
... |
19,424 | test ear | """Tests for msbg module"""
import numpy as np
import pytest
from clarity.evaluator.msbg.msbg import Ear
from clarity.evaluator.msbg.msbg_utils import DF_ED, FF_ED
from clarity.utils.audiogram import AUDIOGRAM_MODERATE_SEVERE, Audiogram
def METHOD_NAME():
"""Test Ear constructor"""
ear = Ear()
assert ea... |
19,425 | fetch | import requests
from bs4 import BeautifulSoup
from waste_collection_schedule import Collection # type: ignore[attr-defined]
from waste_collection_schedule.service.ICS import ICS
TITLE = "Abfallwirtschaft Landkreis Harburg"
DESCRIPTION = "Abfallwirtschaft Landkreis Harburg"
URL = "https://www.landkreis-harburg.de"
TE... |
19,426 | entity |
import numpy as np
from types import ModuleType
from fealpy.functionspace import LagrangeFiniteElementSpace
from ..quadrature import TriangleQuadrature
from .mesh_tools import unique_row, find_node, find_entity, show_mesh_2d
class SurfaceTriangleMesh():
def __init__(self, mesh, surface, p=1, scale=None):
... |
19,427 | test to dict | from pathlib import Path
from unittest.mock import patch, MagicMock
import pytest
import torch
from haystack.preview.dataclasses import Document
from haystack.preview.components.audio import LocalWhisperTranscriber
SAMPLES_PATH = Path(__file__).parent.parent.parent / "test_files"
class TestLocalWhisperTranscriber... |
19,428 | test save load | # Copyright 2017,2018,2019,2020,2021 Sony Corporation.
# Copyright 2022 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... |
19,429 | context menu event | 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... |
19,430 | get fake k8s storage class manifest | import controllers.common.settings as common_settings
import controllers.tests.controller_server.host_definer.settings as test_settings
from controllers.servers.settings import (SECRET_ARRAY_PARAMETER,
SECRET_PASSWORD_PARAMETER,
SECRET_... |
19,431 | test madspin spin only | from __future__ import division
from __future__ import absolute_import
import subprocess
import unittest
import os
import re
import shutil
import sys
import logging
import time
import tempfile
import math
logger = logging.getLogger('test_cmd')
import tests.unit_tests.iolibs.test_file_writers as test_file_writers
imp... |
19,432 | test allow outer | # This file is part of Checkbox.
#
# Copyright 2013 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Checkbox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3,
# as published by the Free Software Foundation.
#... |
19,433 | test module already in sys | import importlib
from importlib import abc
from importlib import util
import sys
import types
import unittest
from . import util as test_util
class CollectInit:
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def exec_module(self, module):
return self
cl... |
19,434 | luajit include folder | from conan import ConanFile
from conan.tools.scm import Version
from conan.tools.files import get, chdir, replace_in_file, copy, rmdir, export_conandata_patches, apply_conandata_patches
from conan.tools.microsoft import is_msvc, MSBuildToolchain, VCVars, unix_path
from conan.tools.layout import basic_layout
from conan.... |
19,435 | test hash entries with duplicates | __copyright__ = "Copyright (C) 2014-2016 Martin Blais"
__license__ = "GNU GPLv2"
import unittest
from beancount.core import data
from beancount.core import compare
from beancount import loader
TEST_INPUT = """
2012-02-01 open Assets:US:Cash
2012-02-01 open Assets:US:Credit-Card
2012-02-01 open Expenses:Grocery
20... |
19,436 | prepend to | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
import inspect
import os
import sys
def evaluate(code, path=__file__, mode="eval"):
# Setting file path here to avoid breaking here if users have set
# "bre... |
19,437 | log | import logging
import os
import shutil
import sqlite3
import warnings
from aequilibrae import global_logger
from aequilibrae.METHOD_NAME import Log
from aequilibrae.parameters import Parameters
from aequilibrae.project.about import About
from aequilibrae.project.data import Matrices
from aequilibrae.project.database_c... |
19,438 | post json | from naas.ntypes import t_add, t_health, t_scheduler, t_job, t_output
from naas.runner.scheduler import Scheduler
from naas.runner.notebooks import Notebooks
from datetime import datetime, timedelta
from naas.runner.logger import Logger
from naas.runner.jobs import Jobs
from naas.runner import n_env
from naas import sc... |
19,439 | refresh state | # SPDX-License-Identifier: MIT
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import (
TYPE_CHECKING,
Any,
Callable,
Coroutine,
Generic,
Optional,
Protocol,
Tuple,
TypeVar,
overload,
)
__all__ = ("Item", "WrappedComponent")
ItemT = TypeVar(... |
19,440 | checkline | import signal
import sys
from bdb import Bdb
from cmd import Cmd
from collections.abc import Callable, Iterable, Mapping, Sequence
from inspect import _SourceObjectType
from types import CodeType, FrameType, TracebackType
from typing import IO, Any, ClassVar, TypeVar
from typing_extensions import ParamSpec, Self
__all... |
19,441 | get output json | import json
import typing as tp
from collections import defaultdict
import mypy.nodes
import mypy.types
import utbot_mypy_runner.mypy_main as mypy_main
import utbot_mypy_runner.expression_traverser as expression_traverser
import utbot_mypy_runner.names
from utbot_mypy_runner.utils import get_borders
from utbot_mypy_r... |
19,442 | query parameters | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
19,443 | read word offset | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import sys
import time
import argpar... |
19,444 | drain | import logging
from abc import ABC, abstractmethod
from collections.abc import Sized
from http.cookies import BaseCookie, Morsel
from typing import (
TYPE_CHECKING,
Any,
Awaitable,
Callable,
Dict,
Generator,
Iterable,
List,
Optional,
Tuple,
)
from multidict import CIMultiDict
fr... |
19,445 | modify population member | """
Reimplementation of search method from Generating Natural Language Adversarial Examples
=========================================================================================
by Alzantot et. al `<arxiv.org/abs/1804.07998>`_ from `<github.com/nesl/nlp_adversarial_examples>`_
"""
import numpy as np
from texta... |
19,446 | get files | import os.path
import time
from contextlib import closing
from dataclasses import dataclass
from glob import glob
from os import PathLike
from typing import Union, List, Optional
import pytest
from boltons.iterutils import chunked
from testplan.common.utils.logfile import (
RotatedFileLogStream,
LogfileInfo,
... |
19,447 | total flux | import scipy.special as special
import numpy as np
import scipy
from lenstronomy.Util import param_util
__all__ = ["SersicUtil"]
class SersicUtil(object):
_s = 0.00001
def __init__(self, smoothing=_s, sersic_major_axis=False):
"""
:param smoothing: smoothing scale of the innermost part of t... |
19,448 | backwards | import json
import os
import time
from datetime import datetime
import six
from django.db import migrations, models
def forwards(apps, schema_editor):
"""
Migrate the initial badge classes, assertions, and course image configurations from lms.djangoapps.certificates.
"""
from xmodule.modulestore.djan... |
19,449 | test adam optimizer univar | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
19,450 | set model params | import copy
import logging
import torch
import wandb
from torch import nn
from ... import mlops
from ...core.alg_frame.server_aggregator import ServerAggregator
class MyServerAggregator(ServerAggregator):
def __init__(self, model, args):
super().__init__(model, args)
self.cpu_transfer = False if... |
19,451 | recv until | #######################################################
#
# ClientReceptionHandler.py
# Python implementation of the Class ClientReceptionHandler
# Generated by Enterprise Architect
# Created on: 19-May-2020 7:17:21 PM
# Original author: Natha Paquette
#
#######################################################
impo... |
19,452 | update amount | # 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 distributed in the hope that it will be useful,
# bu... |
19,453 | init impl | ###
#
# Copyright Alan Kennedy.
#
# You may contact the copyright holder at this uri:
#
# http://www.xhaus.com/contact/modjy
#
# The licence under which this code is released is the Apache License v2.0.
#
# The terms and conditions of this license are listed in a file contained
# in the distribution that also cont... |
19,454 | run | # Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
19,455 | tear down | import ipaddress
import json
import logging
import six
import os
# Packet Test Framework imports
import ptf
import ptf.packet as scapy
import ptf.testutils as testutils
from ptf import config
from ptf.base_tests import BaseTest
logger = logging.getLogger(__name__)
class PopulateFdb(BaseTest):
"""
Popula... |
19,456 | test reading validation mode with enforce valid | # Copyright 2008-2019 pydicom authors. See LICENSE file for details.
"""Unit tests for the pydicom.config module."""
import logging
import sys
import os
import importlib
import pytest
from pydicom import dcmread, DataElement
from pydicom.config import debug
from pydicom.data import get_testdata_file
from pydicom imp... |
19,457 | overlap | from __future__ import division
from bisect import bisect_left
from collections import namedtuple
import numpy as np
from scipy.spatial import distance
import math
RBO = namedtuple("RBO", "min res ext")
RBO.__doc__ += ": Result of full RBO analysis"
RBO.min.__doc__ = "Lower bound estimate"
RBO.res.__doc__ = "Residua... |
19,458 | get file | # Copyright 2010 Google Inc.
# Copyright (c) 2011, Nexenta Systems Inc.
#
# 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... |
19,459 | sound func | # Ridiculously simple test of the winsound module for Windows.
import functools
import time
import unittest
from test import support
from test.support import import_helper
support.requires('audio')
winsound = import_helper.import_module('winsound')
# Unless we actually have an ear in the room, we have no idea whe... |
19,460 | test binary | from __future__ import print_function, division
from builtins import zip
from builtins import range
from builtins import object
###############################################################################
# lazyflow: data flow based lazy parallel computation framework
#
# Copyright (C) 2011-2014, the ilasti... |
19,461 | graph | #!/usr/bin/env python
# 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 "Lice... |
19,462 | test get notional position | import copy
import unittest
from systems.tests.testdata import get_test_object_futures_with_pos_sizing
from systems.basesystem import System
from systems.portfolio import Portfolios
from systems.accounts.accounts_stage import Account
class Test(unittest.TestCase):
def setUp(self):
(
posobjec... |
19,463 | try import fastai | import logging
import platform
from types import ModuleType
from ..version import __version__
__all__ = [
"try_import_mxboard",
"try_import_catboost",
"try_import_lightgbm",
"try_import_xgboost",
"try_import_faiss",
"try_import_fastai",
"try_import_torch",
"try_import_d8",
"try_imp... |
19,464 | auth token | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__all__ ... |
19,465 | match | import math
from PhysicsTools.Heppy.physicsobjects.PhysicsObjects import Muon, Tau, Electron
from PhysicsTools.Heppy.physicsobjects.PhysicsObject import PhysicsObject
from PhysicsTools.Heppy.physicsobjects.HTauTauElectron import HTauTauElectron
from CMGTools.RootTools.utils.DeltaR import deltaR2
class DiObject( Physi... |
19,466 | get guid | """ The POOL XML File module provides a means to extract the GUID of a file or list
of files by searching for an appropriate POOL XML Catalog in the specified directory.
"""
import os
import glob
import tarfile
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.Resources.Catalog.PoolXMLCatalog import PoolXMLCatal... |
19,467 | test transformer no name | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Type
from unittest import TestCase
from dataclasses_json import dataclass_json
from lisa import LisaException, constants, schema, transformer
... |
19,468 | test mni152template is reordered | """Tests common to multiple image plotting functions."""
import matplotlib.pyplot as plt
import numpy as np
import pytest
from nibabel import Nifti1Image
from nilearn.conftest import _affine_mni
from nilearn.datasets import load_mni152_template
from nilearn.image import get_data, reorder_img
from nilearn.plotting imp... |
19,469 | ghissue role | """Define text roles for GitHub
* ghissue - Issue
* ghpull - Pull Request
* ghuser - User
Adapted from bitbucket example here:
https://bitbucket.org/birkenfeld/sphinx-contrib/src/tip/bitbucket/sphinxcontrib/bitbucket.py
Authors
-------
* Doug Hellmann
* Min RK
"""
#
# Original Copyright (c) 2010 Doug Hellmann. All... |
19,470 | check initramfs | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import re
from pathlib import Path
from typing import Any, List, Optional, Pattern
from lisa.feature import Feature
from lisa.util import (
KernelPanicException,
LisaException,
find_patterns_in_lines,
get_datetime_path,
get_m... |
19,471 | list | # pylint: disable=too-many-lines
# 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) AutoRe... |
19,472 | lineoffsets in module | """
For a given source or bytecode file or code object, retrieve
* linenumbers,
* bytecode offsets, and
* nested functions (code objects)
This is useful for example in debuggers that want to set breakpoints only
at valid locations.
"""
from collections import namedtuple
from xdis.bytecode import get_instructio... |
19,473 | show status | import abc
import time
import shutil
import psutil
import datetime
import threading
import subprocess
from ..hands import *
class BaseService(object):
def __init__(self, **kwargs):
self.name = kwargs['name']
self._process = None
self.STOP_TIMEOUT = 10
self.max_retry = 0
se... |
19,474 | main | #!/usr/bin/env python3
import argparse
import logging
import os
import signal
import sys
from argparse import RawTextHelpFormatter
from configparser import ConfigParser, DEFAULTSECT
from blitzpy import RaspiBlitzConfig, RaspiBlitzInfo
LND_CONF = "/mnt/hdd/lnd/lnd.conf"
RB_CONF = "/mnt/hdd/raspiblitz.conf"
log = logg... |
19,475 | sparse tensor dense vs dense matmul benchmark | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
19,476 | is id equals name | import re
from packaging.version import Version
from demisto_sdk.commands.common.constants import DEFAULT_CONTENT_ITEM_FROM_VERSION
from demisto_sdk.commands.common.errors import Errors
from demisto_sdk.commands.common.hook_validations.base_validator import error_codes
from demisto_sdk.commands.common.hook_validation... |
19,477 | test main | from test.test_support import run_unittest
from _locale import (setlocale, LC_NUMERIC, localeconv, Error)
try:
from _locale import (RADIXCHAR, THOUSEP, nl_langinfo)
except ImportError:
nl_langinfo = None
import unittest
import sys
from platform import uname
if uname()[0] == "Darwin":
maj, min, mic = [int(... |
19,478 | ppp cb boilerplate | from functools import wraps
class _PPP_CB:
'''
Internal class to keep track of a the functions to run when a PPP-style
callback is triggered
'''
def __init__(self):
self.callbacks = []
def run(self, *args):
for targ_func in self.callbacks:
targ_func(*args)
def ... |
19,479 | get destination info | # BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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, t... |
19,480 | test update of retention date object mixin | """Tests for the RetentionDateObjectMixin in the ``core`` app of the Marsha project."""
from datetime import date, datetime
from unittest.mock import Mock, patch
from django.test import TestCase, override_settings
from django.utils import timezone
from botocore.exceptions import ClientError
from marsha.core.factorie... |
19,481 | test random markov chain value error | """
Tests for markov/random.py
"""
import numpy as np
from numpy.testing import (
assert_array_equal, assert_raises, assert_array_almost_equal_nulp,
assert_
)
from quantecon.markov import (
random_markov_chain, random_stochastic_matrix, random_discrete_dp
)
def test_random_markov_chain_dense():
spar... |
19,482 | setup visibility groups | #
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2023 PyMeasure Developers
#
# 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 limit... |
19,483 | test compiler flags bad name 1 | # pyflyby/test_flags.py
# License for THIS FILE ONLY: CC0 Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
import ast
import pytest
import warnings
from pyflyby._flags import CompilerFlags
def skip_if_new_compiler_flags_values(func):
return pytest.mark.skipif(
... |
19,484 | validation check | # -------------------------------------------------------------------------------------------------
# Copyright (C) 2015-2023 Nautech Systems Pty Ltd. All rights reserved.
# https://nautechsystems.io
#
# Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
# You may not use this file ex... |
19,485 | create rai insights object regression with model | # Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
import numpy as np
import pandas as pd
import pytest
import shap
import sklearn
from ml_wrappers.model.predictions_wrapper import (
PredictionsModelWrapperClassification, PredictionsModelWrapperRegression)
from sklearn.datasets import fetch_ca... |
19,486 | to dict | import abc
import logging
from typing import Dict, List, Optional
from gear import Database, transaction
from .pricing import Price
log = logging.getLogger('billing_manager')
def product_version_to_resource(product: str, version: str) -> str:
return f'{product}/{version}'
class ProductVersions:
def __ini... |
19,487 | spec | """
component_wise_divide_fc
========================
Autogenerated DPF operator classes.
"""
from warnings import warn
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import Output, _Outputs
from ansys.dpf.core.operators.specification import... |
19,488 | get position | # -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2021 sliptonic shopinthewoods@gmail.com *
# * *
# * This program is free software; you can redistribute it a... |
19,489 | test can delete | import json
import random
from django.urls import reverse
from seahub.test_utils import BaseTestCase
from tests.common.utils import randstring
class GroupsTest(BaseTestCase):
def setUp(self):
self.user_name = self.user.username
self.admin_name = self.admin.username
def tearDown(self):
... |
19,490 | generate | import numpy as np
import sharpy.utils.generator_interface as generator_interface
import sharpy.utils.settings as settings
import sharpy.utils.solver_interface as solver_interface
import sharpy.utils.cout_utils as cout
@generator_interface.generator
class StraightWake(generator_interface.BaseGenerator):
r"""
... |
19,491 | setvalue | #!/usr/bin/env python
import argparse
import subprocess
import sys
import re
class lifeline(object):
symbols = {'NONE': ' ', 'FIRST_HEADER_BIT': 'H', 'DATA_BIT': 'D', 'NOISE': 'X', 'CAS_BIT': 'C'}
def __init__(self, name):
self.__name = name
self.__values = [' ']
self.__events = [[]]
self.__star... |
19,492 | set connection attributes | # Copyright The OpenTelemetry 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 or agreed to in ... |
19,493 | from csv | """
This file defines the loading and saving for correlations data.
"""
import logging
import os
from typing import Optional
import numba as nb
import numpy as np
import pandas as pd
from oasislmf.pytools.common import oasis_float
logger = logging.getLogger(__name__)
Correlation = nb.from_dtype(np.dtype([
('it... |
19,494 | test request multi defroute removing existing different | # SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
from __future__ import absolute_import
from __future__ import division
import copy
from unittest import mock
import pytest
from vdsm.network import canonicalize
from vdsm.network import errors as ne
NET0_SETUP = {'NET0': {'nic': ... |
19,495 | loads | # Copyright 2018 D-Wave Systems 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... |
19,496 | test data context ge cloud mode with | from unittest import mock
import pytest
import responses
from great_expectations.data_context import get_context
from great_expectations.data_context.cloud_constants import CLOUD_DEFAULT_BASE_URL
from great_expectations.data_context.data_context.cloud_data_context import (
CloudDataContext,
)
from great_expectati... |
19,497 | test yahoo finance earnings mocked | """Test the SDK helper functions."""
import pytest
from pandas import DataFrame, to_datetime
from openbb_terminal.stocks.fundamental_analysis import sdk_helpers
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_query_parameters": [
... |
19,498 | get time | import math
import os
import subprocess
from pathlib import Path
from typing import Callable, Dict, List, NamedTuple, Optional, Tuple
from tools.stats.import_test_stats import get_disabled_tests, get_slow_tests
REPO_ROOT = Path(__file__).resolve().parent.parent.parent
IS_MEM_LEAK_CHECK = os.getenv("PYTORCH_TEST_CUD... |
19,499 | gather attached instruments | """Update Firmware of OT3."""
import argparse
import asyncio
from dataclasses import dataclass
from pathlib import Path
from subprocess import run
from typing import Optional, List, Tuple
from hardware_testing.opentrons_api import helpers_ot3
CMD = "python3 -m opentrons_hardware.scripts.update_fw --file {path} --tar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.