content stringlengths 4 20k |
|---|
__revision__ = "src/engine/SCons/Scanner/Dir.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
import SCons.Node.FS
import SCons.Scanner
def only_dirs(nodes):
is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir)
return list(filter(is_Dir, nodes))
def DirScanner(**kw):
"""Return a p... |
#!/usr/bin/env python
## (c) 2015 David A. van Leeuwen
from sn.db import *
from sqlalchemy import or_
import logging
def norm(s):
return s.strip().decode("unicode_escape").encode("ascii", "ignore")
def addto(d, key, value):
if not key in d:
d[key] = []
d[key].append(value)
def string(x):
if... |
import unittest2
from pymysql.tests import base
from pymysql import util
class TestNextset(base.PyMySQLTestCase):
def setUp(self):
super(TestNextset, self).setUp()
self.con = self.connections[0]
def test_nextset(self):
cur = self.con.cursor()
cur.execute("SELECT 1; SELECT 2;... |
#!/usr/bin/python
import xml.dom.minidom as minidom
from sys import exit, argv, stderr, stdout
import re
import argparse
parser = argparse.ArgumentParser(description="Format XML")
parser.add_argument('infile', nargs=1)
parser.add_argument('outfile', nargs='?')
args = parser.parse_args()
f = open(args.infile[0],'r')
... |
import optparse, yaml, json
class OptionResolver(object):
"""Resolve user input options"""
def __init__(self):
self.parser = optparse.OptionParser()
self.set_options()
def set_options(self):
"""Use optparser to manage options"""
self.parser.add_option(... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
DATA = np.genfromtxt("data.txt", dtype=int)
SIZE = 4
def count_occurrences(data, pattern):
"""Find all occurrences of pattern and count them"""
pattern = np.fromstring(pattern, dtype=int, sep=' ')
pattern_len = np.shape(pattern)[0]
data_len = ... |
"""Set multiple robots in one configuration to allow for simultaneously planning
"""
from openravepy import *
env = Environment() # create the environment
env.SetViewer('qtcoin') # start the viewer
with env:
# init scene
robot1 = env.ReadRobotURI('robots/barrettwam.robot.xml')
env.Add(robot1,True)
robot... |
"""
Views and functions for serving static files. These are only to be used during
development, and SHOULD NOT be used in a production setting.
"""
import os
import posixpath
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.six.... |
from types import ModuleType
import coalib.bearlib.aspects
from coalib.bearlib.aspects.exceptions import (AspectNotFoundError,
MultipleAspectFoundError)
import pytest
import unittest
class aspectsModuleTest(unittest.TestCase):
def test_module(self):
# chec... |
from datetime import timedelta
import pytest
import marm
@pytest.mark.parametrize(
'file_name,args,as_fo,expected', [
('sonic.ts', ['-select_streams', 'a'], False, {
1: {'codec_type': u'audio',
'dts': 10931520,
'dts_time': 121.461333,
'duration... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
aspect.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
******************... |
#!/usr/bin/env python
'''
DigitalOcean external inventory script
======================================
Generates Ansible inventory of DigitalOcean Droplets.
In addition to the --list and --host options used by Ansible, there are options
for generating JSON of other DigitalOcean data. This is useful when creating
d... |
import sys
import xml.dom.minidom
from getopt import gnu_getopt
from libtpcodegen import NS_TP, get_descendant_text, get_by_path
from libqtcodegen import binding_from_usage, binding_from_decl, extract_arg_or_member_info, format_docstring, gather_externals, gather_custom_lists, get_qt_name, get_headerfile_cmd, RefRegis... |
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_wpa_passphrase_exists(host):
assert host.file("/usr/bin/wpa_passphrase").exists
@pytest.mark.parametrize('line', [
... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
CloudStackException,
cs_argument_spec,
... |
import cgi
import json
import os
import traceback
import urllib
import urlparse
from constants import content_types
from pipes import Pipeline, template
from ranges import RangeParser
from request import Authentication
from response import MultipartContent
from utils import HTTPException
__all__ = ["file_handler", "p... |
"""
Support for Fast.com internet speed testing sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.fastdotcom/
"""
import logging
import voluptuous as vol
import homeassistant.util.dt as dt_util
import homeassistant.helpers.config_validation ... |
from git.test.lib import *
from git.objects.fun import (
traverse_tree_recursive,
traverse_trees_recursive,
tree_to_stream
)
from git.index.fun import (
aggressive_tr... |
#!/usr/bin/env python3
"""
N queens problem.
The (well-known) problem is due to Niklaus Wirth.
This solution is inspired by Dijkstra (Structured Programming). It is
a classic recursive backtracking approach.
"""
N = 8 # Default; command line overrides
class Queens:
def __ini... |
"""Utilities for second set of flag examples.
"""
import os
import time
import sys
import string
import argparse
from collections import namedtuple
from enum import Enum
Result = namedtuple('Result', 'status data')
HTTPStatus = Enum('Status', 'ok not_found error')
POP20_CC = ('CN IN US ID BR PK NG BD RU JP '
... |
import subprocess
import logging
import json
from lib.cuckoo.common.abstracts import Signature
from subprocess import Popen, PIPE
log = logging.getLogger(__name__)
class DetectDEPInHeap(Signature):
name = "Detect DEP bypass in the heap, probably by ROP"
description = "Detects DEP bypass in the heap"
sever... |
"""Test the -uacomment option."""
import re
from test_framework.test_framework import BitcoinTestFramework
from test_framework.test_node import ErrorMatch
from test_framework.util import assert_equal
class UacommentTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.se... |
import sys
class Node(object):
def children(self):
""" A sequence of all children that are Nodes
"""
pass
def show(self, buf=sys.stdout, offset=0, _my_node_name=None):
""" Pretty print the Node and all its attributes and
children (recursively) to a buffer.
... |
"""
vcoptparse is short for Value-Centric Option Parser. It's a tiny argument parsing library. It has
less features than optparse or argparse, but it kicks more ass.
optparse and argparse allow the client to specify the flags that should be parsed, and as an
afterthought specify what keys should appear in the options ... |
HID0_WEBWIZARD = 34200 + 0
HID0_WEBWIZARD = 34200 + 0
HID0_HELP = 34200 + 1
HID0_NEXT = 34200 + 2
HID0_PREV = 34200 + 3
HID0_CREATE = 34200 + 4
HID0_CANCEL = 34200 + 5
HID0_STATUS_DIALOG = 34200 + 6 #step 1
HID1_LST_SESSIONS = 34200 + 7
HID1_BTN_DEL_SES = 34200 + 9 #step 2
HID2_LST_DOCS = 34200 + 10
HID2_BTN_ADD_DO... |
"""
Example of a basic contour plot
Will hopefully help me write a decent interface.
"""
import sys,os
# import the python visualisation interface
from pyvisi import *
# original vtk code
import vtk
import numarray
# generate the x and y grid data
x = numarray.arrayrange(-1, 1, stride=0.5, type='Float')
y = numar... |
'''
Tests for commands module
Nick Mathewson
'''
import unittest
import os, tempfile, re
from test.test_support import run_unittest, reap_children, import_module, \
check_warnings
# Silence Py3k warning
commands = import_module('commands', deprecated=True)
# The modul... |
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'hera.settings'
from django.db import models
from django.db import transaction
from django.contrib.auth import models as auth_models
from django.core.exceptions import PermissionDenied
import datetime
import os
import jsonfield
import binascii
import json
def MoneyFie... |
# Backport of the match_hostname logic introduced in python 3.2
# http://hg.python.org/releasing/3.3.5/file/993955b807b3/Lib/ssl.py
import re
class CertificateError(ValueError):
pass
def _dnsname_match(dn, hostname, max_wildcards=1):
"""Matching according to RFC 6125, section 6.4.3
http://tools.ietf.o... |
from __future__ import division, print_function, unicode_literals
import argparse
import locale
import logging
import sys
from reprounzip.common import setup_logging
from reprounzip_qt import __version__
from reprounzip_qt.usage import record_usage, submit_usage_report
logger = logging.getLogger('reprounzip_qt')
... |
"""Module provider for Mythic Beasts"""
import binascii
import json
import logging
import requests
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry # type: ignore
from lexicon.exce... |
"""
================================================
Compute MNE-dSPM inverse solution on evoked data
================================================
Compute dSPM inverse solution on MNE evoked dataset
and stores the solution in stc files for visualisation.
"""
#
# License: BSD (3-clause)
import matplotlib.pyplot a... |
import unittest
from unittest import mock
from ppb import GameEngine, BaseScene
CONTINUE = True
STOP = False
class TestEngine(unittest.TestCase):
def test_initialize(self):
pass
def test_start(self):
mock_scene = mock.Mock(spec=BaseScene)
mock_scene_class = mock.Mock(spec=BaseScene... |
"""Tests for Tradfri setup."""
from homeassistant.components import tradfri
from homeassistant.helpers.device_registry import (
async_entries_for_config_entry,
async_get_registry as async_get_device_registry,
)
from homeassistant.setup import async_setup_component
from tests.async_mock import patch
from tests.... |
# -*- coding: utf-8 -*-
import commands
import logging
import simplejson
import os
import os.path
import io
import base64
import openerp
import time
import random
import math
import md5
import openerp.addons.hw_proxy.controllers.main as hw_proxy
import pickle
import re
import subprocess
import traceback
from threading ... |
import argparse
import cgi
import random
import string
import yaml
from flexget import options
from flexget.entry import Entry
from flexget.event import event
from flexget.terminal import console
from flexget.utils import requests
@event('manager.subcommand.inject')
def do_cli(manager, options):
if not options.... |
#!/usr/bin/env python
from utils.munin.base import MuninGraph
class NBMuninGraph(MuninGraph):
@property
def graph_config(self):
graph = {
'graph_category' : 'NewsBlur',
'graph_title' : 'NewsBlur Task Pipeline',
'graph_vlabel' : 'Feed fetch pipeline times',
... |
"""
Tests of the neo.core.view.ChannelView class and related functions
"""
import unittest
import numpy as np
import quantities as pq
from numpy.testing import assert_array_equal
from neo.core.analogsignal import AnalogSignal
from neo.core.irregularlysampledsignal import IrregularlySampledSignal
from neo.core.view ... |
from core.himesis import Himesis
import uuid
class Hlayer0rule2(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer0rule2.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(Hlayer0rule2, self).__init__(name='Hlayer0rule2', num_nodes=0, edg... |
# WEEK1
# to amass working examples of most of the form elements needed
# by the SynVin data input pages
import bottle
import pymongo
from bottle import request
print "binding master form to http:/"
@bottle.route('/')
def index():
return bottle.template ('form_elements')
print "binding form to http://text/"
@b... |
import unittest
from traits.util.event_tracer import (
SentinelRecord, ChangeMessageRecord, CallingMessageRecord,
ExitMessageRecord)
class TestMessageRecords(unittest.TestCase):
def test_base_message_record(self):
record = SentinelRecord()
# Check unicode output
self.assertEqual(... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from .models import Article, Bar, Base, Child, Foo, Whiz
class StringLookupTests(TestCase):
def test_string_form_referencing(self):
"""
Regression test for #1661 and #1662
Check that string... |
#!/usr/bin/env python
'''
Hack synchronisation into pyglet event loop.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import select
import threading
import pyglet
class XlibEventDispatcher(object):
def fileno(self):
raise NotImplementedError('abstract')
def dispatch_events(self):
... |
# pylint: disable=missing-docstring
from lettuce import world, steps
from nose.tools import assert_in, assert_true
from common import i_am_registered_for_the_course, visit_scenario_item
from problems_setup import add_problem_to_course, answer_problem
@steps
class ConditionalSteps(object):
COURSE_NUM = 'test_cou... |
import datetime
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core import mail
from django.core import management
from django.test import TestCase
from django.utils.hashcompat import sha_constructor
from registration.mod... |
"""Tests for export."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.core.framework import tensor_shape_pb2
from tensorflow.core.framework import types_pb2
from tensorflow.core.protobuf import meta_graph_pb2
from tensorflow.python.estimat... |
"""
Adds a sphinx directive that can be used to automatically document a plugin.
this::
.. autoplugin :: nose.plugins.foo
:plugin: Pluggy
produces::
.. automodule :: nose.plugins.foo
Options
-------
.. cmdoption :: --foo=BAR, --fooble=BAR
Do the foo thing to the new thing.
Plugin
----... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class product_product(osv.osv):
_inherit = "product.product"
_columns = {
"bom_ids": fields.one2many('mrp.bom', 'product_id','Bill of Materials', domain=[('bom_id','=',False)]),
}
def copy(self, cr, uid, id, default=... |
"""
Routines for determining whether a given story is syndicated from the Associated Press.
The algorithm used in this module was developed using a decision tree algorithm:
'ap_mentions_sentences',
'1' => '1', X
'0' => [ X
'associated_press_mentions',
'1' => [ X
... |
from flask.ext.script import Manager, prompt, prompt_bool, prompt_pass
from harpy_network import app, db
from harpy_network.models.users import User
manager = Manager(app)
@manager.command
def createdb():
"""
Creates the database tables.
"""
db.create_all()
print("Database created.")
@manager.com... |
from sqlalchemy import Boolean, Column, ForeignKey, String
from neutron.db import model_base
from neutron.db import models_v2
class NetPartition(model_base.BASEV2, models_v2.HasId):
__tablename__ = 'net_partitions'
name = Column(String(64))
l3dom_tmplt_id = Column(String(36))
l2dom_tmplt_id = Column(... |
"""
Tests for helper functions.
"""
import json
import mock
import ddt
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from nose.tools import raises
from ..helpers import (
intercept_errors, shim_student_view,
FormDescription, InvalidFieldError
)
class FakeInputException(Exc... |
"""SCons.Tool.gnulink
Tool-specific initialization for the gnu linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundat... |
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 ListAllTickets(Choreography):
def __init__(self, temboo_session):
"""
Create ... |
from unittest.mock import call, patch
from pytest import raises
from vang.bitbucket.has_tag import has_tag
from vang.bitbucket.has_tag import main
from vang.bitbucket.has_tag import parse_args
import pytest
@pytest.fixture
def tags_fixture():
return [
(('project_key', 'repo_slug1'), {
'id':... |
import PySimAvr.Logging.Logging as Logging
logger = Logging.setup_logging('pysimavr')
####################################################################################################
from PySimAvr.Core.CoreHdlParser import Parser
##################################################################################... |
"""
Contains some data structures.
"""
from webob.util.dictmixin import DictMixin
class EnvironHeaders(DictMixin):
"""An object that represents the headers as present in a
WSGI environment.
This object is a wrapper (with no internal state) for a WSGI
request object, representing the CGI-style HTTP_* ... |
def gen():
yield 1
yield 2
yield 3
yield 4
def gen2():
yield -1
print((yield from gen()))
yield 10
yield 11
g = gen2()
print(next(g))
print(next(g))
g.close()
try:
print(next(g))
except StopIteration:
print("StopIteration")
# Now variation of same test, but with leaf generato... |
# -*- encoding: utf-8 -*-
from django.shortcuts import render
import tweetpony
from tweetdelete.forms import AuthForm
from tweetdelete.models import Data
from django.core.context_processors import csrf
CONSUMER_KEY = 'qoHxj86rXhfEbDsT00DflA'
CONSUMER_SECRET = 'PxRKaEkSlI3Il5jX7uUgAuOPR7WtGnMa8uw5WeI'
def get_api(requ... |
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_raises
from sklearn.utils import check_random_state
from sklearn.datasets import load_iris
from sklearn.linear_model import Pe... |
"""
Exposes regular shell commands as services.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/shell_command/
"""
import logging
import subprocess
import shlex
import voluptuous as vol
from homeassistant.helpers import template
from homeassistant.excep... |
from sqlalchemy import Table
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import ForeignKey
from sqlalchemy import UniqueConstraint
from sqlalchemy.orm import relationship
from model import Base
group_join_site = Table(
'group_join_site',
Base.meta... |
import json
from hashlib import md5
from flask import request
from flask.ext.restplus import Resource as RestplusResource
from flask_restplus import Model, fields, reqparse
from app.helpers.data import update_version
from app.models.event import Event as EventModel
from app.api.helpers.error_docs import (
notfoun... |
{
'name': 'Entries Sequence Numbering',
'version': '1.1',
'category': 'Accounting & Finance',
'description': """
This module maintains internal sequence number for accounting entries.
======================================================================
Allows you to configure the accounting sequences... |
import argparse
import os
import subprocess
import sys
def download(base_url, out_dir, name):
url = '%s/%s' % (base_url, name)
dst = os.path.join(out_dir, name)
print 'Downloading', url
subprocess.call([ 'curl', '-o', dst, url ])
def main():
parser = argparse.ArgumentParser(description='Downloads ... |
r"""System for specifying garbage collection (GC) of path based data.
This framework allows for GC of data specified by path names, for example files
on disk. gc.Path objects each represent a single item stored at a path and may
be a base directory,
/tmp/exports/0/...
/tmp/exports/1/...
...
or a fully qualified... |
from nessusobject import NessusObject
class Vulnerability(NessusObject):
def __init__(self, server):
super(Vulnerability, self).__init__(server)
self._id = None
self._count = 0
self._plugin_id = 0
self._plugin_name = 0
self._plugin_family = None
self._vuln_... |
from __future__ import division, absolute_import
class MonkeyPatcher(object):
"""
Cover up attributes with new objects. Neat for monkey-patching things for
unit-testing purposes.
"""
def __init__(self, *patches):
# List of patches to apply in (obj, name, value).
self._patchesToApp... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import time
from ansible.module_utils._text import to_text
from ansible.module_utils.basic i... |
microcode = '''
def macroop MOVD_MMX_R {
mov2fp mmx, regm, srcSize=dsz, destSize=8
};
def macroop MOVD_MMX_M {
ldfp mmx, seg, sib, disp, dataSize=8
};
def macroop MOVD_MMX_P {
rdip t7
ldfp mmx, seg, riprel, disp, dataSize=8
};
def macroop MOVD_R_MMX {
mov2int reg, mmxm, size=dsz
};
def macroop ... |
import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_1_2(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 1 2'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main() |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
from __future__ import absolute_import, unicode_literals
import re
import os
import jieba
import sys
import marshal
from functools import wraps
from .._compat import *
from .viterbi import viterbi
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
CHAR_STATE_TAB_P = "char_state_tab... |
import logging
import keystoneclient.v2_0.client as ksclient
from .exc import *
class Keystone (object):
log = logging.getLogger(__name__)
def __init__(self, username=None, password=None,
token=None, tenant_name=None,
tenant_id=None, auth_url=None,
endpoin... |
"""Parser for JavaScript files."""
from closure_linter import javascripttokens
from closure_linter import statetracker
from closure_linter import tokenutil
# Shorthand
Type = javascripttokens.JavaScriptTokenType
class JsDocFlag(statetracker.DocFlag):
"""Javascript doc flag object.
Attribute:
flag_type: p... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from itertools import product
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
from ansible.utils.listify import listify_lookup_plugin_terms
class LookupModule(LookupBase):
"""
Create ... |
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from MetricSingle import *
class MetricSingleInputWidget( GridLayout ):
def __init__( self, metr... |
"""Tests for Keras Layer utils."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python import keras
from tensorflow.python.keras.utils import vis_utils
from tensorflow.python.lib.io import file_io
from tensorflow.python.platform import te... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.fields
import modelcluster.contrib.taggit
class Migration(migrations.Migration):
dependencies = [
('taggit', '00... |
N_str = input("Input a large whole number: ")
while N_str.isdigit()==False or int(N_str)<1:
print("Input must be a whole number. Try again")
N_str = input("Input a large whole number: ")
while True:
spl_str=input("Split: ")
if spl_str.isdigit()==False:
print("Input must be a whole number. ... |
import re
import uuid
XASSET_LOCATION_TAG = 'c4x'
XASSET_SRCREF_PREFIX = 'xasset:'
XASSET_THUMBNAIL_TAIL_NAME = '.jpg'
STREAM_DATA_CHUNK_SIZE = 1024
import os
import logging
import StringIO
from urlparse import urlparse, urlunparse, parse_qsl
from urllib import urlencode
from opaque_keys.edx.locator import AssetLoc... |
"""The Dirichlet Multinomial distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distributions.python.ops import distribution
from tensorflow.contrib.distributions.python.ops import distribution_util
from tensorflo... |
import numpy as np
from nose.tools import raises
from stingray import Lightcurve
from stingray import Powerspectrum, AveragedPowerspectrum
from stingray.powerspectrum import classical_pvalue
np.random.seed(20150907)
class TestPowerspectrum(object):
@classmethod
def setup_class(cls):
tstart = 0.0
... |
from openerp.exceptions import UserError, AccessError
from test_sale_common import TestSale
class TestSaleOrder(TestSale):
def test_sale_order(self):
""" Test the sale order flow (invoicing and quantity updates)
- Invoice repeatedly while varrying delivered quantities and check that invoice a... |
# coding=utf-8
""" PyMimircache a cache trace analysis platform.
.. moduleauthor:: Juncheng Yang <<EMAIL>>, Ymir Vigfusson
"""
import os
import sys
try:
import matplotlib
matplotlib.use('Agg')
except Exception as e:
print("WARNING: {}, fail to import matplotlib, "
"plotting function may be lim... |
"""tests basic polymorphic mapper loading/saving, minimal relationships"""
from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.orm import exc as orm_exc
from sqlalchemy.test import Column, testing
from sqlalchemy.util impor... |
"""Tests for slim.evaluation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
import os
import time
import numpy as np
from tensorflow.contrib.framework.python.ops import variables as variables_lib
from tensorflow.contrib.metrics.python.ops... |
from __future__ import unicode_literals
import webnotes, json
from webnotes.widgets import reportview
@webnotes.whitelist()
def get_data(module, doctypes='[]'):
doctypes = json.loads(doctypes)
return {
"reports": get_report_list(module),
"item_count": get_count(doctypes)
}
def get_count(doctypes):
count = {}... |
# -*- coding: utf-8 -*-
'''The GEvent implementation of PyVows runner.'''
# pyvows testing engine
# https://github.com/heynemann/pyvows
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann <EMAIL>
from __future__ import absolute_import
import in... |
"""add data processing cache table
Revision ID: 3857f395fb1d
Revises: 10da2e0bc3bb
Create Date: 2015-06-17 17:53:13.049138
"""
# revision identifiers, used by Alembic.
revision = '3857f395fb1d'
down_revision = '10da2e0bc3bb'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
crc and uuid properties
"""
from rebulk.remodule import re
from rebulk import Rebulk
from ..common.validators import seps_surround
def crc():
"""
Builder for rebulk object.
:return: Created Rebulk object
:rtype: Rebulk
"""
rebulk = Rebulk().re... |
import os
import io
import socket
import traceback
from django.conf import settings
import requests
from kombu import Connection
from PIL import Image
import olympia.core.logger
from olympia.amo import search
from olympia.amo.templatetags.jinja_helpers import user_media_path
monitor_log = olympia.core.logger.get... |
import logging
import re
from urllib.parse import urljoin, urlunparse
from streamlink.exceptions import PluginError
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
class N13TV(Plugin):
url_re = re.compile(r... |
"""
Rackspace Cloud Inventory
Authors:
Jesse Keating <<EMAIL>,
Paul Durivage <<EMAIL>>,
Matt Martz <<EMAIL>>
Description:
Generates inventory that Ansible can understand by making API request to
Rackspace Public Cloud API
When run against a specific host, this script returns variables simila... |
MODEL_PARAMS = {
# Type of model that the rest of these parameters apply to.
'model': "CLA",
# Version that specifies the format of the config.
'version': 1,
# Intermediate variables used to compute fields in modelParams and also
# referenced from the control section.
'aggregationInfo': { ... |
from south.db import db
from django.db import models
from mysite.search.models import *
class Migration:
def forwards(self, orm):
# Adding model 'WannaHelperNote'
db.create_table('search_wannahelpernote', (
('id', orm['search.wannahelpernote:id']),
('created_da... |
import os
import sys
import time
#try:
import cPickle as pickle
#except ImportError:
# import pickle
sys.path.append('/Users/loriab/linux/qcdb')
sys.path.append('/Users/loriab/linux/qcdb/databases')
#import qcdb
import qcdb.dbwrap
homewrite = '.'
dbnet = {}
#dbnet['S22'] = ['dft', 'saptone', 'pt2']
#dbnet['NBC10'] ... |
"""Code for sentences tokenization: Greek.
Sentence tokenization for Ancient Greek is available using a regular-expression based tokenizer.
>>> from cltk.sentence.grc import GreekRegexSentenceTokenizer
>>> from cltk.languages.example_texts import get_example_text
>>> splitter = GreekRegexSentenceTokenizer()
>>> sente... |
from openquake.hazardlib.gsim.toro_1997 import (
ToroEtAl1997MblgNSHMP2008,
ToroEtAl1997MwNSHMP2008
)
from openquake.hazardlib.tests.gsim.utils import BaseGSIMTestCase
# Test data generated from subroutine 'getToro' in hazgridXnga2.f
class ToroEtAl1997MblgNSHMPTestCase(BaseGSIMTestCase):
GSIM_CLASS = To... |
import json
import struct
import re
import base64
import httplib
import sys
settings = {}
class BitcoinRPC:
OBJID = 1
def __init__(self, host, port, username, password):
authpair = "%s:%s" % (username, password)
self.authhdr = "Basic %s" % (base64.b64encode(authpair))
self.conn = httplib.HTTPConnection(host,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.