content stringlengths 4 20k |
|---|
"""Script for training a layered neural renderer on a video.
You need to specify the dataset ('--dataroot') and experiment name ('--name').
Example:
python train.py --dataroot ./datasets/reflection --name reflection --gpu_ids 0,1
The script first creates a model, dataset, and visualizer given the options.
It the... |
from spack import *
class Metasv(PythonPackage):
"""An accurate and integrative structural-variant caller
for next generation sequencing"""
homepage = "http://bioinform.github.io/metasv/"
url = "https://github.com/bioinform/metasv/archive/0.5.4.tar.gz"
version('0.5.4', 'de2e21ac4f86bc4d1... |
import mock
import codecs
import hyperframe
from netlib import tcp, http
from netlib.tutils import raises
from netlib.exceptions import TcpDisconnect
from netlib.http.http2 import framereader
from ..netlib import tservers as netlib_tservers
from pathod.protocols.http2 import HTTP2StateProtocol, TCPHandler
class Te... |
from blivet.util import stringize, unicodeize
from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \
AUTOPART_TYPE_LVM_THINP
class PartSpec(object):
def __init__(self, mountpoint=None, fstype=None, size=None, max_size=None,
grow=False, btr=False, lv=... |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
COHORTE Node Composer HTTP Service Proxy
:authors: Bassem Debbabi
:copyright: Copyright 2015, isandlaTech
:license: Apache Software License 2.0
"""
# iPOPO decorators
from pelix.ipopo.decorators import ComponentFactory, Provides, Property, Instantiate, \
Vali... |
"""Train_eval for CAQL."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
from absl import app
from absl import flags
from absl import logging
import numpy as np
import tensorflow.compat.v1 as tf
from caql import agent_policy
from caql impor... |
from helper import CompatTestCase
from validator.compat import FX13_DEFINITION
class TestFX13Compat(CompatTestCase):
"""Test that compatibility tests for Firefox 13 are properly executed."""
VERSION = FX13_DEFINITION
def test_startendMarker(self):
"""Test that _startMarker and _endMarker are fla... |
from hashlib import sha1
from django.test import TestCase
from mooch.postfinance import PostFinanceMoocher
from testapp.models import Payment
def _messages(response):
return [m.message for m in response.context["messages"]]
class Request:
def build_absolute_uri(*arg):
return ""
class MoochTest(T... |
import matplotlib
matplotlib.use('Agg')
import os
import glob
import numpy as np
import random
import matplotlib.pyplot as plt
from pylab import subplot, scatter
def sample_data(example_paths, target_paths, class_label, accepted_rate=0.1):
examples = glob.glob(example_paths)
examples.sort()
targets = gl... |
"""Tests for normalization layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.keras.python import keras
from tensorflow.contrib.keras.python.keras import testing_utils
from tensorflow.python.platform impor... |
"""Astroid hooks for six module."""
import sys
from textwrap import dedent
from astroid import MANAGER, register_module_extender
from astroid.builder import AstroidBuilder
from astroid.exceptions import AstroidBuildingError, InferenceError
from astroid import nodes
SIX_ADD_METACLASS = 'six.add_metaclass'
def _ind... |
"""A dataset loader for imports85.data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import numpy as np
import tensorflow as tf
try:
import pandas as pd # pylint: disable=g-import-not-at-top
except ImportError:
pass
URL = "... |
"""Read and write Ogg Speex comments.
This module handles Speex files wrapped in an Ogg bitstream. The
first Speex stream found is used.
Read more about Ogg Speex at http://www.speex.org/. This module is
based on the specification at http://www.speex.org/manual2/node7.html
and clarifications after personal communicat... |
"""
Error Page
This plugin to display customize error page
Can be called as standalone
"""
from __future__ import division
import logging
from mocha import (Mocha,
page_attr,
abort)
from mocha import exceptions
from sqlalchemy.exc import SQLAlchemyError
__version__ = "1.0.0"
__... |
"""
Given a list of hostnames, update the config of all the DataNodes,
TaskTrackers and RegionServers on those hosts. The configuration for
the various role types is hardcoded in the code.
Usage: %s [options]
Options:
-f <hostname_file> Path to a file containing the set of hostnames
... |
import sys
import time
from progressbar import Percentage, Bar, RotatingMarker, ETA, ProgressBar
class Progress(object):
def __init__(self, label, max_value):
self.nr_done = 0
widgets = [label, ': ', Percentage(), ' ', Bar(marker=RotatingMarker()),
' ', ETA()]
self.pb... |
import json
import math
import os
import sys
from telemetry import test
from telemetry.core import util
from telemetry.page import page_measurement
from telemetry.page import page_set
from telemetry.value import merge_values
def _GeometricMean(values):
"""Compute a rounded geometric mean from an array of values.""... |
#!/usr/bin/env python2
import os
import json
import argparse
import subprocess
import threading
import sys
import tempfile
from prettytable import PrettyTable
# helper for progress output
class RepeatingTimer(threading._Timer):
def run(self):
while True:
self.finished.wait(self.interval)
... |
#!/usr/bin/env python
import uuid
import re
import json
from tornado import ioloop
from tornado import web
from tornado.options import define, options
define("debug", default=False, help="run in debug mode", type=bool)
define("port", default=9999, help="run on the given port", type=int)
GET_STATUS_XML = (
'<?xm... |
"""Generate java source files from protobuf files.
This is a helper file for the genproto_java action in protoc_java.gypi.
It performs the following steps:
1. Deletes all old sources (ensures deleted classes are not part of new jars).
2. Creates source directory.
3. Generates Java files using protoc (output into eith... |
from __future__ import unicode_literals
from datetime import date, timedelta
from decimal import Decimal
from django.test import TestCase
from model_mommy import mommy
class BudgetModelTest(TestCase):
def test_create_new_budget(self):
budget = mommy.make('Budget')
self.assertTrue(budget.name)... |
from __future__ import print_function
import os
import numpy as np
import warnings
import rasterio as rio
import ctypes
from numpy.ctypeslib import ndpointer
from s2plib import common
from s2plib import rpc_utils
from s2plib import estimation
from s2plib.config import cfg
# Locate sift4ctypes library and raise an Im... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8
import json
from django.conf import settings
from django.core.management import BaseCommand
from django.utils import timezone
from django.utils.dateparse import parse_datetime
from django.utils.translation import ugettext_lazy
from onadata.apps.log... |
from migrate.changeset.constraint import ForeignKeyConstraint
from migrate import UniqueConstraint
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import Index
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import Table
def up... |
"""A setuptools based setup module.
"""
# Always prefer setuptools over distutils
from codecs import open
from os import path
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README'), encoding='utf-8')... |
#!/usr/bin/env python
"Makes working with XML feel like you are working with JSON"
from xml.parsers import expat
from xml.sax.saxutils import XMLGenerator
from xml.sax.xmlreader import AttributesImpl
try: # pragma no cover
from cStringIO import StringIO
except ImportError: # pragma no cover
try:
from... |
from datetime import datetime as dt
import os
import sys
import unittest
import mock
sys.path.insert(1, os.path.abspath(
os.path.join(os.path.dirname(__file__), '../convert_from_telescope')))
import sample_checking
class SampleCounterTest(unittest.TestCase):
def setUp(self):
self.results_a = [[dt(2014, 1... |
import contextlib
import os
import fnmatch
import itertools
import re
import StringIO
import sys
from licenseck import licenses
filetypes_to_check = [".rs", ".rc", ".cpp", ".c", ".h", ".py", ".toml", ".webidl"]
reftest_directories = ["tests/ref"]
reftest_filetype = ".list"
python_dependencies = [
"./python/depende... |
"""
Management class for Storage-related functions (attach, detach, etc).
"""
from nova import exception
from nova.openstack.common import log as logging
from nova.virt.xenapi import vm_utils
from nova.virt.xenapi import volume_utils
LOG = logging.getLogger(__name__)
class VolumeOps(object):
"""
Management... |
import torch
from SSD import _C as C
class ConvertDaliInputIterator(object):
def __init__(self, dali_it):
self._dali_it = dali_it
def __next__(self):
batch = self._dali_it.__next__()
return batch[0]['image'], batch[0]['bbox'], batch[0]['label']
def __iter__(self):
return ... |
from openerp import fields, models, exceptions, api, _
import base64
import csv
import cStringIO
class ImportInventory(models.TransientModel):
_name = 'import.inventory'
_description = 'Import inventory'
def _get_default_location(self):
ctx = self._context
if 'active_id' in ctx:
... |
"""Unit tests for the search engine."""
__revision__ = \
"$Id$"
from invenio.base.wrappers import lazy_import
from invenio.testsuite import make_test_suite, run_test_suite, InvenioTestCase
search_engine = lazy_import('invenio.legacy.search_engine')
class TestWashQueryParameters(InvenioTestCase):
"""Test fo... |
import os, sys
def shortPythonVersion():
hv = sys.hexversion
major = (hv & 0xff000000L) >> 24
minor = (hv & 0x00ff0000L) >> 16
teeny = (hv & 0x0000ff00L) >> 8
return "%s.%s.%s" % (major,minor,teeny)
class Platform:
"""Gives us information about the platform we're running on"""
def __i... |
"""Flax implementation of PixelCNN++
Based on the paper
PixelCNN++: Improving the PixelCNN with discretized logistic mixture
likelihood and other modifications
published at ICLR '17 (https://openreview.net/forum?id=BJrFC6ceg).
"""
# See issue #620.
# pytype: disable=wrong-arg-count
from functools import partia... |
#!/usr/bin/python
from .Game import GameObject
class Card(GameObject):
cardType = "unknown"
def __init__(self, ID, label, cardType):
self.identifier = ID
self.label = label
self.cardType = cardType
def __str__(self):
return ''.join((
"id: ",
self.i... |
"""List virtual servers."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import columns as column_helper
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
# pylint: disable=unnecessary-lambda
COLUMNS = [
... |
#!/usr/bin/env python
"""Provides tools for building Mac application bundles."""
# Based on code by Gary Oberbrunner and Mitch Chapman
from os.path import *
import os
import re
import shutil
from SCons.Builder import *
from SCons.Defaults import SharedCheck, ProgScan
from SCons.Script.SConscript import SConsEnvironme... |
#!/usr/bin/env python
### Very bad, and old+unused, file.
# Vivi does a much better job of producing an .actions file based
# on a .notes file from LilyPond. I wrote this in the very early
# days; I'm only including it here to give people an idea of the
# overall structure in case they want to try out stuff before I
... |
from gizmo.entity import Vertex, Edge
from gizmo.mapper import EntityMapper
class SourcedEvent(Vertex):
_allowed_undefined = True
class SourcedEventMapper(EntityMapper):
entity = SourcedEvent
class TriggedSourceEvent(Edge):
pass
class SourceEventEntry(Edge):
pass
class EventSourceException(Exc... |
from typing import Callable, Tuple
from kitty.fast_data_types import truncate_point_for_length, wcswidth
from kitty.key_encoding import EventType, KeyEvent
from .operations import RESTORE_CURSOR, SAVE_CURSOR, move_cursor_by
class LineEdit:
def __init__(self) -> None:
self.clear()
def clear(self) -... |
from oslo_log import log
from urllib import parse as urlparse
from ceilometer.network.statistics import driver
from ceilometer.network.statistics.opendaylight import client
LOG = log.getLogger(__name__)
def _get_properties(properties, prefix='properties'):
resource_meta = {}
if properties is not None:
... |
#!/usr/bin/env python
import socket
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from subprocess import call, Popen, PIPE
import time
import sys
try:
import glib
except ImportError:
from gi.repository import GLib as glib
# from gi import * # as a hotfix? Creates more problems
switch_back=1
switch_... |
from django import template
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm
from django.contrib.auth.models import User, Group
from django.core.exceptions import PermissionDenied
from django.http import Htt... |
from __future__ import print_function
import six
from st2common.constants.pack import PACK_VERSION_SEPARATOR
from st2common.content.utils import get_pack_base_path
from st2common.runners.base_action import Action
from st2common.util.pack import get_pack_metadata
class GetPackDependencies(Action):
def run(self, ... |
"""Functions used in the computation of subtasks of the dummy task"""
import hashlib
import random
import time
def check_pow(proof, input_data, difficulty):
"""
:param long proof:
:param str input_data:
:param int difficulty:
:rtype bool:
"""
sha = hashlib.sha256()
sha.update(input_da... |
#!/usr/bin/env python
import sys
from os.path import expanduser
import os
import signal
import import_media
# Import Photos!
#
# This script imports photos (or other documents) into date based directories
# Copyright 2014 Michael Moore <<EMAIL>>
#
# SETTINGS
#
# The base directory where photos will be copied into
de... |
"""Tests for ceilometer/storage/impl_mongodb.py
.. note::
In order to run the tests against another MongoDB server set the
environment variable CEILOMETER_TEST_MONGODB_URL to point to a MongoDB
server before running the tests.
"""
from ceilometer.alarm.storage import impl_mongodb as impl_mongodb_alarm
from cei... |
"""
This is a basic tutorial on how to conduct basic empirical likelihood
inference for descriptive statistics. If matplotlib is installed
it also generates plots.
"""
from __future__ import print_function
import numpy as np
import statsmodels.api as sm
print('Welcome to El')
np.random.seed(634) # No significance o... |
"""
This model initialises the database and constructs the auth object and tables
"""
from gluon.custom_import import track_changes; track_changes(True)
from datetime import date
# Setup db object
db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
## by default give a view/generic.extension to... |
import argparse
import datetime
import logging
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.engine.url import URL
from ..resolution import Resolution
from ..fetch.overrides import Overrides
from ..storage import Storage
# Make sure we have a config
try:
from ..confi... |
'''
Author: Alex Baker
Date : 3 April 2008
Description : Investigate the properties of the Pauli Spin matricies.
'''
from numpy import *
import numpy.linalg as la
# pauli spin
sx = array([[0, 1],[ 1, 0]])
sy = array([[0, -1j],[1j, 0]])
sz = array([[1, 0],[0, -1]])
# sigma functions
sigma_x = array([[0, 1],[1, 0]... |
# This dictionary maps Field objects to their associated MySQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict__ before being output.
# If a column type is set to None, it won't be included in the output.
DATA_TYPES = {
'AutoFi... |
"""Media to be displayed in the ZUI (abstract base class)."""
import math
from physicalobject import PhysicalObject
class MediaObject(PhysicalObject):
"""MediaObject objects are used to represent media that can be rendered in
the ZUI.
Constructor: MediaObject(string, Scene)
"""
def __init__(self... |
"""
SIMBAD.py: CCP4 GUI Project
This library is free software: you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
version 3, modified in accordance with the provisions of the
license to address the requirements of UK law.
You should have r... |
import os
import pytest
from selenium.webdriver import FirefoxProfile
from selenium.webdriver.firefox.options import Options
@pytest.fixture(params=['capabilities', 'firefox_profile', 'options'])
def driver_kwargs(request, driver_kwargs, profile):
if request.param == 'capabilities':
options = {'profile'... |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
"""
"""
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import math
import random
import re
import os.path
import pyglet
from pyglet.gl import *
import xml.dom
import xml.dom.minidom
class SmoothLineGroup(pyglet.graphics.Group):
def set_state(self):
... |
import re
import const
import codecs
##
## @brief Levenshtein distance implementation
##
## @param s1 String 1
## @param s2 String 2
##
## @return Levenshtein distance between the two given strings.
##
def levenshtein(s1, s2):
if len(s1) < len(s2):
return levenshtein(s2, s1)
i... |
import forvo
import os
from Tkinter import Tk
from tkFileDialog import askopenfilename
def Main(lang,limit):
#APIKEY is stored separately in another file called apikey
with open('apikey.txt') as a:
APIKEY=a.read()
myfile = fileChoose()
with open(myfile) as words:
#We... |
from django.core.management.base import NoArgsCommand
from optparse import make_option
from menu.models import *
class Command(NoArgsCommand):
help = "Whatever you want to print here"
option_list = NoArgsCommand.option_list + (
make_option('--verbose', action='store_true'),
)
def handle_... |
from api_data_source import APIDataSource
from api_list_data_source import APIListDataSource
from data_source import DataSource
from manifest_data_source import ManifestDataSource
from permissions_data_source import PermissionsDataSource
from samples_data_source import SamplesDataSource
from sidenav_data_source import ... |
"""
Acceptance tests for course in studio
"""
from nose.plugins.attrib import attr
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.studio.index import DashboardPage
from common.test.acceptance.pages.studio.users import CourseTeamPage
from common.test.acceptance.... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ventana_registro.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromU... |
from oslo_messaging.rpc import dispatcher as rpc
import six
from senlin.common import exception
from senlin.engine import environment
from senlin.engine import parser
from senlin.engine import service
from senlin.tests.unit.common import base
from senlin.tests.unit.common import utils
from senlin.tests.unit import fak... |
from datetime import date, timedelta
from itertools import starmap
from random import randint
from pytest import mark, raises
from hscommon.testutil import eq_
from ...model.amount import Amount
from ...model.currency import USD
from ...model.entry import Entry
from ...model.transaction import Transaction
from ...pl... |
#!/usr/bin/env python
# encoding: utf-8
"""
fuzz.py
Copyright (c) 2011 Adam Cohen
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 rights to u... |
import numpy as np
import scipy.stats as ss
import pdb
def lptest(x,y,z,x_err,y_err,z_err):
theta,phi,scatter = p[0],p[1],p[2]
if np.abs(theta-np.pi/4)>np.pi/4:
return -np.inf
if np.abs(phi-np.pi/4)>np.pi/4:
return -np.inf
if scatter<0.0:
return -np.inf
Gamma = x*np.sin(thet... |
"""
Peter Kutschera, 2013-09-11
Time-stamp: "2014-05-07 14:26:09 peter"
The server gets an ICMM worldstate URL and calculates an indicator
Execution example (Change service part and identifier):
http://crisma.ait.ac.at/indicators/pywps.cgi?service=WPS&request=Execute&version=1.0.0&identifier=deathsIndicator&datainput... |
import os, sys, argparse, csv
import dxpy
from ..utils.resolver import ResolutionError, resolve_existing_path
from ..utils.printing import fill
from ..compat import str
parser = argparse.ArgumentParser(description="Download a gtable into a tab-separated file. Provide the --csv flag for commas instead of tabs. Arbitr... |
from urllib.request import urlopen
for line in urlopen('https://secure.ecs.soton.ac.uk/status/'):
line = line.decode('utf-8') # Decoding the binary data to text.
if 'Core Priority Devices' in line: #look for 'Core Priority Devices' To find the line of text with the list of issues
linesIWant = line.spl... |
import os
import sys
import time
import lcm
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
from ddapp import lcmspy as spy
import scipy.signal as sig
def sizeof_fmt(num, suffix='B'):
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
if abs(num) < 1024.0:
return "%3.... |
"""
Register Trials with the admin site.
"""
from django.contrib import admin
from rm.trials.models import (Trial, Report, Participant, Variable,
TutorialExample, Invitation)
class VariableInline(admin.StackedInline):
model = Variable
class ParticipantInline(admin.StackedInline):
... |
# vi: ts=4 sw=4
'''
:mod:`ophyd.control.detector` - Ophyd Detectors Class
=====================================================
.. module:: ophyd.control.detector
:synopsis:
'''
from __future__ import print_function
from .signal import (Signal, SignalGroup)
class DetectorStatus(object):
def __init__(self, de... |
#!/usr/bin/env python
"""
This program launches the integration tests suite
"""
from contextlib import contextmanager
import os
from pathlib import Path
import subprocess
import sys
from typing import List
@contextmanager
def down_to_directory(directory: Path) -> None:
"""
A context manager that descends into... |
"""A binary to train CIFAR-10 using a single GPU.
Accuracy:
cifar10_train.py achieves ~86% accuracy after 100K steps (256 epochs of
data) as judged by cifar10_eval.py.
Speed: With batch_size 128.
System | Step Time (sec/batch) | Accuracy
------------------------------------------------------------------
... |
gdir = 'c:/users/batagelj/work/python/graph/graph'
# wdir = 'c:/users/batagelj/work/python/graph/JSON/test'
wdir = 'c:/users/batagelj/work/python/graph/JSON/SN5'
import sys, os, datetime, json
sys.path = [gdir]+sys.path; os.chdir(wdir)
from GraphNew import Graph
# from copy import deepcopy
import TQ
# file = 'W... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import htpc
import json
import logging
import requests
def search(q, cat):
logger = logging.getLogger('modules.torrentsearch')
username = htpc.settings.get('torrents_norbits_username', '')
passkey = htpc.settings.get('torrents_norbits_passkey', '')
result... |
import glob
import pandas as pd
import numpy as np
df1 = pd.read_csv("repeats_hg19.csv")
RRBS_files = glob.glob("RRBS_NormalBCD19pCD27mcell23_44*")
df_dict = {group : df for group, df in df1.groupby(by="chr")}
# In[11]:
from numpy import nan
def between_range(row, group_dict):
# get sub dataframe from dicti... |
import argparse
from django.contrib.gis import gdal
from django.core.management.base import BaseCommand, CommandError
from django.utils.inspect import get_func_args
class LayerOptionAction(argparse.Action):
"""
Custom argparse action for the `ogrinspect` `layer_key` keyword option
which may be an integer... |
from blending.src.decider.decide_null import DecideNull
from blending.src.decider.decide_random import DecideRandom
from blending.src.decider.decide_best_sti import DecideBestSTI
from blending.util.blending_config import BlendConfig
from blending.util.blending_error import blending_status
__author__ = 'DongMin Kim'
... |
from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
MODE = os.getenv('TS_APP_MODE', 'dev')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'transtats.settings.%s' % MODE)
app = Celery('transtats')
# Using a string here means th... |
"""is_sqllab_view
Revision ID: 130915240929
Revises: f231d82b9b26
Create Date: 2018-04-03 08:19:34.098789
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.ext.declarative import declarative_base
from superset import db
# revision identifiers, used by Alembic.
revision = "130915240929"
down_revisio... |
"""Test running bitcoind with the -rpcbind and -rpcallowip options."""
import socket
import sys
from test_framework.test_framework import PivxTestFramework, SkipTest
from test_framework.util import *
from test_framework.netutil import *
class RPCBindTest(PivxTestFramework):
def set_test_params(self):
sel... |
from __future__ import absolute_import, unicode_literals
class MopidyException(Exception):
def __init__(self, message, *args, **kwargs):
super(MopidyException, self).__init__(message, *args, **kwargs)
self._message = message
@property
def message(self):
"""Reimplement message fie... |
from essentia_test import *
from math import *
class TestBandPass(TestCase):
def testRegression(self):
sr = 44100.
pi2 = 2*pi
signal = [.25*cos(t*pi2*5/sr) + \
.25*cos(t*pi2*50/sr) + \
.25*cos(t*pi2*500./sr) + \
.25*cos(t*pi2*5000./sr)
... |
import json
from plone.app.textfield import RichText
import logging
import time
from castle.cms.tiles.base import BaseTile
from castle.cms.widgets import ImageRelatedItemFieldWidget
from plone import api
from plone.app.theming.interfaces import THEME_RESOURCE_NAME
from plone.app.theming.utils import getCurrentTheme
fr... |
"""Tests for Keras activation functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.keras._impl import keras
from tensorflow.python.platform import test
def _ref_softmax(values):
m = np.max(values)
e ... |
from sympy import sympify, Add, ImmutableMatrix as Matrix
from sympy.core.compatibility import u, unicode
from .printing import (VectorLatexPrinter, VectorPrettyPrinter,
VectorStrPrinter)
__all__ = ['Dyadic']
class Dyadic(object):
"""A Dyadic object.
See:
http://en.wikipedia.org/w... |
"""Models for the social_network."""
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
"""Profile is a Model that stores application-specific data about a user.
This is not used directly for authentication/authorization, instead the
Django default User... |
# coding: utf-8
"""Test cases for the limits extension."""
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from modoboa.admin.factories import populate_database
from modoboa.admin.models import Alias, Domain
from modoboa.core.factories import UserFactory
from modoboa.core.models ... |
from uber.common import *
def check_range(badge_num, badge_type):
if badge_num is not None:
try:
badge_num = int(badge_num)
except:
return '"{}" is not a valid badge number (should be an integer)'.format(badge_num)
if badge_num:
min_num, max_num = c.BAD... |
from direct.particles.Particles import Particles
from direct.particles.ParticleEffect import ParticleEffect
from panda3d.core import Vec4
from panda3d.physics import BaseParticleRenderer
class Explosion:
def __init__(self, base):
self.base = base
self.p = Particles()
self.p.setFactory("Po... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.contrib.contenttypes.models import ContentType
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Comment.wall_owner_content_type'
... |
from __future__ import absolute_import
from totalimpact.providers import provider
from totalimpact.providers.provider import Provider, ProviderContentMalformedError, ProviderAuthenticationError
from totalimpact import tiredis
from totalimpact.utils import Retry
from totalimpact.providers.countries_info import country_... |
from boa.interop.Neo.Runtime import GetTrigger,CheckWitness
from boa.interop.Neo.Storage import Get,Put,Delete,GetContext
from boa.interop.Neo.TriggerType import Application, Verification
OWNER = b'\x03\x19\xe0)\xb9%\x85w\x90\xe4\x17\x85\xbe\x9c\xce\xc6\xca\xb1\x98\x96'
def Main(operation, addr, value):
print("R... |
from django import forms
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from tabbed_admin import TabbedModelAdmin
from django.utils.safestring import mark_safe
from django.utils.html import format_html
from django.utils.encoding import force_text
def get_circuit_id_fr... |
#!/usr/bin/env/python
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import random
from datetime import date, timedelta
from mooddiary import create_app
from mooddiary.core import db
from mooddiary.models import *
from faker import Factory
faker = Factory.create(... |
import constants
import abilities
from player import Player
from cards import Card
class DemonPlayer(Player):
def __init__(self, level=1000):
super(DemonPlayer, self).__init__(level)
def _num_of_cards_allowed(self):
return 1
def _total_cost_allowed(self):
return 99
def __rep... |
"""
.. module:: medium_attribute_type_allowed_value
The **Medium Attribute Type Allowed Value** Model.
PostgreSQL Definition
---------------------
The :code:`medium_attribute_type_allowed_value` table is defined in the MusicBrainz Server as:
.. code-block:: sql
CREATE TABLE medium_attribute_type_allowed_value ... |
# -*- coding: utf-8 -*-
"""
Various utilities
"""
from django.conf import settings
from django.contrib.sites.models import Site
from django.template import Variable, TemplateSyntaxError, VariableDoesNotExist
def get_site_metas(with_static=False, with_media=False, extra={}):
"""
Return metas from the current *S... |
import eventlet
from eventlet import greenpool
import greenlet
from oslo.config import cfg
from oslo.messaging._executors import base
from oslo.messaging.openstack.common import excutils
_eventlet_opts = [
cfg.IntOpt('rpc_thread_pool_size',
default=64,
help='Size of RPC greenthread ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.