id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
2,000 | find | # xml.etree test for cElementTree
import doctest
import sys
from test import test_support
from xml.etree import cElementTree as ET
SAMPLE_XML = """
<body>
<tag>text</tag>
<tag />
<section>
<tag>subtext</tag>
</section>
</body>
"""
SAMPLE_XML_NS = """
<body xmlns="http://effbot.org/ns">
<tag>text</tag... |
2,001 | visualise result | # SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ
# SPDX-FileCopyrightText: 2021 Janek Groehl
# SPDX-License-Identifier: MIT
from simpa import Tags
import simpa as sp
import numpy as np
from skimage.data import shepp_logan_phantom
from scipy.ndimage import zoom
from simpa_tests.manual_tests ... |
2,002 | set up | # Copyright 2022 The KerasCV 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
2,003 | async neo4j driver | # Copyright (c) "Neo4j"
# Neo4j Sweden AB [https://neo4j.com]
#
# This file is part of Neo4j.
#
# 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... |
2,004 | recharge connection config | import uuid
from typing import Any, Dict, Generator
import pydash
import pytest
import requests
from faker import Faker
from requests import Response
from sqlalchemy.orm import Session
from fides.api.db import session
from fides.api.models.connectionconfig import (
AccessLevel,
ConnectionConfig,
Connectio... |
2,005 | post load parent | """
Faraday Penetration Test IDE
Copyright (C) 2016 Infobyte LLC (https://faradaysec.com/)
See the file 'doc/LICENSE' for the license information
"""
# Related third party imports
from flask import Blueprint, abort, make_response, jsonify
from filteralchemy import FilterSet, operators # pylint:disable=unused-import
... |
2,006 | create mock svc record | from unittest import TestCase
from tapiriik.services import Service, ServiceRecord, ServiceBase
from tapiriik.services.interchange import Activity, ActivityType, ActivityStatistic, ActivityStatisticUnit, Waypoint, WaypointType, Lap, Location
from datetime import datetime, timedelta
import random
import pytz
from tapi... |
2,007 | get view frame from calib frame | import numpy as np
import common.transformations.orientation as orient
## -- hardcoded hardware params --
eon_f_focal_length = 910.0
eon_d_focal_length = 650.0
tici_f_focal_length = 2648.0
tici_e_focal_length = tici_d_focal_length = 567.0 # probably wrong? magnification is not consistent across frame
eon_f_frame_siz... |
2,008 | test tuple contains | from collections import defaultdict
import pytest
from diofant import (Basic, Dict, FiniteSet, Integer, Matrix, Rational, Tuple,
false, sympify, true)
from diofant.abc import p, q, r, s, x, y, z
from diofant.core.compatibility import is_sequence, iterable
from diofant.core.containers import tuple... |
2,009 | test object mutation | # stdlib
from textwrap import dedent
# third party
from faker import Faker
import pytest
# syft absolute
import syft
from syft.client.client import SyftClient
from syft.node.worker import Worker
from syft.service.action.action_object import ActionObject
from syft.service.action.action_permissions import ActionPermiss... |
2,010 | test head response doesnt support content | from pathlib import PurePosixPath
from typing import Any, Optional
import pytest
from litestar import MediaType, get
from litestar.datastructures import Cookie
from litestar.exceptions import ImproperlyConfiguredException
from litestar.response import Response
from litestar.response.base import ASGIResponse
from lite... |
2,011 | 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 . im... |
2,012 | is sequence finished | from typing import Any, Callable, Optional
import torch
import torch.distributed as dist
import torch.nn as nn
try:
from transformers.generation_logits_process import (
LogitsProcessorList,
TemperatureLogitsWarper,
TopKLogitsWarper,
TopPLogitsWarper,
)
except ImportError:
f... |
2,013 | test trotter hamiltonian scalar mul | """Test Trotter Hamiltonian methods from `qibo/core/hamiltonians.py`."""
import numpy as np
import pytest
from qibo import hamiltonians
from qibo.backends import NumpyBackend
from qibo.quantum_info import random_hermitian, random_statevector
from .utils import random_complex
@pytest.mark.parametrize("nqubits", [3, ... |
2,014 | test given recognizer result then one is | import pytest
from presidio_anonymizer.entities import InvalidParamException, RecognizerResult
@pytest.mark.parametrize(
# fmt: off
"start, end",
[
(0, 10),
(2, 8),
(0, 8),
(0, 10),
],
# fmt: on
)
def test_given_recognizer_results_then_one_contains_another(start, e... |
2,015 | dict has value | # -*- coding: utf-8 -*-
#
# widgets.py - Mycodo core utils
#
# Copyright (C) 2015-2020 Kyle T. Gabriel <mycodo@kylegabriel.com>
#
# This file is part of Mycodo
#
# Mycodo 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 Softw... |
2,016 | run container | import pytest
import docker
import os
from time import sleep
from subprocess import Popen, PIPE
from sinspqa import LOGS_PATH, is_containerized
from sinspqa.sinsp import SinspStreamerBuilder
def pytest_addoption(parser):
parser.addoption('--no-kmod', action='store_true',
default=False, help=... |
2,017 | test initialise with list kwarg | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
2,018 | test validate slug and generate if needed | from datetime import timedelta
from decimal import Decimal
import pytest
from django.core.exceptions import ValidationError
from django.utils import timezone
from graphql.error import GraphQLError
from ....product.models import Category
from ..validators import (
clean_seo_fields,
validate_end_is_after_start,... |
2,019 | get | # Copyright (c) Meta Platforms, Inc. and affiliates.
from .request import Broker
from .vocabulary import ThreatExchange as t
from .vocabulary import ThreatExchangeMember as tem
from .errors import pytxAttributeError
class ThreatExchangeMember(object):
_URL = t.URL + t.VERSION + t.THREAT_EXCHANGE_MEMBERS
_i... |
2,020 | combine frontiers | import itertools
import random
import sys
import time
import unittest
import backend as F
import dgl
import networkx as nx
import numpy as np
import scipy.sparse as sp
from utils import parametrize_idtype
np.random.seed(42)
def toset(x):
# F.zerocopy_to_numpy may return a int
return set(F.zerocopy_to_numpy... |
2,021 | test edit post belongs to thread and | from guardian.shortcuts import assign_perm
from kitsune.forums.tests import ForumFactory, ForumTestCase, PostFactory, ThreadFactory
from kitsune.sumo.tests import get, post
from kitsune.users.tests import GroupFactory, UserFactory
class BelongsTestCase(ForumTestCase):
"""
Mixing and matching thread, forum, a... |
2,022 | test stock rule buy payment mode | # Copyright 2013-2015 Tecnativa - Pedro M. Baeza
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import fields
from odoo.tests import Form
from odoo.addons.account_payment_purchase.tests.test_account_payment_purchase import (
TestAccountPaymen... |
2,023 | init vars | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
2,024 | callback wazuhdb response | # Copyright (C) 2015-2022, Wazuh Inc.
# Created by Wazuh, Inc. <info@wazuh.com>.
# This program is free software; you can redistribute it and/or modify it under the terms of GPLv2
import functools
import hashlib
import json
import logging
import socket
import sqlite3
import time
from wazuh_testing.tools import GLOBAL_... |
2,025 | autogenerate | #!/usr/bin/env python3
"""
manager.py - Script which acts as the user interface for schema management.
"""
import argparse
import json
import os
from schema_parser import LDAPSchemaParser
from generator import SchemaGenerator
localdir = os.path.dirname(os.path.abspath(__file__))
def generate(infile, schema_type=N... |
2,026 | concat | # Copyright (c) 2023 zfit
import numpy as np
import tensorflow as tf
import zfit.z.numpy as znp
SWITCH_ON = True
def is_tensor(x):
return tf.is_tensor(x)
def has_tensor(x):
return any(tf.is_tensor(t) for t in tf.nest.flatten(x))
def allclose_anyaware(x, y, rtol=1e-5, atol=1e-8):
"""Tests if x and y... |
2,027 | test rst | # Copyright 2023 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
2,028 | pause | """Support for audio output
The `audioio` module contains classes to provide access to audio IO.
All classes change hardware state and should be deinitialized when they
are no longer needed if the program continues after use. To do so, either
call :py:meth:`!deinit` or use a context manager. See
:ref:`lifetime-and-co... |
2,029 | test rename fields check log remove only | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import pytest
from bentoml._internal.configuration.helpers import flatten_dict
from bentoml._internal.configuration.helpers import is_valid_ip_address
from bentoml._internal.configuration.helpers import load_config_file
from bentoml._... |
2,030 | scale | #!/usr/bin/env python
############################################################################
#
# MODULE: r.out.kde
# AUTHOR(S): Anna Petrasova
#
# PURPOSE:
# COPYRIGHT: (C) 2013 - 2019 by the GRASS Development Team
#
# This program is free software under the GNU General Public
# ... |
2,031 | bctester | #!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""Test framework for defi utils.
Runs automatically during `make check`.
Can a... |
2,032 | group hashes | import time
import uuid
import pytest
from sentry.event_manager import _save_aggregate
from sentry.eventstore.models import Event
from sentry.grouping.result import CalculatedHashes
from sentry.models import Group, GroupHash
from sentry.testutils.pytest.fixtures import django_db_all
@pytest.fixture
def fast_save(de... |
2,033 | event | #
# 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 ... |
2,034 | test set owner | from django.test import TestCase
from django.utils import timezone
from ...categories.models import Category
from ...users.test import create_test_user
from ..models import Post, Thread, ThreadParticipant
from ..participants import (
add_participants,
has_participants,
make_participants_aware,
set_owne... |
2,035 | delete host | """
Support for RFC 2136 dynamic DNS updates.
:depends: - dnspython Python module
:configuration: If you want to use TSIG authentication for the server, there
are a couple of optional configuration parameters made available to
support this (the keyname is only needed if the keyring contains more
than one... |
2,036 | repeats cmp | """
Comparison utilities for STIX pattern observation expressions.
"""
from stix2.equivalence.pattern.compare import generic_cmp, iter_lex_cmp
from stix2.equivalence.pattern.compare.comparison import (
comparison_expression_cmp, generic_constant_cmp,
)
from stix2.patterns import (
AndObservationExpression, Foll... |
2,037 | function returning generator | # pylint: disable=too-few-public-methods,import-error, missing-docstring
# pylint: disable=useless-super-delegation,wrong-import-position,invalid-name, wrong-import-order, condition-evals-to-constant
if len('TEST'): # [use-implicit-booleaness-not-len]
pass
if not len('TEST'): # [use-implicit-booleaness-not-len]... |
2,038 | parse datetime | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2022 Satpy developers
#
# This file is part of satpy.
#
# satpy 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... |
2,039 | handle | """
This command:
* deletes all prescribing data (both original data and extracts created by the matrixstore build) from:
* the filesystem
* BigQuery
* Cloud Storage
* resets the import pipeline so that the import may be re-run with correct data
"""
import json
import os
import networkx as ... |
2,040 | test run specs | from unittest import mock
import pytest
import string
import dbt.exceptions
import dbt.graph.selector as graph_selector
import dbt.graph.cli as graph_cli
from dbt.node_types import NodeType
import networkx as nx
from dbt import flags
from argparse import Namespace
from dbt.contracts.project import UserConfig
flag... |
2,041 | compute exact | """
Copyright (c) 2018-2023 Intel 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-2.0
Unless required by applicable law or agreed to in wri... |
2,042 | grad | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
2,043 | separate true followers | import json
import re
from html.parser import HTMLParser
from io import StringIO
from hedera.supported_languages import SUPPORTED_LANGUAGES
from lemmatization.lemmatizer import Lemmatizer
class EditedTextHtmlParser(HTMLParser):
def __init__(self, token_lemma_dict=None, lang=None):
self.current_tag = Non... |
2,044 | awk rule1 | # Leo colorizer control file for awk mode.
# This file is in the public domain.
# Properties for awk mode.
properties = {
"indentCloseBrackets": "}",
"indentOpenBrackets": "{",
"lineComment": "#",
"lineUpClosingBracket": "true",
"wordBreakChars": ",+-=<>/?^&*",
}
# Attributes dict for awk_main rul... |
2,045 | test consider not charging chargepoint in loadmanagement | from typing import List, Tuple
from unittest.mock import Mock
import pytest
from control import data
from control.algorithm import common
from control.chargepoint.chargepoint import Chargepoint
from control.ev import Ev
from control.counter import Counter
from control.counter_all import CounterAll
@pytest.fixture(a... |
2,046 | cindex | """
Classes and methods to interface with files storing rate data.
"""
import os
import re
from scipy.constants import physical_constants
from pynucastro.nucdata.binding_table import BindingTable
from pynucastro.nucdata.elements import PeriodicTable
from pynucastro.nucdata.mass_table import MassTable
from pynucastro... |
2,047 | get test params | """Optional passthrough transformer."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
__author__ = ["aiwalter", "fkiraly"]
__all__ = ["OptionalPassthrough"]
from sktime.transformations._delegate import _DelegatedTransformer
from sktime.transformations.compose._common import CORE_MTYPES
from ... |
2,048 | name | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . imp... |
2,049 | norm | # Test the Unicode versions of normal file functions
# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
import sys, os, unittest
from unicodedata import normalize
from test import test_support
filenames = [
'1_abc',
u'2_ascii',
u'3_Gr\xfc\xdf-Gott',
u'4_\u0393\u03b... |
2,050 | patch internal | # engine params
from typing import Any, Callable, Dict, Optional, Sequence, Union, cast
from .argument_config import get_argument_config_value
from .config_file_config import get_config_dict_from_config_file
from .default_config import get_default_config_value
from .environment_config import get_environment_config_val... |
2,051 | test resampling to numpy img 1 | import numpy as np
import unittest
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.pygrass.raster import raster2numpy_img
from grass.pygrass.gis.region import Region
from grass.script.core import tempfile
has_PyQt4 = False
try:
from PyQt4.QtCore import *
from PyQt4.... |
2,052 | on server init complete | # -*- coding: utf-8 -*-
""" *==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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... |
2,053 | add rule | import re
from collections.abc import Mapping
ELEMENT_SELECTOR = re.compile(r"^([\w-]+)$")
ELEMENT_WITH_ATTR_SELECTOR = re.compile(r"^([\w-]+)\[([\w-]+)\]$")
ELEMENT_WITH_ATTR_EXACT_SINGLE_QUOTE_SELECTOR = re.compile(
r"^([\w-]+)\[([\w-]+)='(.*)'\]$"
)
ELEMENT_WITH_ATTR_EXACT_DOUBLE_QUOTE_SELECTOR = re.compile(
... |
2,054 | test no owner | # 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 that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICUL... |
2,055 | add datum for arg | """
EndpointsHelper
---------------
This is support for session endpoints, which are a flagged feature for mobile that also form the basis of smart
links in web apps.
Endpoints define specific locations in the application using a stack, so they rely on similar logic to end of form
navigation. The complexity of genera... |
2,056 | calc time | # -*- coding: utf-8 -*-
"""
Travel time calculations.
"""
from .helper_classes import TauModelError
from .seismic_phase import SeismicPhase
from .utils import parse_phase_list
from . import _DEFAULT_VALUES
class TauPTime(object):
"""
Calculate travel times for different branches using linear interpolation
... |
2,057 | global var | # 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... |
2,058 | test delta reached pending | import itertools
from datetime import timedelta
import pytest
from django.utils import timezone
from freezegun import freeze_time
from sentry.models import Group, GroupSnooze
from sentry.testutils.cases import PerformanceIssueTestCase, SnubaTestCase, TestCase
from sentry.testutils.helpers.datetime import before_now, ... |
2,059 | validate tar archive | import errno
import json
import os
import shutil
import subprocess
import requests
DEFAULT_MODEL_PATH = "model_archiver/tests/integ_tests/resources/regular_model"
DEFAULT_HANDLER = "service:handle"
DEFAULT_RUNTIME = "python"
DEFAULT_MODEL_NAME = "model"
DEFAULT_EXPORT_PATH = "/tmp/model"
MANIFEST_FILE = "MAR-INF/MANIF... |
2,060 | get enabled | """
Service support for Debian systems (uses update-rc.d and /sbin/service)
.. important::
If you feel that Salt should be using this module to manage services on a
minion, and it is using a different module (or gives an error similar to
*'service.start' is not available*), see :ref:`here
<module-provi... |
2,061 | test resort solo groups | import unittest
from drake.tools.lint.formatter import FormatterBase, IncludeFormatter
class TestFormatterBase(unittest.TestCase):
def test_essentials(self):
original_lines = [
'// Line 1\n',
'/* Line 2 */\n',
'\n',
]
dut = FormatterBase('filename.cc',... |
2,062 | get logger | """Ray Module."""
import logging
import os
from functools import wraps
from typing import TYPE_CHECKING, Any, Callable, List, Optional, TypeVar, Union
from awswrangler._config import apply_configs
from awswrangler._distributed import EngineEnum, engine
if engine.get() == EngineEnum.RAY or TYPE_CHECKING:
import ra... |
2,063 | test hidetip | """Test tooltip, coverage 100%.
Coverage is 100% after excluding 6 lines with "# pragma: no cover".
They involve TclErrors that either should or should not happen in a
particular situation, and which are 'pass'ed if they do.
"""
from idlelib.tooltip import TooltipBase, Hovertip
from test.support import requires
requi... |
2,064 | test biosample characterization upgrade status encode2 | import pytest
def test_antibody_characterization_upgrade(upgrader, antibody_characterization_1):
value = upgrader.upgrade('antibody_characterization', antibody_characterization_1, target_version='3')
assert value['schema_version'] == '3'
assert value['status'] == 'PENDING DCC REVIEW'
assert value['cha... |
2,065 | sub | #
# SPDX-License-Identifier: GPL-2.0-only
#
import errno
import re
import os
class OEList(list):
"""OpenEmbedded 'list' type
Acts as an ordinary list, but is constructed from a string value and a
separator (optional), and re-joins itself when converted to a string with
str(). Set the variable type ... |
2,066 | test place no place info | """ Test PlaceInfo """
import pytest
PHOTOS_DB = "./tests/Test-Places-Catalina-10_15_1.photoslibrary/database/photos.db"
UUID_DICT = {
"place_dc": "128FB4C6-0B16-4E7D-9108-FB2E90DA1546",
"place_maui": "FF7AFE2C-49B0-4C9B-B0D7-7E1F8B8F2F0C",
"no_place": "A9B73E13-A6F2-4915-8D67-7213B39BAE9F",
}
MAUI_DICT ... |
2,067 | test create view no view aborts | import os
import pytest
from tempfile import TemporaryDirectory
from mindsdb.api.http.initialize import initialize_app
from mindsdb.migrations import migrate
from mindsdb.interfaces.storage import db
from mindsdb.utilities.config import Config
@pytest.fixture(scope="session", autouse=True)
def app():
old_minds_d... |
2,068 | register attributes | from collections import UserList
from collections.abc import Iterable
from datetime import datetime
from functools import reduce
from mage_ai.api.operations.constants import READ
from mage_ai.api.resources.BaseResource import BaseResource
from mage_ai.orchestration.db.models.base import BaseModel
from mage_ai.shared.ha... |
2,069 | rebuild cases | from django.core.management.base import BaseCommand
from casexml.apps.case.cleanup import rebuild_case_from_forms
from casexml.apps.case.xform import get_case_updates
from corehq.apps.users.models import CouchUser
from corehq.form_processor.backends.sql.dbaccessors import LedgerAccessorSQL
from corehq.form_processor.m... |
2,070 | short name | # Copyright 2023 The JAX 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
2,071 | test status subscriber error |
import unittest
import multiprocessing
import sys
import time
import ipaddress
import broker
class TestCommunication(unittest.TestCase):
def test_ping(self):
# --peer-start
with broker.Endpoint() as ep1, \
broker.Endpoint() as ep2, \
ep1.make_subscriber("/test") as s1, \... |
2,072 | drop index | from redis import Redis, RedisError, ConnectionPool
import datetime
import itertools
import json
import time
class Document(object):
def __init__(self, id, **fields):
self.id = id
for k, v in fields.iteritems():
setattr(self, k, v)
def __repr__(self):
return 'Document %... |
2,073 | create next relation | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Iterator, Union
from amundsen_common.utils.atlas import AtlasCommonParams, AtlasCommonTypes
from databuilder.models.atlas_entity import AtlasEntity
from databuilder.models.atlas_relationship import AtlasRelatio... |
2,074 | get source | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
"""Data Resource Provider implementation.
"""
import os
from pathlib import Path
from c7n.actions import ActionRegistry
from c7n.exceptions import PolicyExecutionError, PolicyValidationError
from c7n.filters import FilterRegistry
from c7n.m... |
2,075 | test force open completions event | import unittest
from test.test_support import requires
from Tkinter import Tk, Text
import idlelib.AutoComplete as ac
import idlelib.AutoCompleteWindow as acw
from idlelib.idle_test.mock_idle import Func
from idlelib.idle_test.mock_tk import Event
class AutoCompleteWindow:
def complete():
return
class Du... |
2,076 | replace variables | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Module containing command managers (SearchRunner and CommandRunner)."""
import traceback
import re
import contextlib
from typing import TYPE_CHECKING, Callable, Dict, Iterator, Mapping, Muta... |
2,077 | get name cache info | from functools import lru_cache
import logging
import re
from lona import default_settings
ABSTRACT_ROUTE_RE = re.compile(r'<(?P<name>[^:>]+)(:(?P<pattern>[^>]+))?>')
ROUTE_PART_FORMAT_STRING = r'(?P<{}>{})'
DEFAULT_PATTERN = r'[^/]+'
OPTIONAL_TRAILING_SLASH_PATTERN = r'(/)'
MATCH_ALL = 1
logger = logging.getLogger... |
2,078 | get function | from math import floor
import numpy as np
from scipy.signal import savgol_coeffs, savgol_filter
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Double
from featuretools.primitives.base import TransformPrimitive
class SavgolFilter(TransformPrimitive):
"""Applies a Savitzky-Gola... |
2,079 | get revision object | from time import time
from django.contrib.admin.utils import unquote
from django.core.exceptions import PermissionDenied
from django.http import Http404, JsonResponse
from django.http.request import QueryDict
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from djan... |
2,080 | execution instance | # Python
import pytest
from unittest import mock
from contextlib import contextmanager
from awx.main.models import Credential, UnifiedJob, Instance
from awx.main.tests.factories import (
create_organization,
create_job_template,
create_instance,
create_instance_group,
create_notification_template,
... |
2,081 | type | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . im... |
2,082 | test invalid human handle | # Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS
from __future__ import annotations
import zlib
from unicodedata import normalize
import pytest
from parsec._parsec import (
DataError,
DeviceID,
DeviceName,
EntryName,
EntryNameError,
HumanHandle,
Organiz... |
2,083 | test out file | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
2,084 | replace tests | #!/usr/bin/env python3
# NUnit test validator for csplugin tasks
import json
import os
import re
import sys
from subprocess import call, DEVNULL
def replace_all(lines, s1, s2):
for i in range(len(lines)):
s = lines[i]
lines[i] = re.sub(s1, s2, lines[i])
def replace_by(lines, instructions):
r... |
2,085 | locals example defined before | # pylint: disable=missing-docstring, invalid-name, too-few-public-methods, import-outside-toplevel, fixme, line-too-long, broad-exception-raised
def test_regression_737():
import xml # [unused-import]
def test_regression_923():
import unittest.case # [unused-import]
import xml as sql # [unused-import]
d... |
2,086 | can see ban details | from django.apps import AppConfig
from django.utils.translation import pgettext_lazy
from .pages import user_profile, usercp, users_list
class MisagoUsersConfig(AppConfig):
name = "misago.users"
label = "misago_users"
verbose_name = "Misago Auth"
def ready(self):
from . import signals as _
... |
2,087 | add xml attr | ## Original version of code heavily based on recipe written by Wai Yip
## Tung, released under PSF license.
## http://code.activestate.com/recipes/534109/
import re
import os
import xml.sax.handler
class DataNode (object):
def __init__ (self, **kwargs):
self._attrs = {} # XML attributes and child ele... |
2,088 | retry | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... |
2,089 | display participation result | from datetime import timedelta
from django.core.exceptions import ValidationError
from django.db.models import Min, OuterRef, Subquery
from django.template.defaultfilters import floatformat
from django.urls import reverse
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from djan... |
2,090 | d set p | """DistributedNode module: contains the DistributedNode class"""
from panda3d.core import NodePath
from . import GridParent
from . import DistributedObject
class DistributedNode(DistributedObject.DistributedObject, NodePath):
"""Distributed Node class:"""
def __init__(self, cr):
if not hasattr(self,... |
2,091 | test delete | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import shutil
import unittest
from unittest import mock
from azure.monitor.opentelemetry.exporter._storage import (
LocalFileBlob,
LocalFileStorage,
_now,
_seconds,
)
TEST_FOLDER = os.path.abspath(... |
2,092 | test create association in new diagram should | import pytest
from gaphor import UML
from gaphor.core.modeling import Diagram
from gaphor.diagram.tests.fixtures import allow, connect, disconnect, get_connected
from gaphor.UML.classes.association import AssociationItem
from gaphor.UML.classes.klass import ClassItem
@pytest.fixture
def connected_association(create)... |
2,093 | test add noise column df | import numpy as np
import pandas as pd
import pytest
from numpy.core.fromnumeric import sort
from autogluon.core.utils.feature_selection import *
from autogluon.core.utils.utils import unevaluated_fi_df_template
def evaluated_fi_df_template(features, importance=None, n=None):
rng = np.random.default_rng(0)
i... |
2,094 | test nonhashable | import unittest
import twowaymap
class TestTwoWayMap(unittest.TestCase):
def assertTwoWayMap(self, twmap, forward, reverse):
map_repr = (
{ k: twmap.lookup_left(k) for k in twmap.left_all() },
{ k: twmap.lookup_right(k) for k in twmap.right_all() }
)
self.assertEqual(map_repr, (forward, rever... |
2,095 | get default display mode | # ***************************************************************************
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
2,096 | write parameters | # Copyright (c) 2017 The University of Manchester
#
# 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 ... |
2,097 | build transform | # Copyright 2019 Open Source Robotics Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... |
2,098 | get vertexai job client | # Copyright 2022 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 applicable law or ... |
2,099 | get cluster log groups from boto3 | import json
import logging
import boto3
import utils
from botocore.exceptions import ClientError
LOGGER = logging.getLogger(__name__)
def _dumps_json(obj):
"""Dump obj to a JSON string."""
return json.dumps(obj, indent=2)
def METHOD_NAME(cluster_log_group_prefix):
"""
Get log groups with cluster l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.