content string |
|---|
import os
import sys
import traceback
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.parsing import DataLoader
from ansible.parsing.vault import VaultEditor
from ansible.cli import CLI
from ansible.utils.display import Display
class VaultCLI(CLI):
""" ... |
from user import User
from db import Base, Session
from sqlalchemy import *
from sqlalchemy.orm import relation, sessionmaker
from datetime import datetime, date
from attendee import Attendee
from werkzeug.security import generate_password_hash, check_password_hash
from flask import json
from sqlalchemy import exc
from... |
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
service from AWS.
"""
from boto.ec2.connection import EC2Connection
def regions(**kw_params):
"""
Get all available regions for the EC2 service.
You may pass any of the arguments accepted by the EC2Connection
object's constructor ... |
from openerp.osv import osv, fields
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class stock_return_picking(osv.osv_memory):
_inherit = 'stock.return.picking'
_columns = {
'invoice_state': fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_u... |
"""Based on code from timeout_socket.py, with some tweaks for compatibility.
These tweaks should really be rolled back into timeout_socket, but it's
not totally clear who is maintaining it at this point. In the meantime,
we'll use a different module name for our tweaked version to avoid any
confusion.
T... |
"""Ops for representing Bayesian computation.
## This package provides classes for Bayesian computation with TensorFlow.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import,line-too-long
from tensorflow.contrib.bayesflow.pyth... |
"""Stuff that differs in different Python versions and platform
distributions."""
import os
import imp
import sys
import site
__all__ = ['WindowsError']
uses_pycache = hasattr(imp, 'cache_from_source')
class NeverUsedException(Exception):
"""this exception should never be raised"""
try:
WindowsError = Wind... |
"""
SWF (Macromedia/Adobe Flash) file parser.
Documentation:
- Alexis' SWF Reference:
http://www.m2osw.com/swf_alexref.html
- http://www.half-serious.com/swf/format/
- http://www.anotherbigidea.com/javaswf/
- http://www.gnu.org/software/gnash/
Author: Victor Stinner
Creation date: 29 october 2006
"""
from ha... |
#!/usr/bin/env python
__applicationName__ = "doxypy"
__blurb__ = """
doxypy is an input filter for Doxygen. It preprocesses python
files so that docstrings of classes and functions are reformatted
into Doxygen-conform documentation blocks.
"""
__doc__ = __blurb__ + \
"""
In order to make Doxygen preprocess files thro... |
import unittest
import pytest
from selenium.webdriver.common.by import By
class RenderedWebElementTests(unittest.TestCase):
@pytest.mark.ignore_chrome
def testShouldPickUpStyleOfAnElement(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="green-paren... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
import re
import subprocess
from ansible.module_utils.basic import AnsibleModule... |
from __future__ import absolute_import
import os
import shutil
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from django.core.files.images import ImageFile
from django.test import TestCase
from django.utils._os import upath
from django.utils.unittest import skipIf
try:
... |
#!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
'''
Send Openshift Master SkyDNS metric checks to Zagg
Openshift uses SkyDNS to locate services inside of the cluster.
Openshift implements SkyDNS a bit different. Normally SkyDNS uses etcd as a backend
for the DNS data to be stored. Openshift us... |
# -*- coding: utf-8 -*-
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
depends_on = (
("people", "0012_move_instutute_models_to_institutes_app"),
)
def forwards(self, orm):
# moved logic to karaage.people.migrations.0012_move_instutute_models_to_institutes_app
... |
"""
Support for Xiaomi Yeelight Wifi color bulb.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.yeelight/
"""
import logging
import colorsys
import voluptuous as vol
from homeassistant.util.color import (
color_temperature_mired_to_kelvin as ... |
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from Core import *
from perf_trace_context import *
unhandled = autodict()
def trace_begin():
print "trace_begin"
pass
def trace_end():
print_unhandled()
def irq__softirq_entry(event_... |
import sys
import imp
import marshal
from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN
from distutils.version import StrictVersion
from setuptools import compat
__all__ = [
'Require', 'find_module', 'get_module_constant', 'extract_constant'
]
class Require:
"""A prerequisite to building or inst... |
"""A thread pool that logs exceptions raised by tasks executed within it."""
import logging
from concurrent import futures
def _wrap(behavior):
"""Wraps an arbitrary callable behavior in exception-logging."""
def _wrapping(*args, **kwargs):
try:
return behavior(*args, **kwargs)
except Exception as... |
#!/usr/bin/env python
#
# File Name: sensor_box.py
#
# Desc:
# Control the sensor to get humidity and moisture infomation
# If internet is down, store the result into local files
# else send the data to the database
#
import os
import time
import datetime
import logging
import subprocess
import RPi.GPIO as GPIO
impo... |
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
from abc import ABCMeta, abstractmethod
# class Handler(SimpleXMLRPCRequestHandler):
class Proxy:
__metaclass__ = ABCMeta
@abstractmethod
def reserve(resv):
pass
@abstractmethod
de... |
# coding: utf-8
from __future__ import unicode_literals
import io
import logging
import os
config_text = 'site_name: My Docs\n'
index_text = """# Welcome to MkDocs
For full documentation visit [mkdocs.org](http://mkdocs.org).
## Commands
* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start th... |
import perf
def main():
cpus = perf.cpu_map()
threads = perf.thread_map()
evsel = perf.evsel(task = 1, comm = 1, mmap = 0,
wakeup_events = 1, sample_period = 1,
sample_id_all = 1,
sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU | perf.SAMPLE_TID)
evsel.open(cpus = cpus, threa... |
#!/usr/bin/python
# $Id: xtalk.py,v 1.4 2008/08/09 17:00:18 normanr Exp $
import sys,os,xmpp,time,select
class Bot:
def __init__(self,jabber,remotejid):
self.jabber = jabber
self.remotejid = remotejid
def register_handlers(self):
self.jabber.RegisterHandler('message',self.xmpp_message... |
# -*- coding: utf-8 -*-
"""
pygments.styles.native
~~~~~~~~~~~~~~~~~~~~~~
pygments version of my "native" vim theme.
:copyright: 2006-2007 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String... |
from collections import defaultdict
def autodict():
return defaultdict(autodict)
flag_fields = autodict()
symbolic_fields = autodict()
def define_flag_field(event_name, field_name, delim):
flag_fields[event_name][field_name]['delim'] = delim
def define_flag_value(event_name, field_name, value, field_str):
... |
"""Controllers for the Oppia reader view."""
__author__ = 'Sean Lip'
from core.controllers import base
from core.domain import exp_services
from core.domain import rights_manager
from core.domain import skins_services
from core.domain import stats_services
from core.domain import widget_registry
import feconf
import ... |
"""
R code printer
The RCodePrinter converts single sympy expressions into single R expressions,
using the functions defined in math.h where possible.
"""
from __future__ import print_function, division
from sympy.core import S
from sympy.core.compatibility import string_types, range
from sympy.codegen.ast import... |
import account |
#!/usr/bin/env python
"""Doxygen XML to SWIG docstring converter.
Usage:
doxy2swig.py [options] input.xml output.i
Converts Doxygen generated XML files into a file containing docstrings
that can be used by SWIG-1.3.x. Note that you need to get SWIG
version > 1.3.23 or use Robin Dunn's docstring patch to be able t... |
"""
.15925 Editor
Copyright 2014 TechInvestLab.ru <EMAIL>
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
.15925 Ed... |
# -*- coding: utf-8 -*-
"""
Spanish-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
class ESPostalCodeField(RegexField):
"""
A... |
from array import array
from itertools import repeat
def merge_arrays(arrays):
merged_array = array("I", repeat(0, len(arrays[0])))
for arr in arrays:
if arr != None:
for index in range(0, len(arr)):
merged_array[index] += arr[index]
return merged_array |
"""Simulation (not actual implementation) for private FM sketch."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from math import sqrt, log, exp, ceil
import numpy as np
import scipy.integrate as integrate
import scipy.special
from privateFM.utils impor... |
from oslo_config import cfg
from oslo_db import options
from oslo_log import log
from nova import debugger
from nova import paths
from nova import rpc
from nova import version
CONF = cfg.CONF
_DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('nova.sqlite')
# NOTE(mikal): suds is used by the vmware driv... |
"""Test passing structs to Objective-C methods."""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestObjCStructArgument(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp()... |
from itertools import chain
import networkx as nx
from nose.tools import *
class TestIsSemiconnected(object):
def test_undirected(self):
assert_raises(nx.NetworkXNotImplemented, nx.is_semiconnected,
nx.Graph())
assert_raises(nx.NetworkXNotImplemented, nx.is_semiconnected,
... |
"""Base classes to configure a Named daemon"""
import os
from typing import List, Union, Sequence, Optional
from ipaddress import IPv4Address, IPv6Address, ip_address
from mininet.log import lg
from ipmininet.overlay import Overlay
from ipmininet.utils import realIntfList, find_node, has_cmd
from ipmininet.router.con... |
"""Run tasks in parallel on a single machine using multiple cores.
"""
import functools
try:
import joblib
except ImportError:
joblib = False
from bcbio.distributed import resources
from bcbio.log import logger, setup_local_logging
from bcbio.pipeline import config_utils
from bcbio.provenance import diagnosti... |
"""Helper to upload Jenkins test results to BQ"""
from __future__ import print_function
import os
import six
import sys
import time
import uuid
gcp_utils_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__), '../../gcp/utils'))
sys.path.append(gcp_utils_dir)
import big_query_utils
_DATASET_ID = 'jenkin... |
"""Email address parsing code.
Lifted directly from rfc822.py. This should eventually be rewritten.
"""
__all__ = [
'mktime_tz',
'parsedate',
'parsedate_tz',
'quote',
]
import time
SPACE = ' '
EMPTYSTRING = ''
COMMASPACE = ', '
# Parse a date field
_monthnames = ['jan', 'feb... |
"""Test the wallet backup features.
Test case is:
4 nodes. 1 2 and 3 send transactions between each other,
fourth node is a miner.
1 2 3 each mine a block to start, then
Miner creates 100 blocks so 1 2 3 each have 50 mature
coins to spend.
Then 5 iterations of 1/2/3 sending coins amongst
themselves to get transactions... |
from twisted.trial import unittest
from twisted.internet import error
import socket
class TestStringification(unittest.TestCase):
"""Test that the exceptions have useful stringifications.
"""
listOfTests = [
#(output, exception[, args[, kwargs]]),
("An error occurred binding to an interfa... |
"""
Contains various functions for checking and setting required and optional
parameters.
"""
def req_param(obj, paramlist):
for param in paramlist:
if not hasattr(obj, param):
raise ValueError("req param %s missing for %s" % (param,
obj.__class__.__name__))
def ... |
from django.template import TemplateDoesNotExist
from django.template.loader import (
get_template, render_to_string, select_template,
)
from django.test import SimpleTestCase, override_settings
from django.test.client import RequestFactory
@override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.... |
# -*- coding: utf-8 -*-
"""Serializer tests for the Box addon."""
import mock
from nose.tools import * # noqa (PEP8 asserts)
from website.addons.base.testing.serializers import StorageAddonSerializerTestSuiteMixin
from website.addons.box.tests.utils import MockBox
from website.addons.box.tests.factories import BoxAcc... |
from ansible.compat.tests import unittest
from ansible.module_utils import known_hosts
class TestAnsibleModuleKnownHosts(unittest.TestCase):
urls = {
'ssh://one.example.org/example.git':
{'is_ssh_url': True, 'get_fqdn': 'one.example.org'},
'ssh+git://two.example.org/example.git':
... |
from os import getenv
import requests
from behave import *
import json
from app import server
from verify import expect
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
WAIT_SECONDS = 30
BASE_URL = getenv('BAS... |
from libcloud.utils.py3 import xmlrpclib
from libcloud.test import MockHttp
class BaseGandiMockHttp(MockHttp):
def _get_method_name(self, type, use_param, qs, path):
return "_xmlrpc"
def _xmlrpc(self, method, url, body, headers):
params, methodName = xmlrpclib.loads(body)
meth_name =... |
"""
Verifies --generator-output= behavior when using rules.
"""
import TestGyp
# Android doesn't support --generator-output.
test = TestGyp.TestGyp(formats=['!android'])
test.writable(test.workpath('rules'), False)
test.run_gyp('rules.gyp',
'--generator-output=' + test.workpath('gypfiles'),
... |
from collections import OrderedDict
from typing import Dict, Type
from .base import RegionNotificationEndpointsTransport
from .rest import RegionNotificationEndpointsRestTransport
# Compile a registry of transports.
_transport_registry = (
OrderedDict()
) # type: Dict[str, Type[RegionNotificationEndpointsTransp... |
# -*- coding: utf-8 -*-
''' Location parser
.. moduleauthor:: David Marteau <<EMAIL>>
'''
from collections import namedtuple
from bitstring import BitStream
from .utils import lazyproperty
from .constants import (LATEST_BINARY_VERSION,
BINARY_VERSION_2,
MIN_BYTES_... |
"""
A set of classes to hold different kinds of hashes etc and convert between them,
Much of this was adapted from https://github.com/tehmaze/python-multihash,
which seems to have evolved from the pip3 multihash, which is seriously broken.
"""
import hashlib
import struct
import sha3
import pyblake2
import base58
imp... |
import FreeCAD
import FreeCADGui
import Path
import PathScripts
from PySide import QtCore
import math
__doc__ = """Path Array object and FreeCAD command"""
# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectArray:
... |
from __future__ import print_function
import logging
import re
from functools import partial
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream, DASHStream
from streamlink.utils import parse_json, update_scheme, search_dict
log = logging.getLogger(... |
"""Unit tests for WebJournal."""
__revision__ = \
"$Id$"
# pylint invenio/modules/webjournal/lib/webjournal_tests.py
from invenio.testutils import InvenioTestCase
from invenio.webjournal_utils import compare_issues
from invenio.webjournal import issue_is_later_than
#from invenio import webjournal_utils
from in... |
from django.shortcuts import render, get_object_or_404
from django.views.generic import DetailView
from authen.models import User
from fraternity.models import Team, Project
from .models import Post, Hashtag
class GetUserPosts(DetailView):
model = Post
template_name = 'posts.html'
context_object_name = '... |
from anytree import Node, RenderTree
class SitemapNode(Node):
"""
A SitemapNode represents a node of the sitemap. The root node
(the homepage) is available as a property of the Site class,
e.g. site.sitemaps["en"] for the English sitemap. This class
is an extension of Node, from the anytree librar... |
from ..base import BaseEstimator, TransformerMixin
from ..utils import check_array
def _identity(X):
"""The identity function.
"""
return X
class FunctionTransformer(BaseEstimator, TransformerMixin):
"""Constructs a transformer from an arbitrary callable.
A FunctionTransformer forwards its X (a... |
"""Policy framework for the email package.
Allows fine grained feature control of how the package parses and emits data.
"""
import abc
from email import header
from email import charset as _charset
from email.utils import _has_surrogates
__all__ = [
'Policy',
'Compat32',
'compat32',
]
class _Polic... |
from __future__ import print_function
from __future__ import with_statement
from contextlib import contextmanager
import os
import pwd
import grp
import codecs
import fnmatch
import copy
import imp
protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog = imp.load_source('nxDSCLog', '../nxDSCLog.py')
LG = nx... |
# -*- coding: utf-8 -*-
"""
For a massive matrix of colors and color labels you can download
the follow two files
# http://lyst-classifiers.s3.amazonaws.com/color/lab-colors.pk
# http://lyst-classifiers.s3.amazonaws.com/color/lab-matrix.pk
lab-colors is a cPickled list of color names and lab-matrix is a
cPickled (n,3... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils... |
"""monthdelta
Date calculation with months: MonthDelta class and monthmod() function.
"""
__all__ = ['MonthDelta', 'monthmod']
from datetime import date, timedelta
class MonthDelta:
"""Number of months offset from a date or datetime.
MonthDeltas allow date calculation without regard to the different length... |
"""
This module implements clipboard handling on Windows using ctypes.
"""
import time
import contextlib
import ctypes
from ctypes import c_size_t, sizeof, c_wchar_p, get_errno, c_wchar
from .exceptions import PyperclipWindowsException
class CheckedCall(object):
def __init__(self, f):
super(CheckedCall, s... |
"""Utilities to deal with sympy.Matrix, numpy and scipy.sparse."""
from __future__ import print_function, division
from sympy import Matrix, I, Expr, Integer
from sympy.core.compatibility import range
from sympy.matrices import eye, zeros
from sympy.external import import_module
__all__ = [
'numpy_ndarray',
... |
import sys
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
from models import Person
if sys.version_info >= (2, 5):
from tests_25 import AssertNumQueriesContextManagerTests
class SkippingTestCase(TestCase):
def test_skip_unless_db_feature(self):
"A test that might be skipped ... |
"""
LLDB Formatters for LLVM data types.
Load into LLDB with 'command script import /path/to/lldbDataFormatters.py'
"""
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('type category define -e llvm -l c++')
debugger.HandleCommand('type synthetic add -w llvm '
... |
"""Docbuilder for extension docs."""
import os
import os.path
import shutil
import sys
import time
import urllib
from subprocess import Popen, PIPE
from optparse import OptionParser
_script_path = os.path.realpath(__file__)
_build_dir = os.path.dirname(_script_path)
_base_dir = os.path.normpath(_build_dir + "/..")
_... |
"""
Django settings for todo project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
#... |
#!/usr/bin/env python
import cv2
from BaseHTTPServer import BaseHTTPRequestHandler
from BaseHTTPServer import HTTPServer
import time
import argparse
from opencvutils import Camera
import socket as Socket
# import errno
# threaded version
# http://stackoverflow.com/questions/12650238/processing-simultaneous-asynchrono... |
import unittest
import os
import comm
class TestCrosswalkApptoolsFunctions(unittest.TestCase):
def test_dir_exist(self):
comm.setUp()
os.chdir(comm.XwalkPath)
comm.clear("org.xwalk.test")
os.mkdir("org.xwalk.test")
cmd = comm.HOST_PREFIX + comm.PackTools + \
"c... |
from pytest import fixture, mark, raises
from kryptomime import KeyMissingError
from kryptomime.mail import create_mail, protect_mail
from kryptomime.smime import OpenSMIME, Certificate, PrivateKey, MemoryKeyStore, OpenSSL, OpenSSL_CA
import email.mime.text
from conftest import sender, receiver
from test_openssl imp... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import re
from collections import OrderedDict
import tinycss
from PIL import Image, ImageFont, ImageDraw
from six import unichr
class IconFont(object):
"""Base class that represents web icon font"""
def __init__(self,... |
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_u... |
"""
Test suite for _osx_support: shared OS X support functions.
"""
import os
import platform
import shutil
import stat
import sys
import unittest
import test.support
import _osx_support
@unittest.skipUnless(sys.platform.startswith("darwin"), "requires OS X")
class Test_OSXSupport(unittest.TestCase):
def setUp... |
#! /usr/bin/python3
"""Execute arbitrary data as a smart contract."""
import struct
import binascii
import logging
logger = logging.getLogger(__name__)
from counterpartylib.lib import (util, config, exceptions)
from .scriptlib import (utils, blocks, processblock)
FORMAT = '>20sQQQ'
LENGTH = 44
ID = 101
def initial... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import fnmatch
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
get_dict_of_struct,
... |
import sys
import re
import numpy as np
from scipy.sparse import csc_matrix, csr_matrix, lil_matrix
from sklearn.utils.testing import (assert_almost_equal, assert_array_equal,
assert_true)
from sklearn.datasets import load_digits
from sklearn.externals.six.moves import cStringIO as ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
PCA example with Iris Data-set
=========================================================
Principal Component Analysis applied to the Iris dataset.
See `here <http://en.wikipedia.org/wiki/Iris_flower_data_set>`_ fo... |
"""
Declarative objects.
Declarative objects have a simple protocol: you can use classes in
lieu of instances and they are equivalent, and any keyword arguments
you give to the constructor will override those instance variables.
(So if a class is received, we'll simply instantiate an instance with
no arguments).
You ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'core'}
import re
from functools import partial
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vyos import get_config, load_config
from ansible.module_utils.si... |
#! /usr/bin/python
# See README.txt for information and build instructions.
import addressbook_pb2
import sys
# This function fills in a Person message based on user input.
def PromptForAddress(person):
person.id = int(raw_input("Enter person ID number: "))
person.name = raw_input("Enter name: ")
email = raw_... |
import traces
from datetime import datetime
def test_quickstart():
time_series = traces.TimeSeries()
time_series[datetime(2042, 2, 1, 6, 0, 0)] = 0 # 6:00:00am
time_series[datetime(2042, 2, 1, 7, 45, 56)] = 1 # 7:45:56am
time_series[datetime(2042, 2, 1, 8, 51, 42)] = 0 # 8:51:42am
time_ser... |
__author__ = "MetaCarta"
__copyright__ = "Copyright (c) 2006-2008 MetaCarta"
__license__ = "Clear BSD"
__version__ = "$Id: DBM.py 444 2008-03-19 01:35:35Z brentp $"
from FeatureServer.DataSource import DataSource
from FeatureServer.DataSource import Lock
from FeatureServer.Service.Action import Action
import anydbm
... |
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class Top20Page(page_module.Page):
def __init__(self, url, page_set, name=''):
super(Top20Page, self).__init__(url=url, page_set=page_set, name=name)
self.archive_data_file = '../data/chrome_proxy_top_20.j... |
#!/usr/bin/env python2
"""SSH in to a running appliance and set up an internal DB.
An optional region can be specified (default 0), and the script
will use the first available unpartitioned disk as the data volume
for postgresql.
Running this script against an already configured appliance is
unsupported, hilarity ma... |
num_get_values = {
'GL_ACCUM_ALPHA_BITS' : 1,
'GL_ACCUM_BLUE_BITS' : 1,
'GL_ACCUM_CLEAR_VALUE': 4,
'GL_ACCUM_GREEN_BITS' : 1,
'GL_ACCUM_RED_BITS' : 1,
'GL_ALPHA_BIAS' : 1,
'GL_ALPHA_BITS' : 1,
'GL_ALPHA_SCALE' : 1,
'GL_ALPHA_TEST' : 1,
'GL_ALPHA_TEST_FUNC' : 1,
'GL_ALPHA_TEST... |
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, MultiIndex, Series, date_range
from pandas.tests.frame.common import TestData
import pandas.util.testing as tm
from pandas.util.testing import assert_frame_equal, assert_series_equal
class TestDataFrameNonuniqueIndexes(TestData):
... |
"""
OnApp DNS Driver
"""
__all__ = [
'OnAppDNSDriver'
]
import json
from libcloud.common.onapp import OnAppConnection
from libcloud.dns.types import Provider, RecordType
from libcloud.dns.base import DNSDriver, Zone, Record
DEFAULT_ZONE_TTL = 1200
class OnAppDNSDriver(DNSDriver):
type = Provider.ONAPP
... |
from protocol import TBinaryProtocol
from transport import TTransport
def serialize(thrift_object,
protocol_factory=TBinaryProtocol.TBinaryProtocolFactory()):
transport = TTransport.TMemoryBuffer()
protocol = protocol_factory.getProtocol(transport)
thrift_object.write(protocol)
return tr... |
import pytest
import py
import os
from _pytest.config import get_config, PytestPluginManager
from _pytest.main import EXIT_NOTESTSCOLLECTED
@pytest.fixture
def pytestpm():
return PytestPluginManager()
class TestPytestPluginInteractions:
def test_addhooks_conftestplugin(self, testdir):
testdir.makepyf... |
import WebIDL
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface SpecialMethodUniqueness1 {
getter deleter boolean (DOMString name);
getter boolean (DOMString name);
};
""")
results = parser.finish()
ex... |
import random
from direct.distributed import ClockDelta
from direct.task import Task
from toontown.coghq import LaserGameBase
class LaserGameRoll(LaserGameBase.LaserGameBase):
def __init__(self, funcSuccess, funcFail, funcSendGrid, funcSetGrid):
LaserGameBase.LaserGameBase.__init__(self, funcSuccess, fun... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2008 (ita)
"Execute the tasks"
import os, sys, random, time, threading, traceback
try: from Queue import Queue
except ImportError: from queue import Queue
import Build, Utils, Logs, Options
from Logs import debug, error
from Constants import *
GAP = 15
run... |
from __future__ import unicode_literals
from __future__ import absolute_import
from functools import reduce
import logging
from docker.errors import APIError
from .config import get_service_name_from_net, ConfigurationError
from .const import DEFAULT_TIMEOUT, LABEL_PROJECT, LABEL_SERVICE, LABEL_ONE_OFF
from .containe... |
# -*- coding: utf-8 -*-
"""Tests for the XQueue certificates interface. """
from contextlib import contextmanager
import json
from mock import patch, Mock
from nose.plugins.attrib import attr
from django.test import TestCase
from django.test.utils import override_settings
from opaque_keys.edx.locator import CourseLoc... |
def bucket_lister(bucket, prefix='', delimiter='', marker='', headers=None):
"""
A generator function for listing keys in a bucket.
"""
more_results = True
k = None
while more_results:
rs = bucket.get_all_keys(prefix=prefix, marker=marker,
delimiter=delim... |
import os
import files
import tempfile
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from geonode import geoserver, qgis_server
from geonode.layers.forms import JSONField
from geonode.upload.models import UploadFile
from geonode.geoserver.helpers import ogc... |
import bpy, os, sys, configparser
from bpy.props import *
STATIC_CONFIG_FILENAME = "ogre_mesh_exporter.cfg"
class SelectedObject(bpy.types.PropertyGroup):
name = StringProperty(name = "Name", default = "Unknown", options = set())
objectName = StringProperty(name = "Object", default = "Unknown", options = set())
cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.