id int64 0 300k | label stringlengths 1 74 ⌀ | text stringlengths 4k 8k |
|---|---|---|
9,200 | count records | # Copyright (c) 2005-2012 Stephen John Machin, Lingfo Pty Ltd
# This module is part of the xlrd package, which is released under a
# BSD-style licence.
from .info import __VERSION__
import sys, zipfile, pprint
from . import timemachine
from .biffh import (
XLRDError,
biff_text_from_num,
error_text_from_co... |
9,201 | test two args default | # Owner(s): ["oncall: fx"]
import torch
from torch.testing._internal.common_utils import (
TestCase, run_tests)
from torch.fx.experimental.proxy_tensor import make_fx
from torch.fx.passes.dialect.common.cse_pass import CSEPass, get_CSE_banned_ops
from torch.fx import symbolic_trace
import random
banned_ops = g... |
9,202 | is openbsd | """
Functions for identifying which platform a machine is
"""
import multiprocessing
import os
import platform
import subprocess
import sys
import distro
from salt.utils.decorators import memoize as real_memoize
def linux_distribution(full_distribution_name=True):
"""
Simple function to return information ... |
9,203 | map language to code | """base translator class"""
from abc import ABC, abstractmethod
from typing import List, Optional, Union
from deep_translator.constants import GOOGLE_LANGUAGES_TO_CODES
from deep_translator.exceptions import (
InvalidSourceOrTargetLanguage,
LanguageNotSupportedException,
)
class BaseTranslator(ABC):
"""... |
9,204 | init | #! /usr/bin/env python3
import argparse
from pathlib import Path
import shutil
import subprocess
import sys
from armory import __version__ as armory_version
script_dir = Path(__file__).parent
root_dir = script_dir.parent
armory_frameworks = ["armory", "pytorch-deepspeech", "yolo"]
# NOTE: Podman is not officially ... |
9,205 | adjust resource limits | import atexit
import faulthandler
import os
import signal
import sys
import unittest
from test import support
from test.support.os_helper import TESTFN_UNDECODABLE, FS_NONASCII
try:
import gc
except ImportError:
gc = None
from test.libregrtest.utils import (setup_unraisable_hook,
... |
9,206 | client secret | # 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__ ... |
9,207 | test others | '''
Test cases for pyclbr.py
Nick Mathewson
'''
from test.support import run_unittest
import sys
from types import FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase
StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(classmethod(lambda c: None))
# H... |
9,208 | xpath | # Copyright (C) 2023 Sartography
#
# This file is part of SpiffWorkflow.
#
# SpiffWorkflow is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any la... |
9,209 | save config | import re
import os
import sys
from collections import OrderedDict
from spytest import st
class PoeHooks(object):
def get_vars(self, dut, phase=None):
retval = dict()
retval["mgmt_ifname"] = st.get_mgmt_ifname(dut)
retval["mgmt_ipv4"] = st.get_mgmt_ip(dut)
retval["version"] = sel... |
9,210 | breadth | # This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Copyright the Hypothesis Authors.
# Individual contributors are listed in AUTHORS.rst and the git log.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the... |
9,211 | get property |
import copy
import os
import six
import yaml
from collections import Mapping
from geodata.address_expansions.address_dictionaries import address_phrase_dictionaries
from geodata.configs.utils import nested_get, DoesNotExist, recursive_merge, alternative_probabilities
from geodata.math.sampling import cdf, check_prob... |
9,212 | get attr | # 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... |
9,213 | output | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------... |
9,214 | compute am scores and lm scores | import math
from typing import List, Tuple
import torch
try:
import k2
except ImportError or ModuleNotFoundError:
k2 = None
def remove_repeated_and_leq(tokens: List[int], blank_id: int = 0):
"""Generate valid token sequence.
Result may be used as input of transformer decoder and neural language mod... |
9,215 | 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
# --------------------------------... |
9,216 | set low threshold | #!/usr/bin/env python
########################################################################
# DellEMC N3248PXE
#
# Module contains an implementation of SONiC Platform Base API and
# provides the Thermals' information which are available in the platform
#
#############################################################... |
9,217 | test mc2step symm 4o4e | #!/usr/bin/env python
# Copyright 2014-2020 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... |
9,218 | test slotted | """Slot tests
Made for Jython.
"""
from test import test_support
import unittest
# The strict tests fail on PyPy (but work on CPython and Jython).
# They're questionable
strict = True
class SlottedTestCase(unittest.TestCase):
def METHOD_NAME(self):
class Foo(object):
__slots__ = 'bar'
... |
9,219 | on reconnect | # Copyright © 2019 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... |
9,220 | typeof nb type | from collections import namedtuple
from functools import singledispatch
import ctypes
import enum
import numpy as np
from numpy.random.bit_generator import BitGenerator
from numba.core import types, utils, errors
from numba.np import numpy_support
# terminal color markup
_termcolor = errors.termcolor()
class Purp... |
9,221 | test compatible strict optimade field | from typing import Callable, List
import pytest
from pydantic import BaseModel, Field, ValidationError
from optimade.models.utils import OptimadeField, StrictField, SupportLevel
def make_bad_models(field: Callable):
"""Check that models using `field` to replace `Field` provide
appropriate warnings and error... |
9,222 | abstractmethod | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) according to PEP 3119."""
import types
from _weakrefset import WeakSet
# Instance of old-style class
class _C: pass
_InstanceType = type(_C())
def METHOD_NAME(funcobj):
"""A deco... |
9,223 | create dummy report | import contextlib
import os.path
import sys
import traceback
# Encapsulates test result reporting. The interface is probably not optimal,
# but at least it's a start.
#
# The interface is loosely modelled off of python's file API.
class DummyReport:
"""
Can be used in place of TestReport to print results to t... |
9,224 | submit | import os
from . import logfiles
from . import helpers
from . import chunky_parts
from . import workflow
def METHOD_NAME(config):
if config["general"]["verbose"]:
print("\n", 40 * "+ ")
print("Submitting jobscript to batch system...")
print()
print(f"Output written by {config['computer']['bat... |
9,225 | test format output type | from textwrap import dedent
import pytest
from graphql import GraphQLArgument as Argument
from graphql import GraphQLEnumType, GraphQLEnumValue, GraphQLID
from graphql import GraphQLField as Field
from graphql import GraphQLInputField as Input
from graphql import GraphQLInputField as InputField
from graphql import Gra... |
9,226 | handle | # Taken from
# https://github.com/django-extensions/django-extensions/blob/master/django_extensions/management/commands/shell_plus.py
# django_extensions/management/commands/shell_plus.py
# pylint: skip-file
from __future__ import print_function
import os
import time
from django.core.management.base import BaseComma... |
9,227 | test mark absent | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.utils import (
add_days,
add_months,
get_first_day,
get_last_day,
get_year_ending,
get_year_start,
getdate,
nowdate,
)
from erpnext.se... |
9,228 | flip coin | import re
###################
#### CONSTANTS ####
###################
## Change these strings to whatever you choose to name your piles from the XML
deck = "Deck"
discard = "Discard"
## Change this HEX string value to customize the highlight color
highlight = "#ff0000"
# Change this positive integer value to custo... |
9,229 | main | """
An attempt at a user friendly Cart3d GUI
"""
# -*- coding: utf-8 -*-
import sys
import os.path
# kills the program when you hit Cntl+C from the command line
# doesn't save the current state as presumably there's been an error
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
from qtpy import QtCore, QtG... |
9,230 | delete keys from containers | # -*- coding: utf-8 -*-
from contextlib import contextmanager
from datetime import datetime
from os import sep
from typing import Optional, Any, List, Tuple, Union
import dateutil.parser
import deprecation
import logging
from sceptre.exceptions import PathConversionError
from sceptre import __version__
def logging_... |
9,231 | decode special data | ###############################################################
# Copyright 2023 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#
# This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
#
# SPDX-License-Identifier: LGPL-3.0
####... |
9,232 | field | # This file is part of Indico.
# Copyright (C) 2002 - 2023 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.ext.declarative import declared_attr
fro... |
9,233 | set value | # -*- coding: utf-8 -*-
#
# Copyright (c) 2008--2015 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 ... |
9,234 | dump anchor |
# Copyright 2008 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>
# Copyright 2012-2020 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''This modules handles export of LaTeX Code'''
import os
import re
import string
import logging
from zim.newfs import FilePath
from zim.formats import *
from zim.formats.plain imp... |
9,235 | resolve products | from django.db.models import Exists, OuterRef, Sum
from ...channel.models import Channel
from ...order import OrderStatus
from ...order.models import Order
from ...permission.utils import has_one_of_permissions
from ...product import models
from ...product.models import ALL_PRODUCTS_PERMISSIONS
from ..channel import C... |
9,236 | test fixed policy batched on nested observations | # coding=utf-8
# Copyright 2020 The TF-Agents 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 la... |
9,237 | get data module | import json
import math
import random
from functools import partial
from typing import List
import sentencepiece as spm
import torch
import torchaudio
from data_module import LibriSpeechDataModule
from lightning import Batch
_decibel = 2 * 20 * math.log10(torch.iinfo(torch.int16).max)
_gain = pow(10, 0.05 * _decibel... |
9,238 | guess content type | from __future__ import absolute_import
import email.utils
import mimetypes
from .packages import six
def METHOD_NAME(filename, default='application/octet-stream'):
"""
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
:pa... |
9,239 | get historic instrument order from order id | import datetime
from syscore.constants import arg_not_supplied
from sysexecution.orders.named_order_objects import missing_order, no_parent
from sysdata.mongodb.mongo_order_stack import (
mongoInstrumentOrderStackData,
mongoContractOrderStackData,
mongoBrokerOrderStackData,
)
from sysdata.mongodb.mongo_his... |
9,240 | set location | import asyncio
import json
import logging
from homematicip.aio.class_maps import (
TYPE_CLASS_MAP,
TYPE_GROUP_MAP,
TYPE_RULE_MAP,
TYPE_SECURITY_EVENT_MAP,
)
from homematicip.aio.connection import AsyncConnection
from homematicip.aio.securityEvent import AsyncSecurityEvent
from homematicip.base.enums im... |
9,241 | loss | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
9,242 | append | # ../config/cvar.py
"""Provides ConVar functionality in configuration files."""
# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
# Cvars
from cvars import ConVar
# Ho... |
9,243 | poisson residual | import pytest
from firedrake import *
from pyadjoint.tape import get_working_tape, pause_annotation
try:
from firedrake.ml.pytorch import *
import torch
import torch.nn.functional as torch_func
from torch.nn import Module, Flatten, Linear
class EncoderDecoder(Module):
"""Build a simple t... |
9,244 | fixed pooling monotonic attention | from functools import partial
import torch
from torch import Tensor
import math
import torch.nn.functional as F
from . import register_monotonic_attention
from .monotonic_multihead_attention import (
MonotonicAttention,
MonotonicInfiniteLookbackAttention,
WaitKAttention
)
from typing import Dict, Optional... |
9,245 | find server exp | from abc import ABC, abstractmethod
from asyncio import Lock
from io import BytesIO
from logging import Logger
from typing import List
from aiohttp import ClientSession
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
from redbot.core import Config, commands
from redbot.core.bot import Red
cl... |
9,246 | test should be able to click element | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
9,247 | test valid split sms to with extra | from functools import cached_property
from urllib.parse import parse_qs
import responses
from sentry.models import Rule
from sentry.plugins.base import Notification
from sentry.testutils.cases import PluginTestCase, TestCase
from sentry_plugins.twilio.plugin import TwilioConfigurationForm, TwilioPlugin, split_sms_to
... |
9,248 | test right option is selected on language | # encoding: utf-8
import pytest
from ckan.lib.helpers import url_for
from bs4 import BeautifulSoup
from ckan.tests import factories
class TestHome(object):
def test_home_renders(self, app):
response = app.get(url_for("home.index"))
assert "Welcome to CKAN" in response.body
@pytest.mark.usef... |
9,249 | distance indicators | """
BDS test for IID time series
References
----------
Broock, W. A., J. A. Scheinkman, W. D. Dechert, and B. LeBaron. 1996.
"A Test for Independence Based on the Correlation Dimension."
Econometric Reviews 15 (3): 197-235.
Kanzler, Ludwig. 1999.
"Very Fast and Correctly Sized Estimation of the BDS Statistic".
SSRN ... |
9,250 | test should set scripts sources property | # -*- 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... |
9,251 | add plugin | import warnings
from cms.api import METHOD_NAME
from cms.utils.permissions import get_current_user
from cms.wizards.wizard_base import Wizard
from cms.wizards.wizard_pool import AlreadyRegisteredException, wizard_pool
from django import forms
from django.conf import settings
from django.utils.translation import gettex... |
9,252 | test can change images | # Copyright 2013 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
import os
from io import BytesIO
f... |
9,253 | test check on clean dataset | # ----------------------------------------------------------------------------
# Copyright (C) 2021-2023 Deepchecks (https://www.deepchecks.com)
#
# This file is part of Deepchecks.
# Deepchecks is distributed under the terms of the GNU Affero General
# Public License (version 3 or later).
# You should have received a ... |
9,254 | printed assert equal | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import re
import os
import warnings
import platform
import unittest
import inspect
import contextlib
from pathlib import Path
import typing ... |
9,255 | etcd client mock | """
Test case for the etcd SDB module
"""
import logging
import pytest
import salt.sdb.etcd_db as etcd_db
import salt.utils.etcd_util as etcd_util
from tests.support.mock import MagicMock, create_autospec, patch
log = logging.getLogger(__name__)
@pytest.fixture
def configure_loader_modules():
return {
... |
9,256 | get form kwargs | # Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations
from django.core.exceptions import PermissionDenied
from django.forms import inlineformset_factory
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import redirec... |
9,257 | pytest cmdline main | import asyncio
import gc
import logging
import platform
import sys
from datetime import datetime
from typing import Optional
import human_readable
import pytest
from _pytest.config import Config
from _pytest.python import Function
from aiohttp.web_app import Application
from tribler.core.components.restapi.rest.rest_... |
9,258 | test image processor from dict with kwargs | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
9,259 | real extract | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
)
class TV4IE(InfoExtractor):
IE_DESC = 'tv4.se and tv4play.se'
_VALID_URL = r'''(?x)https?://(?:www\.)?
(?:
tv4\.se/(?:[^/]+)/kli... |
9,260 | parse args | #!/usr/bin/env python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""
Script to scan Zephyr include directories and emit system call and subsystem metadata
System calls require a great deal of boilerplate code in order to implement
completely. This script is the first step in the... |
9,261 | test pretty print with full us phone | # These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/phone-number/canonical-data.json
# File last updated on 2023-07-19
import unittest
from phone_number import (
PhoneNumber,
)
class PhoneNumberTest(unittest.TestCase):
def test_clean... |
9,262 | id | # coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__all__ ... |
9,263 | has set active index | #
# auto-pts - The Bluetooth PTS Automation Framework
#
# Copyright (c) 2023, Oticon.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed... |
9,264 | tear down | #
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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... |
9,265 | generate unix entry | from __future__ import annotations
import logging
import re
from base64 import b64decode
from contextlib import suppress
from pathlib import Path
from tempfile import NamedTemporaryFile
from docker.types import Mount
from analysis.PluginBase import AnalysisBasePlugin
from helperFunctions.docker import run_docker_con... |
9,266 | test api key live mode | from copy import deepcopy
from unittest.mock import patch
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from djstripe import models
from djstripe.enums import APIKeyType
from djstripe.settings import djstripe_settings
from . import FAKE_ACCOUNT, FAK... |
9,267 | get boot2docker status | # Copyright 2015 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... |
9,268 | test vert pol | #!/usr/bin/env python
# coding: utf-8
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2015-2018 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# Permission is hereby granted, fr... |
9,269 | get default prefix | # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
class PosConfig(models.Model):
_inherit = "pos.config"
@api.depends(
"l10n_es_simplified_invoice_sequence_id.number_next_actual",
"l10n_es_simplified_invoice_sequence_id.prefix",
... |
9,270 | test query | """
:codeauthor: Rahul Handay <rahulha@saltstack.com>
"""
import pytest
import salt.states.http as http
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {http: {}}
def METHOD_NAME():
"""
Test to perform an HTTP query and statefully return the r... |
9,271 | get subset name | """Create workflow moved from avalon-core repository.
Renamed classes and functions
- 'Creator' -> 'LegacyCreator'
- 'create' -> 'legacy_create'
"""
import os
import logging
import collections
from openpype.client import get_asset_by_id
from .subset_name import METHOD_NAME
class LegacyCreator(object):
"""Det... |
9,272 | wipe | import time
from contextlib import contextmanager
import numpy
import pytest
import stbt_core as stbt
def test_motionresult_repr():
assert repr(stbt.MotionResult(
time=1466002032.335607, motion=True,
region=stbt.Region(x=321, y=32, right=334, bottom=42),
frame=stbt.Frame(numpy.zeros((720... |
9,273 | test split token to subtokens | # Copyright 2018 MLBenchmark Group. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
9,274 | test iter2 | # Copyright (c) 2021 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... |
9,275 | 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... |
9,276 | add weight | """Defines common layers."""
import tensorflow as tf
from opennmt.utils.misc import shape_list
def dropout(x, rate, training=None):
"""Simple dropout layer."""
if not training or rate == 0:
return x
return tf.nn.dropout(x, rate)
def gelu(x):
"""Gaussian Error Linear Unit activation functio... |
9,277 | unregister | # 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... |
9,278 | create subscription in enrollment account initial | # 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 ... |
9,279 | build command | import subprocess
from unittest.mock import MagicMock, call
import pytest
from briefcase.console import Console, Log
from briefcase.exceptions import BriefcaseCommandError
from briefcase.platforms.linux.system import LinuxSystemBuildCommand
@pytest.fixture
def METHOD_NAME(tmp_path, first_app):
command = LinuxSy... |
9,280 | close | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
9,281 | test broken basepath removal | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: © 2004 Tristan Seligmann and Jonathan Jacobs
# SPDX-FileCopyrightText: © 2012 Bastian Kleineidam
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
import json
import os
import re
import pytest
import responses
import dosagelib.cmd
import httpmocks
def cmd(... |
9,282 | 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... |
9,283 | main | #!/usr/bin/env python3
import find_clang
import sys
import clang.cindex
import time
import os
structs = []
extrastructs = []
def valid_spelling(spelling):
return spelling and not spelling.startswith("(")
def build_struct(cursor, anonymousUnion=False):
if not anonymousUnion:
structs.append(cursor.sp... |
9,284 | test clshxma | from pathlib import Path
from larch.io import read_ascii, guess_beamline, guess_filereader, read_fdmnes
base_dir = Path(__file__).parent.parent.resolve()
def _tester(fname, return_group=False):
fname = base_dir / 'examples' / 'xafsdata' / 'beamlines' / fname
group = read_ascii(fname)
cls = guess_beamline... |
9,285 | test profile has builtin blacklist | #
# Copyright (c) 2016 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0
from unittest import mock
import testtools
from stevedore import extension
from bandit.blacklists import utils
from bandit.core import extension_loader
from bandit.core import issue
from bandit.core import test_pr... |
9,286 | test get segment to oid mapping with | from mock import *
from .gp_unittest import *
from gpcheckcat_modules.repair_missing_extraneous import RepairMissingExtraneous
class RepairMissingExtraneousTestCase(GpTestCase):
def setUp(self):
self.all_seg_ids = [-1,0,1,2,3]
self.table_name = 'pg_attribut"e'
self.catalog_table_obj = Mock... |
9,287 | test missing config | # 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... |
9,288 | test tno at lon lat | # 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
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Unit tests for the quality assurance
Level classes.
"""
import pytest
from flowmachine.core import make_spatial_u... |
9,289 | strip | # 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... |
9,290 | test adversarial trainer fbf pytorch fit and | # MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# r... |
9,291 | restore tilt configurations | from app.models import BrewPiDevice, Beer, FermentationProfile
from gravity.models import GravitySensor, GravityLog, TiltTempCalibrationPoint, TiltGravityCalibrationPoint, \
TiltConfiguration, TiltBridge, IspindelConfiguration, IspindelGravityCalibrationPoint
from constance import config
def restore_brewpi_device... |
9,292 | test read coinc eventtable | # -*- coding: utf-8 -*-
# Copyright (C) California Institute of Technology (2022)
#
# This file is part of GWpy.
#
# GWpy 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
# (... |
9,293 | test pyunit skip | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
import sys
import traceback
import unittest as pyunit
from unittest import skipIf
from zope.interface import implementer
from twisted.python.failure import Failure
from twisted.trial.itrial import IReporter, ITestCase
from twisted.trial.test im... |
9,294 | ttest finish | # Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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 a... |
9,295 | location | # 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... |
9,296 | get logging health | # -*- coding: utf-8 -*-
# FLEDGE_BEGIN
# See: http://fledge-iot.readthedocs.io/
# FLEDGE_END
import asyncio
import json
from aiohttp import web
from fledge.common.common import _FLEDGE_DATA, _FLEDGE_ROOT
from fledge.common.logger import FLCoreLogger
__author__ = "Deepanshu Yadav"
__copyright__ = "Copyright (c) 202... |
9,297 | kind | # 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... |
9,298 | is agent enabled | """
For Dynatrace, we have two different ingestion methods:
1. via Dynatrace OneAgent. It's being downloaded and injected to the java
runtime.
2. via telegraf. Telegraf ingests custom runtime metrics using Dynatrace
output plugin
"""
import logging
import os
import json
from functools import lru_cache
from urllib.parse... |
9,299 | batch predict | # Copyright (c) 2021 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.