id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
7,200 | extract data | # 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... |
7,201 | del handler | from .manager import Manager
from .template import TemplateFabric
from swsscommon import swsscommon
from .managers_rm import ROUTE_MAPS
import ipaddress
from .log import log_info, log_err, log_debug
class AdvertiseRouteMgr(Manager):
""" This class Advertises routes when ADVERTISE_NETWORK_TABLE in STATE_DB is upda... |
7,202 | 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
# --------------------------------... |
7,203 | decode | # The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software di... |
7,204 | handle | # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
# http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... |
7,205 | test no tds in solute list error | #################################################################################
# WaterTAP Copyright (c) 2020-2023, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National Laboratory,
# National Renewable Energy Laboratory, and National Energy Technology
# Labo... |
7,206 | test expected failure | import unittest
class TestUnittestAssertions(unittest.TestCase):
def testFail(self):
with self.assertRaises(AssertionError):
self.fail("failure")
def testEqual(self):
self.assertEqual(0, 0)
self.assertEqual([0, 1, 2], [0, 1, 2])
with self.assertRaises(AssertionErro... |
7,207 | get signature | """
This type stub file was generated by pyright.
"""
import logging
logger = logging.getLogger(__name__)
EMPTY_SHA256_HASH = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
PAYLOAD_BUFFER = 1024 * 1024
ISO8601 = "%Y-%m-%dT%H:%M:%SZ"
SIGV4_TIMESTAMP = "%Y%m%dT%H%M%SZ"
SIGNED_HEADERS_BLACKLIST = ["e... |
7,208 | test upgrade 1 default allowed | ######################################################################
#
# File: test/unit/account_info/test_sqlite_account_info.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
fro... |
7,209 | get filtered trials | import abc
from typing import Callable
from typing import cast
from typing import Collection
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
import numpy
from optuna._transform import _SearchSpaceTransform
from optuna.distributions import BaseDistribution
from optu... |
7,210 | get n mosaic | """CSA header reader from SPM spec
"""
import numpy as np
from .structreader import Unpacker
from .utils import find_private_section
# DICOM VR code to Python type
_CONVERTERS = {
'FL': float, # float
'FD': float, # double
'DS': float, # decimal string
'SS': int, # signed short
'US': int, # u... |
7,211 | eq msg clear | import asyncio
import contextlib
from typing import List
import discord
import lavalink
from lavalink import NodeNotFound, PlayerNotFound
from red_commons.logging import getLogger
from redbot.core import commands
from redbot.core.utils.chat_formatting import box
from ...equalizer import Equalizer
from ..abc import ... |
7,212 | limit log | #**********************************************************************
# Copyright 2020 Advanced Micro Devices, 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.o... |
7,213 | start bundle | #
# 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... |
7,214 | title | import json
import logging
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Optional,
Union,
)
from uuid import uuid4
from gitlab.exceptions import GitlabError
from jinja2 import Template
from reconcile.utils.constants import PROJ_ROOT
from reconcile.utils.gitlab_api import GitLabApi
... |
7,215 | generate config map | # SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0
import drenv
from drenv import kubectl
from drenv import minio
from . import command
def register(commands):
parser = commands.add_parser(
"config",
help="Configure ramen hub operator",
)
parser.set_defau... |
7,216 | load onnx model | # Copyright (c) 2021 - present / Neuralmagic, 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 b... |
7,217 | test git command not found | # -*- coding: utf-8 -*-
# test_exc.py
# Copyright (C) 2008, 2009, 2016 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import re
import ddt
from git.exc import (
InvalidGitRepository... |
7,218 | test import parser direct | import sys
import unittest
import pytest
import six
MODULE_TYPE = type(sys)
# Tests live in datetutil/test which cause a RuntimeWarning for Python2 builds.
# But since we expect lazy imports tests to fail for Python < 3.7 we'll ignore those
# warnings with this filter.
if six.PY2:
filter_import_warning = pytes... |
7,219 | get merged state | from enum import Enum
import cftime
import pace.util
import numpy as np
import pytest
import xarray as xr
from runtime.derived_state import DerivedFV3State, FV3StateMapper, MergedState
class MockFV3GFS:
def __init__(self):
self.set_state_called = False
np.random.seed(0)
nx, ny = 10, 10
... |
7,220 | lint setup py | # -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
7,221 | base loaded | # This file is a part of the AnyBlok project
#
# Copyright (C) 2018 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
# Copyright (C) 2018 Denis VIVIÈS <dvivies@geoblink.com>
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this fi... |
7,222 | test linear solves equivalent | import pytest
from firedrake import *
from firedrake.petsc import PETSc
from numpy.linalg import norm as np_norm
import gc
def count_refs(cls):
""" Counts references of type `cls`
"""
gc.collect()
# A list comprehension here can trigger:
# > ReferenceError: weakly-referenced object no longer exis... |
7,223 | parse args | # serpentarium must be the first import, as it needs to save the state of the
# import system prior to any imports
# isort: off
import serpentarium # noqa: F401
from serpentarium.logging import configure_host_process_logger
# isort: on
import argparse
import logging
import logging.handlers
import os
import re
import ... |
7,224 | set up | # 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... |
7,225 | fast name | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
7,226 | add quarantined replicas | # -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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-... |
7,227 | kill pilots |
__copyright__ = 'Copyright 2022, The RADICAL-Cybertools Team'
__license__ = 'MIT'
# configure the psij logger (captured in the launch components stderr)
import logging
logging.basicConfig(level='DEBUG')
import threading as mt
from .base import PilotLauncherBase
from ... import states as rps
# psij is optional... |
7,228 | display error | # -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2022 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
# Thomas Stivers, Babbage B.V., Accessolutions, Julien Cochuyt
# This file is covered by the GNU General Public License.
# See the file COPYING for mo... |
7,229 | test interpolation rank0 | # Copyright (C) 2011-2022 Garth N. Wells, Jørgen S. Dokken
#
# This file is part of DOLFINx (https://www.fenicsproject.org)
#
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Unit tests for the Function class"""
import importlib
import cffi
import numpy as np
import pytest
import ufl
from basix.ufl import element, ... |
7,230 | test tk err | # -*- coding: utf-8 -*-
from unittest.mock import Mock
import numpy as np
from pytest import raises
from discopy.quantum import tk
from discopy.quantum.gates import *
from discopy.tensor import Tensor, Dim
def test_Circuit_to_tk():
bell_state = Circuit.caps(qubit, qubit)
bell_effect = bell_state[::-1]
... |
7,231 | test zero findings count report | from django.test import TestCase
from audit.models import SingleAuditChecklist
from .errors import err_findings_count_inconsistent
from .check_findings_count_consistency import check_findings_count_consistency
from .sac_validation_shape import sac_validation_shape
from .utils import generate_random_integer
from model_b... |
7,232 | start element | #!/usr/bin/env python
# encoding: utf-8
# Federico Pellegrin, 2016-2019 (fedepell) adapted for Python
"""
This tool helps with finding Python Qt5 tools and libraries,
and provides translation from QT5 files to Python code.
The following snippet illustrates the tool usage::
def options(opt):
opt.load('py pyqt5')
... |
7,233 | tear down module | #!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
7,234 | test does identity match is set true | import pytest
from core.constants import INTEGER, STRING
from environments.identities.traits.models import Trait
from segments.models import (
EQUAL,
GREATER_THAN,
GREATER_THAN_INCLUSIVE,
IN,
IS_NOT_SET,
IS_SET,
LESS_THAN,
LESS_THAN_INCLUSIVE,
MODULO,
NOT_EQUAL,
Condition,
)... |
7,235 | listen | import socket
import sys
from _typeshed import ReadableBuffer
from builtins import type as Type # alias to avoid name clashes with property named "type"
from collections.abc import Iterable
from types import TracebackType
from typing import Any, BinaryIO, NoReturn, overload
from typing_extensions import TypeAlias
# T... |
7,236 | test normalize non default types | import copy
import unittest
import geopandas
import xarray
from xcube.core.mldataset import MultiLevelDataset
from xcube.core.store.datatype import ANY_TYPE, DataTypeLike
from xcube.core.store.datatype import DATASET_TYPE
from xcube.core.store.datatype import DataType
from xcube.core.store.datatype import GEO_DATA_FR... |
7,237 | calculate vertex points | #
# cocos2d:
# http://los-cocos.github.io/cocos-site/
#
# An example of how to generate a 3D scene manually
# Of course, the easiest way is to execute an Waves3D action,
# but this example is provided to show the
# 'internals' of generating a 3D effect.
#
from __future__ import division, print_function, unicode_litera... |
7,238 | get max iterations | """This provides a native realtime MPC and SSID framework to DART, utilizing the trajectory package to solve."""
from __future__ import annotations
import nimblephysics_libs._nimblephysics.realtime
import typing
import nimblephysics_libs._nimblephysics.simulation
import nimblephysics_libs._nimblephysics.trajectory
impo... |
7,239 | measure prusti time | """The benchmarking functionality of `x.py`."""
import argparse
import csv
import json
import os
import signal
import sys
import subprocess
import time
from reporting import (
report, error
)
from helper_functions import (
get_env, run_command, extract_test_compile_flags
)
def get_prusti_server_path_for_benc... |
7,240 | test lt gte multiple | from datetime import datetime
from unittest.mock import Mock
from zoneinfo import ZoneInfo
from django.test.client import RequestFactory
from django.test.utils import override_settings
from rest_framework import fields, serializers
from kitsune.sumo import api_utils
from kitsune.sumo.tests import TestCase
@override... |
7,241 | settimeout | #!/usr/bin/env python
#############################################################################
#
# Module contains an implementation of SONiC Platform Base API and
# provides the Watchdog information
#
#############################################################################
import fcntl
import os
import arr... |
7,242 | test query user with policy as string | # -*- coding: utf-8 -*-
import pytest
import time
from .test_base_class import TestBaseClass
from aerospike import exception as e
import aerospike
@pytest.mark.skip("client.admin_query_user() is deprecated")
class TestQueryUser(TestBaseClass):
pytestmark = pytest.mark.skipif(
not TestBaseClass.auth_in_... |
7,243 | print errors | '''Test runner and result class for the regression test suite.
'''
import functools
import io
import sys
import time
import traceback
import unittest
import xml.etree.ElementTree as ET
from datetime import datetime
class RegressionTestResult(unittest.TextTestResult):
separator1 = '=' * 70 + '\n'
separator2... |
7,244 | test if check runs exampl e08 without | #!/usr/bin/env python3
# -*- encoding: 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/CONTRIBUTIN... |
7,245 | chassis api | """ This module provides interface to interact with the chassis of the DUT
via platform API remotely """
import json
import logging
import re
logger = logging.getLogger(__name__)
INBAND_PORT_REGEX = (r"(Ethernet-IB)(\d+)$")
def METHOD_NAME(conn, name, args=None):
if args is None:
args = []
conn... |
7,246 | crit dice gen | import copy
from typing import Callable
import d20
import draconic
from d20.utils import TreeType
import aliasing.api.statblock
from cogs5e.models.sheet.statblock import StatBlock
def maybe_alias_statblock(target):
"""Returns the AliasStatBlock for the target if applicable."""
if not isinstance(target, (Sta... |
7,247 | encode question | # # TODO: allow google to show the image
#
# from WolframGoogle import WolframGoogle
#
# google = WolframGoogle()
#
# r = google.get_result_from_google_directly('What is the molecular weight of Ch4')
# print(r)
import re
html_template = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link ... |
7,248 | send request | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
7,249 | set job os |
# Copyright 2016 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 agr... |
7,250 | delete prereq | #!/usr/bin/env python
import os
import sys
import json
import pprint
import argparse
import boto3
import misc
import certs
import thing
import policy
pp = pprint.PrettyPrinter(indent=4)
def check_aws_configuration():
mysession = boto3.session.Session()
if not mysession._session._config['profiles']:
... |
7,251 | test gateway runtimes | import os
import time
import pytest
from jina.excepts import RuntimeFailToStart
from jina.orchestrate.pods import Pod
from jina.parsers import set_gateway_parser
from jina.serve.runtimes import asyncio as runtime_asyncio
from jina.serve.executors import BaseExecutor
from tests.helper import _generate_pod_args
@pyte... |
7,252 | test create from local file | import uuid
from labelbox import parser
import pytest
from labelbox.schema.annotation_import import AnnotationImportState, MEAPredictionImport
from labelbox.data.serialization import NDJsonConverter
"""
- Here we only want to check that the uploads are calling the validation
- Then with unit tests we can check the typ... |
7,253 | project | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
7,254 | get next | # 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... |
7,255 | test duplicate symbol | # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
from collections.abc import ValuesView
from pathlib ... |
7,256 | callback regex1 | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2023
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
7,257 | load design matrix | import os
import re
import pandas
from qtpy.QtWidgets import QCheckBox
from ert import LibresFacade
from ert.config import CancelPluginException, ErtPlugin
from ert.gui.ertwidgets.customdialog import CustomDialog
from ert.gui.ertwidgets.listeditbox import ListEditBox
from ert.gui.ertwidgets.models.path_model import P... |
7,258 | tear down | import asyncio
import tempfile
import contextlib
from http import HTTPStatus
import pathlib
from unittest.mock import patch
from typing import AsyncIterator, Dict
import aiohttp
from dffml import (
Record,
config,
Features,
Feature,
ModelContext,
Model,
Sources,
SourcesContext,
ent... |
7,259 | create business | # Copyright © 2022 Province of British Columbia
#
# 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... |
7,260 | mix | #!/usr/bin/env python
#
# Copyright 2008,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, filter, blocks
import cmath
import math
def fir_filter(x, taps, decim=1):
y = []
x2 = (len(taps) -... |
7,261 | test read saved params | #!/usr/bin/env python3
import random
import unittest
import numpy as np
import cereal.messaging as messaging
from cereal import log
from common.params import Params
from selfdrive.locationd.calibrationd import Calibrator, INPUTS_NEEDED, INPUTS_WANTED, BLOCK_SIZE, MIN_SPEED_FILTER, MAX_YAW_RATE_FILTER, SMOOTH_CYCLES, ... |
7,262 | set up | # Copyright (c) 2015 VMware, Inc.
# Copyright (c) 2015 Hewlett Packard Enterprise
#
# SPDX-License-Identifier: Apache-2.0
import collections
import tempfile
from unittest import mock
import testtools
import bandit
from bandit.core import config
from bandit.core import docs_utils
from bandit.core import issue
from ban... |
7,263 | get service endpoint 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 . imp... |
7,264 | get iot hub resource | # 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... |
7,265 | test elfr register event source w | # Impacket - Collection of Python classes for working with network protocols.
#
# Copyright (C) 2023 Fortra. All rights reserved.
#
# This software is provided under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Tested so far:
# (h)ElfrOpen... |
7,266 | do makecache | # -*- coding: utf-8 -*-
# Copyright (C) 2014-2018 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed ... |
7,267 | test set single value | # Copyright 2015 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... |
7,268 | managed by | # 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... |
7,269 | post init | from abc import ABC, abstractmethod
from contextlib import nullcontext
from typing import Callable, Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from coati.experience_buffer import ExperienceBuffer
from torch.optim import Optimizer
from torch.utils.data import DataLoader
from transformers.toke... |
7,270 | test verify agent status | import json
import unittest
from test import DongTaiTestCase
from test.apiserver.test_agent_base import REGISTER_JSON, gzipdata
from rest_framework.test import APITestCase
from dongtai_common.models.user import User
class MyTestCase(DongTaiTestCase):
def test_something(self):
self.assertEqual(True, Fals... |
7,271 | repr frozenset | """Redo the builtin repr() (representation) but with limits on most sizes."""
__all__ = ["Repr", "repr", "recursive_repr"]
import builtins
from itertools import islice
from _thread import get_ident
def recursive_repr(fillvalue='...'):
'Decorator to make a repr function return fillvalue for a recursive call'
... |
7,272 | test serialisation | ##########################################################################
#
# Copyright (c) 2020, Cinesite VFX Ltd. 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 ... |
7,273 | execute base | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017-2021 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
"""
Core execution - this is the special sauce of the default operation
"""
import logging
from tern.classes.notice import Notice
from tern.classes.package import Package
from tern.report imp... |
7,274 | get schema | from django.core.exceptions import ValidationError
from django.urls import reverse
from django.db.models import Q
from rest_access_policy import PermittedPkRelatedField
from rest_framework import serializers
from mathesar.api.db.permissions.query_table import QueryTableAccessPolicy
from mathesar.api.exceptions.mixins... |
7,275 | is draggable | from meerk40t.core.node.node import Node
class RootNode(Node):
"""
RootNode is one of the few directly declarable node-types and serves as the base type for all Node classes.
The notifications are shallow. They refer *only* to the node in question, not to any children or parents.
"""
def __init_... |
7,276 | run | #
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... |
7,277 | authenticate | """
Classes that override default django-oauth-toolkit behavior
"""
from datetime import datetime, timedelta
from django.contrib.auth import authenticate, get_user_model
from django.db.models.signals import pre_save
from django.dispatch import receiver
from oauth2_provider.models import AccessToken
from oauth2_provi... |
7,278 | test futures | import concurrent.futures
import threading
import time
import numpy as np
import pytest
import strax
SHORT_TIMEOUT = 0.1
LONG_TIMEOUT = 5 * SHORT_TIMEOUT
def reader(source, reader_sleeps=0, name=''):
result = []
for x in source:
print(f"Reader {name} got {x}, sleeping for {reader_sleeps}")
... |
7,279 | test list pipelines | #!/usr/bin/env python
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... |
7,280 | get post dominators | from typing import Optional
import logging
import networkx
from ..utils.graph import compute_dominance_frontier, PostDominators, TemporaryNode
from . import Analysis
_l = logging.getLogger(name=__name__)
class CDG(Analysis):
"""
Implements a control dependence graph.
"""
def __init__(self, cfg, s... |
7,281 | update data | # ***************************************************************************
# * *
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
# * Copyright (c) 2017-2018 Oliver Oxtoby (CSIR) <ooxtoby@csir.co.za> *
# * Co... |
7,282 | test broadcast tensors | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
7,283 | test ec2 no instances | from unittest import mock
from boto3 import resource, session
from moto import mock_ec2
from prowler.providers.aws.lib.audit_info.models import AWS_Audit_Info
from prowler.providers.aws.services.ssm.ssm_service import ManagedInstance
from prowler.providers.common.models import Audit_Metadata
AWS_REGION = "us-east-1"... |
7,284 | get pauli string | """
QAOA with finite measurement shot noise
"""
from functools import partial
import numpy as np
from scipy import optimize
import networkx as nx
import optax
import cotengra as ctg
import tensorcircuit as tc
from tensorcircuit import experimental as E
from tensorcircuit.applications.graphdata import maxcut_solution_b... |
7,285 | validate mock ran with noop | from unittest.mock import MagicMock, patch
from django.test import RequestFactory, override_settings
from sentry.middleware.integrations.classifications import (
BaseClassification,
IntegrationClassification,
PluginClassification,
)
from sentry.middleware.integrations.integration_control import Integratio... |
7,286 | test lexx decorators | # coding: utf-8
import sys
import abipy.data as abidata
import abipy.abilab as abilab
import abipy.abio.decorators as ideco
from abipy.core.testing import AbipyTest
from abipy.abio.factories import *
class DecoratorTest(AbipyTest):
def setUp(self):
# Si ebands
si_structure = abilab.Structure.fro... |
7,287 | test load metadata from file | import json
import os
from copy import deepcopy
from pathlib import Path
from typing import Dict, Union
from pynwb.ophys import ImagingPlane, TwoPhotonSeries
from neuroconv.utils import (
dict_deep_update,
fill_defaults,
get_schema_from_hdmf_class,
get_schema_from_method_signature,
load_dict_from_... |
7,288 | get model version | # 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... |
7,289 | data actions | # 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__ ... |
7,290 | landmark pred | import numpy as np
def clip_boxes(boxes, im_shape):
"""
Clip boxes to image boundaries.
:param boxes: [N, 4* num_classes]
:param im_shape: tuple of 2
:return: [N, 4* num_classes]
"""
# x1 >= 0
boxes[:, 0::4] = np.maximum(np.minimum(boxes[:, 0::4], im_shape[1] - 1), 0)
# y1 >= 0
... |
7,291 | should stop | import asyncio
import time
from typing import Any, Awaitable, Callable, Optional
from .. import background_tasks, globals # pylint: disable=redefined-builtin
from ..binding import BindableProperty
from ..slot import Slot
class Timer:
active = BindableProperty()
interval = BindableProperty()
def __init_... |
7,292 | test load correct file structure | import torchvision.transforms as transforms
import pytest
from pathlib import Path
from common.dataset import loader_from_zipped, errorMessage
from common.constants import UNZIPPED_DIR_NAME
from filecmp import dircmp
import torch
import os
different_folder = "zip_files/different_folders.Zip"
empty_folder = "zip_files/... |
7,293 | test create type | from textwrap import dedent
import pytest
import strawberry
from strawberry.annotation import StrawberryAnnotation
from strawberry.field import StrawberryField
from strawberry.tools import create_type
from strawberry.type import get_object_definition
def METHOD_NAME():
@strawberry.field
def name() -> str:
... |
7,294 | iq to bytes | from collections import OrderedDict
from multiprocessing import Array
from multiprocessing.connection import Connection
import numpy as np
from urh.dev.native.Device import Device
from urh.dev.native.lib import usrp
class USRP(Device):
DEVICE_METHODS = Device.DEVICE_METHODS.copy()
DEVICE_METHODS.update({"SE... |
7,295 | prepare | """Embedded workers for integration tests."""
import logging
import os
import threading
from contextlib import contextmanager
from typing import Any, Iterable, Union # noqa
import celery.worker.consumer # noqa
from celery import Celery, worker # noqa
from celery.result import _set_task_join_will_block, allow_join_r... |
7,296 | configure s3 access | # This file is part of the Open Data Cube, see https://opendatacube.org for more information
#
# Copyright (c) 2015-2023 ODC Contributors
# SPDX-License-Identifier: Apache-2.0
""" rasterio environment management tools
"""
import threading
from types import SimpleNamespace
import rasterio ... |
7,297 | flush | from __future__ import annotations
import json
import queue
import typing as t
import threading
from pathlib import Path
from collections import defaultdict
from starwhale.consts import VERSION_PREFIX_CNT
from starwhale.utils.fs import (
ensure_dir,
ensure_file,
blake2b_content,
BLAKE2B_SIGNATURE_ALGO... |
7,298 | check and get bufsize | #!/usr/bin/env python3
# Copyright (C) 2017 Alexandre Abadie <alexandre.abadie@inria.fr>
#
# 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 sys
import os
from testrunner import run
EXPECTED_... |
7,299 | expect sqlalchemy deprecated | from __future__ import annotations
import contextlib
import re
import sys
from typing import Any
from typing import Dict
from sqlalchemy import exc as sa_exc
from sqlalchemy.engine import default
from sqlalchemy.testing.assertions import _expect_warnings
from sqlalchemy.testing.assertions import eq_ # noqa
from sqla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.