content stringlengths 4 20k |
|---|
import os
import pygame
from threading import Thread
import juliet_importer
from juliet_input import Juliet_Input
BLACK = (0,0,0)
WHITE = (255,255,255)
class Juliet_Graphics (Thread):
screen = None
current_modules = []
stop_running = False
def __init__(self):
Thread.__init__(self)
sel... |
import mock
from oslo_utils import versionutils
from nova import exception
from nova import objects
from nova.tests.functional.api_sample_tests import test_servers
class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
sample_dir = "os-migrate-server"
def setUp(self):
"""setUp Method fo... |
import os
import unittest
import doctest
import glob
env_root = os.environ['CUDDLEFISH_ROOT']
def get_tests():
import cuddlefish
import cuddlefish.tests
tests = []
packages = [cuddlefish, cuddlefish.tests]
for package in packages:
path = os.path.abspath(package.__path__[0])
pyname... |
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
nb_cores = 4
cpus = [ DerivO3CPU(cpu_id=i) for i in xrange(nb_cores) ]
import ruby_config
ruby_memory = ruby_config.generate("TwoLevel_SplitL1UnifiedL2.rb", nb_cores)
# system simulated
system = System(cpu = cpus, physmem = ruby_memory, membus... |
from django import template
from horizon.utils import html
class Breadcrumb(html.HTMLElement):
def __init__(self, request, template, root,
subfolder_path, url, attr=None):
super(Breadcrumb, self).__init__()
self.template = template
self.request = request
self.root... |
"""
Tests for discussion API permission logic
"""
import itertools
from unittest import TestCase
import ddt
from discussion_api.permissions import can_delete, get_editable_fields
from lms.lib.comment_client.comment import Comment
from lms.lib.comment_client.thread import Thread
from lms.lib.comment_client.user import... |
"""Shared utilities for access the Cloud KMS API."""
from googlecloudsdk.core import apis
from googlecloudsdk.core import resources
def GetClientInstance():
return apis.GetClientInstance('cloudkms', 'v1beta1')
def GetMessagesModule():
return apis.GetMessagesModule('cloudkms', 'v1beta1')
def MakeGetUriFunc(co... |
from __future__ import unicode_literals
import frappe
import frappe.desk.reportview
from frappe.utils import cstr, unique
# this is called by the Link Field
@frappe.whitelist()
def search_link(doctype, txt, query=None, filters=None, page_len=20, searchfield=None):
search_widget(doctype, txt, query, searchfield=search... |
import os
import subprocess
from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetry.core.platform import profiler
class AndroidScreenRecordingProfiler(profiler.Profiler):
"""Captures a screen recording on Android."""
def __init__(self, browser_backend, pla... |
"""
`schemes` is a dictionary with lowercase URI addressing schemes as
keys and descriptions as values. It was compiled from the index at
http://www.iana.org/assignments/uri-schemes (revised 2005-11-28)
and an older list at http://www.w3.org/Addressing/schemes.html.
"""
# Many values are blank and should be filled in ... |
from zope.interface import implements
from twisted.application import service
from buildbot.interfaces import IStatusReceiver
from buildbot import util, pbutil
class StatusReceiver:
implements(IStatusReceiver)
def requestSubmitted(self, request):
pass
def requestCancelled(self, builder, request)... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
fr... |
"""Find the frequencies in raw audio data by using fast Fourier transformations
(supplied by numpy).
This module can also convert the found frequencies to Note objects.
"""
import wave
import struct
import numpy
from mingus.containers.note import Note
from numpy.fft import fft as _fft
import operator
# Making a freq... |
from django.core.exceptions import ImproperlyConfigured
from django.template import engines
from django.test import SimpleTestCase, override_settings
class TemplateUtilsTests(SimpleTestCase):
@override_settings(TEMPLATES=[{'BACKEND': 'raise.import.error'}])
def test_backend_import_error(self):
"""
... |
"""
Tests for the wrapping layer that provides the XBlock API using XModule/Descriptor
functionality
"""
# For tests, ignore access to protected members
# pylint: disable=protected-access
import webob
import ddt
from factory import (
BUILD_STRATEGY,
Factory,
lazy_attribute,
LazyAttributeSequence,
p... |
import os
from six import text_type
from tests.support.asserts import assert_same_element, assert_success
from tests.support.inline import inline
def execute_async_script(session, script, args=None):
if args is None:
args = []
body = {"script": script, "args": args}
return session.transport.sen... |
__all__ = [
'LXMLTreeBuilderForXML',
'LXMLTreeBuilder',
]
from io import BytesIO
from io import StringIO
import collections
from lxml import etree
from bs4.element import Comment, Doctype, NamespacedAttribute
from bs4.builder import (
FAST,
HTML,
HTMLTreeBuilder,
PERMISSIVE,
ParserRejec... |
# Time: O(n + p)
# Space: O(p)
# Given two sentences words1, words2 (each represented as an array of strings),
# and a list of similar word pairs pairs, determine if two sentences are similar.
#
# For example, words1 = ["great", "acting", "skills"] and
# words2 = ["fine", "drama", "talent"] are similar,
# if the simi... |
import yaml
import json
import urllib.request
import time
from wallet import Wallet
from database.database import Database
config = yaml.safe_load(open("config.yml"))
f = open('dataset.txt', 'r')
dataset = f.readlines()
dataset = [float(i) for i in dataset]
walletBitcoin = 0.0
cash_wallet = Wallet()
firstrun = True
... |
import urllib
# ===========================================
# Module execution.
#
def main():
module = AnsibleModule(
argument_spec=dict(
token=dict(required=True, no_log=True),
environment=dict(required=True),
user=dict(required=False),
repo=dict(required=... |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.ActionMap import ActionMap
from Components.Sources.FrontendStatus import FrontendStatus
from Components.Sources.StaticText import StaticText
from Components.config import config, configfile, getConfigListEntry
from Comp... |
from btcommon import *
import _msbt as bt
bt.initwinsock ()
# ============== SDP service registration and unregistration ============
def discover_devices (duration=8, flush_cache=True, lookup_names=False):
return bt.discover_devices (flush_cache, lookup_names)
def lookup_name (address, timeout=10):
if not ... |
"""DLKit Services implementations of authentication service."""
# pylint: disable=no-init
# osid specification includes some 'marker' interfaces.
# pylint: disable=too-many-ancestors
# number of ancestors defined in spec.
# pylint: disable=too-few-public-methods,too-many-public-methods
# number of methods d... |
"""
An ontology backed by a remote Wikidata SPARQL service.
"""
import networkx as nx
import logging
import ontobio.ontol
from ontobio.ontol import Ontology, Synonym
from prefixcommons.curie_util import contract_uri, expand_uri, get_prefixes
from SPARQLWrapper import SPARQLWrapper, JSON, RDF
from ontobio.sparql.rdflib... |
from __future__ import absolute_import, print_function, division
import numpy
import theano
from theano.misc.cudamat_utils import cudamat_available
if not cudamat_available: # noqa
from nose.plugins.skip import SkipTest
raise SkipTest("gnumpy not installed. Skip test of theano op with pycuda "
... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy 2009-2018 (ita)
# DragoonX6 2018
"""
Detect the Clang++ C++ compiler
This version is an attempt at supporting the -target and -sysroot flag of Clang++.
"""
from waflib.Tools import ccroot, ar, gxx
from waflib.Configure import conf
import waflib.extras.clang_cross_... |
"""Unit tests for __instancecheck__ and __subclasscheck__."""
import unittest
from test import support
class ABC(type):
def __instancecheck__(cls, inst):
"""Implement isinstance(inst, cls)."""
return any(cls.__subclasscheck__(c)
for c in {type(inst), inst.__class__})
def ... |
from pyre.applications.Script import Script
class PickleScript(Script):
class Inventory(Script.Inventory):
import pyre.geometry
import pyre.inventory
name = pyre.inventory.str("name", default="geometry-test.pml")
modeller = pyre.inventory.facility("modeller", default="canister"... |
"""Unittests for stats."""
from __future__ import print_function
import time
import urllib2
from chromite.lib import cros_test_lib
from chromite.lib import parallel
from chromite.lib import parallel_unittest
from chromite.lib import partial_mock
from chromite.lib import stats
from chromite.lib import timeout_util
... |
import unittest
import numpy as np
from numpy.testing import assert_allclose
import theano
from keras.layers import convolutional
class TestConvolutions(unittest.TestCase):
def test_convolution_1d(self):
nb_samples = 9
nb_steps = 7
input_dim = 10
filter_length = 6
nb_filte... |
from nose.tools import *
import adaptive_interpolation.generate as generate
def test_generation():
pass
def test_code_execution():
func1 = lambda x: np.sin(x**1.1)
a, b = -10, 10
domain_size = 500
x = np.linspace(a, b, domain_size, dtype=np.float64)
max_val = la.norm(func1(x), n... |
"""
This module implements the XmlRpcRequest class which is a more convenient class
(that Request) to generate xml-rpc requests.
See documentation in docs/topics/request-response.rst
"""
import xmlrpclib
from scrapy.http.request import Request
from scrapy.utils.python import get_func_args
DUMPS_ARGS = get_func_args... |
# Öz məxsusi exception-larımızı hazırlayırıq
class Error(Exception):
pass
class StackOverFlow(Error):
def __init__(self, message):
self.message = message
class StackUnderFlow(Error):
def __init__(self, message):
self.message = message
class ArrayStack:
def __init__(self, limit=10)... |
from openerp import _, api, models, fields
from openerp.exceptions import Warning as UserError
class ResPartner(models.Model):
_inherit = 'res.partner'
# added to port old field fam_spouse_employer on hr_employee
# from previous version
employer = fields.Many2one(
'res.partner', 'Employer', d... |
'''
Created on 26 dec. 2011
Copyright: Jev Kuznetsov
License: BSD
sender-reciever pattern.
'''
import logger as logger
import types
class Sender(object):
"""
Sender -> dispatches messages to interested callables
"""
def __init__(self):
self.listeners = {}
self.logg... |
import sys
import unittest
from telemetry.core import exceptions
from telemetry.testing import gtest_progress_reporter
from telemetry.testing import simple_mock
from telemetry.testing import stream
try:
raise exceptions.IntentionalException()
except exceptions.IntentionalException:
INTENTIONAL_EXCEPTION = sys.ex... |
"""
streamcloud urlresolver plugin
Copyright (C) 2012 Lynx187
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 is ... |
#!/usr/bin/env python
"""
Cross-check energies of molecules from AlkEthOH set using SMIRNOFF xml file
versus energies from AMBER .prmtop and .crd files (parm@frosst params).
"""
import os
# datapath = './AlkEthOH_tripos/AlkEthOH_chain_filt1'
# datapath = './AlkEthOH_tripos/AlkEthOH_rings_filt1'
datapath = './AlkEthO... |
"""
Overridden syncdb command
"""
import sys
from optparse import make_option
from django.core.management.base import NoArgsCommand, BaseCommand
from django.core.management.color import no_style
from django.utils.datastructures import SortedDict
from django.core.management.commands import syncdb
from django.conf imp... |
from .xmlbuilder import XMLBuilder, XMLProperty
class IdMap(XMLBuilder):
"""
Class for generating user namespace related XML
"""
_XML_ROOT_NAME = "idmap"
_XML_PROP_ORDER = ["uid_start", "uid_target", "uid_count",
"gid_start", "gid_target", "gid_count"]
uid_start = XMLProperty("./u... |
# -*- coding: utf-8 -*-
"""
sphinx.websupport.storage.sqlalchemy_db
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQLAlchemy table and mapper definitions used by the
:class:`sphinx.websupport.storage.sqlalchemystorage.SQLAlchemyStorage`.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
... |
"""Module that builds the Graphical User Interface."""
import os
from shutil import copy
from tkinter import *
from tkinter.ttk import *
from tkinter import messagebox
from threading import Thread, active_count
from uiplib.gui import generalTab, settingsTab
from uiplib.scheduler import scheduler
from uiplib.utils.uti... |
from boto.compat import http_client
from tests.compat import mock, unittest
class AWSMockServiceTestCase(unittest.TestCase):
"""Base class for mocking aws services."""
# This param is used by the unittest module to display a full
# diff when assert*Equal methods produce an error message.
maxDiff = Non... |
"""
This module houses the Geometry Collection objects:
GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
"""
from ctypes import c_int, c_uint, byref
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos i... |
#
# written by Stefano Sanfilippo <<EMAIL>>
#
"""Tests for P.A.C.K.E.R. unpacker."""
import unittest
from jsbeautifier.unpackers.packer import detect, unpack
# pylint: disable=R0904
class TestPacker(unittest.TestCase):
"""P.A.C.K.E.R. testcase."""
def test_detect(self):
"""Test detect() function.... |
import unittest
from datetime import datetime, timedelta
from airflow.models import DagBag
import json
class ApiExperimentalTests(unittest.TestCase):
def setUp(self):
from airflow import configuration
configuration.load_test_config()
from airflow.www import app as application
app... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import bigsuds
except ImportError:
bigsuds_found = False
else:
bigsuds_found = True
from ansible.module_utils.basic import AnsibleModule
from ansible.module_util... |
"""tf_export tests."""
# pylint: disable=unused-import
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from tensorflow.python.platform import test
from tensorflow.python.util import tf_decorator
from tensorflow.python.util import tf_export
def... |
# -*- coding: utf-8 -*-
from functools import partial
from django.db import models
from djspace.core.models import FILE_VALIDATORS
from djspace.core.models import Base
from djspace.core.models import GenericChoice
from djspace.core.utils import upload_to_path
from djspace.registration.choices import GRADUATE_DEGREE
f... |
# -*- coding: utf-8 -*-
'''
Created on 2014-2-10
'''
from __future__ import absolute_import
from flask import Blueprint, abort, request, flash, jsonify
from flask.globals import current_app
from ...common.job_state_updater import JobStateUpdater
from ...common.model_meta import dashboard_check_cfg
mod = Blueprint('c... |
"""
The package for the psi statistics computation
"""
import numpy as np
try:
from scipy import weave
def _psicomputations(variance, lengthscale, Z, variational_posterior):
"""
Z - MxQ
mu - NxQ
S - NxQ
gamma - NxQ
"""
# here are the "statistics" f... |
import urllib2, random, sys
try: multi
except NameError: from threading import Thread as multi
__module_Author__ = "Handrix"
__module_name__ = "py99 include Plug-in"
__module_version__ = "1.0"
__module_description__ = "include shell"
class exploiter(multi):
global headers
headers=[[('User-agent'... |
from __future__ import unicode_literals
from datetime import datetime
from operator import attrgetter
from django.test import TestCase, skipUnlessDBFeature
from .models import (
CustomMembership, Employee, Event, Friendship, Group, Ingredient,
Invitation, Membership, Person, PersonSelfRefM2M, Recipe, RecipeI... |
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.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'n... |
"""
Hard-coded results for test_regression
"""
### REGRESSION MODEL RESULTS : OLS, GLS, WLS, AR###
import numpy as np
class Longley(object):
'''
The results for the Longley dataset were obtained from NIST
http://www.itl.nist.gov/div898/strd/general/dataarchive.html
Other results were obtained from ... |
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import Worksheet
class TestAssembleWorksheet(unittest.TestCase):
"""
Test assembling a complete Worksheet file.
"""
def test_assemble_xml_file(self):
"""Test writing a worksheet ... |
import zmq
import struct
import random
import binascii
import enum
CURRENT_REQUEST_VERSION = 1
MAX_REQUEST_DATA_SIZE = 32
class RequestType(enum.IntEnum):
ReadMemory = 1,
WriteMemory = 2
CITRA_PORT = "45987"
class Citra:
def __init__(self, address="127.0.0.1", port=CITRA_PORT):
self.context = zm... |
"""Functionality related to notifications common to multiple layers of
the system.
"""
import datetime
from oslo.config import cfg
import nova.context
from nova import db
from nova import notifier as notify
from nova.openstack.common import context as common_context
from nova.openstack.common import excutils
from no... |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils.encoding import smart_text
register = template.Library()
class BaseCommentNode(template.Node... |
# Learn Python The Hard Way
# Exercise 43: Basic Object-Oriented Analysis and Design
# http://learnpythonthehardway.org/book/ex43.html
# Aliens have invaded a space ship and our hero has to go through a maze
# of rooms defeating them so he can escape into an escape pod to the planet
# below. The game will be more li... |
import sys
import time
import subprocess
from six.moves.urllib.parse import urlencode
import scrapy
from scrapy.commands import ScrapyCommand
from scrapy.linkextractors import LinkExtractor
class Command(ScrapyCommand):
default_settings = {
'LOG_LEVEL': 'INFO',
'LOGSTATS_INTERVAL': 1,
'... |
import sys
import re
import time
import datetime
import array
debug = False
docfile = ''
start_time = time.time()
debug = 0
stats = {'passed':0, 'failed':0, 'skipped':0, 'internal_errors':0, 'cmd':0}
class bcolors:
header = '\033[95m'
okblue = '\033[94m'
okgreen = '\033[92m'
warning = '\033[93m'
... |
'''Helpers for parsing command line options'''
import logging
import os
import sys
from getpass import getuser
from tempfile import gettempdir
from tests.comparison import db_connection
from tests.comparison.cluster import (
CmCluster,
DEFAULT_HIVE_HOST,
DEFAULT_HIVE_PASSWORD,
DEFAULT_HIVE_PORT,
D... |
import sys
import shlex
from io import BytesIO, TextIOWrapper
from os import WEXITSTATUS, listdir, system
from subprocess import Popen, PIPE
from os.path import isfile, join
from unittest.mock import patch
import self as grader
def list_files(path, extension=''):
return [f for f in listdir(path) if isfile(join(p... |
import copy
import mock
from oslo_config import cfg
# XXX: actionsensor import depends on config being setup.
import st2tests.config as tests_config
tests_config.parse_args()
import st2common.bootstrap.runnersregistrar as runners_registrar
from st2common.runners.base import ActionRunner
import local_runner
from st2... |
# -*- coding: utf-8 -*-
from django.core.mail import send_mail
from django.db import models
from django.utils import timezone
from django.utils.http import urlquote
try:
import re
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager
from django.core import validators
f... |
import hashlib
import time
from .. import constants
__author__ = 'bromix'
class AccessManager(object):
def __init__(self, settings):
self._settings = settings
pass
def has_login_credentials(self):
"""
Returns True if we have a username and password.
:return: True if ... |
import shared
import os
# This is used so that the translateText function can be used when we are in daemon mode and not using any QT functions.
class translateClass:
def __init__(self, context, text):
self.context = context
self.text = text
def arg(self,argument):
if '%' in self.text:
... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class TheOnionIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?theonion\.com/video/[^,]+,(?P<id>[0-9]+)/?'
_TEST = {
'url': 'http://www.theonion.com/video/man-wearing-mm-jacket-gods-image,36918/',... |
class MockUtil:
def __init__(self, test):
self.test = test
def get_log_dir(self):
return "/tmp"
def log(self, msg):
print(msg)
def error(self, msg):
print(msg)
def get_seq_no(self):
return "0"
def do_status_report(self, operation, status, status_code,... |
import sys
from ..Qt import QtGui, QtCore
from ..SignalProxy import SignalProxy
from ..pgcollections import OrderedDict
from ..python2_3 import asUnicode, basestring
class ComboBox(QtGui.QComboBox):
"""Extends QComboBox to add extra functionality.
* Handles dict mappings -- user selects a text key, and the C... |
"""distutils.command.bdist_wininst
Implements the Distutils 'bdist_wininst' command: create a windows installer
exe-program."""
__revision__ = "$Id$"
import sys
import os
import string
from sysconfig import get_python_version
from distutils.core import Command
from distutils.dir_util import remove_tree
from distut... |
"""Contains the logic for `aq del switch`."""
from aquilon.exceptions_ import ArgumentError
from aquilon.aqdb.model import Switch
from aquilon.worker.broker import BrokerCommand # pylint: disable=W0611
from aquilon.worker.dbwrappers.dns import delete_dns_record
from aquilon.worker.locks import lock_queue, CompileKey... |
server="irc.freenode.net"
port=6665
channel="#webkit" |
# IR Beacon Grayscale Tracking Example
#
# This example shows off IR beacon Grayscale tracking using the OpenMV Cam.
import sensor, image, time
thresholds = (255, 255) # thresholds for bright white light from IR.
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.set_window... |
from __future__ import unicode_literals
from .common import InfoExtractor
class DefenseGouvFrIE(InfoExtractor):
IE_NAME = 'defense.gouv.fr'
_VALID_URL = r'https?://.*?\.defense\.gouv\.fr/layout/set/ligthboxvideo/base-de-medias/webtv/(?P<id>[^/?#]*)'
_TEST = {
'url': 'http://www.defense.gouv.fr/l... |
""" Maps the tweet user into the requires data structure (the same as that used by the
network script.)
For each mentioned user the creation timestamp is the timestamp of the earliest
tweet we see that has is present.
"""
def add_user(users_map,user_id,screen_name,created_ts):
link = "https://twitter.co... |
from guardian.shortcuts import get_objects_for_user
from django.http import Http404, HttpResponseRedirect
from django.db.models import Count
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from vdw.samples.models import Sample, Project, Batch, Cohort
from .forms impor... |
from .api import Account, Charges, Customers, Events, Tokens
from . import errors
import requests
import json
class WebPay:
"""Main interface of webpay library.
See `API reference<https://webpay.jp/docs/api/python>`.
"""
_headers = {
'Content-Type': 'application/json',
'Accept': 'ap... |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, flt
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
import datetime
from controllers.buying_controller import BuyingController
class DocType(BuyingController):
def _... |
# -*- coding: utf-'8' "-*-"
import base64
try:
import simplejson as json
except ImportError:
import json
import logging
import urlparse
import werkzeug.urls
import urllib2
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_paypal.controllers.main import Payp... |
import numpy as np
import pytest
from pandas._libs.tslibs.period import IncompatibleFrequency
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
NaT,
Period,
PeriodIndex,
Series,
date_range,
offsets,
period_range,... |
"""Different kinds of SAX Exceptions"""
import sys
if sys.platform[:4] == "java":
from java.lang import Exception
del sys
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can contain
basic error or warning information from either the XM... |
from __future__ import division, absolute_import, print_function
import numpy as np
try:
from scipy.spatial import (cKDTree, KDTree, SphericalVoronoi, distance,
ConvexHull, Voronoi)
except ImportError:
pass
from .common import Benchmark
class Build(Benchmark):
params = [
[(3,10000,1000), (8... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2009 Canonical
Copyright (C) 2012 Fabio Erculiani
Authors:
Michael Vogt
Fabio Erculiani
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; version 3.
This... |
"""Plugin for VGTV, Norwegian newspaper VG Nett's streaming service."""
import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import HDSStream, HLSStream, HTTPStream
# This will have to be set to handle "secure" HDS streams. For now we
# leave it... |
from __future__ import unicode_literals
import time
import unittest
import spotify
from spotify.utils import load
import tests
from tests import mock
class Foo(object):
def __init__(self, session):
self._session = session
@property
def is_loaded(self):
return True
def load(self, t... |
from setuptools import setup, find_packages
from hueversion import VERSION
setup(
name = "impala",
version = VERSION,
author = "Hue",
url = 'http://github.com/cloudera/hue',
description = "Real time queries all your Big Data",
packages = find_packages('src'),
package_dir = {''... |
"""
Tests for HiddenContentTransformer.
"""
from datetime import timedelta
import ddt
from django.utils.timezone import now
from nose.plugins.attrib import attr
from ..hidden_content import HiddenContentTransformer
from .helpers import BlockParentsMapTestCase, update_block
@attr(shard=3)
@ddt.ddt
class HiddenConten... |
# -*- coding: utf-8 -*-
"""
raven.utils.serializer.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import itertools
import types
from raven.utils import six
from raven.... |
"""
SpreadLabs - Social media suite
Copyright (C) 2015 Christopher Mejia Montoya - <EMAIL> - chrissmejia.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version... |
# 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 'Week.prediction'
db.add_column('contest_week', 'prediction', self.gf('django.db.models.fie... |
#!/usr/bin/env python
"""
Copyright (C) 2010 Alvin Penner, <EMAIL>
- Voronoi Diagram algorithm and C code by Steven Fortune, 1987, http://ect.bell-labs.com/who/sjf/
- Python translation to file voronoi.py by Bill Simons, 2005, http://www.oxfish.com/
This program is free software; you can redistribute it and/or modify... |
"""URL configuration for Machinetracker tool"""
from django.conf.urls import url
from nav.web.machinetracker import views
urlpatterns = [
url(r'^$',
views.ip_search,
name='machinetracker'),
url(r'^ip/$',
views.ip_search,
name='machinetracker-ip'),
url(r'^ip/prefix/(?P<pre... |
import numpy as np
import cv2
from time import sleep
import serial
#ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1)
ser = serial.Serial('/dev/ttyACM0', 115200, timeout=1)
cap = cv2.VideoCapture(0)
NUM_LEDS = 100
SEND_SERIAL = True
while 1:
ret,frame = cap.read()
if frame == None:
continue
# ... |
"""HTTP related handlers.
Note that some other HTTP handlers live in more specific modules: _auth.py,
_gzip.py, etc.
Copyright 2002-2006 John J Lee <<EMAIL>>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file
COPYING.txt included with th... |
microcode = ""
#let {{
# class DAA(Inst):
# "GenFault ${new UnimpInstFault}"
# class DAS(Inst):
# "GenFault ${new UnimpInstFault}"
#}}; |
# http://www.pgroup.com
from __future__ import division, absolute_import, print_function
from numpy.distutils.fcompiler import FCompiler
from sys import platform
compilers = ['PGroupFCompiler']
class PGroupFCompiler(FCompiler):
compiler_type = 'pg'
description = 'Portland Group Fortran Compiler'
version... |
import argparse
import spack.cmd
import spack.modules
import spack.spec
import spack.store
from spack.util.pattern import Args
__all__ = ['add_common_arguments']
_arguments = {}
def add_common_arguments(parser, list_of_arguments):
"""Extend a parser with extra arguments
Args:
parser: parser to be ... |
"""
Utilities for writing code compatible with different versions of Python.
Mostly stolen from six, but we don't want to make it a dependency.
"""
import sys
PY3 = sys.version_info[0] == 3
if PY3:
text_type = str
binary_type = bytes
integer_types = int,
numeric_types = int, float
from urllib... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.