id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
2,700 | block inc | from __future__ import annotations
import random
from concurrent.futures import (
FIRST_COMPLETED,
FIRST_EXCEPTION,
Future,
TimeoutError,
as_completed,
wait,
)
from time import sleep
import pytest
from tlz import take
from distributed.event import Event
from distributed.metrics import time
fr... |
2,701 | slice by element id | from io import StringIO
from numpy import zeros, searchsorted, where, asarray, array
from pyNastran.dev.bdf_vectorized.cards.elements.element import Element
class SolidElement(Element):
def __init__(self, model):
Element.__init__(self, model)
def __getitem__(self, i):
return self.slice_by_ind... |
2,702 | test check strategy might suggest sampled from | # This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Copyright the Hypothesis Authors.
# Individual contributors are listed in AUTHORS.rst and the git log.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the... |
2,703 | build list request | # 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... |
2,704 | keys | # MONKEY PATCH!!!
import json
import os
from unittest import mock
import mockredis
import redis
import swsssdk
from sonic_py_common import multi_asic
from swsssdk import SonicDBConfig, SonicV2Connector, ConfigDBConnector, ConfigDBPipeConnector
from swsscommon import swsscommon
topo = None
dedicated_dbs = {}
def cle... |
2,705 | test var | # ***************************************************************
# Copyright (c) 2023 Jittor. All Rights Reserved.
# Maintainers: Dun Liang <randonlang@gmail.com>.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ************************... |
2,706 | test propagation failure on run exception | from ipaddress import IPv4Address
from threading import Event
from typing import Callable, Tuple, Type
from unittest.mock import MagicMock
from uuid import UUID
import pytest
from agent_plugins.exploiters.mssql.src.mssql_client import MSSQLClient
from agent_plugins.exploiters.mssql.src.mssql_exploit_client import MSSQ... |
2,707 | test get shipping methods for checkout use | from datetime import timedelta
from decimal import Decimal
from unittest import mock
from django.utils import timezone
from ....webhook.event_types import WebhookEventSyncType
from ....webhook.payloads import generate_checkout_payload
from ..plugin import CACHE_TIME_SHIPPING_LIST_METHODS_FOR_CHECKOUT
from ..shipping ... |
2,708 | dependencies | import os
import re
import subprocess
import sys
from contextlib import contextmanager
FORBIDDEN_CODECOV_FLAG_CHARS = re.compile(r'[^\w\.\-]')
class GoModule:
"""
A Go module abstraction.
independent specifies whether this modules is supposed to exist independently of the datadog-agent module.
If Tru... |
2,709 | forward | import torch
import torch.nn as nn
import torchvision.models as models
class PerceptualLoss(nn.Module):
r"""
Perceptual loss, VGG-based
https://arxiv.org/abs/1603.08155
https://github.com/dxyang/StyleTransfer/blob/master/utils.py
"""
def __init__(self, weights=[1.0, 1.0, 1.0, 1.0, 1.0]):
... |
2,710 | test add data docs site already existing | import copy
from unittest import mock
import pytest
import great_expectations.exceptions as gx_exceptions
from great_expectations.data_context import EphemeralDataContext
@pytest.fixture
def new_site_config() -> dict:
return {
"class_name": "SiteBuilder",
"module_name": "great_expectations.rende... |
2,711 | set plot options | import sys
import inspect
import base64
if (sys.version_info > (3, 0)):
import io
else:
import cStringIO as io
from viewerstate import *
from visitstate import RPCType as RPC
class ViewerMethods:
def __init__(self,_state):
self.state = _state
def sync(self):
gmap = sys.modules["__main_... |
2,712 | decode audio | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
2,713 | run enabled | # -*- coding: utf-8 -*-
import re
from thonny import get_runner, get_workbench, ui_utils
from thonny.codeview import CodeViewText
cell_regex = re.compile(r"(^|\n)(# ?%%|##|# In\[\d+\]:)[^\n]*", re.MULTILINE) # @UndefinedVariable
def update_editor_cells(event):
text = event.widget
if not getattr(text, "ce... |
2,714 | process raw data | import os
import dgl
import numpy
import pandas
import torch
def METHOD_NAME(raw_dir, processed_dir):
r"""
Description
-----------
Preprocess Elliptic dataset like the EvolveGCN official instruction:
github.com/IBM/EvolveGCN/blob/master/elliptic_construction.md
The main purpose is to conver... |
2,715 | get validation support | import os
import re
from typing import Tuple
from qtpy.QtCore import QSize
from qtpy.QtWidgets import QFileDialog, QHBoxLayout, QLineEdit, QToolButton, QWidget
from ert.gui.ertwidgets import resourceIcon
from ert.gui.ertwidgets.validationsupport import ValidationSupport
class PathChooser(QWidget):
"""
PathC... |
2,716 | open process for memory access | #!/usr/bin/env python
"""OSX specific utils."""
import ctypes
import ctypes.util
import logging
import os
import platform
from grr_response_client import client_utils_osx_linux
from grr_response_client.osx import objc
from grr_response_client.osx import process
from grr_response_core.lib import utils
from grr_respon... |
2,717 | one publish many subscribe | """
Example of ZMQ Publish servers and Subscribe clients.
"""
import time
import zmq
from testplan.testing.multitest import MultiTest, testsuite, testcase
from testplan.testing.multitest.driver.zmq import ZMQServer, ZMQClient
from testplan.common.utils.context import context
def after_start(env):
# The subscr... |
2,718 | test fail on bad client id | # Copyright 2019, 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... |
2,719 | load feature | # The learn_kmeans.py uses code from Fairseq:
# https://github.com/pytorch/fairseq/blob/master/examples/hubert/simple_kmeans/learn_kmeans.py
#
# Thanks to Abdelrahman Mohamed and Wei-Ning Hsu's help in this implementation,
# Their origial Hubert work is in:
# Paper: https://arxiv.org/pdf/2106.07447.pdf
# Co... |
2,720 | test create web dirs | import os
import shutil
from pathlib import Path
import pytest
from cobbler.cexceptions import CX
from cobbler.utils import filesystem_helpers
from tests.conftest import does_not_raise
@pytest.mark.parametrize(
"test_src,is_symlink,test_dst,expected_result",
[
# ("", "", False), --> This has a task... |
2,721 | test simple | import os
from pathlib import Path
import time
from ansys.tools.path import find_ansys
import numpy as np
import pytest
from ansys.mapdl.core import LocalMapdlPool, examples
from ansys.mapdl.core.errors import VersionError
from conftest import skip_if_not_local
# skip entire module unless HAS_GRPC
pytestmark = pytes... |
2,722 | tags | # 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... |
2,723 | test get connections target models | # -*- coding: utf-8 -*-
#
# test_getconnections.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 Lic... |
2,724 | has camera | #!/usr/bin/env python
from __future__ import print_function
import os, sys
import subprocess
import datetime
# There is something like a set of gphoto2 python bindings, at
# http://magiclantern.wikia.com/wiki/Remote_control_with_PTP_and_Python
# but it's not widely available and you'd have to compile it for the RPi.... |
2,725 | get assessment output | # 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... |
2,726 | timings | # encoding: utf-8
"""
Utilities for timing code execution.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of... |
2,727 | get module constant | import sys
import marshal
import contextlib
import dis
from setuptools.extern.packaging import version
from ._imp import find_module, PY_COMPILED, PY_FROZEN, PY_SOURCE
from . import _imp
__all__ = [
'Require', 'find_module', 'get_module_constant', 'extract_constant'
]
class Require:
"""A prerequisite to b... |
2,728 | get params | # 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... |
2,729 | parse | # Copyright (C) Donald Stufft and individual contributors
# SPDX-License-Identifier: BSD-2-Clause
"""
This file was partially copied from the packaging.version module before the
LegacyVersion class was removed to continue to support version parsing in
a backward-compatible way where PEP 440 support can't be used.
Copy... |
2,730 | suite | # -*- coding: utf-8 -*-
#
# test_connect_one_to_one.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... |
2,731 | tf create global tensor | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... |
2,732 | test getattribute | # third party
import numpy as np
# syft absolute
from syft.service.action.action_object import ActionObject
from syft.service.action.plan import planify
from syft.types.twin_object import TwinObject
def test_eager_permissions(worker, guest_client):
root_domain_client = worker.root_client
input_obj = TwinObje... |
2,733 | build stdlib | # Copyright 2019 The Bazel Go Rules Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
2,734 | key func 0 | """Index entries adapters for sphinx.environment."""
from __future__ import annotations
import re
import unicodedata
from itertools import groupby
from typing import TYPE_CHECKING, Any, Literal
from sphinx.errors import NoUri
from sphinx.locale import _, __
from sphinx.util import logging
from sphinx.util.index_entr... |
2,735 | time stamp | """
Copyright (C) 2014 David Boddie <david@boddie.org.uk>
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 is dist... |
2,736 | set up | # Copyright 2020 KMEE INFORMATICA LTDA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
from odoo.addons.l10n_br_fiscal.constants.fiscal import (
PROCESSADOR_NENHUM,
PROCESSADOR_OCA,
)
from ..models.document import filter_processador_edoc_nfse... |
2,737 | get obj temp | # coding=utf-8
#
# From https://github.com/CRImier/python-MLX90614
#
# MIT License
#
# Copyright (c) 2016 Arsenijs
#
# 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, inclu... |
2,738 | find entity | # Copyright (c) 2021 Baidu.com, Inc. 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 l... |
2,739 | parse http url | ##################################################################
# Copyright 2018 Open Source Geospatial Foundation and others #
# licensed under MIT, Please consult LICENSE.txt for details #
##################################################################
"""
XML tools
"""
import logging
from typing import... |
2,740 | export sources | from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir
import os
required_conan_version = ">=1.53.0"... |
2,741 | test batch download matched set report download | # Use fixtures from features, indexing workbook
import pytest
from encoded.tests.features.conftest import app, app_settings, index_workbook
from encoded.batch_download import lookup_column_value
from encoded.batch_download import format_row
from encoded.batch_download import _convert_camel_to_snake
pytestmark = [
... |
2,742 | id | # 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... |
2,743 | url | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------... |
2,744 | p pruning | # Copyright (c) Alibaba, Inc. and its affiliates.
from typing import Any, Dict, Union
import hdbscan
import numpy as np
import scipy
import sklearn
import umap
from sklearn.cluster._kmeans import k_means
from modelscope.metainfo import Models
from modelscope.models import MODELS, TorchModel
from modelscope.utils.con... |
2,745 | output | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
2,746 | get processor | # Copyright 2021 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 ... |
2,747 | test remove basic | from copy import deepcopy
import numpy
import pytest
from openff.toolkit import Molecule, Topology
from openff.units import unit
from openff.interchange import Interchange
from openff.interchange._tests import _BaseTest, needs_gmx
from openff.interchange.components.mdconfig import get_intermol_defaults
from openff.in... |
2,748 | start reader threads | #
# 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 us... |
2,749 | main | # SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
"""
Stress tests for switching the master storage domain.
Usage:
1. Have two storage domains: one is the current master domain,
and the other will be the new master domain.
2. Run this on the SPM host:
python3 switch_master.py -... |
2,750 | skip config | import logging
import pytest
from ipaddress import ip_interface
from constants import ENI, VM_VNI, VNET1_VNI, VNET2_VNI, REMOTE_CA_IP, LOCAL_CA_IP, REMOTE_ENI_MAC,\
LOCAL_ENI_MAC, REMOTE_CA_PREFIX, LOOPBACK_IP, DUT_MAC, LOCAL_PA_IP, LOCAL_PTF_INTF, LOCAL_PTF_MAC,\
REMOTE_PA_IP, REMOTE_PTF_INTF, REMOTE_PTF_MAC,... |
2,751 | deregister all callbacks | import sys
from qtpy import QtWidgets, QtCore, QtGui
from openpype.tools.utils import host_tools
from openpype.style import load_stylesheet
from openpype.lib import register_event_callback
from openpype.hosts.fusion.scripts import (
duplicate_with_inputs,
)
from openpype.hosts.fusion.api.lib import (
set_asse... |
2,752 | simple tag func | #!/usr/bin/env python
"""
This example shows how to use the parametrization
feature of `@testcase` decorator.
"""
import sys
from testplan.testing.multitest import MultiTest, testsuite, testcase
from testplan import test_plan
from testplan.report.testing.styles import Style
@testsuite
class SimpleTest:
# This ... |
2,753 | test arccosh | # Owner(s): ["module: dynamo"]
# this file is autogenerated via gen_ufuncs.py
# do not edit manually!
import numpy as np
from torch._numpy._ufuncs import * # noqa: F403
from torch._numpy.testing import assert_allclose
def test_absolute():
assert_allclose(np.absolute(0.5), absolute(0.5), atol=1e-14, check_dtyp... |
2,754 | start | """
Riak Salt Module
"""
import salt.utils.path
def __virtual__():
"""
Only available on systems with Riak installed.
"""
if salt.utils.path.which("riak"):
return True
return (
False,
"The riak execution module failed to load: the riak binary is not in the path.",
)
... |
2,755 | test assign none to enum or none | # -*- coding: UTF-8 -*-
# pylint: disable=missing-docstring, too-few-public-methods
"""
Test the trait-type ``UseEnum``.
"""
import unittest
import enum
from ipython_genutils.py3compat import string_types
from traitlets import HasTraits, TraitError, UseEnum
# ---------------------------------------------------------... |
2,756 | base64 encode | #
# Copyright (c) 2022, Neptune Labs Sp. z o.o.
#
# 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... |
2,757 | monitoring cleanup | 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... |
2,758 | test excluded user repo | """Test cases for MagicLink."""
from .. import util
class TestMagicLinkShortner(util.MdCase):
"""Test cases for repo link shortening."""
extension = [
'pymdownx.magiclink',
]
extension_configs = {
'pymdownx.magiclink': {
'repo_url_shortener': True
}
}
def... |
2,759 | prepare request | # 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... |
2,760 | set value | # 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... |
2,761 | plot corr | import json
import plotly.subplots
from dash import html
from dash import dcc
from dash.dependencies import Input, Output, State
from NuRadioReco.eventbrowser.app import app
from NuRadioReco.utilities import units
from NuRadioReco.eventbrowser.default_layout import default_layout
from NuRadioReco.framework.parameters i... |
2,762 | run command | # -*- coding: utf-8 -*-
# (c) 2020, Alexei Znamensky <russoz@gmail.com>
# Copyright (c) 2020, Ansible Project
# Simplified BSD License (see LICENSES/BSD-2-Clause.txt or https://opensource.org/licenses/BSD-2-Clause)
# SPDX-License-Identifier: BSD-2-Clause
from __future__ import absolute_import, division, print_function... |
2,763 | set up | #
# @file TestL3Parameter.py
# @brief L3 Parameter unit tests
#
# @author Akiya Jouraku (Python conversion)
# @author Sarah Keating
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generated automatically by converting the file locat... |
2,764 | package info | from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd, stdcpp_library
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
from conan.tools.micr... |
2,765 | test prepare twice raises | from pathlib import Path
import pytest
import qcodes as qc
from qcodes.dataset import connect, load_by_guid, load_or_create_experiment
from qcodes.dataset.data_set_in_memory import DataSetInMem
from qcodes.dataset.descriptions.dependencies import InterDependencies_
from qcodes.dataset.descriptions.param_spec import P... |
2,766 | logout |
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
__author__ = ["Andrew Hopkinso... |
2,767 | 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... |
2,768 | test500x500 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: molecule.py
#
# Tests: mesh - 3D points
# plots - Molecule
# operators - CreateBonds, Replicate
#
# Programmer: Kathleen Biagas
# Date: June 15, 2021
#
#... |
2,769 | test attribute not member type | import pytest
from vyper.exceptions import (
ArrayIndexException,
InvalidOperation,
InvalidReference,
TypeMismatch,
UndeclaredDefinition,
UnknownAttribute,
)
from vyper.semantics.analysis.base import VarInfo
from vyper.semantics.analysis.utils import get_possible_types_from_node
from vyper.sema... |
2,770 | firebase auth user | from random import randint
from typing import Any, Dict, Generator
import pydash
import pytest
from firebase_admin import auth
from firebase_admin.auth import UserNotFoundError
from firebase_admin.exceptions import FirebaseError
from sqlalchemy.orm import Session
from fides.api.cryptography import cryptographic_util
... |
2,771 | compute expected freqs | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
2,772 | add unit to tree | #
# Copyright 2008-2010 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 lat... |
2,773 | test when install does not error installed | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.modules.npm as npmmod
import salt.states.npm as npm
from salt.exceptions import CommandExecutionError
from tests.support.mock import MagicMock, create_autospec, patch
@pytest.fixture
def configure_loader_modules():
return {... |
2,774 | doit | """Sort performance test.
See main() for command line syntax.
See tabulate() for output format.
"""
import sys
import time
import random
import marshal
import tempfile
import os
td = tempfile.gettempdir()
def randfloats(n):
"""Return a list of n random floats in [0, 1)."""
# Generating floats is expensive,... |
2,775 | dereference | from __future__ import annotations
from typing import TYPE_CHECKING, Any, ClassVar, List, Optional, Union
import attrs
from .. import errors, settings
from ..exception import FrictionlessException
from ..metadata import Metadata
from .dataset import Dataset
from .factory import Factory
if TYPE_CHECKING:
from ..... |
2,776 | remote setup | # coding=utf-8
"""flask views that deal with user authentication."""
import json
import logging
import flask_login
from flask import jsonify
from flask import redirect
from flask import render_template
from flask import request
from flask import url_for
from flask.blueprints import Blueprint
from mycodo.databases.mod... |
2,777 | fill cache | # Copyright (C) 2011 by Calvin Spealman (ironfroggy@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... |
2,778 | test urlfile iterable | import io
import pickle
import pytest
import responses
from cog.types import URLFile, get_filename
@responses.activate
def test_urlfile_acts_like_response():
responses.get(
"https://example.com/some/url",
json={"message": "hello world"},
status=200,
)
u = URLFile("https://example... |
2,779 | token | from mage_ai.api.errors import ApiError
from mage_ai.api.resources.DatabaseResource import DatabaseResource
from mage_ai.api.utils import get_access_for_roles
from mage_ai.authentication.oauth2 import encode_token, generate_access_token
from mage_ai.authentication.passwords import (
create_bcrypt_hash,
generate... |
2,780 | get presences for realm | import datetime
import time
from collections import defaultdict
from typing import Any, Dict, Mapping, Optional, Sequence, Set
from django.conf import settings
from django.utils.timezone import now as timezone_now
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.models import PushDeviceToken, Realm,... |
2,781 | should be trimmed | from typing import Optional
from robot.api.parsing import CommentSection, EmptyLine, Token
try:
from robot.api.parsing import Config # from RF 6.0
except ImportError:
Config = None
from robotidy.disablers import skip_section_if_disabled
from robotidy.skip import Skip
from robotidy.transformers import Transf... |
2,782 | test build gecos field | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.modules.useradd as useradd
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
try:
import pwd
HAS_PWD = True
except ImportError:... |
2,783 | add image | """
DICOMSeries outlines an instance of the DICOM series that can be found within a study
"""
from PySide6.QtCore import Qt
from src.Model.DICOM.DICOMWidgetItem import DICOMWidgetItem
class Series:
"""Holds a set of images within an individual series within a DICOM study"""
def __init__(self, series_uid):
... |
2,784 | id | # 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... |
2,785 | unpack range | import numpy as np
import unittest
from numba.core.compiler import compile_isolated, Flags
from numba.core import errors, types
from numba import typeof
from numba.tests.support import TestCase, MemoryLeakMixin, tag
enable_pyobj_flags = Flags()
enable_pyobj_flags.enable_pyobject = True
force_pyobj_flags = Flags()
fo... |
2,786 | diff lists | from django.utils.translation import gettext as _
from corehq.apps.fixtures.exceptions import FixtureUploadError
from corehq.apps.fixtures.upload.failure_messages import FAILURE_MESSAGES
from corehq.apps.fixtures.upload.workbook import get_workbook
from corehq.apps.fixtures.utils import get_fields_without_attributes
f... |
2,787 | modify internal dictionary | # 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... |
2,788 | is enabled | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
2,789 | get roles and doctypes | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
import frappe.defaults
from frappe import _
from frappe.core.doctype.doctype.doctype import (
clear_permissions_cache,
validate_permissions_for_doctype,
)
from frappe.exceptions import DoesNotExistError
fr... |
2,790 | set status | # Copyright (C) 2012 Rocco Aliberti
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that it... |
2,791 | get | # This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... |
2,792 | test smart component regular flipped x | # coding=UTF-8
#
# Copyright 2016 Google Inc. 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... |
2,793 | expand | from random import random
from panda3d.core import Point3
from direct.task.TaskManagerGlobal import taskMgr
from direct.gui import DirectGuiGlobals
from direct.gui.DirectGui import DirectButton, DirectDialog, DirectEntry, DirectFrame, YesNoDialog
def test_DirectGui(base):
# EXAMPLE CODE
# Load a model
smi... |
2,794 | test package resource access | # Owner(s): ["oncall: package/deploy"]
from io import BytesIO
from sys import version_info
from textwrap import dedent
from unittest import skipIf
from torch.package import PackageExporter, PackageImporter
from torch.testing._internal.common_utils import run_tests
try:
from .common import PackageTestCase
except ... |
2,795 | print usage | # Copyright (c) 2012-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""
Defi base58 encoding and decoding.
Based on https://bitcointalk.org/index.php?topic=1026.0 (public domain)
"""
import hashl... |
2,796 | test auto all error | import datetime
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import MagicMock, call, patch
from piccolo.apps.migrations.commands.new import (
BaseMigrationManager,
_create_new_migration,
_generate_migration_meta,
new,
)
from piccolo.conf.apps import AppConfig... |
2,797 | install runtime dependencies | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... |
2,798 | test multiple swipes | """
Copyright(C) 2023 Altom Consulting
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 is... |
2,799 | test srmr | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.