content string |
|---|
"""
Bare-Metal DB testcase for BareMetalNode
"""
from nova import exception
from nova.tests.virt.baremetal.db import base
from nova.tests.virt.baremetal.db import utils
from nova.virt.baremetal import db
class BareMetalNodesTestCase(base.BMDBTestCase):
def _create_nodes(self):
nodes = [
util... |
'''
Widget animation
================
This example demonstrates creating and applying a multi-part animation to
a button widget. You should see a button labelled 'plop' that will move with
an animation when clicked.
'''
import kivy
kivy.require('1.0.7')
from kivy.animation import Animation
from kivy.app import App
f... |
import glob
from optparse import make_option
import os
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.importlib import import_module
import horizon
class Command(TemplateCommand):
template = os.path.join(horizon.__path__[0], "c... |
from __future__ import unicode_literals
import frappe, json
from frappe.widgets.form.load import run_onload
@frappe.whitelist()
def savedocs():
"""save / submit / update doclist"""
try:
doc = frappe.get_doc(json.loads(frappe.form_dict.doc))
set_local_name(doc)
# action
doc.docstatus = {"Save":0, "Submit": 1... |
# -*- coding: utf-8 -*-
# Tests for the contrib/localflavor/ RO form fields.
tests = r"""
>>> from django.contrib.localflavor.ro.forms import *
##ROCIFField ################################################################
f = ROCIFField()
f.clean('21694681')
u'21694681'
f.clean('RO21694681')
u'21694681'
f.clean('216... |
# -*- coding: utf-8 -*-
"""
==================================
Color Quantization using K-Means
==================================
Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace
(China), reducing the number of colors required to show the image from 96,615
unique colors to 64, while pre... |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class FlatPage(models.Model):
url = models.CharField(_('URL'), max_length=100, db_index=True)
title = models.CharField(_('title'), max_length=200)
content = models.TextField(_(... |
#!/usr/bin/env python
import shogun as sg
traindna = '../data/fm_train_dna.dat'
testdna = '../data/fm_test_dna.dat'
parameter_list = [[traindna,testdna,3,0,False],[traindna,testdna,4,0,False]]
def distance_manhattenword (train_fname=traindna,test_fname=testdna,order=3,gap=0,reverse=False):
charfeat=sg.create_string... |
"""
Helpers for configuring locale settings.
Name `localization` is chosen to avoid overlap with builtin `locale` module.
"""
from contextlib import contextmanager
import locale
import re
import subprocess
from pandas._config.config import options
@contextmanager
def set_locale(new_locale, lc_var=locale.LC_ALL):
... |
"""
Tests sklearn matrix decomposition converters
"""
import unittest
import warnings
import sys
from distutils.version import LooseVersion
import numpy as np
import torch
import sklearn
from sklearn.decomposition import FastICA, KernelPCA, PCA, TruncatedSVD
from sklearn.model_selection import train_test_split
from sk... |
from ._type_base import conv, convgen, ConversionError
from .bit import bit, bit8, bit16, bit32, bit64, Bit
from .array import Array, array
from .vector import vector, Vector
from .struct import struct, Struct
from .enum import Enum
__all__ = ["conv",
"convgen",
"bit",
"bit8",
... |
"""
KFServing
Python SDK for KFServing # noqa: E501
The version of the OpenAPI document: v0.1
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import kfserving
from kfserving.models.v1beta1_transformer_config import V1beta1Tra... |
import os
import inspect
from flask import current_app
from flask_registry import RegistryProxy, ImportPathRegistry, \
ModuleAutoDiscoveryRegistry
from invenio.ext.registry import ModuleAutoDiscoverySubRegistry
from invenio.utils.datastructures import LazyDict
legacy_modules = RegistryProxy('legacy', ImportPathR... |
# -*- coding: iso-8859-1 -*-
from enigma import eConsoleAppContainer
from Components.Console import Console
from Components.About import about
from Components.PackageInfo import PackageInfoHandler
from Components.Language import language
from Components.Sources.List import List
from Components.Ipkg import IpkgComponent... |
import sys
import time
try:
import boto.ec2
except ImportError:
print "failed=True msg='boto required for this module'"
sys.exit(1)
def main():
argument_spec = ec2_argument_spec()
argument_spec.update(
dict(
volume_id = dict(),
description = dict(),
inst... |
# Don't import __future__ packages here; they make setup fail
# First, we try to use setuptools. If it's not available locally,
# we fall back on ez_setup.
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
with open(... |
from matplotlib.pyplot import *
from math import sqrt
m = 1/3.
xs = [+1, +1, -1, -1]
ys = [-1, +1, -1, +1]
figure(figsize=(4, 4))
ax = gca()
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_position(('data', 0))
ax.spines['bottom'].set_position(('data', 0))
ax.xaxis.set_t... |
"""SiteCompare component to handle bulk scrapes.
Invokes a list of browsers and sends them to a list of URLs,
saving the rendered results to a specified directory, then
performs comparison operations on the resulting bitmaps and
saves the results
"""
# This line is necessary to work around a QEMU bug
import _imaging... |
"""Tests for google3.cloud.bigscience.apitools.base.py.batch."""
import textwrap
import mock
from six.moves import http_client
from six.moves.urllib import parse
import unittest2
from apitools.base.py import batch
from apitools.base.py import exceptions
from apitools.base.py import http_wrapper
class FakeCredentia... |
#!/usr/bin/env python3
import os
import sys
import tempfile
import sh
REPO_PATH = {'extras': '/srv/ansible/stable-2.2/lib/ansible/modules/extras',
'core': '/srv/ansible/stable-2.2/lib/ansible/modules/core'}
if __name__ == '__main__':
commit_hash = sys.argv[1]
which_modules = sys.argv[2]
git = sh... |
from charmhelpers.core import unitdata
class FlagManager:
'''
FlagManager - A Python class for managing the flags to pass to an
application without remembering what's been set previously.
This is a blind class assuming the operator knows what they are doing.
Each instance of this class should be ... |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.wrappers
~~~~~~~~~~~~~~~~~~~~~~~~~
Extra wrappers or mixins contributed by the community. These wrappers can
be mixed in into request objects to add extra functionality.
Example::
from werkzeug.wrappers import Request as RequestBase
fr... |
"""Tests methods that access or alter columns"""
import unittest
from sparktkregtests.lib import sparktk_test
dummy_int_val = -77 # placeholder data value for added column
dummy_col_count = 1000 # length of dummy list for column add
# This method is to test different sources of functions
# i.e. global
def glob... |
from {{cookiecutter.project_slug}}.data.cms_page import CmsPage
from {{cookiecutter.project_slug}}.data.dbsession import DbSessionFactory
class CmsService:
@classmethod
def get_page_by_url(cls, url):
if not url:
return None
url = url.lower().strip()
session = DbSessionFact... |
from __future__ import print_function, division
from sympy.core import S, pi, Rational
from sympy.functions import assoc_laguerre, sqrt, exp, factorial, factorial2
def R_nl(n, l, nu, r):
"""
Returns the radial wavefunction R_{nl} for a 3d isotropic harmonic
oscillator.
``n``
the "nodal" quan... |
import collections
import json
import os
import re
import subprocess
import sys
UTF8 = "utf-8"
TRANSFORM, SUMMARIZE = ("TRANSFORM", "SUMMARIZE")
Code = collections.namedtuple("Code", "name code kind")
def main():
genome = 3 * GENOME
for i, code in enumerate(CODE):
context = dict(genome=genome, targe... |
from django.conf.urls import url
from django.contrib import admin
from fluent_contents.admin import PlaceholderEditorAdmin
from fluent_contents.analyzer import get_template_placeholder_data
from fluent_utils.ajax import JsonResponse
from mezzanine.pages.admin import PageAdmin
from . import models, widgets
class Flue... |
# -*- coding: utf-8 -*-
from yaml import load, dump
try:
from yaml import CSafeLoader as SafeLoader
print "Using CSafeLoader"
except ImportError:
from yaml import SafeLoader
print "Using Python SafeLoader"
import os
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
from sqlalchemy import Table
def importyaml... |
import sqlalchemy
def upgrade(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_engine)
stack = sqlalchemy.Table('stack', meta, autoload=True)
nested_depth = sqlalchemy.Column(
'nested_depth', sqlalchemy.Integer(), default=0)
nested_depth.create(stack)
def get_stacks(owner_id):
... |
from cloudferrylib.scheduler import task
class Action(task.Task):
def __init__(self, init, cloud=None):
self.cloud = None
self.src_cloud = None
self.dst_cloud = None
self.cfg = None
self.__dict__.update(init)
self.init = init
if cloud:
self.clou... |
__all__ = ['Client']
try:
import ssl
_HAS_SSL = True
except ImportError:
_HAS_SSL = False
import sys
_HAS_SSL_CLIENT_CONTEXT = sys.version_info >= (2,7,9)
import json
import hmac
import hashlib
import base64
import random
from datetime import datetime
import six
from six.moves.urllib import parse
from six... |
from lxml import etree
import webob
from nova.api.openstack.compute.contrib import volumes
from nova import context
from nova.openstack.common import jsonutils
from nova.openstack.common import timeutils
from nova import test
from nova.tests.api.openstack import fakes
from nova.volume import cinder
class SnapshotApi... |
from openerp import models, api
class ProductTemplate(models.Model):
_inherit = 'product.template'
@api.multi
def write(self, vals):
res = {}
for product_tmpl in self:
write_vals = {}
if 'uom_po_id' in vals:
write_vals['uom_po_id'] = vals.pop("uom_p... |
'''
watchfreeinhd urlresolver plugin
Copyright (C) 2013 voinage
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 3 of the License, or
(at your option) any later version.
This program i... |
# coding=utf-8
import random
import data
import renpy.exports as renpy
import renpy.store as store
import girls_data
from treasures import gen_treas
from utils import call
from characters import Girl
from data import achieve_target
class GirlsList(object):
def __init__(self, game_ref, base_character):
se... |
from flask import (Blueprint, render_template, flash, request, redirect,
url_for)
from flask.ext.login import login_required, current_user
from users.models import User
from items.models import Item
from users.forms import EditProfileForm
from flask.ext.babel import gettext as _
users = Blueprint('u... |
"""
Invokes the specified (quoted) command for all files modified
between the current git branch and the specified branch or commit.
The special token [[FILENAME]] (or whatever you choose using the -t
flag) is replaced with each of the filenames of new or modified files.
Deleted files are not included. Nei... |
from django.conf.urls import url, patterns, include
from rest_framework import routers
from .views.model_views import BuildViewSet, ProjectViewSet, NotificationViewSet, VersionViewSet
from readthedocs.comments.views import CommentViewSet
router = routers.DefaultRouter()
router.register(r'build', BuildViewSet)
router... |
import copy
import os
import unittest
from ansible.module_utils.network.ftd.common import HTTPMethod
from ansible.module_utils.network.ftd.fdm_swagger_client import FdmSwaggerParser
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
TEST_DATA_FOLDER = os.path.join(DIR_PATH, 'test_data')
base = {
'basePath': ... |
from __future__ import unicode_literals
import frappe
from frappe import _
from erpnext.utilities.transaction_base import TransactionBase
class MaintenanceVisit(TransactionBase):
def get_feed(self):
return _("To {0}").format(self.customer_name)
def validate_serial_no(self):
for d in self.get('purposes'):
if... |
from oslo_config import cfg
from nova.tests.functional.v3 import test_servers
from nova.tests.unit.image import fake
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class MultipleCreateJsonTest(test_servers.ServersSampleBase):
extension_name = ... |
'''
Worst fighting game ever
By: Owen Wattenmaker, Max Lambek
'''
#TODO
############################################################################################
### -add in frames for attacking, looks too choppy, need more pictures ###
### -fix yellow hit marker ###
### -f... |
# w.data(" and ")
# w.element("i", "italic")
# w.data(".")
# w.end("p")
#
# w.close(html)
# </pre>
##
import re, sys, string
try:
unicode("")
except NameError:
def encode(s, encoding):
# 1.5.2: application must use the right encoding
return s
_escape = re.compile(r"[&<>\"\x80-\xff]+") # 1.... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.learn.python.learn.datasets import base
from tensorflow.python.platform import test
mock = test.mock
_TIMEOUT = IOError(110, "timeout")
class BaseTest(test.TestCase):
"""Test load ... |
"""
German language mappings for language-dependent features of Docutils.
"""
__docformat__ = 'reStructuredText'
labels = {
'author': 'Autor',
'authors': 'Autoren',
'organization': 'Organisation',
'address': 'Adresse',
'contact': 'Kontakt',
'version': 'Version',
'revision': 'Revision',
... |
import imp
import os
import pytest
KEYBOARD_LSUSB_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'keyboard'
)
KEYBOARD_LSUSB_OUTPUTS = [
('no_keyboard', None),
('other_keyboard', None),
('en_keyboard', 'en'),
('es_keyboard', 'es'),
]
@pytest.fixture(scope='function', params=KE... |
__all__ = ['Composer', 'ComposerError']
from error import MarkedYAMLError
from events import *
from nodes import *
class ComposerError(MarkedYAMLError):
pass
class Composer(object):
def __init__(self):
self.anchors = {}
def check_node(self):
# Drop the STREAM-START event.
if sel... |
from __future__ import absolute_import
from django.conf import settings
from django import template
from openstack_dashboard.api import keystone
register = template.Library()
def is_multi_region_configured(request):
return False
def is_multidomain_supported():
return (keystone.VERSIONS.active >= 3 and
... |
import idaapi
import idautils
import idc
import functools
import datetime
import threading
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
import idaapi
import idautils
import idc
# Save the database so nothing gets lost.
idc.SaveBase(idc.GetIdbPath() + '.' + datetime.datetime.now().isoformat())
x... |
from troposphere import Ref, Template, Output
from troposphere.apigateway import RestApi, Method
from troposphere.apigateway import Resource, MethodResponse
from troposphere.apigateway import Integration, IntegrationResponse
from troposphere.apigateway import Deployment, Stage, ApiStage
from troposphere.apigateway impo... |
"""Contains extensions to Atom objects used with Blogger."""
__author__ = 'api.jscudder (Jeffrey Scudder)'
import atom
import gdata
import re
LABEL_SCHEME = 'http://www.blogger.com/atom/ns#'
THR_NAMESPACE = 'http://purl.org/syndication/thread/1.0'
class BloggerEntry(gdata.GDataEntry):
"""Adds convenience meth... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
# Userprofile Permissions
CAN_ADD_USERPROFILE = 'add_userprofile'
CAN_CHANGE_USERPROFILE = 'change_userprofile'
CAN_DELETE_USERPROFILE = 'delete_userprofile'
CAN_ADD_XFORM_TO_PROFILE = 'can_add_xform'
CAN_VIEW_PROFILE = 'view_profile'
# ... |
import restaurant
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from django.contrib.auth import get_user_model
from geonode.tests.base import GeoNodeBaseTestSupport
import os
import re
import gisdata
from urllib.parse import urljoin
from django.conf import settings
from geonode import geoserver
from geonode.decorators import on_ogc_backend
from geonode.layers.models import Laye... |
from neutron.common import constants
from neutron.extensions import portbindings
from neutron.openstack.common import log
from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers import mech_agent
LOG = log.getLogger(__name__)
class LinuxbridgeMechanismDriver(mech_agent.SimpleAgentMechanism... |
from __future__ import print_function
from build_util import build_directory_recurse, check_visible
import os.path
def build(source_path, build_path, install_path, targets):
# build requirement 'floob' should be visible
check_visible("foo", "floob")
import floob
print(floob.hello())
# do the bu... |
import campaign_analysis
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# encoding: 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 model 'LoginLog'
db.create_table('ssheepdog_loginlog', (
('stdout', self.gf('djan... |
#
# gb2312.py: Python Unicode Codec for GB2312
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_cn, codecs
import _multibytecodec as mbc
codec = _codecs_cn.getcodec('gb2312')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncrementalEncod... |
"""
This is the shoppingcart context_processor module.
Currently the only context_processor detects whether request.user has a cart that should be displayed in the
navigation. We want to do this in the context_processor to
1) keep database accesses out of templates (this led to a transaction bug with user email change... |
"""
"""
from __future__ import absolute_import
from ..unitquantity import UnitQuantity
from .time import s
from .mass import kg
from .energy import J
from .electromagnetism import coulomb
Bq = becquerel = UnitQuantity(
'becquerel',
1/s,
symbol='Bq',
aliases=['becquerels']
)
Ci = curie = UnitQuantity(... |
"""Functions that prepare GAE user code for running in a GCE VM."""
import json
import logging
import logging.handlers
import math
import sys
import traceback
from google.appengine import api
from google.appengine.api import app_logging
from google.appengine.api.logservice import logservice
from google.appengine.... |
"""
Python Enhancement Proposal (PEP) Reader.
"""
__docformat__ = 'reStructuredText'
from docutils.readers import standalone
from docutils.transforms import peps, references, misc, frontmatter
from docutils.parsers import rst
class Reader(standalone.Reader):
supported = ('pep',)
"""Contexts... |
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import caches
from django.utils.six.moves import xrange
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
... |
# disable missing docstring
# pylint: disable=missing-docstring
import os
from lettuce import world, step
from django.conf import settings
from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore
from xmodule.exceptions import NotFoundError
from splinter.request_han... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = """
options:
host:
description:
- Specifies the DNS host name or address for connecting to the remote
device over the specified transport. The value of host is used as
the destination address f... |
from mbcharsetprober import MultiByteCharSetProber
from codingstatemachine import CodingStateMachine
from chardistribution import SJISDistributionAnalysis
from jpcntx import SJISContextAnalysis
from mbcssm import SJISSMModel
import constants, sys
from constants import eStart, eError, eItsMe
class SJISProber(MultiByteC... |
import base64
import os.path
import re
import sys
import textwrap
import urllib
objects = []
def printable_serial(obj):
return ".".join(map(lambda x:str(ord(x)), obj['CKA_SERIAL_NUMBER']))
# Dirty file parser.
in_data, in_multiline, in_obj = False, False, False
field, type, value, obj = None, None, None, dict()
fo... |
import base64
import random
# Empire imports
from lib.common import helpers
from lib.common import agents
from lib.common import encryption
from lib.common import packets
from lib.common import messages
class Listener:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Template... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
# NOQA
try:
import botocore
HAS_BOTO3 = True
except ImportError:
HAS_BOTO3 = Fa... |
# -*- coding: utf-8 -*-
"""
signup.py
~~~~~~~~~
木犀官网注册API
"""
from flask import jsonify, g, request
from . import api
from muxiwebsite.models import User
from .authentication import auth
from muxiwebsite import db
from werkzeug.security import generate_password_hash
import base64
@api.route('/signup/', m... |
import arrow
from bs4 import BeautifulSoup
import requests
timezone = 'Canada/Pacific'
def fetch_production(country_code='CA-YT', session=None):
"""Requests the last known production mix (in MW) of a given region
Arguments:
country_code -- ignored here, only information for CA-YT is returned
... |
from settings import *
import os
DATABASES["default"] = {"NAME": "zulip_test",
"USER": "zulip_test",
"PASSWORD": LOCAL_DATABASE_PASSWORD,
"HOST": "localhost",
"SCHEMA": "zulip",
"ENGINE": "django.db.... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action import ActionBase
from ansible.plugins.action.template import ActionModule as TemplateActionModule
# Even though TemplateActionModule inherits from ActionBase, we still need to
# directly inherit from A... |
import json
import os
import sys
import time
from . import junit_output
ABS_PATH_PREFIX = os.getcwd() + os.sep
def EscapeCommand(command):
parts = []
for part in command:
if ' ' in part:
# Escape spaces. We may need to escape more characters for this
# to work properly.
parts.append('"%s... |
"""
This class interacts with the code generated for evaluating a
scisheet to control the execution of blocks of code. A block
of code (hereafter, just block) can be a formulas, prologue, or
epilogue.
"""
from Files.logger import Logger
from mysite import settings
import inspect
import os
import sys
class BlockExecut... |
from dtest import Tester
from assertions import assert_invalid
from tools import since
import os, sys, time
from ccmlib.cluster import Cluster
@since('2.1')
class TestUDTEncoding(Tester):
def udt_test(self):
""" Test (somewhat indirectly) that user queries involving UDT's are properly encoded (due to dri... |
# coding: utf-8
from __future__ import unicode_literals
import os
import configparser
from unittest import TestCase
import bugwarrior.config as config
from .base import ConfigTest
class TestGetConfigPath(ConfigTest):
def create(self, path):
"""
Create an empty file in the temporary directory, ... |
"""
Test for lms courseware app, module data (runtime data storage for XBlocks)
"""
import json
from mock import Mock, patch
from functools import partial
from courseware.model_data import DjangoKeyValueStore
from courseware.model_data import InvalidScopeError, FieldDataCache
from courseware.models import StudentModul... |
"""
Python package for random data generation.
"""
import sys
from functools import wraps
from pyspark.mllib.common import callMLlibFunc
__all__ = ['RandomRDDs', ]
def toArray(f):
@wraps(f)
def func(sc, *a, **kw):
rdd = f(sc, *a, **kw)
return rdd.map(lambda vec: vec.toArray())
return f... |
from sympy.external.importtools import import_module
disabled = False
# if pyglet.gl fails to import, e.g. opengl is missing, we disable the tests
pyglet_gl = import_module("pyglet.gl", catch=(OSError,))
pyglet_window = import_module("pyglet.window", catch=(OSError,))
if not pyglet_gl or not pyglet_window:
disabl... |
from __future__ import absolute_import, unicode_literals
from xml.dom import minidom
from django.contrib.syndication import views
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils import tzinfo
from django.utils.feedgenerator import rfc2822_date, rfc3339_date
... |
#!/usr/bin/env python3
from linker import Linker
import htmlPage
import content.index,content.db,content.fincom
# TODO put into config
spbBudgetXlsPath='../spb-budget-xls'
if __name__=='__main__':
linker=Linker('filelists',{
'csv':['csv'],
'xls':['xls'],
'db':['zip','sql','xlsx'],
})
htmlPage.HtmlPage('inde... |
import logging as log
import os
import re
# builds a dictionary of frame names indexed by wordnet synset id
offset2bn = dict()
bn2offset = dict()
offset2wn = dict()
wn2offset = dict()
wn2bn = dict()
bn2wn = dict()
wn30wn31 = dict()
wn31wn30 = dict()
bn2dbpedia = dict()
dbpedia2bn = dict()
# the mapping is in a tabula... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import filter
from gnuradio import blocks
import sys
import numpy
try:
from gnuradio import analog
except ImportError:
sys.stderr.write("Error: Program requires gr... |
"""
@copyright: 2007-2014 Quotemaster cc. See LICENSE for details.
Interface definitions for Entropy.
"""
from zope.interface import Interface, Attribute
class IContentObject(Interface):
"""
Immutable content object.
"""
hash = Attribute("""The hash function used to calculate the content digest.""")... |
"""Provides a custom script for gcalctool."""
__id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
__license__ = "LGPL"
import pyatspi
import orca.scripts.toolkits.gtk as gtk
import orca.messages as messages
##################... |
import ddt
import mock
from oslo_log import log
from manila.share.drivers.netapp.dataontap.client import api as netapp_api
from manila.share.drivers.netapp.dataontap.client import client_base
from manila import test
from manila.tests.share.drivers.netapp.dataontap.client import fakes as fake
@ddt.ddt
class NetAppBas... |
"""
This module houses the GEOS ctypes prototype functions for the
topological operations on geometries.
"""
from ctypes import c_double, c_int
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_minus_one, check_string... |
"""Tests for tensorflow.python.framework.tensorboard_logging."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
import os
import shutil
import tempfile
import time
from tensorflow.core.util import event_pb2
from tensorflow.python.platform impo... |
from functools import wraps
from collections import OrderedDict
def _embed_ipython_shell(namespace={}, banner=''):
"""Start an IPython Shell"""
try:
from IPython.terminal.embed import InteractiveShellEmbed
from IPython.terminal.ipapp import load_default_config
except ImportError:
fr... |
#!/usr/bin/env python
"""
This script generated test_cases for test_distribution_version.py.
To do so it outputs the relevant files from /etc/*release, the output of platform.dist() and the current ansible_facts regarding the distribution version.
This assumes a working ansible version in the path.
"""
import platf... |
"""Support for consuming values for the Volkszaehler API."""
from datetime import timedelta
import logging
from volkszaehler import Volkszaehler
from volkszaehler.exceptions import VolkszaehlerApiConnectionError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.co... |
from pcs.packets.ptp import *
from pcs.packets.ptp_common import Common
from pcs.packets.ipv4 import ipv4
from pcs.packets.udpv4 import udpv4
import pcs
import datetime
def main():
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-f", "--file",
dest="fil... |
import utime
from hwconfig import LED
# Using sleep_ms() gives pretty poor PWM resolution and
# brightness control, but we use it in the attempt to
# make this demo portable to even more boards (e.g. to
# those which don't provide sleep_us(), or provide, but
# it's not precise, like would be on non realtime OSes).
# ... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para ultramegabit
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core ... |
import os
import sys
#
# Compiles and executes the Python code that the generator code has access to.
# Returns the global python environment that must be used between all code runs in a file.
#
def CreatePythonExecEnvironment():
prologue = """
import os
import inspect
# Empty string for output
g_EmitOutput = ""
... |
"""Unittests for TestRunResults."""
import unittest
from pylib.base.base_test_result import BaseTestResult
from pylib.base.base_test_result import TestRunResults
from pylib.base.base_test_result import ResultType
class TestTestRunResults(unittest.TestCase):
def setUp(self):
self.p1 = BaseTestResult('p1', Resu... |
import unittest
from mock import Mock
from mock import patch
from airflow import configuration
from airflow.hooks.jdbc_hook import JdbcHook
from airflow import models
from airflow.utils import db
jdbc_conn_mock = Mock(
name="jdbc_conn"
)
class TestJdbcHook(unittest.TestCase):
def setUp(self):
c... |
from openerp.osv import osv
from openerp.tools.translate import _
class account_invoice_confirm(osv.osv_memory):
"""
This wizard will confirm the all the selected draft invoices
"""
_name = "account.invoice.confirm"
_description = "Confirm the selected invoices"
def invoice_confirm(self, cr, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.