content string |
|---|
"""Tests for memorizingfile module."""
import StringIO
import unittest
import set_sys_path # Update sys.path to locate mod_pywebsocket module.
from mod_pywebsocket import memorizingfile
class UtilTest(unittest.TestCase):
"""A unittest for memorizingfile module."""
def check(self, memorizing_file, num_re... |
"""This module is part of Swampy, a suite of programs available from
allendowney.com/swampy.
Copyright 2010 Allen B. Downey
Distributed under the GNU General Public License at gnu.org/licenses/gpl.html.
"""
from Tkinter import TOP, BOTTOM, LEFT, RIGHT, END, LAST, NONE, SUNKEN
from Gui import Callable
from World impo... |
import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage
from django.contrib.messages.storage.cookie import (
MessageDecoder, MessageEncoder,
)
from django.utils import six
class SessionStorage(BaseStorage):
"""
Stores messages in the session (that is, dja... |
"""
Some integration tests for the GSConnection
"""
import os
import re
import StringIO
import urllib
import xml.sax
from boto import handler
from boto import storage_uri
from boto.gs.acl import ACL
from boto.gs.cors import Cors
from boto.gs.lifecycle import LifecycleConfig
from tests.integration.gs.testcase import G... |
# -*- coding: utf-8 -*-
"""Manage background (threaded) jobs conveniently from an interactive shell.
This module provides a BackgroundJobManager class. This is the main class
meant for public usage, it implements an object which can create and manage
new background jobs.
It also provides the actual job classes manag... |
from django.db.models import Aggregate
from django.contrib.gis.db.backend import SpatialBackend
from django.contrib.gis.db.models.sql import GeomField
class GeoAggregate(Aggregate):
def add_to_query(self, query, alias, col, source, is_summary):
if hasattr(source, '_geom'):
# Doing additional s... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import boto3_conn, get_aws_connection_info, ec2_argument_spec, camel_dict_to_snak... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutSets(Koan):
def test_sets_make_keep_lists_unique(self):
highlanders = ['MacLeod', 'Ramirez', 'MacLeod', 'Matunas',
'MacLeod', 'Malcolm', 'MacLeod']
there_can_only_be_only_one = set(highlanders)
... |
"""Unit tests for the search engine query parsers."""
from invenio.testsuite import InvenioTestCase
import sys
from StringIO import StringIO
from datetime import datetime, timedelta
from invenio.testsuite import make_test_suite, run_test_suite
class SelfCitesIndexerTests(InvenioTestCase):
"""Test utility funct... |
"""
Django settings for mainsite project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from django.core.urlresolvers import reverse_lazy
from os.path import dirn... |
"""RIPEMD-160 cryptographic hash algorithm.
RIPEMD-160_ produces the 160 bit digest of a message.
>>> from Crypto.Hash import RIPEMD
>>>
>>> h = RIPEMD.new()
>>> h.update(b'Hello')
>>> print h.hexdigest()
RIPEMD-160 stands for RACE Integrity Primitives Evaluation Message Digest
with a 160 bit dig... |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
response.headers.set("Content... |
#!/usr/bin/env python
import sys
import signal
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import QWebPage
def save_webpage_screenshot(url, width, height, file_name = None):
"""Saves a screenshot of the webpage given in url into filename+".png"
width and height, if given, ar... |
"""
Get different statistics about the underlying index in a collection
"""
from future.utils import iteritems
from solrcloudpy.utils import _Request, SolrResult
class SolrIndexStats(object):
"""
Get different statistics about the underlying index in a collection
"""
def __init__(self, connection, nam... |
from django import forms
from django.utils.translation import ugettext_lazy as _
# Stop Words courtesy of:
# http://www.dcs.gla.ac.uk/idom/ir_resources/linguistic_utils/stop_words
STOP_WORDS = r"""\b(a|about|above|across|after|afterwards|again|
against|all|almost|alone|along|already|also|although|always|am|
among|am... |
{
"name" : "Format product",
"description" : """Add format field to product""",
"version" : "1.0",
"author" : "Pexego",
"depends" : ["base", "product", "stock"],
"category" : "Product",
"init_xml" : [],
"update_xml" : ["product_format_view.xml", "product_view.xml", "security/ir.model.acc... |
import optparse
import os
from os import environ as env
import plistlib
import re
import subprocess
import sys
import tempfile
TOP = os.path.join(env['SRCROOT'], '..')
def _GetOutput(args):
"""Runs a subprocess and waits for termination. Returns (stdout, returncode)
of the process. stderr is attached to the pare... |
import contextlib
import json
import logging
import re
import urllib2
from telemetry.core import util
from telemetry.core.backends.chrome import chrome_browser_backend
from telemetry.core.backends.chrome import system_info_backend
class IosBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
_DEBUGGER_URL_... |
"""
RadioRecord Top Hits Downloader
"""
from setuptools import find_packages, setup
dependencies = ['click==6.6', 'aiohttp==0.22.5', 'lxml==3.6.1']
setup(
name='rrtop100',
version='0.1.0',
url='https://github.com/kidig/rrtop100',
license='BSD',
author='Dmitrii Gerasimenko',
author_email='<EMAI... |
"""
Tests to verify that CorrectMap behaves correctly
"""
import unittest
from capa.correctmap import CorrectMap
import datetime
class CorrectMapTest(unittest.TestCase):
"""
Tests to verify that CorrectMap behaves correctly
"""
def setUp(self):
self.cmap = CorrectMap()
def test_set_inpu... |
import os
import os.path
import shutil
import re
def main():
pam_items = [ 'core', 'data', 'fsize', 'memlock', 'nofile', 'rss', 'stack', 'cpu', 'nproc', 'as', 'maxlogins', 'maxsyslogins', 'priority', 'locks', 'sigpending', 'msgqueue', 'nice', 'rtprio', 'chroot' ]
pam_types = [ 'soft', 'hard', '-' ]
limi... |
from kafkatest.services.kafka.directory import kafka_dir
class JmxMixin(object):
"""This mixin helps existing service subclasses start JmxTool on their worker nodes and collect jmx stats.
Note that this is not a service in its own right.
"""
def __init__(self, num_nodes, jmx_object_names=None, jmx_att... |
import json
import os
import uuid
import hashlib
import requests
from stem import Signal
from stem.control import Controller
DEFAULT_PATH = "{}/".format(os.path.expanduser('~'))
class InstagramPySession:
'''
__init__:
- loads configuration from specified file.
- gets the perfect p... |
# -*- coding: utf-8 -*-
"""Inter Rater Agreement
contains
--------
fleiss_kappa
cohens_kappa
aggregate_raters:
helper function to get data into fleiss_kappa format
to_table:
helper function to create contingency table, can be used for cohens_kappa
Created on Thu Dec 06 22:57:56 2012
Author: Josef Perktold
Li... |
from ..glib import gchar_p
from ..gobject import GType
from .gibaseinfo import GIBaseInfo
from .._utils import find_library, wrap_class
_gir = find_library("girepository-1.0")
class GIRegisteredTypeInfo(GIBaseInfo):
def _get_repr(self):
values = super(GIRegisteredTypeInfo, self)._get_repr()
valu... |
"""
The Desired Capabilities implementation.
"""
class DesiredCapabilities(object):
"""
Set of default supported desired capabilities.
Use this as a starting point for creating a desired capabilities object for
requesting remote webdrivers for connecting to selenium server or selenium grid.
Usa... |
#!/usr/bin/env python
from setuptools import setup, find_packages
requirements = ['Django>=1.7.0', ]
try:
from unittest import mock
except ImportError:
requirements.append('mock')
setup(
name="django-doberman",
version="0.5.9",
author="Nicolas Mendoza",
author_email="<EMAIL>",
maintainer=... |
"""
Galician-language mappings for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
directives = {
# language-dependent: fixed
u'atenci\u00f3n': 'attention',
u'advertencia': 'caution',
u'code (translation required)': 'code',
u'perigo': 'danger',
... |
from six.moves import range
from glance import context
from glance.tests.unit import utils as unit_utils
from glance.tests import utils
def _fake_image(owner, is_public):
return {
'id': None,
'owner': owner,
'is_public': is_public,
}
def _fake_membership(can_share=False):
return... |
# -*- coding: utf-8 -*-
"""
werkzeug.debug.console
~~~~~~~~~~~~~~~~~~~~~~
Interactive console support.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import sys
import code
from types import CodeType
from werkzeug.utils import escape
from werkzeug.loca... |
import abc
class A(object):
def __init__(self):
self._x = 1
@property
def foo(self):
return self._x
@foo.setter
def foo(self, x):
self._x = x
@foo.deleter
def foo(self):
pass
@property
def boo(self):
return self._x
<warning descr="Names of function and decorator don't matc... |
#!/usr/bin/env python
'''
Generate valid and invalid base58 address and private key test vectors.
Usage:
gen_base58_test_vectors.py valid 50 > ../../src/test/data/base58_keys_valid.json
gen_base58_test_vectors.py invalid 50 > ../../src/test/data/base58_keys_invalid.json
'''
# 2012 Wladimir J. van der Laan
# R... |
"""Tests for arbitrary expression evaluator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.debug.cli import evaluator
from tensorflow.python.debug.lib import debug_data
from tensorflow.python.framework import t... |
import numpy as np
class ParameterTransformation(object):
def forward(self, external_value):
raise NotImplementedError("You have to implement this")
def backward(self, internal_value):
raise NotImplementedError("You have to implement this")
class LogarithmicTransformation(ParameterTransf... |
import os
import subprocess
from .sourcefile import SourceFile
class Git(object):
def __init__(self, repo_root, url_base):
self.root = os.path.abspath(repo_root)
self.git = Git.get_func(repo_root)
self.url_base = url_base
@staticmethod
def get_func(repo_path):
def git(cmd... |
# http://www.absoft.com/literature/osxuserguide.pdf
# http://www.absoft.com/documentation.html
# Notes:
# - when using -g77 then use -DUNDERSCORE_G77 to compile f2py
# generated extension modules (works for f2py v2.45.241_1936 and up)
import os
from numpy.distutils.cpuinfo import cpu
from numpy.distutils.fcompiler... |
"""Example of Estimator for DNN-based text classification with DBpedia data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import numpy as np
import pandas
from sklearn import metrics
import tensorflow as tf
from tensorflow.... |
import unittest
from biicode.server.model.social_account import SocialAccount, SocialAccountToken
from biicode.server.model.epoch.utc_datetime import UtcDatetime
import datetime
class SocialAccountTest(unittest.TestCase):
def setUp(self):
self.utc_datetime = UtcDatetime.deserialize(datetime.datetime.now()... |
"""Django DDP WebSocket service."""
from __future__ import print_function, absolute_import
import collections
import inspect
import optparse
import random
import signal
import socket
from django.core.management.base import BaseCommand
from django.db import connection, close_old_connections
from django.utils.module_l... |
"""merge_heads_2
Revision ID: 03bc53e68815
Revises: 0a2a5b66e19d, bf00311e1990
Create Date: 2018-11-24 20:21:46.605414
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '03bc53e68815'
down_revision = ('0a2a5b66e19d', 'bf00311e1990')
branch_labels = None
depends_on = None
def upgrade()... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import (
run_module_suite, assert_equal, assert_array_equal,
assert_raises, assert_
)
from numpy.lib.stride_tricks import (
as_strided, broadcast_arrays, _broadcast_shape, broadcast_to
)
def assert_s... |
from xml.etree import cElementTree as ET
from pybtex.database import Entry, Person
from pybtex.database.input import BaseParser
bibtexns = '{http://bibtexml.sf.net/}'
def remove_ns(s):
if s.startswith(bibtexns):
return s[len(bibtexns):]
class Parser(BaseParser):
default_suffix = '.xml'
def par... |
"""Provide a :class:`.CacheImpl` for the Beaker caching system."""
from mako import exceptions
from mako.cache import CacheImpl
_beaker_cache = None
class BeakerCacheImpl(CacheImpl):
"""A :class:`.CacheImpl` provided for the Beaker caching system.
This plugin is used by default, based on the default
... |
"""A script to prepare version informtion for use the gtest Info.plist file.
This script extracts the version information from the configure.ac file and
uses it to generate a header file containing the same information. The
#defines in this header file will be included in during the generation of
the Info.plis... |
"""Functions that read and write gzipped files.
The user of the file doesn't have to worry about the compression,
but random access is not allowed."""
# based on Andrew Kuchling's minigzip.py distributed with the zlib module
import struct, sys, time
import zlib
import __builtin__
__all__ = ["GzipFile","o... |
__revision__ = "src/engine/SCons/Options/BoolOption.py 5134 2010/08/16 23:02:40 bdeegan"
__doc__ = """Place-holder for the old SCons.Options module hierarchy
This is for backwards compatibility. The new equivalent is the Variables/
class hierarchy. These will have deprecation warnings added (some day),
and will the... |
import os
from adb_profile_chrome import trace_packager
from adb_profile_chrome import ui
from pylib import constants
def _StartTracing(controllers, interval):
for controller in controllers:
controller.StartTracing(interval)
def _StopTracing(controllers):
for controller in controllers:
controller.Stop... |
"""
Tests for L{twisted.protocol.socks}, an implementation of the SOCKSv4 and
SOCKSv4a protocols.
"""
import struct, socket
from twisted.trial import unittest
from twisted.test import proto_helpers
from twisted.internet import defer, address, reactor
from twisted.internet.error import DNSLookupError
from twisted.prot... |
from __future__ import absolute_import
import datetime
import json
import logging
import os.path
import sys
from pip._vendor import lockfile
from pip._vendor.packaging import version as packaging_version
from pip.compat import total_seconds, WINDOWS
from pip.index import PyPI
from pip.locations import USER_CACHE_DIR... |
#! /usr/bin/env python
"""
Analog to the oggz-chop program.
Example:
examples/chop.py -o s.ogv -s 20 -e 30 video.ogv
See "./chop.py -h" for help.
"""
from optparse import OptionParser
from theora import Theora, TheoraEncoder
def convert(infile, outfile, start, end):
print "converting %s to %s, between the tim... |
from django.db.models.signals import pre_save
import threading
stash = threading.local()
def get_current_user():
"""Get the user whose session resulted in the current code running. (Only valid during requests.)"""
return getattr(stash, 'current_user', None)
def set_current_user(user):
stash.cur... |
from . import constants
import sys
import codecs
from .latin1prober import Latin1Prober # windows-1252
from .mbcsgroupprober import MBCSGroupProber # multi-byte character sets
from .sbcsgroupprober import SBCSGroupProber # single-byte character sets
from .escprober import EscCharSetProber # ISO-2122, etc.
import re... |
import datetime
import warnings
import unittest
from itertools import product
class Test_Assertions(unittest.TestCase):
def test_AlmostEqual(self):
self.assertAlmostEqual(1.00000001, 1.0)
self.assertNotAlmostEqual(1.0000001, 1.0)
self.assertRaises(self.failureException,
... |
import gzip
import functools
import pendulum
from io import BytesIO as IO
from flask import after_this_request, redirect, request, url_for, g
from airflow import models, settings
def action_logging(f):
"""
Decorator to log user actions
"""
@functools.wraps(f)
def wrapper(*args, **kwargs):
... |
#!/usr/bin/env python
from mininet.topo import Topo
class ObeliskTopo( Topo ):
def __init__( self ):
Topo.__init__( self )
topSwitch = self.addSwitch('s1',dpid='1000'.zfill(16))
leftTopSwitch = self.addSwitch('s2',dpid='2000'.zfill(16))
rightTopSwitch = self.addSwitch('s5',dpid='50... |
__all__ = ['PrefSetting', 'PrefList']
from pyasm.search import SObject, Search, DatabaseException
from pyasm.common import Container, TacticException, Environment
class PrefList(SObject):
'''Defines all of the pref settings in the Admin area'''
SEARCH_TYPE = "sthpw/pref_list"
def get_value_by_key(cls, k... |
from selenium.common.exceptions import NoSuchElementException
from Selenium2Library import utils
from elementfinder import ElementFinder
class TableElementFinder(object):
def __init__(self, element_finder=None):
if not element_finder:
element_finder = ElementFinder()
self._element_find... |
"""Interface to runtime cuda kernel compile module."""
from __future__ import absolute_import
import ctypes
from .base import _LIB, NDArrayHandle, RtcHandle, mx_uint, c_array, check_call
class Rtc(object):
"""MXRtc object in mxnet.
This class allow you to write CUDA kernels in Python
and call them with ND... |
"""
copied from
werkzeug.contrib.cache
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from cache.posixemulation import rename
from itertools import izip
from time import time
import os
import re
import... |
# -*- coding: utf-8 -*-
"""
Django settings for myproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
from __future__ import absolute_import, unicode_... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt
from frappe import msgprint, _, throw
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
class PurchaseOrder(BuyingController):
tname = 'Purchase Order Item'
fname =... |
"""A utility script to perform code coverage analysis."""
import glob
import logging
import optparse
import os
import shutil
import subprocess
import sys
import tempfile
# The list of DLLs we want to instrument in addition to _unittests executables.
_DLLS_TO_INSTRUMENT = [
'basic_block_entry_client.dll',
'cal... |
import uuid
from keystone.contrib import s3
from keystone import exception
from keystone.tests import unit as tests
class S3ContribCore(tests.TestCase):
def setUp(self):
super(S3ContribCore, self).setUp()
self.load_backends()
self.controller = s3.S3Controller()
def test_good_signat... |
"""Support for Nest Thermostat binary sensors."""
from itertools import chain
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import CONF_MONITORED_CONDITIONS
from . import (
CONF_BINARY_SENSORS, DATA_NEST, DATA_NEST_CONFIG, NestSensorDevice)
_LOGGER ... |
"""
Benchmark the USB/USRP throughput. Finds the maximum full-duplex speed
the USRP/USB combination can sustain without errors.
This program does not currently give reliable results. Sorry about that...
"""
from gnuradio import gr
from gnuradio import usrp
from gnuradio import eng_notation
import sys
def run_test... |
"""
WSGI Test Server
This builds upon paste.util.baseserver to customize it for regressions
where using raw_interactive won't do.
"""
import time
from paste.httpserver import *
class WSGIRegressionServer(WSGIServer):
"""
A threaded WSGIServer for use in regression testing. To use this
module, call serv... |
"""Tests of the later module."""
import threading
import time
import unittest
from grpc.framework.foundation import later
TICK = 0.1
class LaterTest(unittest.TestCase):
def test_simple_delay(self):
lock = threading.Lock()
cell = [0]
return_value = object()
def computation():
with lock:
... |
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from test._common import unittest
from test.helper import TestHelper
from beets.mediafile import MediaFile
from beets.util import displayable_path
class InfoTest(unittest.TestCase, TestHelper):
def setU... |
"""
setup file for leap.keymanager
"""
import re
from setuptools import setup
from setuptools import find_packages
import versioneer
versioneer.versionfile_source = 'src/leap/keymanager/_version.py'
versioneer.versionfile_build = 'leap/keymanager/_version.py'
versioneer.tag_prefix = '' # tags are like 1.2.0
versionee... |
"""
Django Extensions abstract base mongoengine Document classes.
"""
import datetime
from django.utils.translation import ugettext_lazy as _
from mongoengine.document import Document
from mongoengine.fields import DateTimeField, IntField, StringField
from mongoengine.queryset import QuerySetManager
from django_exten... |
"""Metrics to assess performance on regression task
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <<EMAIL>>
# Mathieu Blondel <<EMAI... |
from __future__ import (absolute_import, division)
__metaclass__ = type
# for testing
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import Mock, patch
from ansible.module_utils.facts import collector
from ansible.module_utils.facts import ansible_collector
from ansible.module_utils.facts im... |
import hashlib
import time
from datetime import datetime
import ecdsa
from . import util
from .util import profiler, bh2u
from .logging import get_logger
_logger = get_logger(__name__)
# algo OIDs
ALGO_RSA_SHA1 = '1.2.840.113549.1.1.5'
ALGO_RSA_SHA256 = '1.2.840.113549.1.1.11'
ALGO_RSA_SHA384 = '1.2.840.113549.1.... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import json
import os
import sys
import threading
import time
import uuid
from contextlib import contextmanager
import requests
from pants.base.build_environment imp... |
def verbing(s):
# +++your code here+++
# LAB(begin solution)
if len(s) >= 3:
if s[-3:] != 'ing': s = s + 'ing'
else: s = s + 'ly'
return s
# LAB(replace solution)
# return
# LAB(end solution)
# E. not_bad
# Given a string, find the first appearance of the
# substring 'not' and 'bad'. If the 'bad... |
import six
import testtools
from openstack.auth import service_filter as filt
from openstack import exceptions
from openstack.identity import identity_service
class TestServiceFilter(testtools.TestCase):
def test_minimum(self):
sot = filt.ServiceFilter()
self.assertEqual("service_type=any,interfa... |
"""
"""
from __future__ import absolute_import
import json
import logging
from urlparse import parse_qsl, urlsplit, urlunsplit
import mock
from oauth2client.client import FlowExchangeError
import pytest
@pytest.fixture
def redirect_url():
return 'http://localhost/trac_oidc/redirect'
@pytest.fixture
def openid... |
from . import test_portal
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
ldif - generate and parse LDIF data (see RFC 2849)
See http://www.python-ldap.org/ for details.
$Id: ldif.py,v 1.56 2010/07/19 08:23:22 stroeder Exp $
Python compability note:
Tested with Python 2.0+, but should work with Python 1.5.2+.
"""
__version__ = '2.3.12'
__all__ = [
# constants
'ldif_pattern',
#... |
import sys
from . import constants
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import EUCJPDistributionAnalysis
from .jpcntx import EUCJPContextAnalysis
from .mbcssm import EUCJPSMModel
class EUCJPProber(MultiByteCharSetProber)... |
"""Unit test for xcodeproj.py."""
import unittest
import xcodeproj
class TestErrorHandler(object):
"""Error handler for XcodeProjectFileChecker unittests"""
def __init__(self, handler):
self.handler = handler
def turn_off_line_filtering(self):
pass
def __call__(self, line_number, ca... |
"""
Schema Transformer monitor logger
"""
from sandesh_common.vns.ttypes import Module
from cfgm_common.vnc_logger import ConfigServiceLogger
from schema_transformer.config_db import DBBaseST, VirtualNetworkST,\
RoutingInstanceST, ServiceChain
from schema_transformer.sandesh.st_introspect import ttypes as san... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import models
from django.forms import (
CharField, FileField, Form, ModelChoiceField, ModelForm,
)
from django.forms.models import ModelFormMetaclass
from d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import traceback
import logging.config
import pika
import sys
import argparse
import datetime
def get_logging_level_from_name(name):
try:
name = name.upper()
except:
name = "CRITICAL"
level = logging.getLevelName(name)
... |
import datetime as dt
import unittest
import holidays
from bdateutil import isbday
from bdateutil import relativedelta
from bdateutil import parse
from bdateutil.rrule import *
from bdateutil import date, datetime, time
from testdateutil import *
class TestIsBday(unittest.TestCase):
def test_isbday(self):
... |
from dizzy.state import State
class InteractionState(State):
def __init__(self, obj):
State.__init__(self, obj)
def next(self):
# Mutate the dizz object before the dizz functions is call
self.bak = self.iter.mutate()
# Call the dizz functions and return the current state
... |
from xmodule.modulestore.django import modulestore
from xmodule.course_module import CourseDescriptor
from django.conf import settings
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from microsite_configuration import microsite
def get_visible_courses():
"""
Return the set of CourseDescriptors... |
"""Routines to handle the string class registry used by declarative.
This system allows specification of classes and expressions used in
:func:`.relationship` using strings.
"""
from ...orm.properties import ColumnProperty, RelationshipProperty, \
SynonymProperty
from ...schema import _get_table_key
from ...orm i... |
from m5.SimObject import SimObject
from m5.params import *
from m5.proxy import *
class ProbeListenerObject(SimObject):
type = 'ProbeListenerObject'
cxx_header = 'sim/probe/probe.hh'
manager = Param.SimObject(Parent.any, "ProbeManager") |
from __future__ import with_statement
import ConfigParser
from hashlib import md5
from CodernityDB.hash_index import HashIndex
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.variable imp... |
"""Windows service. Requires pywin32."""
import os
import win32api
import win32con
import win32event
import win32service
import win32serviceutil
from cherrypy.process import wspbus, plugins
class ConsoleCtrlHandler(plugins.SimplePlugin):
"""A WSPBus plugin for handling Win32 console events (like Ctrl-C)."""
... |
'''
unit test describing the hyperbolic half-plane with the Poincare metric. This
is a basic model of hyperbolic geometry on the (positive) half-space
{(x,y) \in R^2 | y > 0}
with the Riemannian metric
ds^2 = (dx^2 + dy^2)/y^2
It has constant negative scalar curvature = -2
https://en.wikipedia.org/wiki/Poincare_ha... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# File: symmath_check.py
#
# Symbolic mathematical expression checker for edX. Uses sympy to check for expression equality.
#
# Takes in math expressions given as Presentation MathML (from ASCIIMathML), converts to Content MathML using SnuggleTeX
import traceback
from .fo... |
{
'name': 'MRP Byproducts',
'version': '1.0',
'category': 'Manufacturing',
'description': """
This module allows you to produce several products from one production order.
=============================================================================
You can configure by-products in the bill of material... |
# Symbolic constants for use with sunaudiodev module
# The names are the same as in audioio.h with the leading AUDIO_
# removed.
from warnings import warnpy3k
warnpy3k("the SUNAUDIODEV module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
# Not all values are supported on all releases of SunOS.
# Encodin... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import os.path
from subprocess import Popen, PIPE, call
import re
LOCALE_NORMALIZATION = {
".utf8": ".UTF-8",
".eucjp": ".EUC-JP",
}
# ===========================================
# location module specific support methods.
#
def is_available(name, ubuntuMo... |
'''
Bubble
======
.. versionadded:: 1.1.0
.. image:: images/bubble.jpg
:align: right
The Bubble widget is a form of menu or a small popup where the menu options
are stacked either vertically or horizontally.
The :class:`Bubble` contains an arrow pointing in the direction you
choose.
Simple example
------------... |
from django.contrib import auth
from django.contrib.auth import load_backend
from django.contrib.auth.backends import RemoteUserBackend
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import SimpleLazyObject
def get_user(request):
if not hasattr(request, '_cached_user'):
... |
# These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
from django.conf import settings
from django.utils.encoding import force_text
from django.ut... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
lassplit.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.