content stringlengths 4 20k |
|---|
#
# SNMPv2c PDU syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc1905.txt
#
from pyasn1.type import univ, namedtype, namedval, tag, constraint
from pyasn1_modules import rfc1902
max_bindings = rfc1902.Integer(2147483647)
class _BindValue(univ.Choice):
componentType = namedtype.NamedTypes(
namedt... |
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import __version__
from ansible.errors import AnsibleError
from distutils.version import LooseVersion
from operator import eq, ge, gt
from sys import version_info
try:
from __main__ ... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetLoanUpdates(Choreography):
def __init__(self, temboo_session):
"""
Create ... |
from boto.exception import JSONResponseError
class ProvisionedThroughputExceededException(JSONResponseError):
pass
class LimitExceededException(JSONResponseError):
pass
class ConditionalCheckFailedException(JSONResponseError):
pass
class ResourceInUseException(JSONResponseError):
pass
class Re... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import datetime
import os
import traceback
try:
from nailgun import entities, entity_f... |
microcode = '''
# FNOP
''' |
#!/usr/bin/env python
# -*- encoding=utf-8 -*-
from crawlers.electorates.base_provincePage import *
from utils import sanitize, InvalidCrawlerError
def Crawler(nth, election_name, electionType, target):
if nth == 1:
raise NotImplementedError('Educational Parliament Election was not held in 1995.')
elif nth == 2:
... |
# Wrapper module for _ssl, providing some additional facilities
# implemented in Python. Written by Bill Janssen.
"""\
This module provides some more Pythonic support for SSL.
Object types:
SSLSocket -- subtype of socket.socket which does SSL over the socket
Exceptions:
SSLError -- exception raised for I/O er... |
import mock
from oslo_config import cfg
from nova.compute import api as compute_api
from nova.compute import manager as compute_manager
from nova.servicegroup import api as service_group_api
from nova.tests.functional.api_sample_tests import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
... |
# Source: http://code.activestate.com/recipes/576693/
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ide... |
"""
This code was Ported from CPython's sha512module.c
"""
import struct
SHA_BLOCKSIZE = 128
SHA_DIGESTSIZE = 64
def new_shaobject():
return {
'digest': [0]*8,
'count_lo': 0,
'count_hi': 0,
'data': [0]* SHA_BLOCKSIZE,
'local': 0,
'digestsize': 0
}
ROR64 = lam... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.netv... |
"""Test suite for abdt_differresultcache."""
# =============================================================================
# TEST PLAN
# -----------------------------------------------------------------------------
# Here we detail the things we are concerned to test and specify whic... |
'''
Logic for checking if the Pulp server is configured to apply *any* repo
authentication. This is meant to be used as a short-circuit validation
to prevent the more costly tests from being run in the case the Pulp server
doesn't care at all about repo authentication.
'''
from ConfigParser import SafeConfigParser
# ... |
#!/usr/bin/env python2.7
"""Inspects player behaviour to ensure playback is occuring."""
class Watchdog(object):
"""Aids in debugging issues caused by stalled playback."""
watch_value = 0
watch_count = False
max_seg_duration = 0
run = False
def __init__(self, player):
"""Start thre... |
"""
This package contains modules for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
import sys
from docutils.utils import normalize_language_tag
if sys.version_info < (2,5):
from docutils._compat import __import__
_languages = {}
def get_language(language_code):
fo... |
import logbook
import blue_yellow_app.infrastructure.static_cache as static_cache
import pyramid.renderers
import pyramid.httpexceptions as exc
from blue_yellow_app.infrastructure.supressor import suppress
import blue_yellow_app.infrastructure.cookie_auth as cookie_auth
from blue_yellow_app.services.account_service i... |
"""
Classes used to model the roles used in the courseware. Each role is responsible for checking membership,
adding users, removing users, and listing members
"""
from abc import ABCMeta, abstractmethod
from django.contrib.auth.models import User
import logging
from student.models import CourseAccessRole
from xmodu... |
"""Skia's Chromium DEPS roll script.
This script:
- searches through the last N Skia git commits to find out the hash that is
associated with the SVN revision number.
- creates a new branch in the Chromium tree, modifies the DEPS file to
point at the given Skia commit, commits, uploads to Rietveld, and
deletes t... |
from cwatm.management_modules.data_handling import *
from cwatm.hydrological_modules.routing_reservoirs.routing_sub import *
from cwatm.management_modules.globals import *
class lakes_res_small(object):
"""
Small LAKES AND RESERVOIRS
Note:
Calculate water retention in lakes and reservoirs
... |
#!/usr/bin/env python
# generate hotindexing undo provisional tests with 2 nested transactions
import sys
def print_tr(fp, tr, trstack):
trtype = tr[0]
xid = tr[1:]
if trtype == 'i':
print >>fp, "insert", trstack, xid, "v"+xid
if trtype == 'd':
print >>fp, "delete", trstack, xid
if... |
import platform
import Queue
import re
import threading
import time
import urllib
HTTP_TIMEOUT = 10.0 # Max. seconds to wait for a response
HTTP_TITLE = "Wheel Index" # HTTP Title to look for to validate the page
MAX_THREADS = 10
MIRROR_LIST = [
"http://mirror.dfw.rax.openstack.org/wheel/",
"http://mi... |
__doc__ = """
gyptest.py -- test runner for GYP tests.
"""
import os
import optparse
import subprocess
import sys
class CommandRunner:
"""
Executor class for commands, including "commands" implemented by
Python functions.
"""
verbose = True
active = True
def __init__(self, dictionary={}):
self.subs... |
"""
Models for Bookmarks.
"""
import logging
from django.contrib.auth.models import User
from django.db import models
from jsonfield.fields import JSONField
from model_utils.models import TimeStampedModel
from opaque_keys.edx.keys import UsageKey
from xmodule.modulestore import search
from xmodule.modulestore.django... |
# XBMC modules
import xbmc
import xbmcgui
import xbmcaddon
# STANDARD library modules
import os
import sys
import requests
import subprocess
import threading
sys.path.append(xbmc.translatePath(os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'resources','lib')))
# Custom Modules
import timezones
import LICENSE
im... |
from .case import ModelTestCase
from . import setUpModule, tearDownModule
class GroupTestCase(ModelTestCase):
def test_by_name(self):
from pyshop.models import Group
grp = Group.by_name(self.session, u'admin')
self.assertIsInstance(grp, Group)
self.assertEqual(grp.name, u'admin')
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: bigip_profile_persistence_src_addr
short_description: Manag... |
import csv
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from .models import Record
from .exporters import (
Record1FieldExporter,
RecordExcludeIdExporter... |
import sys
sys.path = ['.'] + sys.path
from test_support import verbose, TestFailed
import re
import sys, os, string, traceback
# Misc tests from Tim Peters' re.doc
if verbose:
print 'Running tests on re.search and re.match'
try:
assert re.search('x*', 'axx').span(0) == (0, 0)
assert re.search('x*', 'ax... |
""" Data iterators for common data formats and utility functions."""
from . import io
from .io import CSVIter, DataBatch, DataDesc, DataIter, ImageDetRecordIter, ImageRecordInt8Iter, ImageRecordIter,\
ImageRecordIter_v1, ImageRecordUInt8Iter, ImageRecordUInt8Iter_v1, LibSVMIter, MNISTIter, MXDataIter, NDArrayIter,... |
# -*- coding: utf-8 -*-
"""
Test cases related to RelaxNG parsing and validation
"""
import unittest, sys, os.path
this_dir = os.path.dirname(__file__)
if this_dir not in sys.path:
sys.path.insert(0, this_dir) # needed for Py3
from common_imports import etree, BytesIO, _bytes, HelperTestCase, fileInTestDir
from... |
from django.test.client import Client
from django.contrib.auth.models import User
from survey.views.aggregates import *
from survey.tests.base_test import BaseTest
class AggregatesPageTest(BaseTest):
def setUp(self):
self.client = Client()
user_without_permission = User.objects.create_user(userna... |
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.rds import RDSConnection
from boto.rds.dbsnapshot import DBSnapshot
from boto.rds import DBInstance
class TestDescribeDBSnapshots(AWSMockServiceTestCase):
connection_class = RDSConnection
def default_body(self):
... |
from pytest import raises
from flexx.util.testing import run_tests_if_main
from flexx.pyscript.parser0 import JSError, unify
from flexx import pyscript
def test_unify():
# Simple objects
assert unify('3') == '3'
assert unify('3.12') == '3.12'
assert unify('"aa"') == '"aa"'
assert unify("'aa'... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
import socket
try:
import dns.resolver
import dns.reversename
from dns.rdatatype import (A, AAAA, CNAME, DLV, DNAME, DNSKEY, DS, HIN... |
#!/usr/bin/env python
#fileencoding=utf-8
import time
import logging
from tornado.options import options, parse_command_line
from pymongo import MongoClient
import settings
class Scaffold(object):
def __init__(self):
self.setup()
def setup(self):
settings.define_app_options()
parse_... |
from opus_core.variables.variable import Variable
from urbansim.functions import attribute_label
from variable_functions import my_attribute_label
from opus_core.logger import logger
class de_population_DDD(Variable):
"""sum of year DDD population forecast by Dram/Empal in large area"""
_return_type="in... |
from couchpotato.core.logger import CPLog
import xml.etree.ElementTree as XMLTree
log = CPLog(__name__)
class RSS(object):
def getTextElements(self, xml, path):
""" Find elements and return tree"""
textelements = []
try:
elements = xml.findall(path)
except:
... |
from typing import List
import hashlib
import time
try:
import simplejson as json
except ImportError:
import json # type: ignore
from libcloud.utils.py3 import httplib
from libcloud.utils.connection import get_response_object
from libcloud.common.types import InvalidCredsError
from libcloud.common.base impo... |
import time
import os
import random
import numpy as np
import pandas as pd
import argparse
import mlflow
from pathlib import Path
from contextlib import contextmanager
@contextmanager
def timer(name):
t0 = time.time()
yield
print(f"[{name}] done in {time.time() - t0:.0f} s")
def reduce_mem_usage(df: pd... |
import account_bank_statement
import controllers
import point_of_sale
import report
import res_users
import res_partner
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from __future__ import unicode_literals
import re
subtitle_exts = [ 'srt', 'idx', 'sub', 'ssa' ]
video_exts = ['3g2', '3gp', '3gp2', 'asf', 'avi', 'divx', 'flv', 'm4v', 'mk2',
'mka', 'mkv', 'mov', 'mp4', 'mp4a', 'mpeg', 'mpg', 'ogg', 'ogm',
'ogv', 'qt', 'ra', 'ram', 'rm', 'ts', 'wav', 'we... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.six import string_types
def pct_to_int(value, num_items, min_value=1):
'''
Converts a given value to a percentage if specified as "x%",
otherwise converts the given value to an integer.
'... |
import time
import unittest
import getpass
import gdata.spreadsheet.text_db
import gdata.spreadsheet.service
__author__ = 'api.jscudder (Jeffrey Scudder)'
username = ''
password = ''
class FactoryTest(unittest.TestCase):
def setUp(self):
self.client = gdata.spreadsheet.text_db.DatabaseClient()
def testB... |
"""Script for testing tools/cfgupgrade"""
import os
import sys
import unittest
import shutil
import tempfile
import operator
import json
from ganeti import constants
from ganeti import utils
from ganeti import serializer
from ganeti import netutils
from ganeti.utils import version
import testutils
def GetMinimalC... |
import logging
from c7n.filters import Filter
from c7n.utils import type_schema
from c7n_azure.actions.base import AzureBaseAction
from c7n_azure.constants import GRAPH_AUTH_ENDPOINT
from c7n_azure.filters import FirewallBypassFilter, FirewallRulesFilter
from c7n_azure.provider import resources
from c7n_azure.resource... |
"""Utility methods for working with WSGI servers."""
from __future__ import print_function
import errno
import os
import socket
import ssl
import sys
import time
import eventlet
import eventlet.wsgi
import greenlet
from oslo.config import cfg
from paste import deploy
import routes.middleware
import webob.dec
import ... |
"""A simple demo of new RNN cell with PTB language model."""
import os
import numpy as np
import mxnet as mx
from bucket_io import BucketSentenceIter, default_build_vocab
data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
def Perplexity(label, pred):
# TODO(tofix): we make a transpos... |
"""Tests for the selector module."""
__author__ = '<EMAIL> (Thomas Stromberg)'
import selectors
import unittest
class SelectorsTest(unittest.TestCase):
def testMaxRepeatCount(self):
self.assertEquals(selectors.MaxRepeatCount(range(1,10), 5),
selectors.MAX_REPEAT)
self.assertEquals(s... |
""" This is the Bokeh charts testing interface.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with thi... |
''' Provide a web socket handler for the Bokeh Server application.
'''
from __future__ import absolute_import, print_function
import logging
log = logging.getLogger(__name__)
import codecs
from six.moves.urllib.parse import urlparse
from tornado import gen, locks
from tornado.websocket import StreamClosedError, We... |
microcode = '''
def macroop SALC_R
{
sbb reg, reg, reg, dataSize=1
};
def macroop SETZ_R
{
movi reg, reg, 1, flags=(CZF,)
movi reg, reg, 0, flags=(nCZF,)
};
def macroop SETZ_M
{
movi t1, t1, 1, flags=(CZF,)
movi t1, t1, 0, flags=(nCZF,)
st t1, seg, sib, disp
};
def macroop SETZ_P
{
rdip t... |
"""
A workflow is defined by a set of states that a translation unit can be in and
the (allowed) transitions between these states. A state is defined by a range
between -128 and 127, indicating its level of "completeness". The range is
closed at the beginning and open at the end. That is, if a workflow contains
states ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
import shlex
import subprocess
import select
def run_cmd(cmd, live=False, readsize=10):
#readsize = 10
cmdargs = shlex.split(cmd)
p = subprocess.Popen(cmdargs, stdout=subprocess.PIPE, stderr=subp... |
"""
This test verifies that compare correctly does the call to Cortical.io's
API and gets a dictionary of distances
"""
import cortipy
import unittest
class CompareTest(unittest.TestCase):
"""Requires CORTICAL_API_KEY to be set"""
def testCompare(self):
"""
Tests client.createClassification(). Asse... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
)
class DaumIE(InfoExtractor):
_VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:v/|.*?clipid=)(?P<id>[^?#&]+)'
IE_NAME = 'daum.net'
_TESTS = [{
... |
import uhttpd
import network
class Handler:
def __init__(self):
pass
#
# callbacks
#
def get(self, api_request):
components = api_request['context']
full_response = self.get_response()
return self.extract_response(components, full_response)
#
# internal o... |
import os
from sanic import Sanic
from sanic.log import log
from sanic.response import json, text, file
from sanic.exceptions import ServerError
app = Sanic(__name__)
@app.route("/")
async def test_async(request):
return json({"test": True})
@app.route("/sync", methods=['GET', 'POST'])
def test_sync(request):... |
from collections import defaultdict, deque
import itertools
import pprint
import textwrap
from jsonschema import _utils
from jsonschema.compat import PY3, iteritems
WEAK_MATCHES = frozenset(["anyOf", "oneOf"])
STRONG_MATCHES = frozenset()
_unset = _utils.Unset()
class _Error(Exception):
def __init__(
... |
# Django settings for myapp project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'default.db', ... |
from django.apps import apps
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.sitemaps import Sitemap
from django.core import urlresolvers
from django.db import models
class KMLSitemap(Sitemap):
"""
A minimal hook to produce KML sitemaps.
"""
geo_format = 'kml'
de... |
"""email package exception classes."""
class MessageError(Exception):
"""Base class for errors in the email package."""
class MessageParseError(MessageError):
"""Base class for message parsing errors."""
class HeaderParseError(MessageParseError):
"""Error while parsing headers."""
class BoundaryErro... |
import itertools
import operator
from django.db.models import Count, Min
from symposion.schedule.models import Room, Slot, SlotRoom
class TimeTable(object):
def __init__(self, day):
self.day = day
def slots_qs(self):
qs = Slot.objects.all()
qs = qs.filter(day=self.day)
... |
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest import test
CONF = config.CONF
class ImagesNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
def ski... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import os.path
import string
import sys
import TestSCons
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
test.write('mylatex.py', r"""
import getopt
import os
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'tx', [])
opt_st... |
import sys
import mock
from oslo_config import cfg
from neutron.plugins.embrane.common import config # noqa
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
'EmbraneFakePlugin')
class EmbranePluginV2TestCas... |
# coding: utf8
"""
webencodings.x_user_defined
~~~~~~~~~~~~~~~~~~~~~~~~~~~
An implementation of the x-user-defined encoding.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
import codecs
### Codec APIs
class Codec... |
from openerp.addons.mail.tests.common import TestMail
from openerp.exceptions import AccessError
from openerp.osv.orm import except_orm
from openerp.tools import mute_logger
class TestMailGroup(TestMail):
@mute_logger('openerp.addons.base.ir.ir_model', 'openerp.osv.orm')
def test_00_mail_group_access_rights(... |
import os
import sys
from setuptools import setup, find_packages
def get_version():
p = os.path.join(os.path.dirname(
os.path.abspath(__file__)), "py", "__init__.py")
with open(p) as f:
for line in f.readlines():
if "__version__" in line:
return line.s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'supported_by': 'community',
'status': ['preview']
}
DOCUMENTATION = r'''
---
module: postgresql_query
short_description: Run PostgreSQL queries
description:
- Runs arbit... |
import re
from command import Command, MirrorSafeCommand
class List(Command, MirrorSafeCommand):
common = True
helpSummary = "List projects and their associated directories"
helpUsage = """
%prog [-f] [<project>...]
%prog [-f] -r str1 [str2]..."
"""
helpDescription = """
List all projects; pass '.' to list th... |
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
import product
from openerp.exceptions import UserError
class stock_landed_cost(osv.osv):
_name = 'stock.landed.cost'
_description = 'Stock Landed Cost'
_inherit = 'mail.thread'
_tr... |
"""Tests for Adam optimizer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.optimizer_v2 import adam
from tensorflow.python.client import session
from tensorflow.python.eager import context
from tensorflow.pyt... |
import httplib, mimetypes
def post_multipart(host, selector, fields, files):
"""
Post fields and files to an http host as multipart/form-data.
fields is a sequence of (name, value) elements for regular form fields.
files is a sequence of (name, filename, value) elements for data to be uploaded as files... |
import ast
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from django.shortcuts import render, get_object_or_404, re... |
""" Tests for the openshift_version Ansible filter module. """
# pylint: disable=missing-docstring,invalid-name
import os
import sys
import unittest
sys.path = [os.path.abspath(os.path.dirname(__file__) + "/../filter_plugins/")] + sys.path
# pylint: disable=import-error
import openshift_version # noqa: E402
class... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_find
version_added: "2.3"
short_description: return a list of files based on specific criteria
description:
- Return a list of files based... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import errno
import json
from units.mock.procenv import ModuleTestCase, swap_stdin_and_argv
from units.compat.mock import patch, MagicMock, mock_open, Mock
from ansible.module_utils.six.moves import builtins
realimport = builtins.... |
from .. import abc
from .. import util
from . import util as builtin_util
frozen_machinery, source_machinery = util.import_importlib('importlib.machinery')
import sys
import unittest
class FindSpecTests(abc.FinderTests):
"""Test find_spec() for built-in modules."""
def test_module(self):
# Common ... |
"""
Decorators for labeling and modifying behavior of test objects.
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
::
nose.tools.make_decorator(original_function)(decorator)
in returning the decorator, i... |
from collections import OrderedDict
from django.db import models
from django.utils.translation import ugettext_lazy as _
from modelutils import *
def prepend_verbose(mydict, field_name, num):
field = mydict[field_name]
field.verbose_name = '(%s) %s' % (num, field_name)
class InternetNewsJournalist(Journalist... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
gridnet.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*****************... |
"""Helper functions useful when writing scripts that are run from GN's
exec_script function."""
class GNException(Exception):
pass
def ToGNString(value, allow_dicts = True):
"""Prints the given value to stdout.
allow_dicts indicates if this function will allow converting dictionaries
to GN scopes. This is o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
© Copyright 2015-2016, 3D Robotics.
drone_delivery.py:
A CherryPy based web application that displays a mapbox map to let you view the current vehicle position and send the vehicle commands to fly to a particular latitude and longitude.
Full documentation is provided... |
from __future__ import print_function
# $example on$
from pyspark.ml.linalg import Vectors
from pyspark.ml.stat import Correlation
# $example off$
from pyspark.sql import SparkSession
"""
An example for computing correlation matrix.
Run with:
bin/spark-submit examples/src/main/python/ml/correlation_example.py
"""
i... |
from gnuradio_core import *
from exceptions import *
from hier_block2 import *
from top_block import *
from gateway import basic_block, sync_block, decim_block, interp_block
from tag_utils import tag_to_python, tag_to_pmt
# create a couple of aliases
serial_to_parallel = stream_to_vector
parallel_to_serial = vector_to... |
# # -*- coding: utf-8 -*-
# """
# .. module:: djbraintree.webhooks
# :synopsis: dj-braintree - Utils related to processing or registering for webhooks
#
# .. moduleauthor:: Bill Huneke (@wahuneke)
#
# A model registers itself here if it wants to be in the list of processing
# functions for a particular webhook. Each... |
import os
import sys
import random
def test_bare_msg_type():
import genmsg.msgs
tests = [(None, None), ('String', 'String'), ('std_msgs/String', 'std_msgs/String'),
('String[10]', 'String'), ('string[10]', 'string'), ('std_msgs/String[10]', 'std_msgs/String'),
]
for val, res ... |
import tempfile
from cloudfiles.errors import ContainerNotEmpty
from django import http
from django.core.urlresolvers import reverse
from mox import IsA
from horizon import api
from horizon import test
from .tables import ContainersTable, ObjectsTable
CONTAINER_INDEX_URL = reverse('horizon:nova:containers:index')
... |
from copperhead import *
from numpy import zeros
@cu
def initialize(N):
nx, ny = N
def el(i):
y = i / nx
if y==0:
return 1.0
else:
return 0.0
return map(el, range(nx * ny))
@cu
def solve(u, N, D2, it):
nx, ny = N
dx2, dy2 = D2
def el(i):
... |
"""
Application-specific exceptions raised by the block structure framework.
"""
class BlockStructureException(Exception):
"""
Base class for all Block Structure framework exceptions.
"""
pass
class TransformerException(BlockStructureException):
"""
Exception class for Transformer related er... |
"""Utility methods for working with WSGI servers."""
import sys
from oslo_config import cfg
from oslo_log import log as logging
from paste import deploy
import routes.middleware
import webob.dec
import webob.exc
from cinder import exception
from cinder.i18n import _, _LE
from cinder import utils
CONF = cfg.CONF
LOG... |
from selenium.webdriver.support.ui import Select
from keywordgroup import KeywordGroup
class _SelectElementKeywords(KeywordGroup):
# Public
def get_list_items(self, locator):
"""Returns the values in the select list identified by `locator`.
Select list keywords work on both lists and combo b... |
import collections
import glob
import logging
import os
import sys
import tempfile
import time
import traceback
import random
from telemetry.core import browser_finder
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.core import wpr_modes
from telemetry.core.platform.profiler import... |
import re
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y', 'z', 'e1', 'e2'])
class Point(object):
def __init__(self, x=None, y=None, z=None, e1=None, e2=None, f=None):
self.x = x
self.y = y
self.z = z
self.e1 = e1
self.e2 = e2
self.f = f
... |
__prog_desc__ = 'create dictionary of gene counts for each genome'
__author__ = 'Donovan Parks'
__copyright__ = 'Copyright 2013'
__credits__ = ['Donovan Parks']
__license__ = 'GPL3'
__version__ = '0.1'
__maintainer__ = 'Donovan Parks'
__email__ = '<EMAIL>'
__status__ = 'Development'
import argparse
from checkm.lib.i... |
import os
import stat
def clean_path(path):
try:
path = str(path)
except UnicodeEncodeError:
raise ValueError("dulwich requires bytestring path names")
path = os.path.normpath(path)
if '..' in path:
raise ValueError("found '..' in path")
return path
def iter_blob_paths(re... |
from django.views.generic.list import ListView
from django.views.generic.edit import UpdateView, DeleteView
from django.views.generic import FormView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import permission_required
from django.shortcuts import get_object_or_404
from dj... |
from __future__ import unicode_literals
import warnings
from collections import deque
from functools import total_ordering
from django.db.migrations.state import ProjectState
from django.utils.datastructures import OrderedSet
from django.utils.encoding import python_2_unicode_compatible
from .exceptions import Circu... |
# pylint: disable=line-too-long, unused-argument
import json
from django.template.loader import render_to_string
def format_reading(probe_name, json_payload):
item = json.loads(json_payload)
heart = '?'
steps = '?'
distance = '?'
calories = '?'
floors = '?'
elevation = '?'
if 'HEAR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.