code stringlengths 1 199k |
|---|
"""
Custom controler
""" |
import tensorflow as tf
import numpy as np
import os
from learner import Learner
from valuerl import ValueRL
from worldmodel import DeterministicWorldModel
class ValueRLLearner(Learner):
"""
ValueRL-specific training loop details.
"""
def learner_name(self): return "valuerl"
def make_loader_placeholders(self)... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as n... |
# -*- coding: utf8 -*-
""" Tests for swift.common.utils """
from __future__ import with_statement
import logging
import socket
import time
import unittest
from uuid import uuid4
from swift.common import memcached
from test.unit import NullLoggingHandler
class ExplodingMockMemcached(object):
exploded = False
de... |
from datetime import datetime
import pytz
from framework.celery_tasks import app
from website.settings import DATE_LAST_LOGIN_THROTTLE_DELTA
@app.task
def update_user_from_activity(user_id, login_time, cas_login=False, updates=None):
from osf.models import OSFUser
if not updates:
updates = {}
if typ... |
"""Sparse Tensor Representation.
See also `tf.sparse.SparseTensor`.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numbers
import numpy as np
from tensorflow.python.compat import compat as tf_compat
from tensorflow.python.framework import constant... |
import numpy as np
from scipy import optimize
def TLS_logL(v, X, dX):
"""Compute the total least squares log-likelihood
This uses Hogg et al eq. 29-32
Parameters
----------
v : ndarray
The normal vector to the linear best fit. shape=(D,).
Note that the magnitude |v| is a stand-in fo... |
import re
from collections import OrderedDict
from django import template
from django.template import loader
from django.urls import NoReverseMatch, reverse
from django.utils.encoding import iri_to_uri
from django.utils.html import escape, format_html, smart_urlquote
from django.utils.safestring import mark_safe
from r... |
r"""
Kurtosis and Skew
-----------------
Figure 3.6.
An example of distributions with different skewness
:math:`\Sigma` (top panel) and kurtosis K (bottom panel). The modified
Gaussian in the upper panel is a normal distribution multiplied by a
Gram-Charlier series (see eq. 4.70), with a0 = 2, a1 = 1, and a2 = 0.5.
The... |
from streamlink.plugins.brightcove import Brightcove
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlBrightcove(PluginCanHandleUrl):
__plugin__ = Brightcove
should_match = [
"https://players.brightcove.net/123/default_default/index.html?videoId=456",
"https://players.bri... |
"""
The DenseDesignMatrix class and related code. Functionality for representing
data that can be described as a dense matrix (rather than a sparse matrix)
with each row containing an example and each column corresponding to a
different feature. DenseDesignMatrix also supports other "views" of the data,
for example a d... |
import json
import logging
import datetime
from post_request_task.task import task
import mkt
from mkt.constants.regions import REGIONS_CHOICES_SLUG
from mkt.monolith.models import MonolithRecord
from mkt.site.decorators import use_master
from mkt.ratings.models import Review
from mkt.webapps.models import AddonUser, W... |
from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from oscar.core.loading import get_cla... |
from __future__ import print_function, division, unicode_literals, absolute_import
import os
from ....interfaces.utility import Function, IdentityInterface
from ....pipeline import engine as pe # pypeline engine
from ....interfaces.freesurfer import *
from ....interfaces.io import DataGrabber
from ....interfaces.utili... |
"""Replacement authentication decorators that work around redirection loops"""
from __future__ import unicode_literals
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import log... |
"""Miscellaneous helper functions for mysql queries."""
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
try:
import oursql as mysqldb
except ImportError:
import MySQLdb as mysqldb
import pywikibot
from pywikibot import config2 as config
def mysql_query(query, params=(), dbname=None... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from froide.helper.auth_migration_util import USER_DB_NAME
APP_MODEL, APP_MODEL_NAME = 'account.User', 'account.user'
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'FoiAttach... |
from django.apps import AppConfig
class PluginsConfig(AppConfig):
name = 'plugins' |
"""NodeJs File Parser."""
from biicode.common.edition.parsing.file_parser import FileParser
from biicode.common.edition.parsing.code_reference import CodeReference
from biicode.common.utils.bii_logging import logger
import re
from biicode.common.edition.parsing.conf.comments_tags_parser import parse_tags
def require_in... |
__doc__ = """
Generic Taskmaster module for the SCons build engine.
This module contains the primary interface(s) between a wrapping user
interface and the SCons build engine. There are two key classes here:
Taskmaster
This is the main engine for walking the dependency graph and
calling things to d... |
import re
import urllib
import datetime
import time
import json
from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
class sfp_historic(SpiderFootPlugin):
"""Historic Files:Identifies historic versions of interesting files/pages from the Wayback Machine."""
# Default options
opts = {
'far... |
from openerp.addons.report_aeroo.ctt_objects import ctt_currency
class usd(ctt_currency):
def _init_currency(self):
self.language = u'ru_RU'
self.code = u'USD'
self.fractions = 100
self.cur_singular = u' доллара США'
# default plural form for currency
self.cur_plural ... |
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
**************... |
"""
A Multiple Select Idevice is one built up from Questions
"""
import logging
from exe.engine.persist import Persistable
from exe.engine.idevice import Idevice
from exe.engine.translate import lateTranslate
from exe.engine.field import SelectQuestionField
log = logging.getLogger(__name__)
class ScormMultiSele... |
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from .. import Rule
from ....lib.nametype import NameType
class HasNameType(Rule):
"""Rule that checks the type of name"""
labels = [ _('Name type:')]
name = _('People with the <Name type>')
description = _("Matches people wi... |
'''
Finds C source code files that call sf_input for a given file, but forget to
call sf_close. Call this program from the upper directory (RSFSRC) with no
arguments, i.e.:
./admin/find_file_leaks.py > results.asc
It will print a list of affected files, sorted in a few categories.
To eliminate the file leak, make s... |
"""Unit tests for workflows models."""
from __future__ import absolute_import
from invenio.ext.sqlalchemy import db
from invenio.testsuite import InvenioTestCase, make_test_suite, run_test_suite
class TestWorkflowModels(InvenioTestCase):
"""Test meant for testing the models available."""
def setUp(self):
... |
"""
***************************************************************************
r_li_padrange.py
----------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
***************************************************... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: azure_rm_postgresqlserver_facts
version_added: "2.7"
short_desc... |
import re
from module.plugins.internal.SimpleCrypter import SimpleCrypter
class Dereferer(SimpleCrypter):
__name__ = "Dereferer"
__type__ = "crypter"
__version__ = "0.25"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-]{3,63}(?:\.[a-zA-Z]{2,}){1... |
"""add poi_types_json to mimir autocomplete params in tyr
Revision ID: 3f620c440544
Revises: e632d689de5
Create Date: 2018-11-22 09:35:17.988985
"""
revision = '3f620c440544'
down_revision = 'e632d689de5'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('autocomplete_parameter', sa.Column... |
from spack import *
class LdcBootstrap(CMakePackage):
"""The LDC project aims to provide a portable D programming language
compiler with modern optimization and code generation capabilities.
LDC is fully Open Source; the parts of the code not taken/adapted from
other projects are BSD-licensed (see the L... |
"""
This module contains the HTTP fetcher interface and several implementations.
"""
__all__ = [
'fetch', 'getDefaultFetcher', 'setDefaultFetcher', 'HTTPResponse',
'HTTPFetcher', 'createHTTPFetcher', 'HTTPFetchingError', 'HTTPError'
]
import urllib.request
import urllib.error
import urllib.parse
import http.cli... |
"""This component provides support to the Ring Door Bell camera."""
import asyncio
from datetime import timedelta
from itertools import chain
import logging
from haffmpeg.camera import CameraMjpeg
from haffmpeg.tools import IMAGE_JPEG, ImageFrame
import requests
from homeassistant.components.camera import Camera
from h... |
"""Execution Callbacks for Eager Mode."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import numpy as np
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.eager import context
from tensorflow.python.eager import core
... |
import socket,sys
sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sk.settimeout(1)
try:
sk.connect((sys.argv[1],int(sys.argv[2])))
print 'ok'
except Exception:
print 'no'
sk.close() |
"""Deployment script for Oppia.
USE THIS SCRIPT AT YOUR OWN RISK! A safe option is to modify app.yaml manually
and run the 'appcfg.py update' command.
This script performs a deployment of Oppia to a Google App Engine appspot
instance. It creates a build with unnecessary files removed, and saves a copy
of the uploaded f... |
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.binding.datatypes as xs
import pyxb.binding.basis
import pyxb.utils.domutils
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org... |
import uuid
import mock
from keystone import auth
from keystone import exception
from keystone.tests import unit as tests
METHOD_NAME = 'simple_challenge_response'
EXPECTED_RESPONSE = uuid.uuid4().hex
DEMO_USER_ID = uuid.uuid4().hex
class SimpleChallengeResponse(auth.AuthMethodHandler):
method = METHOD_NAME
def... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class NewCommittees(Choreography):
def __init__(self, temboo_session):
"""
Create a ne... |
"""
Support for interface with an Orange Livebox Play TV appliance.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.liveboxplaytv/
"""
import logging
from datetime import timedelta
import requests
import voluptuous as vol
import homeassistant.... |
"""
@package mi.dataset.parser
@file mi-dataset/mi/dataset/parser/pco2w_abc_dcl.py
@author Joe Padula
@brief Parser for the pco2w_abc_dcl recovered and telemetered dataset driver
Release notes:
initial release
"""
__author__ = 'Joe Padula'
__license__ = 'Apache 2.0'
import re
from mi.dataset.parser.utilities import \
... |
"""A crude *bit of everything* smoke test to verify PyInstaller compatibility.
PyInstaller typically goes wrong by forgetting to package modules, extension
modules or shared libraries. This script should aim to touch as many of those
as possible in an attempt to trip a ModuleNotFoundError or a DLL load failure
due to a... |
import numpy as np
from numpy.testing import assert_allclose
import pandas as pd
import pytest
from statsmodels.genmod.qif import (QIF, QIFIndependence, QIFExchangeable,
QIFAutoregressive)
from statsmodels.tools.numdiff import approx_fprime
from statsmodels.genmod import families
@py... |
command += testshade("-t 1 -g 32 32 -od uint8 a_v_b_u -o cout vu.tif -o mcout vu_m.tif")
outputs.append ("vu.tif")
outputs.append ("vu_m.tif")
command += testshade("-t 1 -g 32 32 -od uint8 a_u_b_v -o cout uv.tif -o mcout uv_m.tif")
outputs.append ("uv.tif")
outputs.append ("uv_m.tif")
command += testshade("-t 1 -g 32 3... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Counties.poly'
db.alter_column(u'locations_counties', 'poly', self.gf('django.contrib.gis.db.models.fields.MultiPolyg... |
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application() |
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Package Manager Client Package Interface}.
"""
from entropy.const import etpConst
from entropy.exceptions import SPMError
from entropy.i18n import _
from entropy.output ... |
from argparse import ArgumentParser
from miasm2.analysis import debugging, gdbserver
from miasm2.jitter.csts import *
from miasm2.analysis.machine import Machine
from pdb import pm
parser = ArgumentParser(
description="""Sandbox raw binary with mips32 engine
(ex: jit_mips32.py example/mips32_sc_l.bin 0)""")
parser.... |
class Calculator(object):
def __init__(self):
self.args = []
def push(self, value):
self.args.append(value)
def add(self):
return sum(self.args)
def divide(self):
return float(self.args[0]) / float(self.args[1]) |
"""
Copyright (C) 2014 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from operator import attrgetter
from django import forms
class CreateForm(forms.Form):
cluster_id = forms... |
import pytest
from pootle_checks.constants import Category, CHECK_NAMES
from pootle_checks.utils import (
get_category_code,
get_category_name,
get_qualitychecks,
get_qualitycheck_list,
get_qualitycheck_schema)
def test_get_qualitycheck_schema():
d = {}
checks = get_qualitychecks()
for c... |
"""
Upload code coverage reports to codecov.io.
Multiple coverage files from multiple languages are accepted and aggregated after upload.
Python coverage, as well as PowerShell and Python stubs can all be uploaded.
"""
import argparse
import dataclasses
import pathlib
import shutil
import subprocess
import tempfile
imp... |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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) any later version.
CVXPY is distributed in t... |
"""
Module for reading/writing data from/to Python pickle format.
Class:
PickleIO
Supported: Read/Write
Authors: Andrew Davison
"""
try:
import cPickle as pickle # Python 2
except ImportError:
import pickle # Python 3
from neo.io.baseio import BaseIO
from neo.core import (Block, Segment,
... |
"""Access Ansible Core CI remote services."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import tempfile
import time
from .util import (
SubprocessError,
ApplicationError,
cmd_quote,
display,
ANSIBLE_TEST_DATA_ROOT,
)
from .util_common import (
... |
import re
import time
from module.plugins.internal.Account import Account
class UploadedTo(Account):
__name__ = "UploadedTo"
__type__ = "account"
__version__ = "0.36"
__status__ = "testing"
__description__ = """Uploaded.to account plugin"""
__license__ = "GPLv3"
__authors__ = ... |
import abc
import json
import six
from shoop.utils.serialization import ExtendedJSONEncoder
class Chart(six.with_metaclass(abc.ABCMeta)):
def __init__(self, title):
self.title = title
@abc.abstractmethod
def get_config(self):
"""
Get a JSONable dictionary of configuration data for th... |
import operator
import simplejson
import urllib2
import openerp
from openerp import tools
from openerp import SUPERUSER_ID
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools.translate import _
from openerp.http import request
from datetime import datetime, timedelta
... |
"""
The purpose of this example is to show that the PAR shutsdown cleanly
even if the message sent is a producerFinished() message. Essentially
it's an acceptance test.
"""
import os
import time
import Axon
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.Chassis.PAR import PAR
class timedShutdown(Axon.Thre... |
__all__ = ['edtlib', 'dtlib'] |
"Namespace allocated to utility components contributed by Stephen Anderson" |
"""Commands for reading and manipulating health checks."""
from googlecloudsdk.calliope import base
class HealthChecks(base.Group):
"""Read and manipulate health checks for load balanced instances."""
HealthChecks.detailed_help = {
'brief': ('Read and manipulate health checks for load balanced '
'in... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import dedent
from pants.backend.core.tasks.list_owners import ListOwners
from pants.backend.python.targets.python_library import PythonLibrary
from pants... |
"""Tests for multiplex_2."""
import numpy as np
import tensorflow as tf
from tensorflow.examples.custom_ops_doc.multiplex_2 import multiplex_2_op
from tensorflow.python.framework import errors_impl
from tensorflow.python.framework import test_util # pylint: disable=g-direct-tensorflow-import
@test_util.with_eager_op_a... |
"""Tests for the SWIG-wrapped device lib."""
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import device_lib
from tensorflow.python.framework import test_util
from tensorflow.python.platform import googletest
from tensorflow.python.platform import test
class DeviceLibTest(test_util.Tenso... |
import mock
from oslo_versionedobjects import fixture as ovo_fixture
from nova import context
from nova.db.sqlalchemy import api as db_api
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import instance_group
from nova import test
from nova.tests import uuidsentinel a... |
import time
import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest import exceptions
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
from tempest.services.compute.xml.common import Text
from tempest.services... |
"""
Unit Tests for nova.consoleauth.rpcapi
"""
from oslo.config import cfg
from nova.consoleauth import rpcapi as consoleauth_rpcapi
from nova import context
from nova.openstack.common import rpc
from nova import test
CONF = cfg.CONF
class ConsoleAuthRpcAPITestCase(test.TestCase):
def _test_consoleauth_api(self, me... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class AntlrPyGenIntegrationTest(PantsRunIntegrationTest):
def test_antlr_py_gen_integration(... |
from __future__ import print_function, absolute_import
from .support import TestCase, override_config, captured_stdout
from numba import unittest_support as unittest
from numba import jit, types
from numba.compiler import compile_isolated
@jit((types.int32,), nopython=True)
def inner(a):
return a + 1
@jit((types.in... |
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class PathologicalMobileSitesPage(page_module.Page):
def __init__(self, url, page_set):
super(PathologicalMobileSitesPage, self).__init__(
url=url, page_set=page_set, credentials_path='data/credentials.js... |
import numpy as np
import matplotlib.pylab as pl
from scipy.stats import t, laplace, norm
a = np.random.randn(30)
outliers = np.array([8, 8.75, 9.5])
pl.hist(a, 7, weights=[1 / 30] * 30, rwidth=0.8)
x = np.linspace(-5, 10, 500)
loc, scale = norm.fit(a)
n = norm.pdf(x, loc=loc, scale=scale)
loc, scale = laplace.fit(a)
l... |
try:
from django.conf.urls import patterns, url
except ImportError:
from django.conf.urls.defaults import patterns, url # noqa
from subdomains.tests.views import view
urlpatterns = patterns('',
url(regex=r'^$', view=view, name='home'),
url(regex=r'^example/$', view=view, name='example'),
) |
"""Upgrade recipe."""
from invenio.legacy.dbquery import run_sql
from invenio.utils.serializers import deserialize_via_marshal, \
serialize_via_marshal
depends_on = ['invenio_release_1_1_0']
def info():
"""info."""
return "Change of oaiHARVEST.arguments c_cfg-file to c_stylesheet"
def do_upgrade():
"""d... |
import sys
import traceback
import logging
from virttest import openvswitch
from virttest import versionable_class
from autotest.client.shared import error
from autotest.client.shared import utils
@error.context_aware
def run(test, params, env):
"""
Run basic test of OpenVSwitch driver.
"""
_e = None
... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param root, a tree node
# @return a tree node
def recoverTree(self, root):
order_table = []
def inorder(root):
if root:
inorder(ro... |
"""
Copyright 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... |
from __future__ import print_function, unicode_literals
import os
import time
import traceback
import sickbeard
from sickbeard import common, config, generic_queue, logger, processTV
from sickbeard.processTV import log_helper, process_dir
from sickrage.helper.encoding import ek
MANUAL_POST_PROCESS = 120
AUTO_POST_PROCE... |
from weboob.tools.test import BackendTest
import itertools
class RegionsjobTest(BackendTest):
MODULE = 'regionsjob'
def test_regionjob_search(self):
l = list(itertools.islice(self.backend.search_job(u'informaticien'), 0, 20))
assert len(l)
advert = self.backend.get_job_advert(l[0].id, No... |
from Child import Child
from Node import Node # noqa: I201
ATTRIBUTE_NODES = [
# token-list -> token token-list?
Node('TokenList', kind='SyntaxCollection',
element='Token'),
# attribute -> '@' identifier '('? token-list ')'?
Node('Attribute', kind='Syntax',
children=[
Chi... |
""" Test reading and changing the active set of available packages"""
import shutil
import pytest
from pkgpanda import Install, Repository
from pkgpanda.util import expect_fs, is_windows, resources_test_dir
@pytest.fixture
def repository():
return Repository(str(resources_test_dir("packages")))
@pytest.fixture
def ... |
from __future__ import unicode_literals
from datetime import datetime
from dateutil.tz import tzutc
import boto3
from freezegun import freeze_time
import requests
import sure # noqa
from botocore.exceptions import ClientError
from moto.packages.responses import responses
from moto import mock_apigateway, settings
@fre... |
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkSubPixelPositionEdgels(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkSubPixelPositionEdgels(), 'Processing.',
... |
from StringIO import StringIO
import unicodehelper
INFINITY = float('inf')
class ContextGenerator:
"""The context generator creates a line-by-line mapping of all files that
are validated. It will then use that to help produce useful bits of code
for errors, warnings, and the like."""
def __init__(self, ... |
"""
The module for psi-statistics for RBF kernel
"""
import numpy as np
from paramz.caching import Cache_this
from . import PSICOMP_RBF
gpu_code = """
// define THREADNUM
#define IDX_NMQ(n,m,q) ((q*M+m)*N+n)
#define IDX_NMM(n,m1,m2) ((m2*M+m1)*N+n)
#define IDX_NQ(n,q) (q*N+n)
#define IDX_NM(n,m) (m*... |
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth import login
from registration import signals
from registration.views import RegistrationView as BaseRegistrationView
from registration.users import UserModel
class RegistrationView(BaseRegistrationView):
"""
... |
import math
import m5
from m5.objects import *
from m5.defines import buildEnv
from Ruby import create_topology
class Cache(RubyCache):
latency = 3
def define_options(parser):
return
def create_system(options, system, piobus, dma_ports, ruby_system):
if buildEnv['PROTOCOL'] != 'MI_example':
panic("T... |
from ..ui import UIComponent
import pandas as pd
from flask import request, jsonify, make_response
class Chart(UIComponent):
name = "Chart"
@staticmethod
def apply_filters(df, filters):
idx = pd.Series([True]*df.shape[0])
for k, v in filters.items():
if k not in df.columns:
... |
import os,re
for root, dirs, files in os.walk('.'):
for name in files:
if not name.endswith('.cpp'): continue
#if name!='BssSnowGrain.cpp': continue
modified=False
new=[]
for l in open(root+'/'+name):
m=re.match('(.*)YADE_PLUGIN\(([^)]*)\)(.*)',l)
if m:
modified=True
plugins=''.join(['('+pl.str... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from . import DOMAIN, PORT # contained in __init__.py
def test(request):
context = {
'DOMAIN': DOMAIN,
'PORT': PORT
}
return render_to_response('test.html', context,
cont... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATION = """
---
module: iosxr_config
version_added: "2.1"
author: "Ricardo Carrillo Cruz (@rcarrillocruz)"
short_description: Manage Cisco IOS XR configuration sections
descripti... |
testIndexDict = {'asmicro/alloc-1.as': {'memory': 300.0, 'v8': 25},
'asmicro/alloc-10.as': {'memory': 300.0, 'v8': 6},
'asmicro/alloc-11.as': {'memory': 300.0, 'v8': 7},
'asmicro/alloc-12.as': {'memory': 300.0, 'v8': 4},
'asmicro/alloc-13.as': {'memory': 300.0, 'v8': 63},
'asmicro/alloc-14.as': {'memory': 556.0, '... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn.python import learn
from tensorflow.contrib.learn.python.learn import datasets
from tensorflow.contrib.learn.python.learn.es... |
"""The tests for the Ring switch platform."""
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.helpers import entity_registry as er
from .common import setup_platform
from tests.common import load_fixture
async def test_entity_registry(hass, requests_mock):
"""Tests that the de... |
"""Tests for contrib.seq2seq.python.seq2seq.decoder."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.seq2seq.python.ops import basic_decoder
from tensorflow.contrib.seq2seq.python.ops import sampler as sampler_py
... |
match 42:
case {'foo': 1, 'bar': foo.bar}:
x
y |
"""
This file demonstrates drawing graphs using circular vertices via
vtkRenderedGraphRepresentation.
"""
from vtk import *
if __name__ == "__main__":
# Create a random graph
source = vtkRandomGraphSource()
source.SetNumberOfVertices(15)
source.SetStartWithTree(True)
#-------------------------------... |
""" Sahana Eden Content Management System Model
@copyright: 2012 (c) Sahana Software Foundation
@license: MIT
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
restric... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.