code stringlengths 1 199k |
|---|
"""Benchmarks collected/inspired from StackOverflow."""
import math
import tensorflow as tf
from tf_coder.benchmarks import benchmark
def stackoverflow_01():
examples = [
benchmark.Example(
inputs=[
[[5., 2.], [1., 3.], [0., -1.]],
],
output=[[[5., 5.], [1., 1.], [0.,... |
'''
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 use this ... |
"""
This is the Registry's Driver API.
This API relies on the registry RPC client (version >= 2). The functions bellow
work as a proxy for the database back-end configured in the registry service,
which means that everything returned by that back-end will be also returned by
this API.
This API exists for supporting dep... |
import sys
import types
import unittest
from com.xhaus.jyson import *
def compareObjectToDict(d, o):
for k in d.keys():
if not (o.has_key(k) and d[k] == o[k]):
raise AssertionError("o is missing key '%s'(%s)" % (k, str(type(k))))
for k in o.keys():
if not (d.has_key(k) and d[k] == o[k]):
raise AssertionErro... |
import logging
import hashlib
import unittest
import os
import random
from common.hash import md5sum, sha1sum, sha224sum, sha256sum, sha384sum, \
sha512sum
from tempfile import TemporaryFile
def enable_logging(level=logging.INFO, handler=None, formatter=None):
global log
log = logging.getLogger()
if for... |
'''
ExpSettingsVal -
Validates Experimental Settings against a set of rules known to cause
the Compiler (Compiler.py) to fail if they are not followed
Created on April 17, 2015
Original Author: Brian Donovan
Copyright 2015 Raytheon BBN Technologies
Licensed under the Apache License, Version 2.0 (the "License");
you may... |
"""Lookup AMI ID from a simple name."""
import json
import logging
import os
from base64 import b64decode
import gitlab
import requests
from ..consts import AMI_JSON_URL, GIT_URL, GITLAB_TOKEN
from ..exceptions import GitLabApiError
from .warn_user import warn_user
LOG = logging.getLogger(__name__)
def ami_lookup(regio... |
from application.extensions import db
from configs.enum import USER_ROLE
__all__ = ['BackendPermission', 'Role']
class BackendPermission(db.Document):
meta = {
'indexes': ['name'],
}
name = db.StringField(required=True, unique=True)
roles = db.ListField(db.ReferenceField('Role'))
class Role(db.D... |
"""Tests application-provided metadata, status code, and details."""
import threading
import unittest
import grpc
from tests.unit import test_common
from tests.unit.framework.common import test_constants
from tests.unit.framework.common import test_control
_SERIALIZED_REQUEST = b'\x46\x47\x48'
_SERIALIZED_RESPONSE = b'... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import tinymce.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
fields=[... |
import logging
from novaclient import exceptions as nova_exc
from cloudferry.lib.base.action import action
from cloudferry.lib.base import exception
from cloudferry.lib.utils import utils
LOG = logging.getLogger(__name__)
class CheckPointVm(action.Action):
def run(self, info, **kwargs):
src_compute = self.s... |
import tensorflow as tf
import numpy as np
import os
import sys
from datetime import datetime
from tensorflow.python.ops import data_flow_ops
import nets
import models
from utils import lines_from_file
from datasets import sample_videos, input_pipeline
num_frames = 10
train_folder = "/home/aiteam/quan/datasets/ucf101/t... |
from tastypie.resources import ModelResource
from {{ project_name }}.models import * |
import collections
import contextlib
import datetime
import mock
from neutron_lib.api.definitions import portbindings
from neutron_lib import constants
from neutron_lib import context as n_context
from neutron_lib.exceptions import l3 as l3_exc
from neutron_lib.plugins import constants as plugin_constants
from neutron_... |
from typing import TYPE_CHECKING
from ...file_utils import (
_LazyModule,
is_flax_available,
is_sentencepiece_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
_import_structure = {
"configuration_t5": ["T5_PRETRAINED_CONFIG_ARCHIVE_MAP", "T5Config", "T5OnnxConfig"],... |
import os
from keystoneclient.v2_0 import client
def get_os_env(env):
value = os.environ.get(env)
if not value:
raise SystemExit('[ERROR] Require %s but not found in os '
'environment, please export it' % env)
return value
def get_keystone_client():
user_name = get_os_en... |
"""
:codeauthor: Gareth J. Greenaway <ggreenaway@vmware.com>
"""
import os
import pytest
import salt.modules.pkg_resource as pkg_resource
import salt.modules.zypperpkg as zypper
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {zypper: {"rpm": None}, pkg_res... |
import warnings
from boto import cloudformation
from monocyte.handler import Resource, Handler
class Stack(Handler):
VALID_TARGET_STATES = ["DELETE_COMPLETE", "DELETE_IN_PROGRESS"]
def fetch_region_names(self):
return [region.name for region in cloudformation.regions()]
def fetch_unwanted_resources(... |
"""State management for eager execution."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import copy
import random
import threading
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf import re... |
"""Tests for /query api endpoint."""
from sqlalchemy import func
from flask import json
from ddt import ddt
from ddt import data
from ggrc import app
from ggrc import views
from ggrc import models
from ggrc import db
from integration.ggrc import TestCase
from integration.ggrc.models import factories
@ddt
class TestAudi... |
import errno
import socket
from hazelcast.serialization.bits import *
SIZE_OF_FRAME_LENGTH_AND_FLAGS = INT_SIZE_IN_BYTES + SHORT_SIZE_IN_BYTES
_MESSAGE_TYPE_OFFSET = 0
_CORRELATION_ID_OFFSET = _MESSAGE_TYPE_OFFSET + INT_SIZE_IN_BYTES
_RESPONSE_BACKUP_ACKS_OFFSET = _CORRELATION_ID_OFFSET + LONG_SIZE_IN_BYTES
_PARTITION_... |
import pika
import time
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='task_queue', durable=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
def callback(ch, method, properties, body):
print(" [x] R... |
from neutron.common import constants
from neutron.openstack.common import log
from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers import mech_agent
from neutron import context as ctx
from neutron import manager
from calico.openstack.t_etcd import CalicoTransportEtcd
LOG = log.getLogger(__... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
import logging
from datetime import datetime
import humanize
from tabulate import tabulate
from injector import inject, singleton
from midonet_sandbox.assets.assets import Assets
from midonet_sandbox.configuration import Config
from midonet_sandbox.logic.builder import Builder
from midonet_sandbox.logic.composer import... |
from __future__ import absolute_import, division, print_function
import logging
from utils import *
from poly import *
schedule_logger = logging.getLogger("schedule.py")
schedule_logger.setLevel(logging.INFO)
LOG = schedule_logger.log
def naive_sched_objs(order):
# get a reverse map for the object order map
rev... |
from builtins import str
import requests
import tenacity
from airflow.hooks.base_hook import BaseHook
from airflow.exceptions import AirflowException
class HttpHook(BaseHook):
"""
Interact with HTTP servers.
:param http_conn_id: connection that has the base API url i.e https://www.google.com/
and op... |
from caldavclientlibrary.protocol.http.session import Session
from caldavclientlibrary.protocol.webdav.head import Head
import unittest
class TestRequest(unittest.TestCase):
def test_Method(self):
server = Session("www.example.com")
request = Head(server, "/")
self.assertEqual(request.getMet... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
from ray.rllib.utils.annotations import DeveloperAPI
from ray.rllib.evaluation.metrics import collect_episodes, summarize_episodes
logger = logging.getLogger(__name__)
@DeveloperAPI
class PolicyOp... |
import copy
from distutils import spawn
import math
import os
import sys
import daiquiri
from oslo_config import cfg
from oslo_policy import opts as policy_opts
from gnocchi import opts
from gnocchi.rest import app
from gnocchi import service
from gnocchi import utils
LOG = daiquiri.getLogger(__name__)
def prepare_serv... |
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine import properties
from heat.engine import resource
from heat.engine import software_config_io as swc_io
from heat.engine import support
from heat.rpc import api as rpc_api
class SoftwareConfig(resource.Resource):
"""A resource for de... |
from flask.signals import got_request_exception
from flask.ext.restful import Api
class APIController(Api):
def handle_error(self, e):
"""
Almost identical to Flask-Restful's handle_error, but fixes some minor
issues.
Specifically, this fixes exceptions so they get propagated correct... |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple
from google.api_core import grpc_helpers # type: ignore
from google.api_core import gapic_v1 # type: ignore
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.g... |
import sys
import os
import psycopg2
import xml.etree.ElementTree as ET
from lxml import etree
import math
from collections import Counter
from operator import itemgetter
import datetime
import collections
import datetime
import io
import math
def parse_xml(afile, out_dir):
parser = etree.XMLParser(ns_clean=True, reco... |
from oslo_config import cfg
from jacket.tests.compute.functional.api_sample_tests import api_sample_base
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'compute.api.openstack.compute.legacy_v2.extensions')
class UsedLimitsSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API =... |
class InvalidUrlException(Exception):
def __init__(self, message=None, action=None):
if not message:
message = ''
if not action:
action = ''
self.message = message
self.action = action
class ExpiredUrlException(InvalidUrlException):
pass
class AlreadyUsedU... |
from vitrage.common.constants import DatasourceProperties as DSProps
from vitrage.common.constants import EdgeLabel
from vitrage.common.constants import EntityCategory
from vitrage.common.constants import VertexProperties as VProps
from vitrage.datasources.alarm_transformer_base import AlarmTransformerBase
from vitrage... |
from .predictor import TopiaryPredictor
from .sequence_helpers import (
check_padding_around_mutation,
peptide_mutation_interval,
contains_mutant_residues,
protein_subsequences_around_mutations,
)
__version__ = '3.0.6'
__all__ = [
"TopiaryPredictor",
"contains_mutant_residues",
"check_paddin... |
"""Test a driver by itself.
"""
import sys
import os
import os.path
from optparse import OptionParser
import json
from itertools import ifilter
import fixup_python_path
import engage.utils.log_setup as log_setup
from engage.engine.engage_file_layout import get_engine_layout_mgr
from engage.engine.library import parse_l... |
import itertools
import json
import re
import sys
import time
import html2text
import requests
from pyquery import PyQuery as pq
def RateLimited(maxPerSecond):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
lastTimeCalled = [0.0]
def rateLimitedFunction(*args, **kargs):
... |
"""
@version: v1.0
@author: jayzhen
@license: Apache Licence
@contact: jayzhen_testing@163.com
@site: http://blog.csdn.net/u013948858
@software: PyCharm
"""
import os
import platform
import re
import subprocess
import sys
import time
import string
import EventKeys
import json
reload(sys)
sys.setdefaultencoding('utf8')
... |
import os
import logging
import CsHelper
from CsFile import CsFile
from CsProcess import CsProcess
from CsApp import CsPasswdSvc
from CsAddress import CsDevice
from CsRoute import CsRoute
from CsStaticRoutes import CsStaticRoutes
import socket
from time import sleep
class CsRedundant(object):
CS_RAMDISK_DIR = "/ram... |
import os
import os.path
def checkConfigFile(path):
if not os.path.isfile(path):
print "Config file not found"
def get_first_broker(brokers):
return brokers.split(",")[0].split(":")[0]
def getMissingEnvVar():
error_msg = "\nThe following env variable are not set :\n"
if not os.getenv('KAFKA_HOME... |
"""
mbed SDK
Copyright (c) 2011-2014 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
import StringIO
import mock
from glance.store._drivers import gridfs as gfs
from glance.store.tests import base
try:
import gridfs
import pymongo
except ImportError:
pymongo = None
GRIDFS_CONF = {'mongodb_store_uri': 'mongodb://fake_store_uri',
'mongodb_store_db': 'fake_store_db'}
class FakeM... |
import diventi.accounts.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0151_auto_20190521_0731'),
]
operations = [
migrations.AlterModelManagers(
name='diventiuser',
managers=[
('objects', ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abstractproperty
import six
from pants.backend.jvm.targets.jar_library import JarLibrary
from pants.base.address_lookup_error import AddressLookupError
... |
"""
Starting point for routing EC2 requests.
"""
import webob
import webob.dec
import webob.exc
from nova import context
from nova import exception
from nova import flags
from nova import log as logging
from nova import utils
from nova import wsgi
from nova.api.ec2 import apirequest
from nova.api.ec2 import ec2utils
fr... |
from oslo_config import cfg
from oslo_log import log as logging
from vitrage.common.constants import DatasourceProperties as DSProps
from vitrage.common.constants import EdgeLabel
from vitrage.common.constants import EntityCategory
from vitrage.common.constants import VertexProperties as VProps
from vitrage.datasources... |
"""Tests for tf_agents.policies.eager_tf_policy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from tf_agents.agents.ddpg import actor_network
from tf_agents.envi... |
"""
Local data handler, used for testing.
In production, one would use a data server like the one here: https://github.com/neutrons/live_data_server
"""
from __future__ import unicode_literals
from django.db import models
class Instrument(models.Model):
"""
Table of instruments
"""
name = mo... |
from flask import Flask, current_app, request, jsonify
import io
import base64
import logging
import numpy as np
import cv2
from service import model
def create_app(config, debug=False, testing=False, config_overrides=None):
app = Flask(__name__)
app.config.from_object(config)
if config_overrides:
a... |
import HeeksPython as cad
cad.sketch()
sketch = cad.getlastobj()
cad.line(0,1,4,1)
l1= cad.getlastobj()
cad.line(4,1,4,2)
l2= cad.getlastobj()
cad.line(4,2,0,2)
l3= cad.getlastobj()
cad.line(0,2,0,1)
l4= cad.getlastobj()
cad.add(sketch,l1)
cad.add(sketch,l2)
cad.add(sketch,l3)
cad.add(sketch, l4)
cad.reorder(sketch)
ca... |
from rest_framework import status as http_status
from flask import request
from django.core.exceptions import ValidationError
from django.utils import timezone
from framework import forms, status
from framework.auth import cas
from framework.auth.core import get_user, generate_verification_key
from framework.auth.decor... |
import pickle
try:
from unittest import mock
except ImportError: # pragma: NO PY3 COVER
import mock
import pytest
import six
from google.cloud.datastore import entity as datastore_entity
from google.cloud.datastore import helpers
from google.cloud.ndb import _datastore_api
from google.cloud.ndb import _datasto... |
from iptest.assert_util import *
skiptest("silverlight")
skiptest("win32")
from time import sleep
import sys
import re
from System.Diagnostics import Process, ProcessWindowStyle
from System.IO import File
import clr
sys.exit(0)
if is_peverify_run:
AddReferenceToDlrCore()
clr.AddReference("Microsoft.Script... |
from oslo_db import exception as db_exception
from manila import context
from manila.db import api as db_api
from manila import exception
from manila import test
security_service_dict = {
'id': 'fake id',
'project_id': 'fake project',
'type': 'ldap',
'dns_ip': 'fake dns',
'server': 'fake ldap server... |
from collections import defaultdict
class FlagRegistry:
def __init__(self):
self.r = defaultdict(list)
def register(self, flag, depends_on=0, key=None):
"""
optional methods must register their flag with the FlagRegistry.
The registry:
- stores the flags relevant to e... |
from google.cloud import compute_v1
def create_with_additional_disk(project_id: str, zone: str, instance_name: str) -> compute_v1.Instance:
"""
Create a new VM instance with Debian 10 operating system on a 20 GB disk
and a 25 GB additional empty disk.
Args:
project_id: project ID or project numb... |
"""empty message
Revision ID: 77a82201a8cf
Revises: None
Create Date: 2016-08-22 13:38:24.727824
"""
revision = '77a82201a8cf'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.d... |
import logging
import re
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.http import Http404
from django.utils.translation import ugettext as _
from thrift.transport.TTransport import TTransportException
from desktop.context_processors import get_app_name
from deskto... |
import json
import requests
from app.models import Setting
def shodan(indicator):
try:
settings = Setting.query.filter_by(_id=1).first()
apikey = settings.shodankey
url = "https://api.shodan.io/shodan/host/"
ip = indicator
tempdict = {}
r = requests.get(url + ip + "?k... |
import time
import logging
from threading import Thread
from AWSIoTPythonSDK.core.protocol.internal.events import EventTypes
from AWSIoTPythonSDK.core.protocol.internal.events import FixedEventMids
from AWSIoTPythonSDK.core.protocol.internal.clients import ClientStatus
from AWSIoTPythonSDK.core.protocol.internal.queues... |
"""Input Field Models Testing""" |
import collections
from hashlib import sha1
import hmac
import json
import os
import time
import six
from six.moves.urllib import parse
from openstack.object_store.v1 import account as _account
from openstack.object_store.v1 import container as _container
from openstack.object_store.v1 import obj as _obj
from openstack... |
import json
from flask.ext.restful import Resource, request
from flask import Response
from openeye.oechem import *
from openeye.oedepict import *
from openeye.oegrapheme import *
from openeye.oedocking import *
from oemicroservices.resources.depict.base import depictor_base_arg_parser
from oemicroservices.common.funct... |
import collections
import datetime
import logging
import os
import shutil
from datetime import timedelta
from tempfile import mkdtemp
from typing import Deque, Generator, Optional
from unittest import mock
from unittest.mock import MagicMock, patch
import psutil
import pytest
from freezegun import freeze_time
from sqla... |
from sparktk.loggers import log_load; log_load(__name__); del log_load
from sparktk.propobj import PropertiesObject
from sparktk import TkContext
__all__ = ["train", "load", "PcaModel"]
def train(frame, columns, mean_centered=True, k=None):
"""
Creates a PcaModel by training on the given frame
Parameters
... |
"""
Copyright (C) 2013-2018 Calliope contributors listed in AUTHORS.
Licensed under the Apache 2.0 License (see LICENSE file).
"""
from copy import deepcopy
import functools
import importlib
import operator
import os
import sys
def get_from_dict(data_dict, map_list):
return functools.reduce(operator.getitem, map_li... |
from random import randrange
import random
from model.group import Group
def test_delete_some_group(app, db, check_ui):
if len(db.get_group_list()):
app.group.create(Group(name="test"))
old_groups = db.get_group_list()
group = random.choice(old_groups)
app.group.delete_group_by_id(group.id)
... |
"""The main point for importing pytest-asyncio items."""
from ._version import version as __version__ # noqa
from .plugin import fixture
__all__ = ("fixture",) |
import argparse
import sys
from ros_buildfarm.argument import add_argument_arch
from ros_buildfarm.argument import add_argument_build_name
from ros_buildfarm.argument import add_argument_config_url
from ros_buildfarm.argument import add_argument_dry_run
from ros_buildfarm.argument import add_argument_os_code_name
from ... |
"""Summary reporting"""
import sys
from coverage.report import Reporter
from coverage.results import Numbers
from coverage.misc import NotPython, CoverageException
class SummaryReporter(Reporter):
"""A reporter for writing the summary report."""
def __init__(self, coverage, config):
super(SummaryReporte... |
"""必要的工具函数"""
from numpy import *
from numpy import linalg as la
from math import log
def pear_sim(c_a, c_b):
"""皮尔逊相关系数计算相似度
Args:
c_a: 列(行)向量a
c_b: 列(行)向量b
Return:
c_a与c_b之间的相似度
"""
if len(c_a) < 3: return 1.0
# corrcoef返回的数值范围为-1~1,通过0.5+0.5×corrcoef归一化到0~1范围
retur... |
"""
Copyright 2012 GroupDocs.
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 writ... |
import unittest
from framework.lwm2m.tlv import TLV
from framework.lwm2m_test import *
TEST_OBJECT_OID = 1337
TEST_OBJECT_RES_BYTES = 5
TEST_OBJECT_RES_BYTES_SIZE = 6
TEST_OBJECT_RES_BYTES_BURST = 7
class BlockResponseTest(test_suite.Lwm2mSingleServerTest):
def setUp(self, bytes_size=9001, extra_cmdline_args=None):... |
"""Run-time objects."""
try:
import __builtin__ as builtins
except ImportError:
import builtins
import keyword
import sys
from dtfabric import data_types
from dtfabric import definitions
class StructureValuesClassFactory(object):
"""Structure values class factory."""
_CLASS_TEMPLATE = '\n'.join([
'class {... |
import argparse
import logging
import uuid
from typing import List
from rasa import telemetry
from rasa.cli import SubParsersAction
from rasa.cli.arguments import shell as arguments
from rasa.engine.storage.local_model_storage import LocalModelStorage
from rasa.model import get_latest_model
from rasa.shared.importers.a... |
"""Layer utilities.
[1]: Zhiyun Lu, Eugene Ie, Fei Sha. Uncertainty Estimation with Infinitesimal
Jackknife. _arXiv preprint arXiv:2006.07584_, 2020.
https://arxiv.org/abs/2006.07584
"""
import functools
import random
import numpy as np
import tensorflow as tf
import tensorflow.compat.v1 as tf1
try:
from s... |
"""
:codeauthor: Nicole Thomas <nicole@saltstack.com>
"""
import logging
import os
import pytest # pylint: disable=unused-import
import salt.exceptions
import salt.state
import salt.utils.files
import salt.utils.platform
log = logging.getLogger(__name__)
@pytest.fixture
def root_dir(tmp_path):
return str(tmp_p... |
import json
import logging
import sys
import time
import traceback
from typing import TYPE_CHECKING, Callable, List, Union
from uuid import uuid4
from opentracing import Format, Span, logs, tags
from prometheus_client import Counter, Gauge, Histogram
from twisted.internet.defer import ensureDeferred
from twisted.web im... |
"""
Classes for preprocessing input data in various contexts.
:author: Jeremy Biggs (jbiggs@ets.org)
:author: Anastassia Loukina (aloukina@ets.org)
:author: Nitin Madnani (nmadnani@ets.org)
:organization: ETS
"""
import logging
import re
import numpy as np
import pandas as pd
from numpy.random import RandomState
from .... |
r"""Electronic Voting Example.
In this example we use DeepSets to estimate the winner of an election.
Each vote is represented by a one-hot encoded vector.
It goes without saying, but don't use this in a real election!
Seriously, don't!
"""
import collections
import logging
import random
from absl import app
import hai... |
'''
Copyright 2014 eBay Software Foundation
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, s... |
import copy
import datetime
import mock
import novaclient.exceptions
import novaclient.v2.servers as novaclient_servers
from searchlight.elasticsearch.plugins.nova import\
servers as servers_plugin
import searchlight.tests.unit.utils as unit_test_utils
import searchlight.tests.utils as test_utils
USER1 = u'27f4d76b... |
from google.cloud import aiplatform_v1beta1
async def sample_list_datasets():
# Create a client
client = aiplatform_v1beta1.DatasetServiceAsyncClient()
# Initialize request argument(s)
request = aiplatform_v1beta1.ListDatasetsRequest(
parent="parent_value",
)
# Make the request
page_... |
"""
PyKerberos Function Description.
"""
class KrbError(Exception):
pass
class BasicAuthError(KrbError):
pass
class GSSError(KrbError):
pass
def checkPassword(user, pswd, service, default_realm):
"""
This function provides a simple way to verify that a user name and password match
those normally... |
import numpy as np
import sys
import gc
import pytest
import xgboost as xgb
from hypothesis import given, strategies, assume, settings, note
sys.path.append("tests/python")
import testing as tm
import test_updaters as test_up
parameter_strategy = strategies.fixed_dictionaries({
'max_depth': strategies.integers(0, 1... |
import foobar
if __name__ == "__main__":
foobar.Foobar() |
import sys
sys.path.append("/Users/mac/Desktop/project/")
import numpy as np
import learning.modules.regression.mvln_regression as mvlnreg
import matplotlib.pyplot as plt
nbr_ligne= 0
i=0
with open("ex1data1.txt","r") as mon_fichier:
contenu = mon_fichier.read()
mes_lignes=contenu.split("\n")
X = np.zeros(shape = (l... |
"""
Permissions for Django Rest Framework and other permission classes.
"""
from rest_framework import permissions
class IsAuthorOrReadOnly(permissions.BasePermission):
"""
Object-level permission to allow only owners of an object to edit.
Note, this permission assumes there is an `author` attribute on the
... |
import sys
import os
from Pegasus.DAX3 import *
if len(sys.argv) != 2:
print "Usage: %s PEGASUS_BIN" % (sys.argv[0])
sys.exit(1)
diamond = ADAG("diamond")
diamond.metadata("name", "diamond")
diamond.metadata("createdby", "Karan Vahi")
a = File("f.a")
keg = PFN("file://" + sys.argv[1] + "/pegasus-keg", "... |
from wm_follow.srv import *
import rospy
from math import *
import tf.transformations
import time
import actionlib
from people_msgs.msg import *
from move_base_msgs.msg import *
MOVING_DISTANCE = 1.0;
class Person:
def __init__(self):
self.found = False
self.X = 0
self.Y = 0
class Follower:
... |
"""
A factory function that returns the stubber for an AWS service, based on the
name of the service that is used by Boto 3.
This factory is used by the make_stubber fixture found in the set of common fixtures.
"""
from test_tools.acm_stubber import AcmStubber
from test_tools.apigateway_stubber import ApiGatewayStubber... |
"""Tests for classification of NonnegativeInts."""
__author__ = 'Sean Lip'
from core.tests import test_utils
from extensions.rules import nonnegative_int
class NonnegativeIntUnitTests(test_utils.GenericTestBase):
"""Tests for rules operating on NonnegativeInt objects."""
def test_equals_rule(self):
self... |
from __future__ import print_function, division, absolute_import
import os
import argparse
import random
import numpy as np
import torch
import torch.backends.cudnn as cudnn
cudnn.benchmark = True
from sklearn.datasets import load_svmlight_file
from scipy.sparse import csr_matrix
import matplotlib
matplotlib.use("Agg")... |
from django.contrib import admin
from .models import Kisaaja
from .models import Kilpailu
from .models import Laji
from .models import LajiPisteet
admin.site.register(Kisaaja)
admin.site.register(Kilpailu)
admin.site.register(Laji)
admin.site.register(LajiPisteet) |
from __future__ import unicode_literals
from .strings import stringify, stringify_list
from ..contexts import current_context
from glob2 import glob as glob2
import os
def join_path(*segments):
"""
Joins the path segments into a single path tring. No attempt is made to make it an absolute
path, nor to check... |
"""
.. py:currentmodule:: FileFormat.Results.test_SimulationParameters
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Tests for the module `SimulationParameters`.
"""
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)"
__version__ = ""
__date__ = ""
__copyright__ = "Copyright (c) 2012 Hendri... |
"""
COHORTE file include unit test
:author: Aurélien PISU
:license: Apache Software License 2.0
..
Copyright 2014 isandlaTech
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
h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.