content stringlengths 4 20k |
|---|
from io import BytesIO
from itertools import product
import warnings
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from statsmodels import tools
from statsmodels.regression.linear_model import WLS
from statsmodels.regression.rolling import RollingWL... |
"""Tests for util.request module."""
import unittest
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.test.client import RequestFactory
from util.request import course_id_from_url, safe_get_host
class ResponseTestCase(unittest.TestCase):
""" Tests for response... |
from collections import deque
import sys
import time
from evy.pools import Pool
from evy import timeout
from evy import hubs
from evy.hubs.timer import Timer
from evy.green.threads import GreenThread
class ConnectTimeout(Exception):
pass
class BaseConnectionPool(Pool):
def __init__ (self, db_module,
... |
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from openstack_dashboard import api
class CreateRoleLink(tables.LinkAction):
name = "create"
verbose_name = _("Create Role")
url = "horizon:identity:roles:create"
cl... |
"""
mailthon.api
~~~~~~~~~~~~
Implements simple-to-use wrapper functions over
the more verbose object-oriented core.
:copyright: (c) 2015 by Eeo Jun
:license: MIT, see LICENSE for details.
"""
from mailthon.enclosure import HTML, Attachment
from mailthon.envelope import Envelope
from mailthon... |
from __future__ import unicode_literals
import re
from django.core.validators import MaxValueValidator, RegexValidator
from django.db import models
from django.test import TestCase
from rest_framework import generics, serializers, status
from rest_framework.test import APIRequestFactory
factory = APIRequestFactory(... |
import os
from .. import metadata, products
from base import Step, StepRunner
class GetUpdatePropertyList(Step):
provides = ["property_order", "boolean_properties"]
def create(self, state):
property_order, boolean_properties = products.load_product_update(
state.config, state.product)
... |
"""
Replacement for the Django JSON encoder that handles microseconds.
"""
import datetime
from django.utils import datetime_safe
from django.utils import simplejson
class DjangoJSONEncoder(simplejson.JSONEncoder):
"""
JSONEncoder subclass that knows how to encode date/time with microseconds.
"""
DA... |
"""
Open edX Documentation Builder
Ties into Sphinx to generate files at the specified location(s)
"""
from __future__ import print_function
import sys
from paver.easy import cmdopts, needs, sh, task
DOC_PATHS = {
"dev": "docs/en_us/developers",
"author": "docs/en_us/course_authors",
"data": "docs/en_us/... |
import sys
import os
import difflib
import subprocess
import re
import pydoc
import inspect
import unittest
import test.test_support
from test import pydoc_mod
expected_text_pattern = \
"""
NAME
test.pydoc_mod - This is a test module for test_pydoc
FILE
%s
%s
CLASSES
__builtin__.object
B
A
\x... |
""" import the necessary modules """
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import text
# Create a class that will give us an object that we can use to connect to a database
class MySQLConnection(object):
def __init__(self, app, db):
config = {
'host': 'localhost',
... |
"""Functional tests for 3d pooling operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
class PoolingTest(tf.test.TestCase):
def _VerifyValues(self, pool_func, input_sizes, window, strides, padding,
... |
{
'name': 'Base import',
'description': """
New extensible file import for OpenERP
======================================
Re-implement openerp's file import system:
* Server side, the previous system forces most of the logic into the
client which duplicates the effort (between clients), makes the
import s... |
from boto import handler
import xml.sax
class Deleted(object):
"""
A successfully deleted object in a multi-object delete request.
:ivar key: Key name of the object that was deleted.
:ivar version_id: Version id of the object that was deleted.
:ivar delete_marker: If True, indicates the ... |
from __future__ import absolute_import
from .test_error_messages import (FormsErrorMessagesTestCase,
ModelChoiceFieldErrorMessagesTestCase)
from .test_extra import FormsExtraTestCase, FormsExtraL10NTestCase
from .test_fields import FieldsTests
from .test_forms import FormsTestCase
from .test_formsets import (Forms... |
import os
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.http import JsonResponse, HttpResponseRedirect
from labels.csv_generator import CSVGenerator
import labels.models as LabelM... |
# Made by Fulminus, version 0.1
import sys
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "234_FatesWhisper"
PIPETTE_KNIFE = 4665
REIRIAS_SOUL_ORB = 4666
KERMONS_INFERNI... |
"""Integrating embed tables
Revision ID: 1b8856078bd3
Revises: f2b0984f780
Create Date: 2016-10-28 10:58:42.229165
"""
# revision identifiers, used by Alembic.
revision = '1b8856078bd3'
down_revision = 'f2b0984f780'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by A... |
import copy
node = {
'type': 'object',
'properties': {
'id': {'type': 'string'},
'interfaces': {'type': 'array'},
'host': {'type': 'string'},
'task_state': {'type': ['string', 'null']},
'cpus': {'type': ['integer', 'string']},
'memory_mb': {'type': ['integer', 's... |
"""Message related utilities.
Note: request.connection.write/read are used in this module, even though
mod_python document says that they should be used only in connection
handlers. Unfortunately, we have no other options. For example,
request.write/read are not suitable because they don't allow direct raw
bytes writi... |
"""
Unit tests runner for ``django-guardian`` based on boundled example project.
Tests are independent from this example application but setuptools need
instructions how to interpret ``test`` command when we run::
python setup.py test
"""
import os
import sys
os.environ["DJANGO_SETTINGS_MODULE"] = 'guardian.test... |
"""
Support for Hyperion remotes.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.hyperion/
"""
import json
import logging
import socket
import voluptuous as vol
from homeassistant.components.light import (
ATTR_RGB_COLOR, SUPPORT_RGB_COLOR, L... |
# -*- coding:utf-8 -*-
from selenium import webdriver
import requests
import sqlite3
browser = webdriver.Firefox()
browser.get('http://www.mouser.cn')
html_source = browser.page_source
print html_source
coon = sqlite3.connect('/root/.mozilla/firefox/gmfs2ivm.default/cookies.sqlite')
cursor = coon.cursor()
cursor.exe... |
# -*- coding: utf-8 -*
#
# Split search string - Useful when building advanced search application
# By: Peter Bengtsson, <EMAIL>
# May 2008-2010
# Python
#
# Taken from http://www.peterbe.com/plog/split_search
import re
__version__ = '1.4'
def split_search(q, keywords):
"""
Splits the search string into a f... |
''' A simple test for the verify_boilerplate python script.
This will create a set of test files, both valid and invalid,
and confirm that the has_valid_header call returns the correct
value.
It also checks the number of files that are found by the
get_files call.
'''
from copy import deepcopy
from tempfile import mkdt... |
""" Commerce API v0 view tests. """
import itertools
import json
from datetime import datetime, timedelta
from uuid import uuid4
import ddt
import mock
import pytz
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_setti... |
from sfepy.terms.terms import *
from sfepy.terms.terms_base import ScalarScalar
from sfepy.terms.utils import fix_scalar_constant, fix_scalar_in_el
class LaplaceTerm( ScalarScalar, Term ):
r""":description: Laplace term with $c$ constant or constant per element.
:definition: $c \int_{\Omega}\nabla s \cdot \nab... |
"""Learning rate scheduler."""
import math
import logging
class LearningRateScheduler(object):
"""Base class of learning rate scheduler."""
def __init__(self):
self.base_lr = 0.01
def __call__(self, iteration):
"""
Call to schedule current learning rate.
Parameters
... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
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_LIB = True... |
from distutils.core import setup
''' Create a sourcecode distribution. Arguments
setup(name='NAME_SOURCE_DISTRIBUTION',
version='TEXT',
description='TEXT',
long_description='TEXT',
author='TEXT',
author_email='TEXT',
maintainer='TEXT',
maintainer_email='TEXT',
url='TEX... |
"""
Routers provide a convenient and consistent way of automatically
determining the URL conf for your API.
They are used by simply instantiating a Router class, and then registering
all the required ViewSets with that router.
For example, you might have a `urls.py` that looks something like this:
router = route... |
"""Undocumented Module"""
__all__ = ['FourState']
from direct.directnotify import DirectNotifyGlobal
#import DistributedObject
import ClassicFSM
import State
class FourState:
"""
Generic four state ClassicFSM base class.
This is a mix-in class that expects that your derived class
is a Distrib... |
from __future__ import unicode_literals
import frappe
import re
def execute():
# NOTE: sequence is important
fields_list = (
("amount", "base_amount"),
("ref_rate", "price_list_rate"),
("base_ref_rate", "base_price_list_rate"),
("adj_rate", "discount_percentage"),
("export_rate", "rate"),
("basic_rate", ... |
"""network unittest"""
import unittest
import network as pynet
import klincs
import random
random.seed(10)
import pysal
import numpy as np
class KLINCS_Tester(unittest.TestCase):
def setUp(self):
self.population = range(5)
self.weights = [0.1, 0.25, 0.1, 0.2, 0.35]
np.random.seed(10)
... |
'''Unittest for saving and loading keys.'''
import base64
import unittest2
from rsa._compat import b
import rsa.key
B64PRIV_DER = b('MC4CAQACBQDeKYlRAgMBAAECBQDHn4npAgMA/icCAwDfxwIDANcXAgInbwIDAMZt')
PRIVATE_DER = base64.decodestring(B64PRIV_DER)
B64PUB_DER = b('MAwCBQDeKYlRAgMBAAE=')
PUBLIC_DER = base64.decodestri... |
"""
Factories for generating edXML for testing XModule import
"""
import inspect
from fs.memoryfs import MemoryFS
from factory import Factory, lazy_attribute, post_generation, Sequence
from lxml import etree
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.modulestore import only_xmodules
... |
from openerp.osv import fields,osv
from openerp import tools
AVAILABLE_STATES = [
('draft','Draft'),
('open','Open'),
('cancel', 'Cancelled'),
('done', 'Closed'),
('pending','Pending')
]
class crm_helpdesk_report(osv.osv):
""" Helpdesk report after Sales Services """
_name = "crm.helpdes... |
#!/usr/bin/env python
import gevent
import numpy as np
import sys
import liblo
from gevent import monkey
monkey.patch_all()
class MuseOSC:
def __init__(self, port=None, return_packet_cb=None):
self.return_packet_cb = return_packet_cb
try:
self.server = liblo.Server(port, liblo.TCP)
... |
from gnuradio import gr
from gnuradio import blocks
from gnuradio.eng_option import eng_option
from optparse import OptionParser
class vector_source(gr.top_block):
def __init__(self, host, port, pkt_size, eof):
gr.top_block.__init__(self, "vector_source")
data = [i*0.01 for i in range(1000)]
... |
'''
Created on Nov 24, 2016
@author: kostya
TASK
Write area calculator function that takes number of arguments (1 arg. for circle, 2 for square
or rectangle, 3 for triangle, 4 for trapezoid), automatically detects which equation should it use
and then calculates and shows the surface area result.
Possible output:
==... |
#!/usr/bin/env python
'''miscellaneous commands'''
import time, math, sys
from pymavlink import mavutil
from MAVProxy.modules.lib import mp_module
from MAVProxy.modules.lib import mp_util
from os import kill
from signal import signal
from subprocess import PIPE, Popen
class RepeatCommand(object):
'''repeated c... |
"""Support for ESPHome climate devices."""
import logging
from typing import TYPE_CHECKING, List, Optional
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
STATE_AUTO, STATE_COOL, ST... |
from nose import SkipTest
import networkx as nx
from networkx.generators.degree_seq import havel_hakimi_graph
class TestGraphMatrix(object):
numpy=1 # nosetests attribute, use nosetests -a 'not numpy' to skip test
@classmethod
def setupClass(cls):
global numpy
global assert_equal
g... |
import base64
import struct
# Some DER encoding stuff. Bleh. This is because the ccache contains a
# DER-encoded krb5 Ticket structure, whereas Webathena deserializes
# into the various fields. Re-encoding in the client would be easy as
# there is already an ASN.1 implementation, but in the interest of
# limiting MIT ... |
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_interface_policy_mcp
short_description: Manage MCP inter... |
from django.conf import settings
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False):
"""
Gets a number (as a number or string), and returns it as a string,
using formats defined as arguments:
* ... |
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils.password import update_password, check_password, passlibctx
class TestPassword(unittest.TestCase):
def setUp(self):
frappe.delete_doc('Email Account', 'Test Email Account Password')
frappe.delete_doc('Email Account', 'Test Ema... |
"""
Gives a GUI for blocking individual MAC addresses.
Meant to work with reactive components like l2_learning or l2_pairs.
Start with --no-clear-tables if you don't want to clear tables on changes.
"""
from pox.core import core
from pox.lib.revent import EventHalt
from pox.lib.addresses import EthAddr
import pox.o... |
"""
Interfaces with SimpliSafe alarm control panel.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.simplisafe/
"""
import logging
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
from homeassista... |
"""Generates data for graphing latency of different transports.
"""
from __future__ import division, print_function
from common import *
import subprocess
from collections import defaultdict
from transportbench import *
import sys
uncached = True
if len(sys.argv) > 1 and sys.argv[1] == '-c':
print('Running cached... |
import sys, ecto
import ecto.ecto_test as ecto_test
from util import fail
from ecto import BlackBoxCellInfo as CellInfo, BlackBoxForward as Forward
class MyBlackBox(ecto.BlackBox):
''' A simple black box that doesn't really do anything.
'''
@classmethod
def declare_cells(cls, p):
return {'gen'... |
# -*- coding:utf-8 -*-
import difflib
import io
import re
from tempfile import mkstemp
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
from portage import os
from portage import shutil
from portage import util
_copyright_re1 = re.compile(br'^(# Copyright \d\d\... |
import logging
logger = logging.getLogger('p4a.z2utils.patches')
def apply_patches():
_apply_getSubObject_patch()
_apply_DynamicView_patch()
def unapply_patches():
_unapply_getSubObject_patch()
_unapply_DynamicView_patch()
def _unapply_getSubObject_patch():
import Products.Archetypes
patched ... |
import os
import tempfile
from django import forms
from django.contrib.auth.models import User
from django.core.files.storage import FileSystemStorage
from django.forms.formsets import formset_factory
from django.forms.models import modelformset_factory
from django.http import HttpResponse
from django.template import ... |
# Mimic the sqlite3 console shell's .dump command
# Every identifier in sql is quoted based on a comment in sqlite
# documentation "SQLite adds new keywords from time to time when it
# takes on new features. So to prevent your code from being broken by
# future enhancements, you should normally quote any identifier th... |
import json
import uuid
import md5
def u():
return uuid.uuid1()
def hashcontent(content):
m = md5.new(content)
return m.hexdigest()
sect = {"id": "org.cnx.sect:d3911c28-2a9e-4153-9546-f71d83e41126",
"version":"ad0d6c247e0f1347364d890ec2e9fb53",
"title": "Introduction... |
from common_fixtures import * # NOQA
from test_docker import docker_client, TEST_IMAGE_UUID, if_docker
import requests
import jwt
# work around flake8 issue
docker_client
@if_docker
def test_stats_host(docker_client, context):
host = docker_client.list_host()[0]
sim_host = context.host
assert 'stats' ... |
from django.core.exceptions import FieldError
from django.test import TestCase
from models import Author, Article
class CustomColumnsTests(TestCase):
def test_db_column(self):
a1 = Author.objects.create(first_name="John", last_name="Smith")
a2 = Author.objects.create(first_name="Peter", last_name... |
"""
A test facility to assert call sequences while mocking their behavior.
"""
import os
import sys
import unittest
from pylib import constants
sys.path.append(os.path.join(
constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
class TestCase(unittest.TestCase):
"""Adds ass... |
__all__=(
'Ean13BarcodeWidget','isEanString',
)
from reportlab.graphics.shapes import Group, String, Rect
from reportlab.lib import colors
from reportlab.pdfbase.pdfmetrics import stringWidth
from reportlab.lib.validators import isNumber, isColor, isString, Validator, isBoolean
from reportlab.lib.attrma... |
from threading import local
_local = local()
def get_current_context(silent=False):
"""Returns the current click context. This can be used as a way to
access the current context object from anywhere. This is a more implicit
alternative to the :func:`pass_context` decorator. This function is
prima... |
""" Twitch plugin for twitch notifications.
More to come?
Commands:
twitch
"""
import discord
import logging
from datetime import datetime, timedelta
from pcbot import utils, Config
import plugins
from plugins.twitchlib import twitch
client = plugins.client # type: discord.Client
twitch_config = Config("twit... |
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from twilio.rest import TwilioRestClient
from twilio.rest import resources
from mock import patch, Mock
class RestClientTest(unittest.TestCase):
def setUp(self):
self.client = TwilioRestClient("ACCOUNT_SID"... |
from datetime import datetime
from threading import Thread
import Queue
from boto.utils import RequestHook
class RequestLogger(RequestHook):
"""
This class implements a request logger that uses a single thread to
write to a log file.
"""
def __init__(self, filename='/tmp/request_log.csv'):
... |
import testtools
from heat.common import identifier
class IdentifierTest(testtools.TestCase):
url_prefix = 'http://1.2.3.4/foo/'
def test_attrs(self):
hi = identifier.HeatIdentifier('t', 's', 'i', 'p')
self.assertEqual('t', hi.tenant)
self.assertEqual('s', hi.stack_name)
self... |
from ..test_module import TestModule
from mock import Mock, patch
# SUT
import floatmod
class TestFloatMod(TestModule):
def setUp(self):
super(TestFloatMod, self).setUp()
self.floatmod_obj = floatmod.floatmod(self.bot)
def test_init(self):
pass
class TestFloatCmd(TestFloatMod):
d... |
import json
from rdflib import ConjunctiveGraph, URIRef
from pyld import jsonld
from pyld.jsonld import compact, expand, frame, from_rdf, to_rdf, JsonLdProcessor
import urllib
# Stop code from looking up the contexts online for every operation
docCache = {}
def fetch(url):
fh = urllib.urlopen(url)
data = fh.r... |
#!/usr/bin/env python
""" calibrate_linear.py - Version 1.1 2013-12-20
Move the robot 1.0 meter to check on the PID parameters of the base controller.
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2012 Patrick Goebel. All rights reserved.
This program is free software; you ... |
# -*- coding: utf-8 -*-
import httplib as http
from flask import request
from framework.exceptions import HTTPError
from framework.auth.decorators import must_be_logged_in
from website.util import web_url_for
from website.project.decorators import (
must_have_addon, must_be_addon_authorizer,
must_have_permi... |
from __future__ import with_statement
import errno
import filecmp
import os.path
import re
import tempfile
import sys
# A minimal memoizing decorator. It'll blow up if the args aren't immutable,
# among other "problems".
class memoize(object):
def __init__(self, func):
self.func = func
self.cache = {}
de... |
# -*- coding: utf-8 -*-
"""
jinja2.defaults
~~~~~~~~~~~~~~~
Jinja default filters and tags.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2._compat import range_type
from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
# defaults for ... |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import sys, logging, os, traceback, time
from PyQt4.QtGui import QKeySequence, QPainter, QDialog, QSpinBox, QSlider, QIcon
from PyQt4.QtCore import Qt, QObject, SIGNAL, QCoreApplication, QThread
from calibre import __appname__, set... |
import unittest
import shelve
import glob
from test import support
from collections.abc import MutableMapping
from test.test_dbm import dbm_iterator
def L1(s):
return s.decode("latin-1")
class byteskeydict(MutableMapping):
"Mapping that supports bytes keys"
def __init__(self):
self.d = {}
de... |
"""Unit tests for Cisco FC san lookup service."""
from cinder import exception
from cinder import test
from cinder.volume import configuration as conf
from cinder.zonemanager import fc_san_lookup_service as san_service
_target_ns_map = {'100000051e55a100': ['20240002ac000a50']}
_initiator_ns_map = {'100000051e55a100'... |
"""Platform to retrieve uptime for Home Assistant."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import En... |
#
# Autocomplete feature for admin panel
#
# Most of the code has been written by Jannis Leidel:
# http://jannisleidel.com/2008/11/autocomplete-form-widget-foreignkey-model-fields/
#
# to_string_function, Satchmo adaptation and some comments added by emes (Michal Salaban)
#
from django import forms
from dja... |
"""Utils for publishers
"""
import hashlib
import hmac
from oslo.config import cfg
import six
from ceilometer import utils
METER_PUBLISH_OPTS = [
cfg.StrOpt('metering_secret',
secret=True,
default='change this or be hacked',
help='Secret value for signing metering me... |
import unittest
from rankum.models import Doc
from rankum.exceptions import MissingDocIdException, EmptyDocListException
from rankum import JsonDocReader
class JsonDocReaderTest(unittest.TestCase):
def test_should_json_list(self):
input_json = '[{"id": 1, "category": 1}, {"id": "2", "category": 2}]'
... |
from PyQt5.QtNetwork import QNetworkCookie
from PyQt5.QtCore import QUrl
import pytest
from qutebrowser.browser.webkit import cookies
from qutebrowser.utils import usertypes, urlmatch
from qutebrowser.misc import lineparser, objects
pytestmark = pytest.mark.usefixtures('data_tmpdir')
COOKIE1 = b'foo1=bar; expires=T... |
#!/usr/bin/python
#
# DESC:
# Get data from the CT(Current Transformer) Sensor. Compare the current power with the
# previous power data to determine if the status of the pump. Store the status and current
# time into remote database for furthur uses.
#
# 06/03/2014
#
import serial
import MySQLdb
import time
from d... |
from flask import Blueprint, render_template, abort, request, redirect, session, url_for, send_file
from flask.ext.login import current_user, login_user, logout_user
from sqlalchemy import desc, or_, and_
from datetime import datetime, timedelta
from truecraft.objects import *
from truecraft.common import *
from truecr... |
from __future__ import print_function
import os.path
import re
import sys
def get_template(template_path):
import mako.lookup
templates_dir = os.path.join(os.path.dirname(__file__), "templates")
lookup_dirs = [
templates_dir,
os.path.abspath(os.path.join(templates_dir, "..", "..", ".."))... |
from gnuradio import gr, gr_unittest
from gnuradio import blocks
import specest_swig as specest
import signal_generator as siggen
class qa_esprit (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_001_t (self):
"""
... |
{
'name': 'Sales Management',
'version': '1.0',
'category': 'Sales Management',
'sequence': 14,
'summary': 'Quotations, Sales Orders, Invoicing',
'description': """
Manage sales quotations and orders
==================================
This application allows you to manage your sales goals in an... |
"""
Distance and Area objects to allow for sensible and convienient calculation
and conversions. Here are some tests.
"""
from django.contrib.gis.measure import Distance, Area, D, A
from django.utils import unittest
class DistanceTest(unittest.TestCase):
"Testing the Distance object"
def testInit(self):
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Development/python/creepy/gui/compareProjectsDialog.ui'
#
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
excep... |
from pygmin.potentials.maxneib_blj import MaxNeibsBLJ, MaxNeibsBLJSystem
from pygmin.gui import run_gui
import numpy as np
natoms = 50
ntypeA = int(natoms/2)
max_neibs = 7
only_AB_neibs = True
rneib = .74 * (3./4*np.pi)
periodic = True
if periodic:
rho = 1.
boxl = (float(natoms) / rho)**(1./3)
print boxl... |
import purchase_order_group
import purchase_line_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Logging control and utilities.
Control of logging for SA can be performed from the regular python logging
module. The regular dotted module namespace is used, starting at
'sqlalchemy'. For class-level logging, the class name is appended.
The "echo" keyword parameter, available on SQLA :class:`.Engine`
and :class... |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import random
def covtype():
# Log.info("Importing covtype.20k.data...\n")
covtype = h2o.import_file(path=pyunit_utils.locate("smalldata/covtype/covtype.20k.data"))
#
myY = 54
myX = [x for x in range(0,54) if x not... |
#!/usr/bin/python
import sys, os, os.path, re
import fnmatch
import psycopg2
import ConfigParser
from optparse import OptionParser
## Binary Analysis Tool
## Copyright 2012-2016 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This script can be us... |
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from selenium.webdriver.common.keys import Keys
from common import type_in_codemirror, get_codemirror_value
from nose.tools import assert_in # pylint: disable=no-name-in-module
@step(u'I go to the course updat... |
# -*- coding: utf-8 -*-
"""参照 twisted/asyncio重新设计下api"""
import gevent.monkey
gevent.monkey.patch_socket()
import logging
import gevent
import gevent.queue
import gevent.pywsgi
import geventwebsocket.handler
from .util import shorten
logger = logging.getLogger(__name__)
def id_generator():
i = 0
wall =... |
from __future__ import unicode_literals
from django.utils import regex_helper
from django.utils import unittest
class NormalizeTests(unittest.TestCase):
def test_empty(self):
pattern = r""
expected = [('', [])]
result = regex_helper.normalize(pattern)
self.assertEqual(result, expe... |
from report import report_sxw
class visita(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(visita, self).__init__(cr, uid, name, context=context)
report_sxw.report_sxw('report.thakhi.visita', 'thakhi.visita', 'addons/thakhi/report/visita.rml', parser=visita, header=False) |
import mock
from cinder import test
import cinder.volume.drivers.netapp.eseries.fc_driver as fc
from cinder.volume.drivers.netapp import utils as na_utils
class NetAppESeriesFibreChannelDriverTestCase(test.TestCase):
@mock.patch.object(na_utils, 'validate_instantiation')
def test_instantiation(self, mock_va... |
from __future__ import unicode_literals
import datetime
import json
import re
import sys
import time
from email.header import Header
from django.conf import settings
from django.core import signals, signing
from django.core.exceptions import DisallowedRedirect
from django.core.serializers.json import DjangoJSONEncode... |
from __future__ import absolute_import, division, print_function
import time
import appr.models.kv
from appr.exception import ResourceNotFound, UnableToLockResource
from appr.models.kv.models_index_base import ModelsIndexBase
from appr.models.kv.redis import redis_client
class ModelsIndexRedis(ModelsIndexBase):
... |
"""
Functions which are common and require SciPy Base and Level 1 SciPy
(special, linalg)
"""
from __future__ import division, print_function, absolute_import
import numpy
import numpy as np
from numpy import (exp, log, asarray, arange, newaxis, hstack, product, array,
zeros, eye, poly1d, r_, sum, ... |
import extensions.googletransit
import os
import re
import time
import transitfeed
import transitfeed.problems as problems_module
from util import MemoryZipTestCase
from util import RecordingProblemAccumulator
from testfeedvalidator import FullTests
from testtransitfeed import ValidationTestCase
class ExtensionFullT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.