content stringlengths 4 20k |
|---|
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_... |
# Tests that require installed backends go into
# sympy/test_external/test_autowrap
import os
import tempfile
import shutil
from sympy.utilities.autowrap import autowrap, binary_function, CythonCodeWrapper, \
ufuncify
from sympy.utilities.codegen import Routine, CCodeGen, CodeGenArgumentListError
from sympy.utili... |
"""Tests for some testing utils from strategy_test_lib."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import OrderedDict
from absl.testing import parameterized
from tensorflow.contrib.distribute.python import combinations
from tensorf... |
from os.path import abspath
from StringIO import StringIO
import copy
import unittest
import datasets
# Local imports.
from mayavi.core.engine import Engine
from mayavi.core.null_engine import NullEngine
# Enthought library imports
from mayavi.sources.vtk_data_source import VTKDataSource
from mayavi.modules.outline i... |
import mock
from rally.plugins.openstack.scenarios.tempest import tempest
from rally.verification.tempest import tempest as verifier
from tests.unit import test
TEMPEST_DIR = "rally.verification.tempest"
VERIFIER = TEMPEST_DIR + ".tempest"
TS = "rally.plugins.openstack.scenarios.tempest"
class TempestScenarioTestCa... |
__revision__ = "src/engine/SCons/Options/PathOption.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... |
"""
Verifies that dependent Xcode settings are processed correctly.
"""
import TestGyp
import subprocess
import sys
def XcodeVersion():
stdout = subprocess.check_output(['xcodebuild', '-version'])
version = stdout.splitlines()[0].split()[-1].replace('.', '')
return (version + '0' * (3 - len(version))).zfill(4)... |
from django.conf import settings
from django.test.simple import build_suite, DjangoTestSuiteRunner
from django.utils import unittest
def run_tests(*args, **kwargs):
from django.test.simple import run_tests as base_run_tests
return base_run_tests(*args, **kwargs)
def geo_apps(namespace=True, runtests=False):
... |
import os
import sys
sys.path.append('../../utils')
sys.path.append('../../layers')
import theano as t
from optimization import optimization
from io_utils import init_files
t.config.reoptimize_unpickled_function = False
t.config.scan.allow_output_prealloc = True
t.config.exception_verbosity = 'high'
t.config.warn_flo... |
"""
Dashboard utilities.
"""
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.utils.text import capfirst
from django.core.urlresolvers import reverse
from admin_tools.dashboard import ... |
import celery
import celery.result
from booki.editor import models
import sputnik
def fetch_url(url, data):
import urllib2
import httplib
import json
try:
data_json = json.dumps(data)
except TypeError:
return None
req = urllib2.Request(url, data_json)
req.add_header('C... |
import os
import sys
import traceback
sys.path.insert(
0, os.path.abspath(
os.path.realpath(
os.path.dirname(__file__))))
from automation import Automation
from remoteautomation import RemoteAutomation, fennecLogcatFilters
from runtests import MochitestDesktop, MessageLogger
from mochitest_opt... |
# A version of the ActiveScripting engine that enables rexec support
# This version supports hosting by IE - however, due to Python's
# rexec module being neither completely trusted nor private, it is
# *not* enabled by default.
# As of Python 2.2, rexec is simply not available - thus, if you use this,
# a HTML page ca... |
"""
Distance and Area objects to allow for sensible and convenient calculation
and conversions. Here are some tests.
"""
import unittest
from django.contrib.gis.measure import A, D, Area, Distance
class DistanceTest(unittest.TestCase):
"Testing the Distance object"
def testInit(self):
"Testing init... |
"""\
Facts
========
"""
__docformat__ = 'restructuredtext'
import time
from oldanki.db import *
from oldanki.errors import *
from oldanki.models import Model, FieldModel, fieldModelsTable
from oldanki.utils import genID, stripHTMLMedia
from oldanki.hooks import runHook
# Fields in a fact
#############################... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils._text import to_native
from ansible.parsing.mod... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render
from auth_users.forms import AuthUserForm
from core.common import *
def new(r... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
import socket
import getopt
import threading
import subprocess
import shlex
import time
import select
blackhole = (
'10::2222',
'101::1234',
'2001::212',
'2001:da8:112::21ae',
'2003:ff:1:2:3:4:5fff:6',
'2003:ff:1:2:3:... |
"""
Methods for interacting programmatically with the user creator table.
"""
from course_creators.models import CourseCreator
from student.roles import CourseCreatorRole
from student import auth
def add_user_with_status_unrequested(user):
"""
Adds a user to the course creator table with status 'unrequested'.... |
'''
Parser dispatcher mix-in class.
Copyright (c) 2010, Patrick Maupin. All rights reserved.
See http://code.google.com/p/rson/source/browse/trunk/license.txt
'''
def _alter_attributes(cls, attrs):
''' Return a new class with altered attributes.
But throw an exception unless altered attributes
a... |
import logging
import socket
import urllib
import urllib2
import os
from mercurial import httpclient
from mercurial import sslutil
from mercurial import util
from mercurial.i18n import _
# moved here from url.py to avoid a cycle
class httpsendfile(object):
"""This is a wrapper around the objects returned by pytho... |
"""Embedding layer.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.keras.python.keras import backend as K
from tensorflow.contrib.keras.python.keras import constraints
from tensorflow.contrib.keras.python.keras import initializer... |
"""
##########
IDMapShift
##########
IDMapShift is a tool that properly sets the ownership of a filesystem for use
with linux user namespaces.
=====
Usage
=====
nova-idmapshift -i -u 0:10000:2000 -g 0:10000:2000 path
This command will idempotently shift `path` to proper ownership using
the provided uid and gid ... |
from gnuradio import gr, gr_unittest, digital, blocks
class test_probe_density(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
def test_001(self):
src_data = [0, 1, 0, 1]
expected_data = 1
src = blocks.vector_sou... |
import logging
import werkzeug
import openerp
from openerp.addons.auth_signup.res_users import SignupError
from openerp.addons.web.controllers.main import ensure_db
from openerp import http
from openerp.http import request
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
class AuthSignupHo... |
import numpy as np
import pytest
import pandas as pd
from pandas import Categorical, Series, date_range, isna
import pandas._testing as tm
def test_reindex(datetime_series, string_series):
identity = string_series.reindex(string_series.index)
# __array_interface__ is not defined for older numpies
# and ... |
import paddle.v2 as paddle
import paddle.v2.dataset.common as common
import os
import sys
import glob
import pickle
# NOTE: must change this to your own username on paddlecloud.
USERNAME = "demo"
DC = os.getenv("PADDLE_CLOUD_CURRENT_DATACENTER")
common.DATA_HOME = "/pfs/%s/home/%s" % (DC, USERNAME)
TRAIN_FILES_PATH = ... |
{
'name' : 'Online Billing',
'version' : '1.0',
'author' : 'OpenERP SA',
'summary': 'Send Invoices and Track Payments',
'description': """
Invoicing & Payments by Accounting Voucher & Receipts
=====================================================
The specific and easy-to-use Invoicing system in Open... |
from urbansim.abstract_variables.abstract_number_of_agents_with_same_attribute_value import abstract_number_of_agents_with_same_attribute_value
class same_sector_employment_in_zone(abstract_number_of_agents_with_same_attribute_value):
""""""
agent_attribute_name = "job.sector_id"
agent_depen... |
from c7n_azure.provider import resources
from c7n_azure.resources.arm import ArmResourceManager
@resources.register('postgresql-server')
class PostgresqlServer(ArmResourceManager):
"""PostgreSQL Server Resource
:example:
Finds all PostgreSQL Servers that have had zero active connections in the past week... |
session.forget()
def get(args):
if args[0].startswith('__'):
return None
try:
obj = globals(),get(args[0])
for k in range(1,len(args)):
obj = getattr(obj,args[k])
return obj
except:
return None
def vars():
"""the running controller function!"""
t... |
"""Tests for initializers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
from scipy import stats
from tensorflow.contrib.distributions.python.ops import kullback_leibler
from tensorflow.contrib.distributions.python.ops i... |
import os
import tempfile
import shutil
from build import *
from SCons.Script import *
from SCons.Action import *
#
# Generate an Extended 2 Filesystem image.
#
def generateExt2(target, source, env):
# Open the list.
list = open(str(source[0]))
# Copy the entire project.
shutil.copytree(".", "tm... |
import sys
from os.path import join, abspath, dirname
# PATH vars
here = lambda *x: join(abspath(dirname(__file__)), *x)
PROJECT_ROOT = here("..")
root = lambda *x: join(abspath(PROJECT_ROOT), *x)
sys.path.insert(0, root('apps'))
ADMINS = (
('Maxime Lapointe', '<EMAIL>'),
)
MANAGERS = ADMINS
SHELL_PLUS = 'ipyt... |
"""GCP plugin for integration tests."""
from __future__ import absolute_import, print_function
import os
from lib.util import (
display,
ConfigParser,
)
from lib.cloud import (
CloudProvider,
CloudEnvironment,
CloudEnvironmentConfig,
)
class GcpCloudProvider(CloudProvider):
"""GCP cloud pro... |
#!/usr/bin/env python
## vim:ts=4:et:nowrap
"""A user-defined wrapper around string objects
Note: string objects have grown methods in Python 1.6
This module requires Python 1.6 or later.
"""
import sys
import collections
__all__ = ["UserString","MutableString"]
class UserString(collections.Sequence):
... |
from openerp.osv import orm
from openerp.tools.translate import _
class Mod349ExportToBoe(orm.TransientModel):
_inherit = "l10n.es.aeat.report.export_to_boe"
_name = "l10n.es.aeat.mod349.export_to_boe"
_description = "Export AEAT Model 349 to BOE format"
def _get_company_name_with_title(self, company_... |
from __future__ import division
import binascii
import base64
from .six import int2byte, b, integer_types, text_type
class UnexpectedDER(Exception):
pass
def encode_constructed(tag, value):
return int2byte(0xa0+tag) + encode_length(len(value)) + value
def encode_integer(r):
assert r >= 0 # can't support ... |
import re
def to_rust_ident(name):
name = name.replace("-", "_")
if name in ["static", "super", "box", "move"]: # Rust keywords
name += "_"
return name
def to_camel_case(ident):
return re.sub("(^|_|-)([a-z])", lambda m: m.group(2).upper(), ident.strip("_").strip("-"))
class Keyword(object... |
import copy
from typing import Set, Any
from .node import Node
from .fol.node_types import is_variable_declaration
class Namer:
def __init__(self):
self._name_dict = {}
self._first_name_candidates = ['x', 'y', 'z', 'w']
def _new_name(self, taken_names: Set[str]) -> str:
def make_name(... |
#!/usr/bin/env python
"""Linux client repackers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import os
import shutil
import subprocess
import zipfile
from grr_response_client_builder im... |
import os
import socket
import sys
import csv
LB_BASE_DIR = '/var/lib/contrail/loadbalancer/'
STATS_MAP = {
'active_connections': 'qcur',
'max_connections': 'qmax',
'current_sessions': 'scur',
'max_sessions': 'smax',
'total_sessions': 'stot',
'bytes_in': 'bin',
'bytes_out': 'bout',
'co... |
from __future__ import unicode_literals
from django.contrib import admin
from reviewboard.site.models import LocalSite
class LocalSiteAdmin(admin.ModelAdmin):
list_display = ('name', 'public')
filter_horizontal = ('users', 'admins')
admin.site.register(LocalSite, LocalSiteAdmin) |
from sympy.external import import_module
# fixes issue that arose in addressing issue 6533
def test_no_stdlib_collections():
'''
make sure we get the right collections when it is not part of a
larger list
'''
import collections
matplotlib = import_module('matplotlib',
__import__kwargs={... |
"""
Collaborative Filtering Classification Example.
"""
from __future__ import print_function
from pyspark import SparkContext
# $example on$
from pyspark.mllib.recommendation import ALS, MatrixFactorizationModel, Rating
# $example off$
if __name__ == "__main__":
sc = SparkContext(appName="PythonCollaborativeFil... |
import argparse, time
from subprocess import Popen, PIPE
def cmd(s, ignore_errors=False):
print s
t = time.time()
out = Popen(s, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=not isinstance(s, list))
x = out.stdout.read() + out.stderr.read()
e = out.wait() # this must be *after* the out.stdout.rea... |
# 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 field 'Range.proxy_class'
db.add_column('offer_range', 'proxy_class', self.gf('django.db.models.fields.Ch... |
from __future__ import division
from ddcmath.temperature import f2c, c2f, delta_c2f, delta_f2c, oat_percent, mkt
from ddcmath.tolerance import abs_relative_error
from ddcmath.exceptions import InaccuracyException
import pytest
try:
import numpy as np
import pandas as pd
PERM_MKT = True
except ImportErro... |
"""
Support for Melnor RainCloud sprinkler water timer.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/raincloud/
"""
from datetime import timedelta
import logging
from requests.exceptions import ConnectTimeout, HTTPError
import voluptuous as vol
from ... |
from oslo_log import log as logging
from neutron.common import exceptions as n_exc
from neutron.db import api as db_api
from neutron.db import db_base_plugin_common
from neutron.extensions import qos
from neutron.objects.qos import policy as policy_object
from neutron.objects.qos import rule as rule_object
from neutr... |
from __future__ import absolute_import
from os import walk
from os.path import join
from bokeh.settings import settings
import flask
class BokehBlueprint(flask.Blueprint):
def __init__(self, *args, **kwargs):
super(BokehBlueprint, self).__init__(*args, **kwargs)
self.debugjs = None
def setu... |
"""
The httplib2 algorithms ported for use with requests.
"""
import re
import calendar
import time
from email.utils import parsedate_tz
from pip._vendor.requests.structures import CaseInsensitiveDict
from .cache import DictCache
from .serialize import Serializer
URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?... |
from MaKaC.i18n import _
globalOptions = [
#Collaboration options necessary in all plugins
("tab", {"description" : "Name of tab where the Recording Manager plugin will be placed",
"type": str,
"defaultValue": "Recording Manager",
"editable": True,
"v... |
"""Generator script for proxy tests.
See AndroidProxySelectorTest.java
and net/proxy/proxy_config_service_android_unittest.cc
To generate C++, run this script without arguments.
To generate Java, run this script with -j argument.
Note that this generator is not run as part of the build process because
we are assumin... |
"""Parse (absolute and relative) URLs.
See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding,
UC Irvine, June 1995.
"""
__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
"urlsplit", "urlunsplit", "parse_qs", "parse_qsl"]
# A classification of schemes ('' means apply by default)
use... |
from future import Future
from patcher import Patcher
class TestPatcher(Patcher):
def __init__(self, version, patched_files, patch_data):
self._version = version
self._patched_files = patched_files
self._patch_data = patch_data
self.get_version_count = 0
self.get_patched_files_count = 0
self... |
from django.test import TestCase
from models import RelatedModel, RestrictedModel, OneToOneRestrictedModel
class CustomManagersRegressTestCase(TestCase):
def test_filtered_default_manager(self):
"""Even though the default manager filters out some records,
we must still be able to save (particularl... |
from builtins import next
from builtins import zip
import logging
from tempfile import NamedTemporaryFile
from airflow.utils.file import TemporaryDirectory
import gzip
import bz2
import tempfile
import os
from airflow.exceptions import AirflowException
from airflow.hooks.S3_hook import S3Hook
from airflow.hooks.hive_h... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Cluster.title_lt'
db.add_column(u'damis_cluster', 'title_... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# vispy: gallery 3
"""
Minimal example demonstrating the use of frame buffer objects (FBO).
This example blurs the output image.
"""
from vispy import gloo
from vispy import app
import numpy as np
# Create vetices
vPosition = np.array([[-0.8, -0.8, 0.0], [+0.7, -0.7, 0... |
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_switch_controller_802_1X_settings
except... |
import numpy as np
import metadatastore.api as mdsc
EVENT_COUNT = 1000
# I have event count so that
# tests do not take forever during
# development. I will get rid off
# this, bear with me.
class Suite:
params = [1, 10, 100, 1000]
def setup(self, n):
self.obj = range(n)
self.bcfg = mdsc.in... |
"""
This module adds shared support for Direct Connect modules.
"""
import traceback
try:
import botocore
except ImportError:
pass
from ansible.module_utils.ec2 import camel_dict_to_snake_dict
class DirectConnectError(Exception):
def __init__(self, msg, last_traceback=None, response=None):
respon... |
#-*- encoding: utf-8 -*-
'''
Created on 2014年2月14日
@author: ericlin
'''
import logging
import ldap.resiter
from pandas.core.frame import DataFrame
import re
class Query(ldap.resiter.ResultProcessor):
'''
Description:
--------------------------------------------------------
perform ad query... |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class DrugPrescription(Document):
def get_quantity(self):
quantity = 0
dosage = None
period = None
if(self.dosage):
dosage = frappe.get_doc("Prescription Dosage",self.dosage)
for item in dosage.dosage_stren... |
#-----------------------------------------------------------------------------
# class used to store graded responses to CAPA questions
#
# Used by responsetypes and capa_problem
class CorrectMap(object):
"""
Stores map between answer_id and response evaluation result for each question
in a capa problem. ... |
"""
Assorted functionality which is commonly useful when writing unit tests.
"""
from StringIO import StringIO
from zope.interface import implements
from twisted.internet.interfaces import ITransport, IConsumer, IPushProducer,\
IConnector
from twisted.internet.interfaces import IReactorTCP, IReactorSSL, IReactor... |
from __future__ import unicode_literals
import frappe
import json
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.utils import flt, cstr
from frappe.email.doctype.email_group.email_group import add_subscribers
def get_course(program):
'''Return list of courses for a particular program
... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import logging
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config ... |
import json
import operator
import re
import urllib
import urllib2
import webkitpy.common.config.urls as config_urls
from webkitpy.common.memoized import memoized
from webkitpy.common.net.layouttestresults import LayoutTestResults
from webkitpy.common.net.networktransaction import NetworkTransaction
from webkitpy.comm... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Animal(models.Model):
name = models.CharField(max_length=150)
latin_na... |
"""This module implements the Scraper component which parses responses and
extracts information from them"""
import logging
from collections import deque
from twisted.python.failure import Failure
from twisted.internet import defer
from scrapy.utils.defer import defer_result, defer_succeed, parallel, iter_errback
fr... |
#!/usr/bin/python
'''
# Spinnaker Import/Export Tool
Python cli tool that imports and exports the following Spinnaker items:
* Applications
* Pipelines
* Deployment Strategies
* Task Logs
* Echo
* Triggers
* Executions
This is helpful for performing a Spinnaker upgrade. Simply export your items, shut dow... |
# encoding: UTF-8
__author__ = 'CHENXY'
from string import join
from ctp_struct import structDict
def processCallBack(line):
orignalLine = line
line = line.replace('\tvirtual void ', '') # 删除行首的无效内容
line = line.replace('{};\n', '') # 删除行尾的无效内容
content = line.split('(')
cbNa... |
from __future__ import absolute_import, print_function
import logging
logger = logging.getLogger(__file__)
from six import add_metaclass, iteritems
from .properties import Any, HasProps, List, MetaHasProps, Instance, String
from .query import find
from .exceptions import DataIntegrityException
from .util.serializati... |
import os
from cerbero.config import DEFAULT_PACKAGER
from cerbero.errors import EmptyPackageError
from cerbero.packages import PackagerBase, PackageType
from cerbero.packages.disttarball import DistTarball
from cerbero.packages.package import MetaPackage, App
from cerbero.utils import _
from cerbero.utils import mess... |
"""
Boolean geometry utilities.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities import euclidean
import math
__author__ ... |
import json
import struct
import re
import os
import base64
import httplib
import sys
import hashlib
import datetime
import time
import ltc_scrypt
settings = {}
def uint32(x):
return x & 0xffffffffL
def bytereverse(x):
return uint32(( ((x) << 24) | (((x) << 8) & 0x00ff0000) |
(((x) >> 8) & 0x0000ff00) | ... |
"""
A Grid mixin that enables renderers to be plugged in for drawing the
row and col labels, similar to how the cell renderers work.
"""
import wx
class GridWithLabelRenderersMixin(object):
"""
This class can be mixed with wx.grid.Grid to add the ability to plugin
label renderer objects for the row, colu... |
import unittest
class TestEquality(object):
"""Used as a mixin for TestCase"""
# Check for a valid __eq__ implementation
def test_eq(self):
for obj_1, obj_2 in self.eq_pairs:
self.assertEqual(obj_1, obj_2)
self.assertEqual(obj_2, obj_1)
# Check for a valid __ne__ impl... |
from config import *
import collections
import time
import pickle
import socket
import sys
import threading
import logging
import logging.handlers as handlers
import signal
global irc
# Set to false when we've been killed
running = True
# times we've attempted to connect to server
con_attempts = 0
## Set up a logger... |
"""
Top panel for every page, containing basic system and tor related information.
This expands the information it presents to two columns if there's room
available.
"""
import os
import time
import stem
import stem.control
import stem.util.proc
import stem.util.str_tools
import stem.util.system
import nyx.controlle... |
__title__ = "DocumentOject Class to hold mechanical FEM results"
__author__ = "Qingfeng Xia, Bernd Hahnebach"
__url__ = "http://www.freecadweb.org"
## @package FemResultMechanical
# \ingroup FEM
# \brief FreeCAD DocumentObject class to hold mechanical results in FEM workbench
class _FemResultMechanical():
"""T... |
import os
from core import plugin
class DefaultTTSPlugin(plugin.TTSPlugin):
def __init__(self, *args, **kwargs):
plugin.TTSPlugin.__init__(self, *args, **kwargs)
def say(self, phrase):
data = ""
return data |
"""Process related utilities."""
from __future__ import print_function
import errno
import os
import signal
import sys
import time
def GetExitStatus(status):
"""Get the exit status of a child from an os.waitpid call.
Args:
status: The return value of os.waitpid(pid, 0)[1]
Returns:
The exit status of... |
"""Base class for fixers (optional, but recommended)."""
# Python imports
import logging
import itertools
# Local imports
from .patcomp import PatternCompiler
from . import pygram
from .fixer_util import does_tree_import
class BaseFix(object):
"""Optional base class for fixers.
The subclass name must be Fi... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Processing.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... |
import os
import re
import sys
from Utils import unicodise, deunicodise, check_bucket_name_dns_support
import Config
class S3Uri(object):
type = None
_subclasses = None
def __new__(self, string):
if not self._subclasses:
## Generate a list of all subclasses of S3Uri
self._s... |
"""
Support for FRITZ!DECT Switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.fritzdect/
"""
import logging
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from homeassistant.const impor... |
from PIL import ImageFile
from PIL import ImageGrab
from PIL import *
import time
import sys
import glob
import math
import os
import gc
from multiprocessing import Process
import win32ui
import win32gui
import win32con
def piccap(i, w=300, h=300):
hwnd = win32gui.GetDesktopWindow()
wDC = win32gui.GetWindowDC(... |
"""
Common code shared by course and library fixtures.
"""
import json
import requests
from lazy import lazy
from common.test.acceptance.fixtures import STUDIO_BASE_URL
class StudioApiLoginError(Exception):
"""
Error occurred while logging in to the Studio API.
"""
pass
class StudioApiFixture(obje... |
from django.views.generic.base import TemplateView
from django.shortcuts import get_object_or_404
import operator
class BaseSingleMatchView(TemplateView):
"""
This page will display any requested match. This page can be accessed through many places,
such as the list of all matches, or when viewing any tea... |
"""
Example Airflow DAG that displays interactions with Google Cloud Functions.
It creates a function and then deletes it.
This DAG relies on the following OS environment variables
https://airflow.apache.org/concepts.html#variables
* GCP_PROJECT_ID - Google Cloud Project to use for the Cloud Function.
* GCP_LOCATION ... |
# -*- coding: utf-8 -*-
"""
jinja2.testsuite.api
~~~~~~~~~~~~~~~~~~~~
Tests the public API and related stuff.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import unittest
import os
import tempfile
import shutil
from jinja2.testsuite import JinjaTestCase... |
import numpy as np
import warnings
from six import string_types
from ._unwrap_1d import unwrap_1d
from ._unwrap_2d import unwrap_2d
from ._unwrap_3d import unwrap_3d
def unwrap_phase(image, wrap_around=False, seed=None):
'''Recover the original from a wrapped phase image.
From an image wrapped to lie in the... |
import os
import tempfile
import unittest
import webforms_aggregator
class WebformsAggregatorTest(unittest.TestCase):
"""Unit tests for the webforms_aggregator module."""
def setUp(self):
self.cookie_file = 'test.cookie'
self.url1 = 'http://www.google.com'
self.url2 = 'http://www.macys.com'
self... |
# -*- coding: utf-8 -*-
"""
Unit tests for behavior that is specific to the api methods (vs. the view methods).
Most of the functionality is covered in test_views.py.
"""
import re
import ddt
from dateutil.parser import parse as parse_datetime
from mock import Mock, patch
from django.test import TestCase
from nose.too... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import operator
from django.conf import settings
from django.utils import translation
from django.utils.translation import ugettext as _
from six.moves import urllib, zip_longest, zip, range
from typing import Any, List, Dict, Optional, Text
import os
im... |
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.db.models import Q
from identifiers import models
from utils.logger import get_logger
logger = get_logger(__name__)
MAX_POLLING_ATTEMPTS = 20
class Command(BaseCommand):
"""
Executes all of Janewa... |
"""API for general search-related functionality"""
from base64 import urlsafe_b64encode
from collections import Counter, defaultdict
from elasticsearch_dsl import Q, Search
from elasticsearch_dsl.query import MoreLikeThis
from django.conf import settings
from channels.constants import (
CHANNEL_TYPE_PUBLIC,
C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.