content stringlengths 4 20k |
|---|
from __future__ import division, absolute_import, print_function
import beets.plugins
import beets.ui
import beetsplug.web
import flask
import math
import os
import PIL.Image
import random
import tempfile
import time
from flask import g
app = beetsplug.web.app
@app.before_request
def before_request():
g.player... |
"""
Support for Sybase via the python-sybase driver.
http://python-sybase.sourceforge.net/
Connect strings are of the form::
sybase+pysybase://<username>:<password>@<dsn>/[database name]
Unicode Support
---------------
The python-sybase driver does not appear to support non-ASCII strings of any
kind at this ti... |
from __future__ import print_function
from builtins import str
import os
import unittest
import shutil
import yaml
from panstamps.utKit import utKit
from fundamentals import tools
from os.path import expanduser
from docopt import docopt
from panstamps import cl_utils
doc = cl_utils.__doc__
home = expanduser("~")
packa... |
from . import match_algorithm
from . import model
from . import wizard |
from spack import *
class Admixtools(MakefilePackage):
"""The ADMIXTOOLS package implements 5 methods described in
Patterson et al. (2012) Ancient Admixture in Human History. Details
of the methods and algorithm can be found in this paper.."""
homepage = "https://github.com/DReichLab/AdmixTools"
... |
from __future__ import unicode_literals
import datetime
import django
from django.utils.timezone import now
from django.test import TransactionTestCase
from job.messages.blocked_jobs import BlockedJobs
from job.models import Job
from job.test import utils as job_test_utils
class TestBlockedJobs(TransactionTestCase... |
"""
Tests related to XBlock support API.
"""
from xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag
from xblock_django.api import deprecated_xblocks, disabled_xblocks, authorable_xblocks
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
cla... |
class RelationHandler(object):
def __init__(self, object_location, object_class):
self.object_location = object_location
self.object_class = object_class
class Serializer(object):
"""Abstract class that serializes a JSON object according to parameters
that are described by its subclasses."""
TABLE_P... |
from oslo_log import log as logging
from trove.instance.models import DBInstance
LOG = logging.getLogger(__name__)
class Account(object):
"""Shows all trove instance ids owned by an account."""
def __init__(self, id, instance_ids):
self.id = id
self.instance_ids = instance_ids
@static... |
import copy
import logging
from webkitpy.common.memoized import memoized
_log = logging.getLogger(__name__)
# FIXME: Should this function be somewhere more general?
def _invert_dictionary(dictionary):
inverted_dictionary = {}
for key, value in dictionary.items():
if inverted_dictionary.get(value):
... |
from django.conf.urls import url, patterns
urlpatterns = patterns('filebrowser.views',
# Base view
url(r'^$', 'index', name='index'),
# Catch-all for viewing a file (display) or a directory (listdir)
url(r'^view=(?P<path>.*)$', 'view', name='view'),
url(r'^listdir=(?P<path>.*)$', 'listdir', name='listdir'... |
#!/usr/bin/python
# Terminator by Chris Jones <<EMAIL>>
# GPL v2 only
"""container.py - classes necessary to contain Terminal widgets"""
import gobject
import gtk
from factory import Factory
from config import Config
from util import dbg, err
from translation import _
from signalman import Signalman
# pylint: disabl... |
import re
from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
unified_strdate,
)
class PornotubeIE(InfoExtractor):
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?pornotube\.com(/c/(?P<channel>[0-9]+))?(/m/(?P<videoid>[0-9]+))(/(?P<title>.+))$'
_TEST = {
u'url': u'http://por... |
"""ryu plugin update
Revision ID: 49332180ca96
Revises: 1149d7de0cfa
Create Date: 2013-01-30 07:52:58.472885
"""
# revision identifiers, used by Alembic.
revision = '49332180ca96'
down_revision = '1149d7de0cfa'
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
'quantum.plugin... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: expect
version_added: '2.0'
short_description: Executes a ... |
"""
7zip file parser
Informations:
- File 7zformat.txt of 7-zip SDK:
http://www.7-zip.org/sdk.html
Author: Olivier SCHWAB
Creation date: 6 december 2006
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (Field, FieldSet, ParserError,
GenericVector,
Enum, UInt8, UInt32, UInt64,
... |
import datetime
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.http import HttpResponse
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import Cont... |
import sys
import gdb
import os
import os.path
pythondir = '/Users/build/workspace/GCC-5-0-build_build-toolchain-mac/gcc-arm-none-eabi-5_4-2016q2-20160622/install-native/share/gcc-arm-none-eabi'
libdir = '/Users/build/workspace/GCC-5-0-build_build-toolchain-mac/gcc-arm-none-eabi-5_4-2016q2-20160622/install-native/arm-... |
from ..hub_proxy import SAMPHubProxy
from ..hub import SAMPHubServer
from .. import conf
def setup_module(module):
conf.use_internet = False
class TestHubProxy(object):
def setup_method(self, method):
self.hub = SAMPHubServer(web_profile=False, mode='multiple', pool_size=1)
self.hub.start(... |
import py
from py._xmlgen import unicode, html, raw
class ns(py.xml.Namespace):
pass
def test_escape():
uvalue = py.builtin._totext('\xc4\x85\xc4\x87\n\xe2\x82\xac\n', 'utf-8')
class A:
def __unicode__(self):
return uvalue
def __str__(self):
x = self.__unicode__()
... |
"""Implementation of platform-specific functionality.
For each function or class described in `tornado.platform.interface`,
the appropriate platform-specific implementation exists in this module.
Most code that needs access to this functionality should do e.g.::
from tornado.platform.auto import set_close_exec
""... |
from ctypes import byref, c_int
from datetime import date, datetime, time
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException
from django.contrib.gis.gdal.prototypes import ds as capi
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/... |
"""RNN helpers for TensorFlow models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import rnn
from tensorflow.python.ops import variable_scope as vs
def stack_bidirectional_rnn(ce... |
import StringIO
from report.render import render
from report.interface import report_int
from datetime import datetime
import time
from pychart import *
import pychart.legend
import _burndown
class report_tasks(report_int):
def create(self, cr, uid, ids, datas, context=None):
if context is None:
... |
"""Site model and method for get or insert from URL string.
Site model stores root URL for a site. i.e. scheme://netloc. Remember, it
doesn't store path or any other parameters from a URL.
e.g. http://www.google.com:80/%7investors/q4r.html -- For this URL we will only
store http://www.google.com:80.
"""
import urlp... |
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from telemetry import story
def _GetCurrentLocation(action_runner):
return action_runner.EvaluateJavaScript('document.location.href')
def _WaitForLocationChange(action_runner, old_href):
action_runner.WaitForJavaScriptCo... |
import json
import unittest
import webapp2
import webtest
from dashboard import list_monitored_tests
from dashboard import testing_common
from dashboard.models import graph_data
from dashboard.models import sheriff
class ListMonitoredTestsTest(testing_common.TestCase):
def setUp(self):
super(ListMonitoredTes... |
from __future__ import absolute_import, division, print_function
import paramiko
from contextlib import contextmanager
from toolz import keyfilter, memoize, take, curry
from datashape import discover
import re
import uuid
from ..directory import Directory
from ..utils import keywords, tmpfile, sample, ignoring, copyd... |
# -*- 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):
# Adding field 'OrderItem.fulfilled_time'
db.add_column('shoppingcart_orderitem', 'fulfilled_time',
... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutManagerModel.
.. note:: 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 2 of the License, or
(at your option) any later version.... |
from collections import OrderedDict
import simplejson as json
import pandas
def almost_equal(a,b,epsilon = 1.0e-7):
return abs(a-b)< epsilon
class TestDataIterator(object):
"""
>>> data_iterator = TestDataIterator()
>>> print data_iterator.has_next()
True
>>> r = data_iterator.next_row()
... |
import io
import pytest
from nordb.core.nordicRead import *
DUMMY_NORDIC = io.StringIO (
" 2013 0103 0613 04.3 LE 63.635 22.913 0.0F HEL 15 0.3 1.6LHEL 1.4LUPP 1\n"
" GAP= 80 0.1 0.391 0.477 0.0 5\n"
" FULLY AUTOMATIC, EVENT TYPE & LOCATION & MAGN... |
import os
import sys
import tempfile
import shutil
import unittest
import pkg_resources
import warnings
from setuptools.command import egg_info
from setuptools import svn_utils
from setuptools.tests import environment, test_svn
from setuptools.tests.py26compat import skipIf
ENTRIES_V10 = pkg_resources.resource_string... |
import unittest2 as unittest
import sys
from webkitpy.common.system.systemhost import SystemHost
from webkitpy.common.system.platforminfo import PlatformInfo
from webkitpy.common.system.platforminfo_mock import MockPlatformInfo
from webkitpy.common.system import path
class AbspathTest(unittest.TestCase):
def plat... |
"""
Contains common utilities for URL escaping.
"""
import re
def quote_slashes(text):
"""
Quote '/' characters so that they aren't visible to
django's url quoting, unquoting, or url regex matching.
Escapes '/'' to the sequence ';_', and ';' to the sequence
';;'. By making the escape sequence fix... |
#!/usr/bin/env python
""" Microscopic modification and query tool for overrides in projectb """
# Copyright (C) 2004, 2006 Daniel Silverstone <<EMAIL>>
# 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 Fou... |
"""passlib.handlers.mssql - MS-SQL Password Hash
Notes
=====
MS-SQL has used a number of hash algs over the years,
most of which were exposed through the undocumented
'pwdencrypt' and 'pwdcompare' sql functions.
Known formats
-------------
6.5
snefru hash, ascii encoded password
no examples found
7.0
sne... |
# XXX TO DO:
# - popup menu
# - support partial or total redisplay
# - more doc strings
# - tooltips
# object browser
# XXX TO DO:
# - for classes/modules, add "open source" to object browser
import re
from idlelib.TreeWidget import TreeItem, TreeNode, ScrolledCanvas
from reprlib import Repr
myrepr = Repr()
myrep... |
""" Patch utility to apply unified diffs """
""" Brute-force line-by-line parsing
Project home: http://code.google.com/p/python-patch/
This file is subject to the MIT license available here:
http://www.opensource.org/licenses/mit-license.php
CEF Changes
-----------
2015/04/22
... |
from pykickstart.base import BaseData, KickstartCommand
from pykickstart.errors import KickstartError, KickstartValueError, formatErrorMsg
from pykickstart.options import KSOptionParser
import warnings
from pykickstart.i18n import _
class FC6_RepoData(BaseData):
removedKeywords = BaseData.removedKeywords
remo... |
"""Module preprocess
Calculates some basic statistics of the image and sets up processing
parameters for PyBDSM.
"""
from __future__ import absolute_import
import numpy as N
from . import _cbdsm
from .image import *
from math import pi, sqrt, log
from . import const
from . import functions as func
from . import mylog... |
# coding: utf-8
import warnings
from django.test import TestCase
class URLHandling(TestCase):
"""
Tests for URL handling in views and responses.
"""
urls = 'regressiontests.views.generic_urls'
redirect_target = "/%E4%B8%AD%E6%96%87/target/"
def setUp(self):
self.save_warnings_state(... |
import argparse
import json
import matplotlib.pyplot as plt
import skimage.io as io
import cv2
import numpy as np
import glob
import PIL.Image
import os,sys
from lxml import etree, objectify
def cityscapeMask2Pascal(databaseName, extractedFolderAnn, outputFolderAnn, imagesFolder):
print("extractedFolderAnn", extr... |
from reportlab.lib import colors
import re
allcols = colors.getAllNamedColors()
regex_t = re.compile('\(([0-9\.]*),([0-9\.]*),([0-9\.]*)\)')
regex_h = re.compile('#([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z][0-9a-zA-Z])')
def get(col_str):
if col_str is None:
col_str = ''
global allc... |
from __future__ import absolute_import
from django.db import transaction, IntegrityError
from django.test import TestCase
from .models import (Place, Restaurant, Waiter, ManualPrimaryKey, RelatedModel,
MultiModel)
class OneToOneTests(TestCase):
def setUp(self):
self.p1 = Place(name='Demon Dogs', add... |
from boto.regioninfo import RegionInfo, get_regions
def regions():
"""
Get all available regions for the Amazon Cognito Sync service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
from boto.cognito.sync.layer1 import CognitoSyncConnection
return get_regions('cogn... |
"""LTI integration tests"""
from collections import OrderedDict
import json
import mock
import oauthlib
import urllib
from django.conf import settings
from django.core.urlresolvers import reverse
from courseware.tests import BaseTestXmodule
from courseware.views import get_course_lti_endpoints
from lms.djangoapps.lm... |
# (c) 2016, Hao Feng <<EMAIL>>
import logging
from .jobs import Job
from ._async import AsyncRunner
from .context import Context
from exe.executor.utils import *
from exe.utils.err import excinst
from exe.exc import JobNotSupportedError
from exe.exc import ExecutorPrepareError
from exe.exc import ExecutorDeployError... |
def classFactory(iface):
from .fTools import fToolsPlugin
return fToolsPlugin(iface) |
#!/usr/bin/python
import sys
sys.path.append("python")
import os
import openchange
import openchange.mapistore as mapistore
from openchange import mapi
dirname = "/tmp/mapistore"
if not os.path.exists(dirname):
os.mkdir("/tmp/mapistore")
mapistore.set_mapping_path("/tmp/mapistore")
MAPIStore = mapistore.mapist... |
class ModuleDocFragment(object):
# AWS only documentation fragment
DOCUMENTATION = """
options:
ec2_url:
description:
- Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Must be specified if region is not used. If not set then the value of the EC... |
import datetime
import logging
from .base import LitecordObject
from ..utils import dt_to_json
log = logging.getLogger(__name__)
class EmbedFooter(LitecordObject):
"""Embed footer.
Attributes
----------
url: str
Footer URL.
text: str
Footer text.
"""
def __init__(self... |
# -*- coding: utf-8 -*-
"""
Unit tests for landlab.components.overland_flow.KinwaveOverlandFlowModel
last updated: 3/14/16
"""
(_SHAPE, _SPACING, _ORIGIN) = ((10, 10), (25, 25), (0.0, 0.0))
_ARGS = (_SHAPE, _SPACING, _ORIGIN)
def test_KinWaveOF_name(kin_wave_of):
assert kin_wave_of.name == "KinwaveOverlandFlowMo... |
# -*- coding: utf-8 -*-
"""
:copyright: 2005-2008 by The PIDA Project
:license: GPL 2 or later (see README/COPYING/LICENSE)
"""
import os, sys, traceback
from subprocess import Popen, PIPE, STDOUT
from StringIO import StringIO
from optparse import OptionParser
try:
import select
except ImportError:
se... |
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1.type import useful
from pyasn1_modules import rfc2459
# Start of OCSP module definitions
# This should be in directory Authentication Framework (X.509) module
class CRLReason(univ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
def _load_requires_from_file(filepath):
return [pkg_name.rstrip('\r\n') for pkg_name in open(filepath).readlines()]
def _install_requires():
requires = _load_requires_from_file('requirements.txt')
if sy... |
from datetime import datetime
import pandas as pd
#
from django.db import models
class DataGroup(models.Model):
"""
Represents a group an Data Sets
"""
"""
Fields
"""
name = models.CharField(max_length=200)
"""
Methods
"""
def __unicode__(self):
return self... |
from tests.base_test import BaseTest
from testfixtures import log_capture
from core.weexceptions import ArgparseError
from core import modules
from core.sessions import SessionURL
from core import messages
import logging
import os
class SystemInfo(BaseTest):
def setUp(self):
session = SessionURL(self.url,... |
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
class PostGISSchemaEditor(DatabaseSchemaEditor):
geom_index_type = 'GIST'
geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND'
rast_index_wrapper = 'ST_ConvexHull(%s)'
sql_add_spatial_index = "CREATE INDEX %(index)s ON %(table)s USI... |
"""Add new tables that associate calendars and exception dates to a meta vj
Revision ID: 3b17c15627cb
Revises: 2d86200bcb93
Create Date: 2015-01-20 17:08:23.570348
"""
# revision identifiers, used by Alembic.
revision = '3b17c15627cb'
down_revision = '2d86200bcb93'
from alembic import op
import sqlalchemy as sa
imp... |
"""
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... |
"""Generic data manager for images organized by folders.
Each folder is a category.
"""
import os
from deepmodels.tf.core import commons
from deepmodels.tf.core import data_provider
from deepmodels.tf.core import tools
from deepmodels.tf.data import dm_data
class ImgFolderData(dm_data.DMData):
"""Class to manag... |
"""
Django ORM model specifications for the User API application
"""
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_delete, post_save, pre_delete, pre_save
from django.dispatch import receiver
from mode... |
from django.conf import settings
from django.template import Template, Context
from django.db import models
from django.contrib.contenttypes.models import ContentType
import os.path
import djangosphinx.apis.current as sphinxapi
__all__ = ('generate_config_for_model', 'generate_config_for_models')
def _get_database... |
import uuid
from django.test.utils import override_settings
from neutronclient.common import exceptions as neutron_exc
from openstack_dashboard import api
from openstack_dashboard import policy
from openstack_dashboard.test import helpers as test
class NeutronApiTests(test.APITestCase):
def test_network_list(s... |
"""Hashing algorithms
Hash functions take arbitrary binary strings as input, and produce a random-like output
of fixed size that is dependent on the input; it should be practically infeasible
to derive the original input data given only the hash function's
output. In other words, the hash function is *one-way*.
It sh... |
from collections import namedtuple
from copy import deepcopy
from random import randint, sample
from uow import UnitOfWorkFactory
import logging
import sys
######################################################################
## class definitions
OPS = ( "rend", "turn", "sup", "loop" )
Point = namedtuple('Point', ... |
import logging
import time
from cloud.programs.optimization_program import OptimizationProgram
from cloud.models.host import Host
from cloud.models.base_model import BaseModel
from cloud.models.virtual_machine import VirtualMachine
# Configure logging for the module name
logger = logging.getLogger(__name__)
... |
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.views.generic import TemplateView
from django.views.generi... |
import optparse
import os
import sys
def _crop_one_frame(yuv_file, output_file, component_sizes):
"""Crops one frame.
This function crops one frame going through all the YUV planes and cropping
respective amount of rows.
Args:
yuv_file(file): The opened (for binary reading) YUV file.
output_file(fil... |
import crm_lead_report
import crm_phonecall_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Profiling support for unit and performance tests.
These are special purpose profiling methods which operate
in a more fine-grained way than nose's profiling plugin.
"""
import os, sys
from sqlalchemy.test import config
from sqlalchemy.test.util import function_named, gc_collect
from nose import SkipTest
__all__ ... |
"""
Generate the Legendre polynomials using a scipy.stats random variable.
This particular demo generates the Legendre polynomials.
This demo demonstrates how to:
+ Construct a set of orthogonal univariate polynomials given a scipy.stats
random variable.
+ Examine certain properties of a univariate polyn... |
"""
Start-to-finish test from preparation steps to fitting redshifts.
"""
def misc():
"""
Make cutouts of the large 3D-HST mosaic / segm. image for reference.
Put in the "Catalog" directory
"""
os.chdir('/Users/brammer/3DHST/Spectra/Work/GOODS-S/UnitTest/Misc')
iraf.imcopy('/Us... |
import datetime
import os
import django.utils.copycompat as copy
from django.conf import settings
from django.db.models.fields import Field
from django.core.files.base import File, ContentFile
from django.core.files.storage import default_storage
from django.core.files.images import ImageFile, get_image_dime... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './pyqtgraph/flowchart/FlowchartCtrlTemplate.ui'
#
# by: PyQt5 UI code generator 5.0.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, For... |
'''
Tests overall package functions and classes.
.. moduleauthor:: Chris Fournier <<EMAIL>>
'''
from __future__ import absolute_import
import unittest
from decimal import Decimal
import segeval
from segeval.util.test import TestCase
from segeval import (KAZANTSEVA2012_G5, actual_agreement_linear,
... |
from __future__ import print_function
# $example on$
from pyspark.ml.feature import HashingTF, IDF, Tokenizer
# $example off$
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession\
.builder\
.appName("TfIdfExample")\
.getOrCreate()
# $example on$
sen... |
import unittest, os, sys, re, threading, time
myDirectory = os.path.realpath(sys.argv[0])
rootDirectory = re.sub("/testing/.*", "", myDirectory)
sys.path.append(rootDirectory)
from testing.lib import BaseTestSuite
excludes = []
import tempfile, getpass
from xml.dom import minidom
from hodlib.Hod.hadoop import h... |
from sympy.strategies.branch.core import (exhaust, debug, multiplex,
condition, notempty, chain, onaction, sfilter, yieldify, do_one,
identity)
from sympy.core.compatibility import get_function_name, range
def posdec(x):
if x > 0:
yield x-1
else:
yield x
def branch5(x):
if ... |
import time, sys, os, shutil, subprocess, distutils.dir_util
ActiveProjectDirectory = os.getenv("NELBUILDACTIVEPROJECT", "configuration/project")
sys.path.append(ActiveProjectDirectory)
def printLog(log, text):
log.write(text + "\n")
print text
def mkPath(log, path):
printLog(log, "DIR " + path)
distutils.dir_ut... |
from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
try:
import scipy.stats as stats
except ImportError:
pass
from .common import Benchmark
class Anderson_KSamp(Benchmark):
def setup(self, *args):
self.rand = [np.random.normal(loc=i, size=1000) fo... |
import logging
import time
from imaplib import IMAP4
from imaplib import IMAP4_SSL
from poplib import POP3
from poplib import POP3_SSL
try:
import cStringIO as StringIO
except ImportError:
import StringIO
import zipfile
import base64
from openerp import addons
from openerp.osv import fields, osv
from openerp ... |
from __future__ import absolute_import
import pytest
from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson
from ansible.module_utils import basic
from ansible.modules.network.check_point import checkpoint_access_rule
OBJECT = {'layer': 'foo', 'position': 'bar', 'name... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .brightcove import BrightcoveIE
from .common import InfoExtractor
from ..utils import ExtractorError
class NownessIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|cn)\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])'
... |
import os
import sys
import time
import traceback
import eventlet
import greenlet
from oslo_service import service as oslo_service
from gbpservice.nfp.core import common as nfp_common
from gbpservice.nfp.core import context
from gbpservice.nfp.core import event as nfp_event
from gbpservice.nfp.core import log as nfp_... |
from __future__ import unicode_literals
import django.template.loader
from django.conf.urls import url
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.template import Template, TemplateDoesNotExist
from django.test import TestCase
from django.utils import six
from rest_... |
"""
.. todo::
WRITEME
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
from theano.sandbox.rng_mrg import MRG_RandomStreams
from pylearn... |
from __future__ import absolute_import
import os
if os.environ.get('USE_TWISTED', False):
from twisted.trial import unittest
from twisted.internet import defer
from twisted.python.failure import Failure
from autobahn.wamp import message, role
from autobahn.wamp.exception import ProtocolError
f... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for the postgres project storage.
Note: to prepare the DB, you need to run the sql files specified in
tests/testdata/provider/testdata_pg.sh
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as... |
"""
Component to interface with various switches that can be controlled remotely.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/switch/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.loader import bind_h... |
# -*- coding: utf-8 -*-
"""
flask.testsuite.regression
~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests regressions.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import gc
import sys
import flask
import threading
import unittest
from werkzeug.exceptions impor... |
import json
import logging
import ochopod
import os
import re
import redis
import requests
import shutil
import sys
import tempfile
import time
import yaml
from ochopod.core.utils import shell
from ochopod.core.fsm import diagnostic
from os import path
from yaml import YAMLError
logger = logging.getLogger('ochopod')... |
import sys
from twisted.internet import reactor
from twisted.python import log
from twisted.web.server import Site
from twisted.web.static import File
from autobahn.twisted.websocket import WebSocketServerFactory, \
WebSocketServerProtocol, \
listenWS
from autobahn.twisted.resource import WebSocketResource
... |
import os
_basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
# Database setup
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/sketchy-tests.db'
# Broker configuration information, currently only supporting Redis
CELERY_BROKER_URL = 'redis://localhost:6379'
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Virt management features
Copyright 2007, 2012 Red Hat, Inc
Michael DeHaan <<EMAIL>>
Seth Vidal <<EMAIL>>
This software may be freely redistributed under the terms of the GNU
general public license.
You should have received a copy of the GNU General Public License
along ... |
# -*- coding:utf-8 -*-
# PROJECT_NAME : sandiego
# EMAIL : <EMAIL>
from setuptools import setup, find_packages
version = '0.0.1a1'
setup(name='sandiego',
version=version,
description="a lightweight web framework, only for python3 and django haters",
long_description="""\
a lightweight ... |
# coding: utf-8
# cf.http://d.hatena.ne.jp/white_wheels/20100327/p3
import numpy as np
import matplotlib.pylab as plt
from mpl_toolkits.mplot3d import Axes3D
def _numerical_gradient_no_batch(f, x):
h = 1e-4 # 0.0001
grad = np.zeros_like(x)
for idx in range(x.size):
tmp_val = x[idx]
x[... |
from gnuradio import gr
import threading
import numpy
class _variable_sink_base(gr.hier_block2, threading.Thread):
"""
The thread polls the message queue for values and writes to a callback.
"""
def __init__(self, vlen, decim, callback):
self._vlen = vlen
self._callback = callback
self._item_size = self._si... |
from django.core.urlresolvers import reverse
from django import http
from mox3.mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
class VolTypeExtrasTests(test.BaseAdminViewTests):
@test.create_stubs({api.cinder: ('volume_type_extra_get',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.