content string |
|---|
import stock_location
import procurement_pull
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from __future__ import with_statement
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from pyoos import __version__
def readme():
with open('README.md') as f:
return f.read()
reqs = [line.strip() for line in open('requirements.txt')]
class ... |
import abc
from oslo_log import log as logging
from designate.plugin import DriverPlugin
LOG = logging.getLogger(__name__)
class AgentBackend(DriverPlugin):
"""Base class for backend implementations"""
__plugin_type__ = 'backend'
__plugin_ns__ = 'designate.backend.agent_backend'
def __init__(self... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.plugins.action import ActionBase
from ansible.utils.boolean import boolean
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=dict()):
src = self._task.args.get('src', No... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
qualities,
parse_duration,
)
class NDRBaseIE(InfoExtractor):
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
... |
#!/usr/bin/env python
# coding=utf-8
from sacred.utils import iter_prefixes, join_paths
class ConfigSummary(dict):
def __init__(
self, added=(), modified=(), typechanged=(), ignored_fallbacks=(), docs=()
):
super().__init__()
self.added = set(added)
self.modified = set(modifie... |
import IECore
import Gaffer
##\ todo: Remove this class once SceneReader is capable of loading
# single Object scenes using IECore.Reader internally.
class ObjectReader( Gaffer.ComputeNode ) :
def __init__( self, name="ObjectReader" ) :
Gaffer.ComputeNode.__init__( self, name )
self.addChild( Gaffer.StringPlu... |
from ..excel_comparsion_test import ExcelComparisonTest
from datetime import datetime
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filen... |
import unittest
import weakref
import imath
import Gaffer
import GafferTest
import GafferUI
import GafferUITest
class CompoundEditorTest( GafferUITest.TestCase ) :
def testAddEditorLifetime( self ) :
s = Gaffer.ScriptNode()
s["n"] = GafferTest.AddNode()
c = GafferUI.CompoundEditor( s )
e = GafferUI.Graph... |
"""
============
Data Browser
============
"""
import numpy as np
import matplotlib.pyplot as plt
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 600)
plt.cla()
plt.clf()
plt.close('all')
def tempimage():
... |
from __future__ import absolute_import
from __future__ import print_function
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_create_stream
from zerver.models import Realm, get_realm
import sys
class Command(BaseCommand):
help = """Create a stream, and subscribe all active u... |
__all__ = ("L2CAP", "RFCOMM", "OBEX", "BluetoothError", "splitclass")
# Protocol/service class types, used for sockets and advertising services
L2CAP, RFCOMM, OBEX = (10, 11, 12)
class BluetoothError(IOError):
"""
Generic exception raised for Bluetooth errors. This is not raised for
socket-related e... |
from decimal_precision import get_precision
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Actions to run at server startup.
"""
from django.db import connection
from django.db import transaction
def run():
"""Call this from manage.py or tests.
"""
_add_custom_mult_agg_function()
def _add_custom_mult_agg_function():
"""Make sure the Postgresql database has a custom function array_agg_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import distutils.spawn
import os
import os.path
import pipes
import subprocess
import traceback
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.plugins.connection import ConnectionBase
from ... |
import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_rf, h2o_import as h2i, h2o_util
paramDict = {
# 2 new
'destination_key': ['model_keyA', '012345', '__hello'],
'cols': [None, None, None, None, None, '0,1,2,3,4,5,6,7,8','C1,C2,C3,C4,C5,C6,C7,C8'],
# exc... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.parsing.splitter import split_args, parse_kv
import pytest
SPLIT_DATA = (
(u'a',
[u'a'],
{u'_raw_params': u'a'}),
(u'a=b',
[u'a=b'],
{u'a': u'b'}),
(u'a="foo bar"',
... |
#!/usr/bin/env python
# - * - coding: UTF-8 - * -
"""
This script generates tests text-emphasis-position-property-001 ~ 006
which cover all possible values of text-emphasis-position property with
all combination of three main writing modes and two orientations. Only
test files are generated by this script. It also out... |
import mock
from oslo_serialization import jsonutils
import webob
from cinder import context
from cinder import exception
from cinder.objects import fields
from cinder import test
from cinder.tests.unit.api import fakes
from cinder.tests.unit import fake_constants as fake
from cinder.tests.unit import fake_snapshot
fr... |
for a, b, c in b:
pass
else:
1/0
for : keyword.control.flow.python, source.python
: source.python
a : source.python
, : punctuation.separator.element.python, source.python
: source.python
b : source.python
, : punctuation.s... |
import numpy as np
from tools.metadata import get_hero_dict
import operator
import pandas as pd
import plotly.graph_objs as go
import plotly.plotly as py
def winrate_statistics(dataset_df, mmr_info):
x_data, y_data = dataset_df
wins = np.zeros(114)
games = np.zeros(114)
winrate = np.zeros(114)
... |
"""This example gets users by email.
"""
# Import appropriate modules from the client library.
from googleads import ad_manager
EMAIL_ADDRESS = 'INSERT_EMAIL_ADDRESS_HERE'
def main(client, email_address):
# Initialize appropriate service.
user_service = client.GetService('UserService', version='v201808')
# Cr... |
from __future__ import absolute_import
import abc
class MinHashIndexBackendTestMixin(object):
__meta__ = abc.ABCMeta
@abc.abstractproperty
def index(self):
pass
def test_basic(self):
self.index.record("example", "1", [("index", "hello world")])
self.index.record("example", "... |
"""
Functions for acting on a axis of an array.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
def axis_slice(a, start=None, stop=None, step=None, axis=-1):
"""Take a slice along axis 'axis' from 'a'.
Parameters
----------
a : numpy.ndarray
The array ... |
"""Tests for summary image op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.python.ops import image_ops
class SummaryImageOp... |
db1 = {"Database":
{"Raynor": {
"Raynor-Counter": ["Tracer", "Uther", "Zeratul"],
"Raynor-Synergize": ["Who", "It" , "is"]
},
"Stitches" : {
"Stiches-Counter": ["What", "ever", "it",],
"Stiches-Synergize":["What", "name", "is"]
}
}
}
db... |
from __future__ import unicode_literals
from datetime import datetime
from django.test import TestCase
from .models import Article, Category
class M2MMultipleTests(TestCase):
def test_multiple(self):
c1, c2, c3, c4 = [
Category.objects.create(name=name)
for name in ["Sports", "N... |
import os
from time import sleep
from django.core.management import BaseCommand
from django.utils import timezone
from privacyscore.backend.models import Site, ScanList
from privacyscore.utils import normalize_url
class Command(BaseCommand):
help = 'Rescan all sites in an exisiting ScanList.'
def add_argum... |
# -*- coding: utf-8 -*-
import json
from binascii import b2a_hex
from beaker.crypto.pbkdf2 import pbkdf2
from pyload.core.network.request_factory import get_url
from ..base.account import BaseAccount
class PBKDF2:
def __init__(self, passphrase, salt, iterations=1000):
self.passphrase = passphrase
... |
"""
The ActionChains implementation,
"""
import time
from selenium.webdriver.remote.command import Command
from .utils import keys_to_typing
from .actions.action_builder import ActionBuilder
class ActionChains(object):
"""
ActionChains are a way to automate low level interactions such as
mouse movement... |
# -*- test-case-name: buildbot.test.test_changes -*-
from twisted.python import log
from buildbot.pbutil import NewCredPerspective
from buildbot.changes import base, changes
class ChangePerspective(NewCredPerspective):
def __init__(self, changemaster, prefix):
self.changemaster = changemaster
se... |
# -*- coding: utf-8 -*-
# deconvolution.py --- Image deconvolution
"""Implementations restoration functions"""
from __future__ import division
import numpy as np
import numpy.random as npr
from scipy.signal import convolve2d
from . import uft
__keywords__ = "restoration, image, deconvolution"
def wiener(image, p... |
"""
Script for importing courseware from git/xml into a mongo modulestore
"""
import os
import re
import StringIO
import subprocess
import logging
from django.core import management
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
import dashboard.g... |
#!/usr/bin/env python
"""buildpkg.py -- Build OS X packages for Apple's Installer.app.
This is an experimental command-line tool for building packages to be
installed with the Mac OS X Installer.app application.
It is much inspired by Apple's GUI tool called PackageMaker.app, that
seems to be part of the OS X develo... |
from unittest import TestCase
from nose.tools import (
timed,
nottest
)
from datetime import datetime
import pandas as pd
import pytz
from zipline.finance import trading
from zipline.algorithm import TradingAlgorithm
from zipline.finance import slippage
from zipline.utils import factory
from zipline.utils.fac... |
import os
import os.path
from subprocess import Popen, PIPE, call
import re
from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception
LOCALE_NORMALIZATION = {
".utf8": ".UTF-8",
".eucjp": ".EUC-JP",
".iso885915": ".ISO-8859-15",
".cp1251": ".CP1251",
".koi8... |
"""HTML5 Push Messaging notification service."""
from datetime import datetime, timedelta
from functools import partial
import json
import logging
import time
from urllib.parse import urlparse
import uuid
from aiohttp.hdrs import AUTHORIZATION
import jwt
from py_vapid import Vapid
from pywebpush import WebPusher
impor... |
"""Cryptlib AES implementation."""
from cryptomath import *
from AES import *
if cryptlibpyLoaded:
def new(key, mode, IV):
return Cryptlib_AES(key, mode, IV)
class Cryptlib_AES(AES):
def __init__(self, key, mode, IV):
AES.__init__(self, key, mode, IV, "cryptlib")
sel... |
"""
Directives for document parts.
"""
__docformat__ = 'reStructuredText'
from docutils import nodes, languages
from docutils.transforms import parts
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
class Contents(Directive):
"""
Table of contents.
The table of co... |
from openerp.osv import fields, osv
class res_company(osv.Model):
_name = "res.company"
_inherit = "res.company"
_columns = {
"gengo_private_key": fields.text("Gengo Private Key", copy=False),
"gengo_public_key": fields.text("Gengo Public Key", copy=False),
"gengo_comment"... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'Port Scanner.',
# list of one or m... |
"""
Since this file contains Python 3 specific syntax, it's named without a test_
prefix so the test runner won't try to import it. Instead, the test class is
imported in test_debug.py, but only on Python 3.
This filename is also in setup.cfg flake8 exclude since the Python 2 syntax
error (raise ... from ...) can't be... |
# -*- coding: utf-8 -*-
# Django settings for the mozillians project.
import logging
import os.path
import sys
from funfactory.manage import path
from funfactory.settings_base import * # noqa
from funfactory.settings_base import JINJA_CONFIG as funfactory_JINJA_CONFIG
from urlparse import urljoin
from django.utils.... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.errors import AnsibleError
# Note, sha1 is the only hash algorithm compatible with python2.4 and with
# FIPS-140 mode (as of 11-2014)
try:
from hashlib import sha1 as sha1
except ImportError:
from sh... |
# pylint: disable=missing-docstring
from lettuce import world, step
from selenium.webdriver.common.keys import Keys
from xmodule.modulestore.django import modulestore
VIDEO_BUTTONS = {
'CC': '.hide-subtitles',
'volume': '.volume',
'play': '.video_control.play',
'pause': '.video_control.pause',
'ha... |
"""Provides the :func:`scan_on_change` function."""
import xml.etree.ElementTree
import re
ON_CHANGE_RE = re.compile('^(.*?)\((.*)\)$')
def scan_on_change(oerp, models):
"""Scan all `on_change` methods detected among views of `models`."""
result = {}
view_obj = oerp.get('ir.ui.view')
model_data_obj =... |
# -*- coding: utf-8 -*-
import rospy
import numpy as np
import cv2
import os.path
import rospy
from tensorflow_node.input import InputLayer
class OpenCVInputLayer(InputLayer):
"""
Contains OpenCV to feed in video feeds to TF.
"""
def __init__(self, batch_size=1, output_size=[28, 28], input="", numb... |
from msrest.serialization import Model
class ContainerServiceCredentials(Model):
"""Information about the Azure Container Registry which contains the images
deployed to the cluster.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar acs_kube_config: The... |
from django.utils.translation import ugettext as _
class RoleNotAllowed(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return _(u"Role %s is not allowed in current application domain") % self.value
class RoleParameterNotAllowed(Exception):
def __init__(self,... |
import os
import imp
from collections import defaultdict
from cerbero.build.cookbook import CookBook
from cerbero.config import Platform, Architecture, Distro, DistroVersion,\
License
from cerbero.packages import package, PackageType
from cerbero.errors import FatalError, PackageNotFoundError
from cerbero.util... |
import sys
import config
import os.path
global have_gtk
have_gtk = False
#if not sys.executable.endswith("pythonw.exe"):
# print "PYTHON PATH =",sys.path
try:
import pygtk
pygtk.require('2.0')
import gtk
have_gtk = True
except Exception,e:
if sys.platform=="win32":
try:
from ctypes import c_int, WINFUNC... |
# -*- coding: utf-8 -*-
from .baseapi import BaseAPI, GET, POST, DELETE
class StickySesions(object):
"""
An object holding information on a LoadBalancer's sticky sessions settings.
Args:
type (str): The type of sticky sessions used. Can be "cookies" or
"none"
cookie_name (str,... |
"""Support for the PostgreSQL database via py-postgresql.
Connecting
----------
URLs are of the form ``postgresql+pypostgresql://user:password@host:port/dbname[?key=value&key=value...]``.
"""
from sqlalchemy import util
from sqlalchemy import types as sqltypes
from sqlalchemy.dialects.postgresql.base import PGDiale... |
# -*- coding: utf-8 -*-
from tw.api import WidgetsList
from tw.forms import TableForm
from tw.forms.fields import HiddenField
from budget.model import DBSession
from budget.model import *
from budget.widgets.components import *
#class SearchForm(RPACForm):
#
# group_options = DBSession.query(Group.group_id,... |
# -*- 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 'PaidCourseRegistration.mode'
db.add_column('shoppingcart_paidcourseregistration', 'mode',
... |
"""
This package contains modules for standard tree transforms available
to Docutils components. Tree transforms serve a variety of purposes:
- To tie up certain syntax-specific "loose ends" that remain after the
initial parsing of the input plaintext. These transforms are used to
supplement a limited syntax.
- T... |
"""
Package containing modules that are used internally by Numenta Python
tools and plugins to extend standard library functionality.
These modules should NOT be used by client applications.
"""
from __future__ import with_statement
# Standard imports
import os
import sys
import inspect
import logging
import logging.... |
from django.db.models import signals
from django.utils.functional import curry
from django.conf import settings
from audit_log import registration
from audit_log.models import fields
from audit_log.models.managers import AuditLogManager
def _disable_audit_log_managers(instance):
for attr in dir(instance):
... |
"""
Tests for `backfill_course_outlines` Studio (cms) management command.
"""
from django.core.management import call_command
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.content.learning_sequences.api import ... |
"""Self-test suite for Crypto.Hash.SHA256"""
__revision__ = "$Id$"
import unittest
from Crypto.Util.py3compat import *
class LargeSHA256Test(unittest.TestCase):
def runTest(self):
"""SHA256: 512/520 MiB test"""
from Crypto.Hash import SHA256
zeros = bchr(0x00) * (1024*1024)
h = S... |
from .primitive import *
from ..rect import Rect
from .unicode import NAME_TO_UNICODE
import re
import time as ti
class Text(Primitive):
def __init__(self, text, font_path, size, align="center"):
super(Text, self).__init__()
self.text = text
self.size = int(size)
self.align = align
# Test if icon
icon =... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import xml.dom.minidom
try:
import ncclient.manager
HAS_NCCLIENT = True
except ImportError:
HAS_NCCLIENT = False
import logging
def netconf_edit_config(m, xml, com... |
import numpy as np
from learning.dataset import CalTechSilhouettes
from learning.preproc import PermuteColumns
from learning.termination import LogLikelihoodIncrease, EarlyStopping
from learning.monitor import MonitorLL, DLogModelParams, SampleFromP
from learning.training import Trainer
from learning.models.rws impo... |
import os
import subprocess
import sys
import time
from multiprocessing import cpu_count, Queue, Process
from test import Test
class Message(object):
"Message exchanged in the TestSet message queue"
pass
class MessageTaskNew(Message):
"Stand for a new task"
def __init__(self, task):
self... |
{
'name': 'Expenses Management',
'version': '1.0',
'category': 'Human Resources',
"sequence": 30,
'complexity': "easy",
'description': """
This module aims to manage employee's expenses.
===============================================
The whole workflow is implemented:
* Draft expense
*... |
import copy
import inspect
from importlib import import_module
from django.db import router
from django.db.models.query import QuerySet
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
def ensure_default_manager(cls):
"""
Ensures that a Model subclass contains a defa... |
import data_utils
import numpy as np
PATH = '../data/twitter/'
class Twitter(object):
def __init__(self, path=PATH):
# data
metadata, idx_q, idx_a = data_utils.load_data('../data/')
# get dictionaries
i2w = metadata['idx2w']
w2i = metadata['w2idx']
... |
"""
Check that all of the certs on all service endpoints validate.
"""
import unittest
from tests.integration import ServiceCertVerificationTest
import boto.datapipeline
class DatapipelineCertVerificationTest(unittest.TestCase, ServiceCertVerificationTest):
datapipeline = True
regions = boto.datapipeline.re... |
import adddeps #fix sys.path
import argparse
import logging
import opentuner
from opentuner.search.manipulator import (ConfigurationManipulator,
IntegerParameter,
FloatParameter)
from opentuner.search.objective import MinimizeTime
fro... |
from frappe import _
def get_data():
return {
"Accounts": {
"color": "#3498db",
"icon": "icon-money",
"type": "module"
},
"Activity": {
"color": "#e67e22",
"icon": "icon-play",
"label": _("Activity"),
"link": "activity",
"type": "page"
},
"Buying": {
"color": "#c0392b",
"icon":... |
"""Generic MIME writer.
This module defines the class MimeWriter. The MimeWriter class implements
a basic formatter for creating MIME multi-part files. It doesn't seek around
the output file nor does it use large amounts of buffer space. You must write
the parts out in the order that they should occur in the final f... |
from collections import namedtuple
from inspect import isgenerator
import warnings
from ..externals.six import string_types
import numpy as np
from scipy import linalg, sparse
from ..source_estimate import SourceEstimate
from ..epochs import _BaseEpochs
from ..evoked import Evoked, EvokedArray
from ..utils import log... |
import os
from setuptools import find_packages, setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def requirements(fname):
return [line.strip()
for line in open(os.path.join(os.path.dirname(__file__), fname))]
setup(
name = "mwmetrics",
version = ... |
"""
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.contrib.admin.op... |
"""The tests for the Scene component."""
import io
import unittest
from homeassistant.setup import setup_component
from homeassistant import loader
from homeassistant.components import light, scene
from homeassistant.util import yaml
from tests.common import get_test_home_assistant
class TestScene(unittest.TestCase... |
import os
import unittest
import shelve
import glob
from test import test_support
class TestCase(unittest.TestCase):
fn = "shelftemp" + os.extsep + "db"
def test_close(self):
d1 = {}
s = shelve.Shelf(d1, protocol=2, writeback=False)
s['key1'] = [1,2,3,4]
self.assertEqual(s['ke... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest
from ans... |
from __future__ import division
import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras.models import Model, Sequential
from keras.layers import Input, Dense, Concatenate
from keras.optimizers import SGD
import keras.backend as K
from rl.util import clone_optimizer, clone_model, huber_lo... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_wireless_controller_hotspot20_anqp_ip_ad... |
from nose.tools import assert_equal, assert_raises, assert_not_equal
import networkx as nx
import io
import tempfile
import os
from networkx.readwrite.p2g import *
from networkx.testing import *
class TestP2G:
def setUp(self):
self.G=nx.Graph(name="test")
e=[('a','b'),('b','c'),('c','d'),('d','e'... |
import math
from Renderer import Renderer
from skin import parseColor
from enigma import eCanvas, eSize, gRGB, eRect
from Components.VariableText import VariableText
from Components.config import config
class Watches(Renderer):
def __init__(self):
Renderer.__init__(self)
self.fColor = gRGB(255, 255, 255, 0)
se... |
"""Loading unittests."""
import os
import re
import sys
import traceback
import types
import functools
from fnmatch import fnmatch
from . import case, suite, util
__unittest = True
# what about .pyc or .pyo (etc)
# we would need to avoid loading the same tests multiple times
# from '.py', '.pyc' *and* '.pyo'
VALID... |
"""Unit tests for numbers.py."""
import math
import operator
import unittest
from numbers import Complex, Real, Rational, Integral
class TestNumbers(unittest.TestCase):
def test_int(self):
self.assertTrue(issubclass(int, Integral))
self.assertTrue(issubclass(int, Complex))
self.assertEqua... |
"""End-to-end benchmark for batch normalization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import tensorflow as tf
from tensorflow.python.ops import gen_nn_ops
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_boolean("use_gpu", True, ""... |
import threading
import contextlib
from socorro.external.hbase import hbase_client
from configman.config_manager import RequiredConfig
from configman import Namespace
class HBaseSingleConnectionContext(RequiredConfig):
"""a configman compliant class for setup of HBase connections
DO NOT SHARE HBASE CONNECTIO... |
#!/usr/bin/env python
''' This is a sample for histogram plotting for RGB images and grayscale images for better understanding of colour distribution
Benefit : Learn how to draw histogram of images
Get familier with cv2.calcHist, cv2.equalizeHist,cv2.normalize and some drawing functions
Level : Beginner or... |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import AuthProvider
from sentry.testutils import TestCase, PermissionTestCase
class OrganizationHomePermissionTest(PermissionTestCase):
def setUp(self):
super(OrganizationHomePermissionTest, self).setU... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable-all
import os
import re
import sys
import codecs
import shutil
import argparse
from textwrap import dedent
from chardet import detect
from pysrt import SubRipFile, SubRipTime, VERSION_STRING
def underline(string):
return "\033[4m%s\033[0m" % string... |
"""Base geometry class and utilities
"""
from functools import wraps
import sys
import warnings
from shapely.coords import CoordinateSequence
from shapely.geos import lgeos
from shapely.impl import DefaultImplementation
from shapely import wkb, wkt
GEOMETRY_TYPES = [
'Point',
'LineString',
'LinearRing',
'Poly... |
from importlib import util
from . import util as test_util
import imp
import sys
import types
import unittest
class ModuleForLoaderTests(unittest.TestCase):
"""Tests for importlib.util.module_for_loader."""
def return_module(self, name):
fxn = util.module_for_loader(lambda self, module: module)
... |
"""This module contains base REST classes for constructing client v1 servlets.
"""
from synapse.http.servlet import RestServlet
from synapse.api.urls import CLIENT_PREFIX
from .transactions import HttpTransactionStore
import re
import logging
logger = logging.getLogger(__name__)
def client_path_pattern(path_regex... |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
PRJ_PATH = os.path.abspath(os.path.curdir)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Alice Bloggs', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ... |
"""
A simple command line tool for dumping a Graphviz description (dot) that
describes include dependencies.
"""
def main():
import sys
from clang.cindex import Index
from optparse import OptionParser, OptionGroup
parser = OptionParser("usage: %prog [options] {filename} [clang-args*]")
parser.dis... |
from ctypes import c_void_p, POINTER, sizeof, Structure, windll, WinError, WINFUNCTYPE
from ctypes.wintypes import BOOL, BYTE, DWORD, HANDLE, LPCWSTR, LPWSTR, UINT, WORD
LPVOID = c_void_p
LPBYTE = POINTER(BYTE)
LPDWORD = POINTER(DWORD)
def ErrCheckBool(result, func, args):
"""errcheck function for Windows functio... |
"""
Helper functions for loading environment settings.
"""
from __future__ import print_function
import os
import sys
import json
from lazy import lazy
from path import Path as path
import memcache
class Env(object):
"""
Load information about the execution environment.
"""
# Root of the git reposito... |
# Taken from Python 2.7 with permission from/by the original author.
import warnings
import sys
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
warnings.warn("django.utils.importlib will be removed in Django 1.9.",
RemovedInDjango19Warning, stacklevel=2)
def _resolve_... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)
"TeX/LaTeX/PDFLaTeX support"
import os, re
import Utils, TaskGen, Task, Runner, Build
from TaskGen import feature, before
from Logs import error, warn, debug
re_tex = re.compile(r'\\(?P<type>include|input|import|bringin|lstinputlisting){(?P<file>[^{}]... |
from neuron import h
h.load_file('mitral.hoc')
from getmitral import getmitral
def mkmitral(gid):
nrn = getmitral(gid)
m = h.Mitral()
m.createsec(len(nrn.dend), len(nrn.tuft))
m.subsets()
m.topol(0) # need to connect secondary dendrites explicitly
for i, d in enumerate(nrn.dend):
# <<< check m... |
import unittest2 as unittest
from .environment import Environment
class EnvironmentTest(unittest.TestCase):
def test_disable_gcc_smartquotes(self):
environment = Environment({})
environment.disable_gcc_smartquotes()
env = environment.to_dictionary()
self.assertEqual(env['LC_ALL'],... |
"""Bounded-Variable Least-Squares algorithm."""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.linalg import norm, lstsq
from scipy.optimize import OptimizeResult
from .common import print_header_linear, print_iteration_linear
def compute_kkt_optimality(g, on_bound):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.