content stringlengths 4 20k |
|---|
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: aci_intf_policy_l2
short_description: Manage Layer 2 interfa... |
import math
import numpy as np
from ..cov import compute_whitener
from ..io.pick import pick_info
from ..forward import apply_forward
from ..utils import (logger, verbose, check_random_state, _check_preload,
_validate_type)
@verbose
def simulate_evoked(fwd, stc, info, cov, nave=30, iir_filter=N... |
import cPickle as pickle
import numpy as np
import os, sys
import scipy.sparse as ss
model_root = '../models/cer'
uidpath = '../complete/uid';
vidpath = '../complete/vid';
tridpath = '../complete/f%dtr.idl';
trpath = '../complete/f%dtr.txt';
teidpath = '../complete/f%dte.%s.idl';
tepath = '../complete/f%dte.%s.txt'
sc... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RasterWriter.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*************************... |
"""SPOJ Problem Set (classical)
2148. Candy III
Problem code: CANDY3
A class went to a school trip. And, as usually, all N kids have got their backpacks stuffed with candy. But soon quarrels started all over the place, as some of the kids had more candies than others. Soon, the teacher realized that he has to ste... |
"""Provides a thread-local transactional wrapper around the root Engine class.
The ``threadlocal`` module is invoked when using the
``strategy="threadlocal"`` flag with :func:`~sqlalchemy.engine.create_engine`.
This module is semi-private and is invoked automatically when the threadlocal
engine strategy is used.
"""
... |
import StringIO
import unittest2 as unittest
from webkitpy.common.system.executive import ScriptError
from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.outputcapture import OutputCapture
from web... |
"""
Tests for miscellaneous functionality in the `funcs` module
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ...tests.helper import pytest
from ... import units as u
from ...time import Time
def test_sun():
"""
Tes... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import get_exception
try:
import pan.xapi
from pan.xapi import PanXapiError
HAS_... |
import json
import os
import unittest
from tellapart.aurproxy.mirror import (
_FALLBACK_MSG,
load_mirror_updater,
MirrorUpdater)
from tellapart.aurproxy.config import SourceEndpoint
def dummy_update(self, kill_running=True):
self._needs_update = False
class MirrorUpdaterTests(unittest.TestCase):
def test_... |
# -*- coding: utf-8 -*-
from . import pygments_override
from . import switcher
import sphinx.environment
import sphinx.builders.html
from docutils import nodes
def setup(app):
if getattr(app.config, 'html_translator_class', None):
app.warn("Overriding the explicitly set html_translator_class setting",
... |
"""tools.gch
Quick tool for creating precompiled headers for gcc
This is a very trimmed down copy SCons.Tool.qt to get a
simple gchBuilder
-Nathan Letwory (jesterKing)
"""
#
import os.path
import re
import SCons.Defaults
import SCons.Tool
import SCons.Util
header_extensions = [".hxx", ".hpp", ".hh", ".h"]
cpluspl... |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
import logging
import warnings
from admin_scripts.tests import AdminScriptTestCase
from django.core import mail
from django.core.files.temp import NamedTemporaryFile
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.te... |
"""Class to hold all cover accessories."""
import logging
from pyhap.const import CATEGORY_GARAGE_DOOR_OPENER, CATEGORY_WINDOW_COVERING
from homeassistant.components.cover import (
ATTR_CURRENT_POSITION, ATTR_POSITION, DOMAIN, SUPPORT_STOP)
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_SUPPORTED_FEAT... |
import json
from datetime import datetime
from prettytable import PrettyTable
from aovek.network.network import YOLO
from aovek.utils.data_loading import DataLoading
class Train(DataLoading):
"""
Class for training YOLO network
"""
def __init__(self, config):
super().__init__(config)
... |
"""Exception handling statements: assert, etc."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import tensor_util
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.util import tf_inspect
def asse... |
import json
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import env_fallback
from ansible.module_utils.network.common.utils import to_list
from ansible.module_utils.connection import Connection, ConnectionError
_DEVICE_CONFIGS = {}
ios_provider_spec = {
'host': dict(),
'port... |
from . import gitlab_ci_controller |
from ansible import utils, errors
from ansible.utils import template
import os
class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
def run(self, terms, inject=None, **kwargs):
try:
terms = template.template(self.basedir, terms, inject)
... |
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
from functional.tests.identity.v3 import test_identity
class DomainTests(test_identity.IdentityTests):
def test_domain_create(self):
domain_name = data_utils.rand_name('TestDomain')
raw_output = self.openstack('do... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 18 11:40:36 2017
@author: Steven
"""
import os
from func import exists
def instructions():
usecase = "Cycling through frames. \'q\' to exit, \'y\' to confirm frame"
usecase += " is positive, otherwise hit \'n\'. \'r\' serves to reverse."
usecase += " When us... |
from __future__ import unicode_literals
from hy import HyString
from hy.models import HyObject
from hy.compiler import hy_compile
from hy.errors import HyCompileError, HyTypeError
from hy.lex.exceptions import LexException
from hy.lex import tokenize
from hy._compat import PY3
import ast
def _ast_spotcheck(arg, roo... |
import arducopter
import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, mavwp, random
def unit_test(mavproxy, mav):
'''A scripted flight plan for testing AP_Limits'''
time.sleep(5)
print "# Setting AP_Limits parameters"
mavproxy.send('param set LIM_ENABLED 1\n')
... |
import xml.sax
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from explore.models import Topic, Article, TopicWeight
from sys import stderr, exit
class Command(BaseCommand) :
args = '<topic mapping file>'
help = 'loads document to topic mapping file into D... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def load_fixture(name):
path = os.... |
"""`StackContext` allows applications to maintain threadlocal-like state
that follows execution as it moves to other execution contexts.
The motivating examples are to eliminate the need for explicit
``async_callback`` wrappers (as in `tornado.web.RequestHandler`), and to
allow some additional context to be kept for l... |
#!/usr/bin/env python
import pygtk
import gtk
import gobject
import operator
import time
import string
import math
import socket
import select
import hildon
import struct
import mmap
import time
import dbus, dbus.service
from dbus.mainloop.glib import DBusGMainLoop
class DashBoard:
height = 396
width = 696
... |
import random,time
import global_data
import os, signal
import os.path
import sys, json
import data_gatherer
import Queue
import chat
import twitter
import threading
import pprint
def GetConversationSymbols(g_data, tweet=None, user=None):
symbols = {}
if not user is None:
g_data.dbmgr.TFIDF(user=user)... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from units.compat import unittest
from units.compat.mock import ... |
"""Read shared style definitions"""
# package imports
from ..shared.xmltools import fromstring, QName
from ..shared.exc import MissingNumberFormat
from ..style import Style, NumberFormat
def read_style_table(xml_source):
"""Read styles from the shared style table"""
table = {}
xmlns = 'http://schemas.ope... |
#!/usr/bin/env python
# coding=utf-8
import re
import string
import time
import database
from lib import contants
from lib.manager import Manager
from lib.logger import log
from lib.exp_parser import ExpParser
from model.instance import Instance
from plug import namenode_web,resourcemanager_web,check_instance_state
... |
import os.path
import time
from django.core.management.base import BaseCommand
from django.conf import settings
import mitxmako
from django.core.mail import send_mass_mail
import sys
import datetime
def chunks(l, n):
""" Yield successive n-sized chunks from l.
"""
for i in xrange(0, len(l), n):
... |
"""Partials contain organized units for templating."""
import os
from grow.documents import document_front_matter
from grow.common import utils
split_front_matter = document_front_matter.DocumentFrontMatter.split_front_matter
class Partial(object):
"""Partial from the partial directory."""
def __init__(se... |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.db import models
from mock import patch
from sentry.models import (
AuditLogEntry,
AuditLogEntryEvent,
AuthIdentity,
AuthProvider,
Organization,
OrganizationMember,
TotpInterface,
)
from sentry.... |
"""TensorFlow Debugger (tfdbg) Utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
from six.moves import xrange # pylint: disable=redefined-builtin
def add_debug_tensor_watch(run_options,
node_name,
... |
import os
import re
import logging
import logging.handlers
import functools
import json
import gzip
import tarfile
from six.moves.urllib import parse
from copy import copy
from codecs import open
from contextlib import contextmanager
from six import StringIO, functools, string_types
import warnings
from datetime import... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: aci_interface_policy_l2
short_description: Manage Layer 2 in... |
"""Mapping a vertical table as a dictionary.
This example illustrates accessing and modifying a "vertical" (or
"properties", or pivoted) table via a dict-like interface. These are tables
that store free-form object properties as rows instead of columns. For
example, instead of::
# A regular ("horizontal") table h... |
import codecs
import os
import re
import sys
from setuptools import setup, find_packages
# Read the version from __init__ to avoid importing ofxparse while installing.
# This lets the install work when the user does not have BeautifulSoup
# installed.
VERSION = re.search(r"__version__ = '(.*?)'",
... |
from assertpy import assert_that,fail
class TestNone(object):
def test_fail(self):
try:
fail()
fail('should have raised error')
except AssertionError as ex:
assert_that(str(ex)).is_equal_to('Fail!')
def test_fail_msg(self):
try:
fail('so... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.action_chains import ActionChains
from random import randint
import time
import unittest
from qa.web_tests import config
class TestTerminateInstance(un... |
"""Unit tests to cover SpotlightService."""
__author__ = '<EMAIL> (Joseph DiLallo)'
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..'))
import unittest
from adspygoogle.common import Utils
from tests.adspygoogle.dfa.v1_18 import client
from tests.adspygoogle.dfa.v1_18 import HTTP_PROXY
from... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.base.cmd_line_spec_parser import CmdLineSpecParser
from pants.base.specs import DescendantAddresses, SiblingAddresses, SingleAddress
from pants_test.test_base import TestBase
def single(directory, name=None):
n... |
from array import array
from whoosh.compat import xrange
from whoosh.system import emptybytes
from whoosh.system import pack_byte, unpack_byte
from whoosh.system import pack_ushort_le, unpack_ushort_le
from whoosh.system import pack_uint_le, unpack_uint_le
def delta_encode(nums):
base = 0
for n in nums:
... |
'''Unit tests for watchlist.py.'''
import unittest2 as unittest
from webkitpy.common.checkout.diff_test_data import DIFF_TEST_DATA
from webkitpy.common.watchlist.watchlistparser import WatchListParser
class WatchListTest(unittest.TestCase):
def setUp(self):
self._watch_list_parser = WatchListParser()
... |
"""
Some unit tests for authenticating over a Transport.
"""
import sys
import threading
import unittest
from paramiko import Transport, ServerInterface, RSAKey, DSSKey, \
SSHException, BadAuthenticationType, InteractiveQuery, ChannelException, \
AuthenticationException
from paramiko import AUTH_FAILED, AUTH_... |
from boto.regioninfo import RegionInfo, get_regions
def regions():
"""
Get all available regions for the Amazon Machine Learning.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
from boto.machinelearning.layer1 import MachineLearningConnection
return get_regions('m... |
import unittest
from kyu7.total_licks import total_licks
class TestTotalClicks(unittest.TestCase):
def test_freezing_temps_260(self):
self.assertEqual('It took 260 licks to get to the tootsie roll center of a tootsie pop. The toughest challenge was freezing temps.',
total_licks(... |
import random
import zlib
import base64
import urllib2
import twitter
from django.conf import settings
from account.models import other_service
def twitter_account_raw(username, password):
return twitter.Api(username=username, password=password)
def twitter_account_for_user(user):
profile = user.get_profi... |
from oslo.config import cfg
meta_plugin_opts = [
cfg.StrOpt('plugin_list', default='',
help=_("List of plugins to load")),
cfg.StrOpt('l3_plugin_list', default='',
help=_("List of L3 plugins to load")),
cfg.StrOpt('default_flavor', default='',
help=_("Default f... |
"""Unit tests for the memoryview
XXX We need more tests! Some tests are in test_bytes
"""
import unittest
import test.support
import sys
import gc
import weakref
import array
import io
class AbstractMemoryTests:
source_bytes = b"abcdef"
@property
def _source(self):
return self.source_bytes
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
from splash.utils import to_bytes, to_unicode
class ToUnicodeTest(unittest.TestCase):
def test_converting_an_utf8_encoded_string_to_unicode(self):
self.assertEqual(to_unicode(b'lel\xc3\xb1e'), u'lel\xf1e')
def test_conver... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_table('invite', 'phonebook_invite')
def backwards(self, orm):
db.rename_table('phonebook_invi... |
from browser import document as doc
from browser import window, html, markdown
import highlight
import time
def run(ev):
# run the code in the elt after the button
ix = ev.target.parent.children.index(ev.target)
elt = ev.target.parent.children[ix+1]
exec(elt.text)
elt.focus()
def load(url,target... |
import ntpath
import os
from test.test_support import TestFailed
from test import test_support, test_genericpath
import unittest
def tester(fn, wantResult):
fn = fn.replace("\\", "\\\\")
gotResult = eval(fn)
if wantResult != gotResult:
raise TestFailed, "%s should return: %s but returned: %s" \
... |
import copy
from conary import conarycfg
from conary import conaryclient
from conary_test import rephelp
class AuthHelper(rephelp.RepositoryHelper):
def setupEntitlement(self, repos, group, ent, reposLabel, troves, label,
onDisk = True, withClass = False):
# just create the gro... |
"""Provide XBlock urls"""
from django.conf.urls import include, patterns, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from workbench.scenarios import init_scenarios
admin.autodiscover()
init_scenarios()
urlpatterns = patterns(
'workbench.views',
... |
import configparser
import datetime
import json
import os.path
import re
import requests
import youtube_dl
def read_config(section, key):
config = configparser.ConfigParser()
config.read('config.cfg')
return config[section][key]
def is_invalid(date):
try:
datetime.datetime.strptime(date, '%Y-%... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
parse_iso8601,
float_or_none,
int_or_none,
compat_str,
determine_ext,
)
class HitboxIE(InfoExtractor):
IE_NAME = 'hitbox'
_VALID_URL = r'https?://(?:w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import xlrd
import xlwt
import datetime
import os
class excelProcess:
def __init__(self,keywordExcelFile,mainExcelFile):
self.keywordExcelFile = keywordExcelFile
self.mainExcelFile = mainExcelFile
def WriteLog(self, message,date):
fileName... |
"""
The SunGrid Engine runner
The main() function of this module will be executed on the
compute node by the submitted job. It accepts as a single
argument the shared temp folder containing the package archive
and pickled task to run, and carries out these steps:
- extract tarfile of package dependencies and place on... |
import inspect
from copy import copy
from django.conf import settings
from django.utils import timezone
from django.utils.functional import cached_property
from django.utils.six.moves import range
from .query_utils import QueryWrapper
class RegisterLookupMixin(object):
def _get_lookup(self, lookup_name):
... |
"""Generic thread tests.
Meant to be used by dummy_thread and thread. To allow for different modules
to be used, test_main() can be called with the module to use as the thread
implementation as its sole argument.
"""
import _dummy_thread as _thread
import time
import queue
import random
import unittest
from test imp... |
"""
Norwegian-specific Form helpers
"""
import re, datetime
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class NOZipCodeField(RegexField):
default_error_mes... |
"""Registry for JavaScript library dependencies."""
import itertools
import os
from extensions.dependencies import dependencies_config
import feconf
import jinja_utils
import utils
class Registry(object):
"""Registry of all JS/CSS library dependencies."""
@classmethod
def get_dependency_html(cls, depen... |
"""Tests for numpy_io."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.estimator.inputs import numpy_io
from tensorflow.python.framework import errors
from tensorflow.python.platform import test
from tensorflow.... |
# -*- coding: utf-8 -*-
from google.appengine.api import users
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils import simpl... |
{
'name': 'Lunch Orders',
'author': 'OpenERP SA',
'version': '0.2',
'depends': ['base', 'report'],
'category' : 'Tools',
'summary': 'Lunch Order, Meal, Food',
'description': """
The base module to manage lunch.
================================
Many companies order sandwiches, pizzas and oth... |
"""KafkaGroupIODatasets"""
import sys
import tensorflow as tf
from tensorflow_io.python.ops import core_ops
class KafkaGroupIODataset(tf.data.Dataset):
"""Represents a streaming dataset from kafka using consumer groups.
The dataset is created by fetching messages from kafka using consumer clients
which ... |
from ..util import jython, pypy, defaultdict, decorator, py2k
import decimal
import gc
import time
import random
import sys
import types
if jython:
def jython_gc_collect(*args):
"""aggressive gc.collect for tests."""
gc.collect()
time.sleep(0.1)
gc.collect()
gc.collect()
... |
import abc
from oslo_log import log as logging
import six
from tempest import auth
from tempest import config
from tempest import exceptions
CONF = config.CONF
LOG = logging.getLogger(__name__)
# Type of credentials available from configuration
CREDENTIAL_TYPES = {
'identity_admin': ('identity', 'admin'),
'... |
from pyb import Pin, ADC
import time
def arduino_map(x, in_min, in_max, out_min, out_max):
return (x - in_min) * (out_max - out_min) // (in_max - in_min) + out_min
def normalize(x, in_min, in_max, out_min=-1, out_max=1):
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
def expo... |
"""IDA utils by @mykill"""
import idc
import ida_ua
import idaapi
import idautils
import ida_kernwin
import binascii
import logging
import numbers
from collections import namedtuple
__author__ = 'Michael Bailey'
__copyright__ = 'Copyright (C) 2019 FireEye, Inc.'
__license__ = 'Apache License 2.0'
__version__ = '1.0'... |
from tests.unit import unittest
from mock import call, Mock, patch, sentinel
import codecs
from boto.glacier.layer1 import Layer1
from boto.glacier.layer2 import Layer2
import boto.glacier.vault
from boto.glacier.vault import Vault
from boto.glacier.vault import Job
from datetime import datetime, tzinfo, timedelta
... |
import json
import logging
import os
import pytest
import requests
import socket
from errbot.backends.test import FullStackTest
from time import sleep
log = logging.getLogger(__name__)
PYTHONOBJECT = ['foo', {'bar': ('baz', None, 1.0, 2)}]
JSONOBJECT = json.dumps(PYTHONOBJECT)
# Webserver port is picked based on the ... |
"""
Unittests for deleting a course in an chosen modulestore
"""
import unittest
import mock
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from django.core.management import CommandError
from contentstore.management.commands.delete_course import Command # pylint: disable=import-error
from contentstor... |
import re
from openerp.osv import osv, fields
class service_authorization(osv.osv):
"""Service Authorization"""
_inherit = 'nautical.service_authorization'
def name_get(self, cr, uid, ids, context=None):
# always return the full hierarchical name
res = {}
for line in self.brow... |
"""The tests for the MQTT switch platform."""
import unittest
from homeassistant.bootstrap import _setup_component
from homeassistant.const import STATE_ON, STATE_OFF, ATTR_ASSUMED_STATE
import homeassistant.components.switch as switch
from tests.common import (
mock_mqtt_component, fire_mqtt_message, get_test_hom... |
# http://wiki.python.org/moin/PythonDecoratorLibrary#Retry
import math
import time
# Retry decorator with exponential backoff
def retry(tries, delay=1, backoff=2):
"""Retries a function or method until it returns True.
delay sets the initial delay, and backoff sets how much the delay should
lengthen after eac... |
from app import app, db, lm
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, UserMixin
from hashlib import md5
import re
import sys
if sys.version_info >= (3,0):
enable_search = False
else:
enable_search = True
import flask_whooshalchemy as whooshalchemy
followers = db.Table('followe... |
"""In order for the multiprocessing module to spawn children correctly on
Windows, we need to be running a Python module that can be imported
(which means a file in sys.path that ends in .py). In addition, we need to
ensure that sys.path / PYTHONPATH is set and propagating correctly.
This module enforces that."""
imp... |
from phystricks import *
def TgCercleTrigono():
pspict,fig = SinglePicture("TgCercleTrigono")
O=Point(0,0)
X=Point(1,0)
Cercle=Circle(O,2)
P=Cercle.get_point(50)
Q=Cercle.get_point(150)
vP=Vector(P)
vQ=Vector(Q)
vP.parameters.color="red"
vQ.parameters.color="cyan"
theta=Angle(X,O,P)
theta.put_mark(0.3,No... |
"""ModelInflection
* handles various naming lookups for models
* can override based on model class variables
"""
import re
class ModelInflector(object):
def __new__(cls, model):
try:
return _inflectors[cls]
except KeyError:
inflector = super(ModelInflector, cls).__new__(cls, model)
_inflec... |
"""
kallithea.lib.celerylib.__init__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
celery libs for Kallithea
This file was forked by the Kallithea project in July 2014.
Original author and date, and relevant copyright and licensing information is below:
:created_on: Nov 27, 2010
:author: marcink
:copyright: (c) 2013 RhodeCode Gmb... |
from __future__ import print_function
import sys
import time
import os
import numpy as np
from numba import njit, stencil
try:
from PIL import Image
except ImportError:
raise RuntimeError("Pillow is needed to run this example. Try 'conda install pillow'")
@njit
def xsten(a):
ret = np.zeros_like(a)
a... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod, abstractproperty
class BaseDag(object):
"""
Base DAG object that both the SimpleDag and DAG inherit.
"""
__meta... |
"""Tests for tensorflow.ops.tf.variable_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.python.platform
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import errors
from tensorflow.python.framework impo... |
from server import app, db
from flask import (render_template, jsonify, request, redirect, url_for,
Response, make_response)
from models import Resource, Tags
from operator import itemgetter
import json
result = [] # Global result list to return result as JSON
r = Resource() # Global Instance of R... |
import logging
from neutronclient.neutron import v2_0 as neutronV20
def _format_timestamp(component):
try:
return component['heartbeat_timestamp'].split(".", 2)[0]
except Exception:
return ''
class ListAgent(neutronV20.ListCommand):
"""List agents."""
resource = 'agent'
log = l... |
"""
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 ... |
import unittest as ut
import unittest_decorators as utx
import numpy as np
import espressomd
import espressomd.lb
from scipy.optimize import curve_fit
AGRID = .5
N_CELLS = 12
TAU = 0.002
SEED = 1
DENS = 2.4
VISC = 1.8
KT = 0.8
class TestLBPressureTensor:
"""Tests that the thermalized LB pressure auto correlatio... |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
float_or_none,
int_or_none,
parse_iso8601,
sanitized_Request,
)
class ToggleIE(InfoExtractor):
IE_NAME = 'toggle'
_VALI... |
# handy helper for calling system calls.
# calls AnsibleModule.run_command and prints a more appropriate message
# exec_path - path to file to execute, with all its arguments.
# E.g "/sbin/ip -o link show"
# failure_msg - what message to print on failure
def run_cmd(module, exec_path):
(_rc, out, _err) = module.run... |
# Large amount of credit goes to:
# https://github.com/keras-team/keras-contrib/blob/master/examples/improved_wgan.py
# which I've used as a reference for this implementation
from __future__ import print_function, division
from keras.datasets import mnist
from keras.layers.merge import _Merge
from keras.layers import... |
from django.test import TestCase
from .models import (
CompetingTeam, Event, Group, IndividualCompetitor, Membership, Person,
)
class MultiTableTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.alice = Person.objects.create(name='Alice')
cls.bob = Person.objects.create(name='Bob')... |
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from notejam.tests import create_user
from notes.models import Note
class NoteTest(TestCase):
def setUp(self):
user_data = {
'email': '<EMAIL>',
'password': 'secure_password'
}
se... |
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 caffe2.python.test_util import TestCase
import tempfile
class TestCounterOps(TestCase):
def test_counter_ops(self):
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible import constants as C
from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, AnsibleFileNotFound, AnsibleAssertionError
from ansible.module_utils._text import to_native
from ansible.module_... |
#!/usr/bin/env python
from __future__ import division
"""Functions supporting the QIIME denoiser"""
__author__ = "Jens Reeder"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Jens Reeder", "Greg Caporaso"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Justin Kuczynski"
__email__ ... |
"""Contains a single class :class:`MultiRegistry`,
please see doc string in the class for the further information.
"""
#todo: allow adding dictionaries as registry stores
#todo: support caching
from import_utils import import_module_from
__version__ = '0.0.2'
class MultiRegistry(object):
"""Allows to aggregate ke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.