content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
'''
Utility testing
'''
# Pyhaa - Templating system for Python 3
# Copyright (c) 2011 Tomasz Kowalczyk
# Contact e-mail: <EMAIL>
#
# This library is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Sof... |
import subprocess
import shlex, re
import os
from subprocess import CalledProcessError
from datetime import *
def find(name):
'''
returns a list of tuples (package_name, description) for apt-cache search results
'''
cmd = 'apt-cache search %s' % name
args = shlex.split(cmd)
try:
out... |
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
import numpy as np
from sklearn import ensemble
from sklearn.metrics import roc_auc_score
def bernoulli_gbm():
#Log.info("Importing prostate.csv data...\n")
prostate_train = h2o.import_file(path=pyunit_utils... |
from __future__ import print_function
from setuptools import setup, find_packages
# See here for more options:
# <http://pythonhosted.org/setuptools/setuptools.html>
mcloud_version = '1.0.3'
setup(
name='mcloud-plugin-haproxy',
version=mcloud_version,
author='Alex Rudakov',
author_email='<EMAIL>',
... |
"""
Settings class
__init__()
__str__()
__repr__()
reset()
load()
save()
ApplicationSettings class (Settings)
__init__( homeFolderName, dataFolderName, settingsFolderName, settingsFilename )
BiblelatorProjectSettings class (Settings)
__init__( projectFolderpath )
saveNameAndAbbrev... |
from pylearn2.models.mlp import MLP
from pylearn2.models.maxout import Maxout
from pylearn2.training_algorithms.sgd import SGD
import logging
import warnings
import sys
import numpy as np
from theano.compat import six
from theano import config
from theano import function
from theano.gof.op import get_debug_values
impo... |
import string
import xmlrpclib
import random
# common modules imports
from spacewalk.common import rhnCache, rhnFlags, rhn_rpm
from spacewalk.common.rhnLog import log_debug
from spacewalk.common.rhnConfig import CFG
from spacewalk.common.rhnException import rhnFault
from spacewalk.common.rhnTranslate import _
# serve... |
# -*- coding: utf-8 -*-
from flask.ext.wtf import Form, validators
from flask.ext.babel import gettext as _
from flask import flash
from wtforms.ext.sqlalchemy.orm import model_form
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms import StringField, SelectField, SubmitField, FormField, TextFiel... |
import signal
import socket
import time
from zktraffic.endpoints.stats_server import StatsServer
from zktraffic.base.process import ProcessOptions
from twitter.common import app, log
from twitter.common.http import HttpServer
from twitter.common.http.diagnostics import DiagnosticsEndpoints
def setup():
app.add_op... |
from __future__ import absolute_import
import datetime
import logging
import six
import sentry
from contextlib import contextmanager
from django.db import transaction
from sentry.utils.cache import memoize
from .param import Param
class Mediator(object):
"""
Objects that encapsulte domain logic.
Media... |
import datetime
def group_log_entries(user, year, month):
'''
Processes and regroups a list of workouts so they can be more easily
used in the different calendar pages
:param user: the user to filter the logs for
:param year: year
:param month: month
:return: a dictionary with grouped lo... |
from django.db import transaction
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.contrib import messages
from django.core.exceptions import Pe... |
"""Here are a bunch of utilities to use with cocos.
utils
=====
This module provides classes or functions that were useful to us while doing games.
"""
__docformat__ = 'restructuredtext'
from cocos.layer import *
from cocos.scene import Scene
from cocos.director import director
class SequenceScene(Scene):
"""Se... |
from __future__ import print_function
import math
from .. import unique_name
__all__ = [
'NoamDecay', 'PiecewiseDecay', 'NaturalExpDecay', 'ExponentialDecay',
'InverseTimeDecay', 'PolynomialDecay', 'CosineDecay'
]
class LearningRateDecay(object):
"""
Base class of learning rate decay
Defin... |
# -*- 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):
# Deleting model 'QandaProfile'
db.delete_table('qanda_app_qandaprofile')
def backwards(self, orm):
... |
#!/usr/bin/env python
# vim:fenc=utf-8
#
# pylint: disable=superfluous-parens
"""Manage haproxy
Usage:
haproxytool haproxy [-D DIR | -F SOCKET] (-a | -A | -C | -e | -i | -M |
-o | -r | -u | -U | -V | -R | -p)
haproxytool haproxy [-D DIR | -F SOCKET] -m METRIC
ha... |
"""Python bindings for core 0MQ objects."""
#
# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
#
# This file is part of pyzmq.
#
# pyzmq is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Software ... |
from pycp2k.inputsection import InputSection
class _cell_ref1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.A = None
self.B = None
self.C = None
self.Abc = None
self.Alpha_beta_gamma = None
self.Cell_file_name = None
self.Cell_f... |
from datetime import datetime, timedelta
import bottle
from bottle import request
from bauble import app, API_ROOT
import bauble.db as db
from bauble.model import Invitation, User
from bauble.utils import create_unique_token
@app.get(API_ROOT + "/invitations/<token:re:\w{32}>")
def get_invitation(token):
json_... |
# -*- coding: utf-8 -*-
import os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
if os.getenv('SPELLCHECK')... |
#!/usr/bin/python
import sys
import time
import math
import pdb
from Utils import GeomUtils
from SketchFramework import Stroke
from SketchFramework import Point
from Tkinter import *
from tkMessageBox import *
# Constants
TEMPLATE_FILE = "board_templates.dat"
TEMPLATE_SAMPLE = 64 #num points in a template
WIDTH = ... |
import sys
sys.path.insert(0, sys.argv[2])
import os
import chimeraInit
# https://gist.github.com/jaimergp/834935666066515246ca
basepath = os.path.dirname(os.path.abspath(sys.argv[0]))
# This is the magic!
# If a script needs to be executed, Chimera does not launch
# the in-house command interface! So, just passing a ... |
"""
bepasty-object commandline interface
"""
import os
import argparse
import logging
import time
from flask import Flask
from ..constants import (
COMPLETE,
FILENAME,
FOREVER,
HASH,
LOCKED,
SIZE,
TIMESTAMP_DOWNLOAD,
TIMESTAMP_MAX_LIFE,
TIMESTAMP_UPLOAD,
TYPE,
)
from ..utils.... |
import re
from monty.io import zopen
from monty.re import regrep
from collections import defaultdict
from pymatgen.core.periodic_table import Element
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.util.io_utils import clean_lines
"""
This module implements inpu... |
# $Id: 001_torture_4475_3_1_1_2.py 369517 2012-07-01 17:28:57Z file $
import inc_sip as sip
import inc_sdp as sdp
# Torture message from RFC 4475
# 3.1.1. Valid Messages
# 3.1.1.2. Wide Range of Valid Characters
complete_msg = \
"""!interesting-Method0123456789_*+`.%indeed'~ sip:1_unusual.URI~(to-be!sure)&isn't+it$/... |
from flask import jsonify
from flask_restful import Resource
from pymongo import MongoClient
import os
import requests
class Status(Resource):
def get(self):
try:
github = 'api.github.com' in requests.get('https://api.github.com/', timeout=30).text
except Exception as error:
... |
from testutils import mock
import errno
import sys
from rbuild_test import rbuildhelp
from rbuild.internal import main
from rbuild import handle
from rbuild import errors
from rbuild import rbuildcfg
from rmake import errors as rmakeerrors
from robj import errors as robjerrors
class MainTest(rbuildhelp.RbuildHelp... |
"""
This example demonstrates how to get host information from a request object.
To test the script, rename the file to report.rpy, and move it to any directory,
let's say /var/www/html/.
Now, start your Twist web server:
$ twistd -n web --path /var/www/html/
Then visit http://127.0.0.1:8080/report.rpy in your we... |
"""
ffex.extract
~~~~~~~~~~~~
Pull resources from the Firefox application.
Resources include:
- bookmarks
- history
--------
-\ ExtractFirefox \-
Information tool used to quickly view all useful information from a
Firefox installation.
Copyright (C) 2017 Clint Moyer
... |
import numpy, sys
import scipy.linalg, scipy.special
'''
VBLinRegARD: Linear basis regression with automatic relevance priors
using Variational Bayes.
For more details on the algorithm see Apprendix of
Roberts, McQuillan, Reece & Aigrain, 2013, MNRAS, 354, 3639.
History:
2011: Translated by Thomas Evans from origina... |
'''OpenGL extension SUN.global_alpha
This module customises the behaviour of the
OpenGL.raw.GL.SUN.global_alpha to provide a more
Python-friendly API
Overview (from the spec)
Transparency is done in OpenGL using alpha blending. An alpha value
of 0.0 is used for fully transparent objects, while an alpha value
o... |
import code
import os
import signal
import sys
import openerp
from . import Command
def raise_keyboard_interrupt(*a):
raise KeyboardInterrupt()
class Console(code.InteractiveConsole):
def __init__(self, locals=None, filename="<console>"):
code.InteractiveConsole.__init__(self, locals, filename)
... |
import mock
from oslo_config import cfg
from jacket.objects import compute
from jacket.compute.scheduler.filters import affinity_filter
from jacket.compute import test
from jacket.tests.compute.unit.scheduler import fakes
CONF = cfg.CONF
CONF.import_opt('my_ip', 'compute.netconf')
class TestDifferentHostFilter(tes... |
from __future__ import print_function, unicode_literals
from __future__ import unicode_literals
import os
import sys
import signal
from optparse import OptionParser
from weblab.admin.script.upgrade import check_updated
from weblab.admin.script.utils import check_dir_exists, run_with_config
from voodoo.gen import l... |
#!/usr/bin/env python
""" autonomous.py - Version 1.0 2016-10-12
General framework based on Patrick Goebel's nav_test.py
Initial version based on ccam-navigation by Chris Mobley
Autonomous movement added by Jonathan Hodges
Define waypoint destinations for a robot to move autonomously within
a map... |
import unittest
from airflow import configuration
from airflow.models.connection import Connection
from airflow.utils import db
try:
from unittest import mock
except ImportError:
try:
import mock
except ImportError:
mock = None
from airflow.contrib.hooks.ssh_hook import SSHHook
HELLO_SER... |
from .models import Reference
from .serializers import ReferenceSerializer, ReferenceEthicsTagsSerializer, ReferenceMetaTagsSerializer, \
ReferenceAllTagsSerializer
from tags.models import EthicsType, EthicsTag
from profile.scoring import get_company_score, get_combined_score
from rest_framework import generic... |
"""module for example bolt: CountBolt"""
from collections import Counter
import heronpy.api.global_metrics as global_metrics
from heronpy.api.bolt.bolt import Bolt
from heronpy.api.state.stateful_component import StatefulComponent
# pylint: disable=unused-argument
class StatefulCountBolt(Bolt, StatefulComponent):
""... |
# coding=utf-8
from django.urls import reverse, resolve
from test_plus.test import TestCase
class TestUserURLs(TestCase):
"""Test URL patterns for users app."""
def setUp(self):
self.user = self.make_user()
def test_list_reverse(self):
"""users:list should reverse to /users/."""
... |
#!/usr/bin/env python
'''Simple web based phone book'''
__author__ = "Miki Tebeka <<EMAIL>>"
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from urlparse import urlparse
from cgi import parse_qs
import socket
# In memory phonebook, an application will have a "real" dateba... |
"""This is your method of passing Pre-Calculus"""
import math
from fractions import Fraction
################################################################################
# Global Constants
################################################################################
nan = float("nan")
NaN = nan
##############... |
"""
Import security advisories from old HTML/PHP files
and convert to snippets of Markdown.
"""
from __future__ import unicode_literals
import argparse
import re
import sys
from cgi import escape
from xml.etree import ElementTree as etree
from pathlib import Path
from pyquery import PyQuery as pq
from yaml import saf... |
#!/usr/bin/env python3
import functools
import os
import sys
from bottle import get, request, response, route, run, static_file
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import GasLexer, LlvmLexer
import playpen
@get("/")
def serve_index():
response = stat... |
import pytest
from kickscraper import KickStarterClient
from kickscraper import Project
@pytest.fixture
def client():
return KickStarterClient()
@pytest.fixture
def project():
return Project(name="Mamma Coal-Reimagining Willie Nelson's Outlaw Concept Album")
class TestClient:
def test_get_stats(self... |
algorithm = "hagedorn"
propagator = "semiclassical"
splitting_method = "Y4"
T = 12
dt = 0.01
dimension = 2
ncomponents = 1
eps = 0.1
potential = "quadratic_2d"
# The parameter set of the initial wavepacket
Q = [[1.0, 0.0],
[0.0, 1.0]]
P = [[1.0j, 0.0 ],
[0.0, 1.0j]]
q = [[-3.0],
[ 0.0]]
p = [[0.... |
import unittest
from lymph.core.monitoring.metrics import RawMetric
from lymph.core.monitoring.aggregator import Aggregator
def _get_metrics_one(self):
yield RawMetric('dummy', 'one')
def _get_metrics_two(self):
yield RawMetric('dummy', 'two')
class AggregatorTestCase(object):
def test_aggregator_on... |
"""Tests the text output of Google C++ Testing Framework.
SYNOPSIS
gtest_output_test.py --build_dir=BUILD/DIR --gengolden
# where BUILD/DIR contains the built gtest_output_test_ file.
gtest_output_test.py --gengolden
gtest_output_test.py
"""
__author__ = '<EMAIL> (Zhanyong Wan)'
import ... |
from __future__ import unicode_literals
# About name_local: capitalize it as if your language name was appearing
# inside a sentence in your language.
LANG_INFO = {
'ar': {
'bidi': True,
'code': 'ar',
'name': 'Arabic',
'name_local': '\u0627\u0644\u0639\u0631\u0628\u064a\u0651\u0629... |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.UGen import UGen
class PauseSelf(UGen):
r'''Pauses the enclosing synth when triggered by `trigger`.
::
>>> trigger = ugentools.Impulse.kr(frequency=1.0)
>>> pause_self = ugentools.PauseSelf.kr(
... trigger=trigger,
... |
from math import floor
from mixins import NameableMixIn, MixIn
from condition import TemporaryCondition
import logging
log = logging.getLogger('game/character')
MAX_INITIATIVE = 100
class Character(NameableMixIn, MixIn):
def __init__(self, data):
super(Character, self).__init__(data)
self._race ... |
#!/usr/bin/python
import json
import requests
import os
import datetime
import subprocess
import time
from datetime import timedelta
webhook_url = 'https://hooks.slack.com/services/XXXX/XXXX/XXXX'
slack_channel = 'some_slack_channel'
slack_username = 'sync_bot'
rsync_user = 'some_user'
rsync_host = 'some_hostname'
fr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... |
""" Utility functions """
import os
import tempfile
import time
import random
import string
from stitches.expect import Expect, ExpectFailed
class Util(object):
'''
Utility functions for instances
'''
@staticmethod
def uncolorify(instr):
""" Remove colorification """
res = instr... |
from __future__ import print_function
from twisted.internet import reactor
from errno import ECONNRESET, ENOTCONN, ESHUTDOWN, EWOULDBLOCK, ENOBUFS, EAGAIN, \
EINTR
from datetime import datetime
from time import sleep, time
from threading import Thread, Condition
from random import random
import socket
import sys, tr... |
from oeqa.runtime.connectivity.bluetooth import bluetooth
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import shell_cmd_timeout
class CommBT6LowPanMNode(oeRuntimeTest):
def setUp(self):
self.bt1 = bluetooth.BTFunction(self.targets[0])
self.bt2 = bluetooth.BTFunction(self.targets[1]... |
import os
import unittest
from vsg.rules import procedure
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_007_test_input.vhd'))
lExpected = []
lExpected.append('')
utils.read_file(os.path.join(sTestDir,... |
# -*- coding: latin1 -*-
################################################################################################
import snap,datetime, sys, time, json, os, os.path, shutil, time, struct, random
import metrics
reload(sys)
sys.setdefaultencoding('utf-8')
#######################################################... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import logging
import requests
import copy
import time
# Our imports
import ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'form.ui'
#
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("SkypeLogsLikeGTalk... |
"""Solvers for Ridge and LogisticRegression using SAG algorithm"""
# Authors: Tom Dupre la Tour <<EMAIL>>
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..exceptions import ConvergenceWarning
from ..utils import check_array
from ..utils.extmath import row_norms
from .base import make_dataset
from ... |
"""Hook that logs golden values to be used in unit tests.
In the Data -> Checkpoint -> Inference -> Eval flow, this verifies no regression
occurred in Data -> Checkpoint.
"""
import os
from typing import List
from absl import logging
import gin
import numpy as np
from tensor2robot.hooks import hook_builder
from tenso... |
from __future__ import division
import ConfigParser
import csv
import time
import datetime
import matplotlib; matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
import scipy.stats as spstats
import exposure
import util
def main():
# Read config
config = ConfigPa... |
"""
regsvcs C# inline shellcode injector using the VirtualAlloc()/CreateThread() pattern.
Uses basic variable renaming obfuscation.
Adapated from code from:
http://webstersprodigy.net/2012/08/31/av-evading-meterpreter-shell-from-a-net-service/
https://github.com/Veil-Framework/Veil/blob/master/Tools/Evasion/p... |
from zs.bibtex import parser
from .helpers import parse_entry, parse_bibliography
def test_bstring():
"""
Test nested bibtex strings.
"""
inp = r'{{test} {{test2}}}'
assert '{test} {{test2}}' == parser.bstring.parseString(inp)[0]
def test_quotedliteral_escapes():
"""
Check if escap sequen... |
import argparse
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--run", type=int, default=999, help="Experiment run ID")
parser.add_argument("--i-size", type=int, default=64, help="Image size")
parser.add_argument("--f-size", type=int... |
from scipy.stats import gamma,rv_continuous,norm
from scipy.special import gamma as gm
from scipy.special import kv
from scipy.integrate import quad
class GG(rv_continuous):
def _pdf(self, x, v, k, b):
return abs(v)*x**(k*v-1)*np.exp(-(x**v)/(b**abs(v)))/(b**(k*abs(v))*gm(k))
def _argcheck(self... |
import seqdb
import template
_DB = seqdb.get()
def get_mnemonic(direction, i, f):
key = "%s ESC %s%s" % (direction, i, f)
if key in _DB:
mnemonic = _DB[key]
else:
mnemonic = '<Unknown>'
return mnemonic
def format_seq(intermediate, final, is_input, tracer, controller):
i = ''.joi... |
"""Unit test for RecipeBase."""
from six import with_metaclass
from ..metarecipes import RecipeType
from ..recipes import BaseRecipeAutoQC
from ..recipes import BaseRecipe
from ..recipeinout import RecipeInput, RecipeResult
from ..requirements import ObservationResultRequirement
from ..dataholders import Product
from... |
from cmd import Cmd
from random import randrange
from combat import FightInterpreter
class Character(object):
"""
The base character class
"""
character_id = None
friendly_name = 'Shifty little man'
inventory = []
hp = 10
armor_class = 1
armor_type = 'cloth'
active_weapon = Non... |
#!/usr/bin/env python
"""
Python WebDAV Server.
This is an example implementation of a DAVserver using the DAV package.
"""
import getopt, sys, os
import logging
logging.basicConfig(level=logging.WARNING)
log = logging.getLogger('pywebdav')
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingM... |
import mango
class BasicFindTests(mango.UserDocsTests):
def test_bad_selector(self):
bad_selectors = [
None,
True,
False,
1.0,
"foobarbaz",
{"foo":{"$not_an_op": 2}},
{"$gt":2},
[None, "bing"]
]
... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^status/$', views.status, name='status'),
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^getLatestBeer$', views.getLatestBeer, name='getbeer'),
url(r'^(?P<id>[0-9]+)/details/$', views.details, name='details'),
... |
'''
test_funcional_api.py
Tests API endpoints for CRUD operations
@todo: Should return erron when requesting feature request not found (view and edit)
@todo: Should return erron when trying to updated feature request without specifying _id
@todo: Should return warning when trying to create feature request with same con... |
from django.views.generic import TemplateView
from pootle.core.delegate import formats
from pootle.core.views import APIView
from pootle.core.views.mixins import SuperuserRequiredMixin
from pootle_app.forms import ProjectForm
from pootle_config.utils import ObjectConfig
from pootle_fs.delegate import fs_plugins
from p... |
from ..ndtypes import (ArrayT, SliceT, ClosureT, NoneT, ScalarT, StructT,
TypeValueT, TupleT, PtrT, FnT)
from shape import Shape, Tuple, Closure, Var, Slice, Struct, Ptr, any_scalar
def shapes_from_types(types):
return Converter().from_types(types)
class Converter(object):
"""
Turn a ... |
"""use epbunch"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from itertools import chain
from eppy.EPlusInterfaceFunctions import readidf
import eppy.bunchhelpers as bunchhelpers
from eppy.EPlusInterfaceFunctions... |
import os
import sys
import time
import random
import StringIO
import nfc
import nfc.ndef
import nfc.llcp
import nfc.handover
import logging
logging.basicConfig()
import wpaspy
wpas_ctrl = '/var/run/wpa_supplicant'
def wpas_connect():
ifaces = []
if os.path.isdir(wpas_ctrl):
try:
ifaces... |
from rekall import plugin
from rekall import testlib
from rekall.plugins.windows import common
from rekall.plugins.addrspaces import crash
from rekall.plugins.addrspaces import standard
from rekall.plugins.overlays.windows import crashdump
class WritableCrashDump(crash.WindowsCrashDumpSpace64,
... |
import datetime
import pytest
from yatt.price import Price
from yatt.ticker import aapl, Tickers
from yatt.event import BarEvent
from yatt.strategy import Strategy
from yatt.strategy import Strategies
from yatt.strategy import BuyAndHold
from yatt.strategy import MovingAverageCrossStrategy
tickers = Tickers([aapl])
t... |
"""Setup script for adjspecies. Use `pip install .` in this directory."""
from setuptools import setup
import adjspecies
setup(
name='adjspecies',
version='0.1.3',
description=adjspecies.__doc__,
long_description=(open('README.rst').read()),
url='http://github.com/hipikat/adjspecies/',
licens... |
import functools
import zmq
from logbook import Logger
from onitu.escalator.client import Escalator, EscalatorClosed
from onitu.utils import get_events_uri, b, log_traceback
from .cmd import UP, DEL, MOV
from .folder import Folder
class Referee(object):
"""Referee class, receive all events and deal with them.... |
import re
from . import furigana
from . import hint
from ..hooks import runFilter
from ..utils import stripHTML, stripHTMLMedia
furigana.install()
hint.install()
clozeReg = r"(?s)\{\{c%s::(.*?)(::(.*?))?\}\}"
modifiers = {}
def modifier(symbol):
"""Decorator for associating a function with a Mustache tag mod... |
import codecs
import glob
import os
import re
import subprocess
import sys
if sys.version_info[:2] < (2, 7):
import unittest2 as unittest
else:
import unittest
import logging
logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s',
level=logging.DEBUG)
import html2text
def t... |
import os
import unittest
from __main__ import vtk, qt, ctk, slicer
#
# WelcomeModuleTests
#
class WelcomeModuleTests:
def __init__(self, parent):
parent.title = "WelcomeModuleTests" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
... |
"""This submodule contains tools for creating path objects from SVG files.
The main tool being the svg2paths() function."""
# External dependencies
from __future__ import division, absolute_import, print_function
from xml.dom.minidom import parse
from os import path as os_path, getcwd
import re
# Internal dependencie... |
import unittest
class TestMessage(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud.pubsub.message import Message
return Message
def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)
def test_ctor_no_attributes(self):
... |
#!/usr/bin/python
import math
import numpy
import scipy.special as special
import string
def minz_j(n):
# We can start table interpolation from zero because there is
# no singularity in bessel_j for z>=0.
return 0
def minz_y(n):
#return max(3., n)
return .5
def maxz_j(n):
z = (n ... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
import os
try:
import koji as koji
except ImportError:
import inspect
import sys
#... |
import re, hashlib, pprint, socket, urllib, time
import urllib.request
from queue import Queue
from collections import Counter, deque, defaultdict
from html.parser import HTMLParser
from classes.fingerprints import Fingerprints
#from classes.requester2 import Requester
from classes.matcher import Match
from classes.req... |
"""Test class for Remote Execution Management UI"""
from robottelo.decorators import stubbed, tier1, tier2
from robottelo.test import UITestCase
class RemoteExecutionTestCase(UITestCase):
"""Test class for remote execution feature"""
@stubbed()
@tier1
def test_positive_create_simple_job_template(self... |
from aquilon.exceptions_ import ArgumentError
from aquilon.aqdb.model import ARecord
from aquilon.aqdb.model.network import get_net_id_from_ip
from aquilon.aqdb.model.network_environment import get_net_dns_env
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.dbwrappers.dns im... |
from decode import *
from sqltools import *
import decimal
def insertpending(txhex):
try:
rawtx = decode(txhex)
except Exception,e:
print "Error: ", e, "\n Could not decode PendingTx: ", txhex
return
if 'BTC' in rawtx:
#handle btc pending amounts
insertbtc(rawtx)
if 'Amount' in rawtx['MP... |
from __future__ import division
from datetime import timedelta, tzinfo
from copy import deepcopy
class FixedOffset(tzinfo):
'''
Represent a timezone with a fixed offset from UTC and no adjustment for
DST.
>>> FixedOffset(4,0)
<UTC+04:00>
>>> FixedOffset(-4,0)
<UTC-04:00>
>>> FixedOff... |
""""
Programa de Extraccion de caracteristicas
Contiene
"""
import cv2 #Opencv 3.000 a 32bits
import numpy as np
from Read import search, imageMatrix
import time
from matplotlib import pyplot as plt
from Segment import cont, cutt
from skimage.transform import rotate
from scipy.interpolate import interp1d
"""Carpetas 00... |
import StringIO
import unittest
import urllib2
import morphlib
class RemoteArtifactCacheTests(unittest.TestCase):
def setUp(self):
loader = morphlib.morphloader.MorphologyLoader()
morph = loader.load_from_string(
'''
name: chunk
kind: chunk
... |
# -*- coding: utf-8 -*-
"""
hyper/common/connection
~~~~~~~~~~~~~~~~~~~~~~~
Hyper's HTTP/1.1 and HTTP/2 abstraction layer.
"""
from .exceptions import TLSUpgrade, HTTPUpgrade
from ..http11.connection import HTTP11Connection
from ..http20.connection import HTTP20Connection
from ..tls import H2_NPN_PROTOCOLS, H2C_PROTOC... |
from django.test import TestCase
from django.utils import six
from .. import utils
from ..views import IndexView
from .models import UtilsTestModel
class UtilsTest(TestCase):
def setUp(self):
self.instance = UtilsTestModel()
def test_as_model_class(self):
self.assertEquals(
Util... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
import string
import sys
test = TestSCons.TestSCons()
# We want to preserve the --warn-undefined-variables option for
# compatibility with GNU Make. Unfortunately, this conflicts with
# the --warn=type option that we're using for our own... |
# mothurmagic.py
from __future__ import print_function
import os
import subprocess as sub
import random
from IPython.core.magic import (Magics, magics_class, line_magic, cell_magic, line_cell_magic)
from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring
from IPython.display import display_... |
'''Helpers for dealing with HTTP level caching.
The `Cache-Control` and `Expires` header can be defined while adding a handler
to the environment::
class MyService(Service):
def run(self):
self.environment.add_handler(...,
cache=CacheConfig(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.