id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
8,200 | image | # coding: utf-8
# /*##########################################################################
#
# Copyright (C) 2016-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... |
8,201 | set up | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
# Copyright 2020 The HuggingFace Team. 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.... |
8,202 | setup autoscale group boto3 | import boto3
import pytest
from moto import mock_autoscaling
from .utils import setup_networking
from tests import EXAMPLE_AMI_ID
def METHOD_NAME():
mocked_networking = setup_networking()
client = boto3.client("autoscaling", region_name="us-east-1")
client.create_launch_configuration(
LaunchConf... |
8,203 | test fft convolution | import unittest
import numpy as np
import time
from tests.QtTestCase import QtTestCase
from urh.controller.widgets.SignalFrame import SignalFrame
from urh.signalprocessing.Filter import Filter
class TestFilter(QtTestCase):
def setUp(self):
super().setUp()
self.add_signal_to_form("unaveraged.coc... |
8,204 | test element extract operator | # Copyright (c) 2017-2021, NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
8,205 | tags | # 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... |
8,206 | 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... |
8,207 | extra options | ##
# Copyright 2016-2023 Forschungszentrum Juelich GmbH
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research... |
8,208 | basic mqtt request args | from typing import Dict
from unittest.mock import MagicMock, Mock, patch
import paho.mqtt.client as paho
import pytest
from tavern._core import exceptions
from tavern._plugins.mqtt.client import MQTTClient, _handle_tls_args, _Subscription
from tavern._plugins.mqtt.request import MQTTRequest
def test_host_required()... |
8,209 | calculated sale by status | from flask_rest_jsonapi import ResourceDetail
from marshmallow_jsonapi import fields
from marshmallow_jsonapi.flask import Schema
from sqlalchemy import func
from app.api.bootstrap import api
from app.api.helpers.db import get_count
from app.api.helpers.utilities import dasherize
from app.models import db
from app.mod... |
8,210 | sample translation specific document | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""
FILE: sample_begin_translation_with_filters.py
DESCRIPTION:
This sample demonstrates how to translate documents under a particular folder in you... |
8,211 | bar | import json
from copy import deepcopy
from django import template
from bestiary.models import RuneObjectBase, Monster
from data_log.reports import chart_templates
register = template.Library()
@register.filter
def drop_summary(summary_data):
# Transform level drop summary to highcharts expected format
char... |
8,212 | get outbound 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... |
8,213 | create tower lcc node defaults | #
# This script will populate the tables with many default entries for a Signal LCC node.
# It will populate:
# 'inactive' sensors matching the logic cell default values.
# sensors for the I/O port event defaults
# and more things...
#
# Ken Cameron, October 2022
# Usage:
# run the script via the Scripting->Run... |
8,214 | build started | # This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
8,215 | exists | import abc
import typing
from types import TracebackType
from typing import IO
from typing import Any
from typing import Dict
from typing import List
from typing import Text
from typing import Type
from typing import Tuple
from typing import Union
from typing import AnyStr
from typing import Mapping
from typing import ... |
8,216 | test dump int | from math import isnan
import pytest
from psycopg.adapt import PyFormat
from psycopg.pq import Format
try:
import numpy as np
except ImportError:
pass
pytest.importorskip("numpy")
pytestmark = [pytest.mark.numpy]
def test_classes_identities():
# Check if we know the class identities correctly. Maybe o... |
8,217 | read pdf | from toolbox import update_ui
from toolbox import CatchException, report_execption, write_results_to_file
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
fast_debug = False
def METHOD_NAME(pdfPath):
"""
读取pdf文件,返回文本内容
"""
import pdfminer
from pdfminer.pdfparser import PDFPar... |
8,218 | 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... |
8,219 | append | import logging
import pyhf
from pyhf import events
from pyhf.tensor.manager import get_backend
from pyhf.parameters import ParamViewer
log = logging.getLogger(__name__)
def required_parset(sample_data, modifier_data):
return {
'paramset_type': 'unconstrained',
'n_parameters': len(sample_data),
... |
8,220 | test invalid param | #!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... |
8,221 | print tail | #!/usr/bin/env python
# $Id: mesadef.py,v 1.2.10.1 2006/01/25 15:55:49 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
#
# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentat... |
8,222 | validate datetime | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... |
8,223 | test cancel | import gevent.testing as greentest
import gevent
from gevent.hub import get_hub
import sys
SHOULD_EXPIRE = 0.01
if not greentest.RUNNING_ON_CI:
SHOULD_NOT_EXPIRE = SHOULD_EXPIRE * 2.0
else:
SHOULD_NOT_EXPIRE = SHOULD_EXPIRE * 20.0
class TestDirectRaise(greentest.TestCase):
switch_expected = False
de... |
8,224 | init feats | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
import torch.nn.functional as F
from pytorch3d.ops.vert_align import vert_align
... |
8,225 | 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... |
8,226 | assert sources | # Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os.path
import subprocess
import sys
from typing import Iterable, Optional
import pytest
from pex import layout
from pex.common import open_zip, touch
from pex.typing import TYPE_... |
8,227 | use rec | #! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2011 (ita)
"""
Common mistakes highlighting.
There is a performance impact, so this tool is only loaded when running ``waf -v``
"""
typos = {
'feature':'features',
'sources':'source',
'targets':'target',
'include':'includes',
'export_include':'export_includes',... |
8,228 | resolved path | import importlib
import os
import sys
import typing
import warnings
import zipimport
folder = os.path.dirname(__file__)
__all__ = {
"lookup_any_item_id_to_name",
"lookup_any_location_id_to_name",
"network_data_package",
"AutoWorldRegister",
"world_sources",
"folder",
}
if typing.TYPE_CHECKING... |
8,229 | reduce metrics | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
import torch
import torch.nn.functional as F
from fairseq import metrics
from fairseq.c... |
8,230 | make model | import numpy as np
import tensorflow as tf
import ase
from ase.calculators.lj import LennardJones
import matplotlib.pyplot as plt
from dscribe.descriptors import SOAP
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import load_model
fr... |
8,231 | delete | from backend.models.postgis.utils import timestamp
from backend import db
from backend.models.dtos.task_annotation_dto import TaskAnnotationDTO
from backend.models.dtos.project_dto import ProjectTaskAnnotationsDTO
class TaskAnnotation(db.Model):
"""Describes Task annotaions like derived ML attributes"""
__ta... |
8,232 | test light linking | ##########################################################################
#
# Copyright (c) 2017, Image Engine Design 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:
#
# * Redistrib... |
8,233 | instance kerberos hostname | # This file is autogenerated.
# To change this file you should edit assets/configuration/spec.yaml and then run the following commands:
# ddev -x validate config -s <INTEGRATION_NAME>
# ddev -x validate models -s <INTEGRATION_NAME>
from datadog_checks.base.utils.models.fields import get_default_field_value
d... |
8,234 | test write multiple coils execute | """Bit Message Test Fixture.
This fixture tests the functionality of all the
bit based request/response messages:
* Read/Write Discretes
* Read Coils
"""
from test.conftest import FakeList, MockContext
from pymodbus.bit_write_message import (
WriteMultipleCoilsRequest,
WriteMultipleCoilsResponse,
WriteSi... |
8,235 | eq | # 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://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
8,236 | test builtin errors | import builtins
import os
import select
import socket
import unittest
import errno
from errno import EEXIST
class SubOSError(OSError):
pass
class SubOSErrorWithInit(OSError):
def __init__(self, message, bar):
self.bar = bar
super().__init__(message)
class SubOSErrorWithNew(OSError):
def ... |
8,237 | main | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
8,238 | post operations | # --------------------------------------------------------------------------------------------
# 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
# --------------------------------... |
8,239 | test mm | # Owner(s): ["module: inductor"]
import torch
from torch._inductor import metrics
from torch._inductor.compile_fx import compile_fx, count_bytes_inner
from torch.testing._internal.common_utils import TestCase as TorchTestCase
from torch.testing._internal.inductor_utils import HAS_CUDA
aten = torch.ops.aten
def cou... |
8,240 | set dt | """
Implicit-explicit time integrators
"""
from .rungekutta import *
class IMEXGeneric(TimeIntegrator, ABC):
"""
Generic implementation of Runge-Kutta Implicit-Explicit schemes
Derived classes must define the implicit :attr:`dirk_class` and explicit
:attr:`erk_class` Runge-Kutta time integrator clas... |
8,241 | rax dns | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DO... |
8,242 | modelname to contextsize | """
Utility Tools for the Portkey Class
This file module contains a collection of utility functions designed to enhance
the functionality and usability of the Portkey class
"""
from typing import List, TYPE_CHECKING
from enum import Enum
from llama_index.llms.base import LLMMetadata
from llama_index.llms.openai import... |
8,243 | href | from functools import total_ordering, cmp_to_key
from django.utils.encoding import smart_text
from django_comments.models import Comment
from mediathread.assetmgr.models import Asset
from mediathread.djangosherd.models import SherdNote, DiscussionIndex
from mediathread.projects.models import Project
from mediathread.u... |
8,244 | test start schema creation | import boto3
import json
from botocore.exceptions import ClientError
import pytest
from moto import mock_appsync
schema = """type Mutation {
putPost(id: ID!, title: String!): Post
}
"My custom post type"
type Post {
id: ID!
title: String!
}
type Query {
singlePost(id: ID!): Post
}
schema {
query... |
8,245 | apply dense | # 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... |
8,246 | read dep versions | #!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023-2023 kcgen <kcgen@users.noreply.github.com>
"""
Generates a vcpkg JSON manifest with pinned dependency versions
extracted from a local vcpkg repository.
Takes in the local project's name, version, vcpkg dependencies, and
path to a ... |
8,247 | test terminate | import json
import logging
import multiprocessing
import threading
import time
import uuid
import pytest
from globus_compute_endpoint.endpoint.rabbit_mq import TaskQueueSubscriber
def test_synch(start_task_q_publisher, start_task_q_subscriber, count=10):
"""Open publisher, and publish to task_q, then open subscr... |
8,248 | test get auto merge list | import pytest
import shutil
from pathlib import Path
import numpy as np
from spikeinterface import WaveformExtractor, load_extractor, extract_waveforms, NumpySorting, set_global_tmp_folder
from spikeinterface.extractors import toy_example
from spikeinterface.core.generate import inject_some_split_units
from spikeint... |
8,249 | build model | # Copyright 2022 The MediaPipe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
8,250 | test creating good address | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import uuid
import mock
import requests
from django.urls import reverse
from rest_framework import status
from rest_framework.status import HTTP_200_OK
from rest_framework.status import HTTP_201_CREATE... |
8,251 | radius | from __future__ import annotations
from dataclasses import dataclass
from functools import cached_property
from itertools import chain
from typing import List, Set
from .constants import IS_ENEMY, IS_MINE
from .data import Alliance, DisplayType
from .pixel_map import PixelMap
from .position import Point2, Point3
from... |
8,252 | port start | # sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
from socket import *
from select import *
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
""... |
8,253 | add methods | #
# SPDX-License-Identifier: GPL-2.0-only
#
import abc
import asyncio
import json
import os
import socket
from . import chunkify, DEFAULT_MAX_CHUNK
class AsyncClient(object):
def __init__(self, proto_name, proto_version, logger, timeout=30):
self.reader = None
self.writer = None
self.max_... |
8,254 | test twoq gate | import pytest
from pyquil.gates import (
CNOT,
CPHASE,
CPHASE00,
CPHASE01,
CPHASE10,
CZ,
H,
I,
ISWAP,
PHASE,
PSWAP,
RX,
RY,
RZ,
S,
SWAP,
T,
X,
Y,
Z,
SQISW,
FSIM,
PHASEDFSIM,
RZZ,
RXX,
RYY,
)
from pyquil.quilbase impo... |
8,255 | contrast | # MicroPython SSD1306 OLED driver, I2C and SPI interfaces
from micropython import const
import framebuf
# register definitions
SET_CONTRAST = const(0x81)
SET_ENTIRE_ON = const(0xA4)
SET_NORM_INV = const(0xA6)
SET_DISP = const(0xAE)
SET_MEM_ADDR = const(0x20)
SET_COL_ADDR = const(0x21)
SET_PAGE_ADDR = const(0x22)
SET... |
8,256 | test change state fail | # Copyright (c) Ansible project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import mock
import pytest
from ansible... |
8,257 | process get | import flask
from flask import Response
from flask_babel import lazy_gettext as _
from api.admin.problem_details import *
from api.nyt import NYTBestSellerAPI
from api.novelist import NoveListAPI
from core.opds_import import MetadataWranglerOPDSLookup
from core.model import (
ExternalIntegration,
get_one,
)
fro... |
8,258 | test delete | """
:codeauthor: Nicole Thomas <nicole@saltstack.com>
"""
import pytest
import salt.modules.mac_group as mac_group
from salt.exceptions import CommandExecutionError, SaltInvocationError
from tests.support.mock import MagicMock, patch
grp = pytest.importorskip("grp", reason="Missing required library 'grp'")
@py... |
8,259 | test one hot encoding | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
8,260 | epsilon closure | # cython: auto_cpdef=True
"""
Python Lexical Analyser
Converting NFA to DFA
"""
from __future__ import absolute_import
from . import Machines
from .Machines import LOWEST_PRIORITY
from .Transitions import TransitionMap
def nfa_to_dfa(old_machine, debug=None):
"""
Given a nondeterministic Machine, return a n... |
8,261 | create topology | # (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import json
import os
from datetime import datetime
from mock import MagicMock, Mock
from pyVmomi import vim
from six import iteritems
HERE = os.path.abspath(os.path.dirname(__file__))
class MockedMOR(Mock):... |
8,262 | create | """ProxyProvider API Views"""
from typing import Any, Optional
from django.utils.translation import gettext_lazy as _
from drf_spectacular.utils import extend_schema_field
from rest_framework.exceptions import ValidationError
from rest_framework.fields import CharField, ListField, ReadOnlyField, SerializerMethodField
... |
8,263 | set up | from abc import ABCMeta
from datetime import date
import people.tests.factories
from django.contrib.contenttypes.models import ContentType
from django.core.management import call_command
from parties.tests.factories import PartyFactory
from people.models import Person
from . import factories
EXAMPLE_PARTIES = [
... |
8,264 | add cookie header | import sys
from _typeshed import StrPath
from collections.abc import Iterable, Iterator, Sequence
from http.client import HTTPResponse
from re import Pattern
from typing import ClassVar, TypeVar, overload
from urllib.request import Request
__all__ = [
"Cookie",
"CookieJar",
"CookiePolicy",
"DefaultCook... |
8,265 | parse args | #!/usr/bin/env python3
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import argparse
import os
import time
import shutil
import subprocess
import sys
from vmstat import capture_sample
from vmstat import plot_output
from vmstat import print_output_to_file
import platform
exe = ""
if platform.system() == "Wi... |
8,266 | config validator | """
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... |
8,267 | chatting | # This bot is needed to connect two people and their subsequent anonymous communication
#
# Avaiable commands:
# `/start` - Just send you a messsage how to start
# `/find` - Find a person you can contact
# `/stop` - Stop active conversation
import telebot
from telebot import types
# Initialize bot with your token
bot... |
8,268 | define binding | import datetime
from typing import Optional
from pony import orm
from tribler.core.utilities.pony_utils import TriblerDatabase, get_or_create
class TagDatabase:
def __init__(self, filename: Optional[str] = None, *, create_tables: bool = True, **generate_mapping_kwargs):
self.instance = TriblerDatabase()... |
8,269 | delete datastore profile | # 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... |
8,270 | test request headers | # Copyright 2017 Workiva
# 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, software
#... |
8,271 | send project invitation email | import re
from django.conf import settings
from django.utils.translation import gettext as _
from django.contrib.auth import get_user_model
from django.utils import timezone
from rest_framework import serializers
from onadata.apps.logger.models import ProjectInvitation
from onadata.libs.permissions import ROLES
from on... |
8,272 | monitor | # The MIT License (MIT)
# Copyright (c) 2019 by the xcube development team and contributors
#
# 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... |
8,273 | python type | import weakref
from sqlalchemy import types
from sqlalchemy.dialects import oracle, postgresql, sqlite
from sqlalchemy.ext.mutable import Mutable
from ..exceptions import ImproperlyConfigured
from .scalar_coercible import ScalarCoercible
passlib = None
try:
import passlib
from passlib.context import LazyCryp... |
8,274 | test default | # (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import re
import pytest
from datadog_checks.dev import TempDir
from datadog_checks.dev.fs import ensure_parent_dir_exists, path_join, write_file
from datadog_checks.dev.tooling.configuration.template imp... |
8,275 | tear down class | # Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
8,276 | np rgba to bgra | from typing import Tuple, Type
import numpy as np
from ..image_utils import MAX_VALUES_BY_DTYPE, as_3d
def np_denorm(x: np.ndarray, min_max: Tuple[float, float] = (-1.0, 1.0)) -> np.ndarray:
"""Denormalize from [-1,1] range to [0,1]
formula: xi' = (xi - mu)/sigma
Example: "out = (x + 1.0) / 2.0" for den... |
8,277 | params | from typing import Any, Dict, Optional
from aws_lambda_powertools.utilities.data_classes.common import DictWrapper
class TimeZone(DictWrapper):
@property
def label(self) -> str:
"""The time range label. Either 'UTC' or 'Local'"""
return self["label"]
@property
def offset_iso(self) ->... |
8,278 | init src | import os
import shutil
import glob
from nbgrader.exchange.abc import ExchangeFetchFeedback as ABCExchangeFetchFeedback
from nbgrader.exchange.default import Exchange
from nbgrader.utils import check_mode, notebook_hash, make_unique_key, get_username
class ExchangeFetchFeedback(Exchange, ABCExchangeFetchFeedback):
... |
8,279 | is any tainted | """
Module detecting dangerous strict equality
"""
from typing import Any, Dict, List, Union
from slither.analyses.data_dependency.data_dependency import is_dependent_ssa
from slither.core.declarations import Function
from slither.core.declarations.function_top_level import FunctionTopLevel
from slither.detectors.... |
8,280 | test inpaint biharmonic 2d color | import numpy as np
from skimage import data, img_as_float
from skimage._shared import testing
from skimage._shared.testing import assert_allclose
from skimage._shared.utils import _supported_float_type
from skimage.color import rgb2gray
from skimage.metrics import mean_squared_error, normalized_root_mse
from skimage.m... |
8,281 | 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... |
8,282 | presented by user | import logging
from venueless.core.permissions import Permission
from venueless.core.services.poster import PosterService
from venueless.live.decorators import command, require_world_permission, room_action
from venueless.live.modules.base import BaseModule
logger = logging.getLogger(__name__)
class PosterModule(Ba... |
8,283 | upload path | import os
from django.conf import settings as django_settings
from django.db import models
from django.db.models import signals
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from wiki import managers
from wiki.decorators import disable_signal_for_loaddata
from wiki... |
8,284 | ket to phase | """
This is a translation of Leo's Martinis Pulses simulation.
For those parts that it pulseshape comes from the waveform module.
"""
import numpy as np
import qutip as qtp
from pycqed.measurement.waveform_control_CC.waveform import \
martinis_flux_pulse
import logging
def METHOD_NAME(states):
"""
Returns... |
8,285 | samples | # Copyright 2017 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... |
8,286 | test should not cut off packages when | # -*- 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... |
8,287 | send warning email at threshold | import os
from datetime import datetime
from unittest.mock import patch
from dimagi.utils.django.email import COMMCARE_MESSAGE_ID_HEADER
from django.core import mail
from corehq.apps.users.event_handlers import handle_email_invite_message
from corehq.apps.users.models import Invitation, InvitationStatus, WebUser, c... |
8,288 | kms key | # 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... |
8,289 | analysis time | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2019.
#
# 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 (at your option... |
8,290 | run left to right | """This demo program solves the steady-state advection equation
div(u0*D) = 0, for a prescribed velocity field u0. An upwind
method is used, which stress-tests both interior and exterior
facet integrals.
"""
import pytest
from firedrake import *
@pytest.fixture(scope='module')
def mesh():
m = UnitIntervalMesh(1... |
8,291 | test task check for updates | """Unit tests for task management."""
import os
from datetime import timedelta
from django.conf import settings
from django.core.management import call_command
from django.db.utils import NotSupportedError
from django.test import TestCase
from django.utils import timezone
from django_q.models import Schedule
from er... |
8,292 | entry changed | '''
conv_slot.py
Copyright (C) 2020, 2021, 2022 Phillip A Carter
Copyright (C) 2020, 2021, 2022 Gregory D Carl
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or
(... |
8,293 | write | import os
from typing import BinaryIO, Optional, Union
import numpy as np
import pyarrow.parquet as pq
from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config
from ..features.features import FeatureType, _visit
from ..formatting import query_table
from ..packaged_modules import _PACKAGED_DATASETS_MO... |
8,294 | get phrase texts | import editdistance # type: ignore
from librelingo_types import Course, Word
from librelingo_utils import (
audio_id,
clean_word,
get_dumb_opaque_id,
iterate_phrases,
remove_control_characters_for_display,
)
from .dictionary import _define_words_in_sentence
def get_listening_challenge(source: Wo... |
8,295 | test os popen4 | #! /usr/bin/env python
"""Test script for popen2.py"""
import warnings
warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*",
DeprecationWarning)
warnings.filterwarnings("ignore", "os\.popen. is deprecated.*",
DeprecationWarning)
import os
import sys
impor... |
8,296 | main | #!/usr/bin/env python3
# Copyright 2018 The Kubernetes 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 appl... |
8,297 | forward | import copy
import os
import torch
import torch.nn as nn
from contextlib import nullcontext
from torch import Tensor
from torch.distributions import Categorical
from typing import Dict, Optional, Tuple
from dataclasses import dataclass
from transformers import AutoModelForMaskedLM, ElectraModel
from transformers.model... |
8,298 | medevac send | #######################################################
#
# core_name_general_controller.py
# Python implementation of the Class CoreNameGeneralController
# Generated by Enterprise Architect
# Created on: 16-Dec-2022 10:56:05 AM
# Original author: Giu Platania
#
##################################################... |
8,299 | set value | # SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
import logging
from pathlib import Path
from typing import Any, Optional
from PySide2 import QtCore
import PyOpenColorIO as ocio
from .config_item_model import ColumnDesc, BaseConfigItemModel
logger = logging.getLogger(__n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.