content stringlengths 4 20k |
|---|
from __future__ import unicode_literals
from .helper import ModelTestCase
import transaction
class TestUserModel(ModelTestCase):
def make_one(self):
from ez2pay.models.user import UserModel
return UserModel(self.session)
def make_group_model(self):
from ez2pay.models.gr... |
# -*- coding: utf-8 -*-
msg = {
'nl': {
'wiktionary-lang-translingual': u'Taalonafhankelijk',
'wiktionary-lang-nl': u'Nederlands',
'wiktionary-lang-en': u'Engels',
'wiktionary-lang-de': u'Duits',
'wiktionary-lang-fr': u'Frans',
... |
from core import models
from lib.reverse_translation import _t
#---PIL
def init():
global Image, ImageOps, imtools
from PIL import Image
from PIL import ImageOps
from lib import imtools
def posterize(image, bits, amount=100):
"""Apply a filter
- amount: 0-1"""
image = imtools.convert_sa... |
import shade
def main():
module = AnsibleModule(
argument_spec = openstack_full_argument_spec(
password = dict(required=True, type='str'),
project = dict(required=True, type='str'),
role = dict(required=True, type='str'),
user = dict(required=True, type='str'... |
"""
Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless requir... |
# coding: utf-8
from typing import Tuple
from .camera import Camera
from .._global import OptionalModule
import numpy as np
import time
try:
import usb.util
import usb.core
Seek_therm_usb_req = {'Write': usb.util.CTRL_OUT |
usb.util.CTRL_TYPE_VENDOR |
... |
from marshmallow_jsonapi import Schema, fields
from marshmallow import validate
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.exc import SQLAlchemyError
db = SQLAlchemy(session_options={"autoflush": True})
class CRUD():
def add(self, resource):
db.session.add(resource)
return db.... |
r"""Class that manages YAML data files for translation
"""
import uuid
from ruamel.yaml import YAML, YAMLError
from ruamel.yaml.comments import CommentedMap
from translate.lang.data import cldr_plural_categories, plural_tags
from translate.misc.multistring import multistring
from translate.storage import base
cla... |
import glob
import os
import subprocess
from geobricks_common.core.filesystem import get_filename
def process_tifs_warp(input_path, output_path):
if not os.path.exists(output_path):
os.makedirs(output_path)
files = glob.glob(input_path + "/*.tif")
for f in files:
filename = get_filename... |
import json
import logging
from relengapi.lib import db
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Text
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import relation
from relengapi.blueprin... |
from vdsm.virt.utils import LibguestfsCommand
_VIRTSYSPREP = LibguestfsCommand("/usr/bin/virt-sysprep")
def sysprep(vm_id, vol_paths):
"""
Run virt-sysprep on the list of volumes
:param vol_paths: list of volume paths
"""
args = ['--hostname', 'localhost', '--selinux-relabel']
for vol_path i... |
#!/usr/bin/python
import os, sys
import logging as log
class WebService(object):
@staticmethod
def loadHandlers(rootDirectory):
sys.path.insert(0, rootDirectory)
handlersDirectory = os.path.sep.join([rootDirectory, 'handlers'])
if not os.path.isdir(handlersDirectory):
log.c... |
# -*- coding: utf-8 -*-
"""ICU (LEGO Island Configuration Utility).
Created 2015 Triangle717
<http://le717.github.io/>
Licensed under The MIT License
<http://opensource.org/licenses/MIT/>
"""
import winreg
import platform
__all__ = ("Registry")
class Registry:
def __init__(self):
self.folPath = ("... |
from django.core.files import File
from django.core.validators import ValidationError
from django.contrib.auth.models import User
from django.http import Http404
from django.utils.translation import ugettext as _
from django.utils import six
from rest_framework import exceptions
from rest_framework import mixins
from ... |
import tensorflow as tf
import time
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = x_train.reshape([x_train.shape[0], -1])
x_train = x_train.astype('float32') / 255
y_train = tf.keras.utils.to_categorical(y_train, num_classes=10)
x_test = x_test.reshape([x_test.shape[0]... |
import logging
LOGGER = logging.getLogger()
def get_service(connection):
return DriveService(connection)
class DriveService():
def __init__(self, connection):
self.connection = connection
def get_drive(self, uuid, variables):
result = self.connection.execute(self.__build_select(uuid, var... |
import unittest.mock
import aiohttp
from .util import Tests, FakeTextResponse, fut_result
from .. import util, request, response, restspec, errors
class RequestBuilderTests(Tests):
async def test_site(self):
async with self.make_site('http://www.example.org/') as site:
self.assertIs(util.rag... |
from unittest import mock
import unittest
from pydoof.management_api import items
from pydoof.management_api.exceptions import TooManyRequestsError
class TestScroll(unittest.TestCase):
@mock.patch('pydoof.management_api.items.sleep')
@mock.patch('pydoof.management_api.items.ManagementAPIClient')
def tes... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
import numpy
from scipy.ndimage.filters import gaussian_filter
# path changes
# own modules
from .utilities import xminus1d
# code
def gauss_xminus1d(img, sigma, dim=2):
r"""
Applies a X-1D gauss to a copy of a XD image, slicing it along dim.
Essentially uses `scipy.ndimage.filters.gaussian_filter`, bu... |
"""Test mining RPCs
- getmininginfo
- getblocktemplate proposal mode
- submitblock"""
import copy
from binascii import b2a_hex
from decimal import Decimal
from test_framework.blocktools import create_coinbase
from test_framework.mininode import CBlock
from test_framework.test_framework import BitcoinTestFramework
fr... |
import sys
import json
import os.path
import requests
import dateutil.parser
def posts_at_url(url):
current_page = 1
max_page = sys.maxint
while current_page <= max_page:
url = os.path.expandvars(url)
resp = requests.get(url, params={'page': current_page, 'count': '-1'})
results ... |
import getpass
import SOAPpy
from config import *
from classes import StoryCard
import re
soap = SOAPpy.WSDL.Proxy(JIRA_URL)
def authorize():
jira_user = raw_input("Username for jira: ")
if jira_user == '':
print 'JIRA login can not be empty string.'
exit()
password = getpass.getpass('Pas... |
from twisted.trial.unittest import TestCase, SkipTest
from twisted.internet import utils, defer
from twisted.python.filepath import FilePath
from twisted.python.procutils import which
from twisted.python import log
class ScriptTest(TestCase):
@defer.inlineCallbacks
def runScript(self, script):
"""
... |
import logging
from math import cos, sin, pi
from typing import List, Iterator
import pytmx
import yaml
from natsort import natsorted
from tuxemon.compat import Rect
from tuxemon import prepare
from tuxemon.event import EventObject, MapAction, MapCondition
from tuxemon.graphics import scaled_image_loader
from tuxemon... |
# -*- coding: utf-8 -*-
"""
sender
~~~~~~
Python SMTP Client for Humans.
:copyright: (c) 2016 by Shipeng Feng.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.3'
import sys
import smtplib
import time
from email import charset
from email.encoders import encode_base64
from email.... |
'''a module that map the abstract.stock module to gtk'''
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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... |
import application
import json
from application.registry import Register
from entry import Entry
app = application.app.test_client()
db = application.db
register = Register('testing', application.app.config['MONGO_URI'])
registry_url = 'http://openregister.org/'
field_url = 'http://testing.openregister.org/'
def ... |
from msrest.exceptions import (
ClientException,
SerializationError,
DeserializationError,
TokenExpiredError,
ClientRequestError,
AuthenticationError,
HttpOperationError,
)
from .api_client import AutoRestSwaggerBATFormDataService, AutoRestSwaggerBATFormDataServiceConfiguration
__all__ = [... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import numpy as np
from scipy.spatial.distance import cdist
import matplotlib.pyplot as plt
from math import sqrt
import matplotlib.animation as animation
from brian import *
''' Spikes model in computational neuroscience with Brian library. '''
# -----------... |
from urlparse import urlparse
from api_tests.nodes.views.test_node_contributors_list import NodeCRUDTestCase
from nose.tools import * # flake8: noqa
from api.base.settings.defaults import API_BASE
from framework.auth.core import Auth
from tests.base import fake
from tests.factories import (
ProjectFactory,
... |
import importlib
import os
from distutils.version import StrictVersion
import pytest
from model_metadata.scripting import as_cwd, cp
def skip_if_grid_type_is_not(bmi, gid, gtype):
if isinstance(gtype, str):
gtype = (gtype,)
if bmi.get_grid_type(gid) not in gtype:
gtypes = ", ".join(gtype)
... |
# Homology modeling by the automodel class
#
# Demonstrates how to refine only a part of the model.
#
# You may want to use the more exhaustive "loop" modeling routines instead.
#
from modeller import *
from modeller.automodel import * # Load the automodel class
log.verbose()
# Override the 'select_atoms' routine ... |
import logging
from builtins import str
import json
import os, re
import glob
from gamedatabase import *
from config import FileType
from util import Logutil
import util
import xbmc, xbmcgui
def saveReadString(prop):
try:
result = str(prop)
except:
result = u''
return ... |
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.db import IntegrityError, models, transaction
from django.db.models.query import QuerySet
from django.template.defaultfilters import slugify as default_slugify
from django.utils.encoding import python_2_unico... |
import unittest
from flatten_array import flatten
# Tests adapted from `problem-specifications//canonical-data.json`
class FlattenArrayTest(unittest.TestCase):
def test_no_nesting(self):
inputs = [0, 1, 2]
expected = [0, 1, 2]
self.assertEqual(flatten(inputs), expected)
def test_fla... |
from scipysim.actors import SisoTestHelper, Channel, Event, LastEvent
from scipysim.actors.math import Abs
import numpy
import unittest
class AbsTests( unittest.TestCase ):
'''Test the absolute actor'''
def setUp( self ):
'''
Unit test setup code
'''
self.q_in = Channel()
... |
import os
from .tester import Tester
from .util import run_cmd, ARROW_ROOT_DEFAULT, log
class RustTester(Tester):
PRODUCER = True
CONSUMER = True
# FLIGHT_SERVER = True
# FLIGHT_CLIENT = True
EXE_PATH = os.path.join(ARROW_ROOT_DEFAULT, 'rust/target/debug')
RUST_INTEGRATION_EXE = os.path.joi... |
from bambou import NURESTFetcher
class NUNSGInfosFetcher(NURESTFetcher):
""" Represents a NUNSGInfos fetcher
Notes:
This fetcher enables to fetch NUNSGInfo objects.
See:
bambou.NURESTFetcher
"""
@classmethod
def managed_class(cls):
""" Return NUNSGInf... |
# Shmup - Part 3
# bullets (space bar)
# by KidsCanCode 2015
# A space shmup in multiple parts
# For educational purposes only
import pygame
import random
# define some colors (R, G, B)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
# game settings
WIDTH = 48... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 6 13:41:57 2017
@author: AmatVictoriaCuramIII
"""
def DefNCAdviceGiver(Aggregate, q):
import numpy as np
import pandas as pd
Aggregate = pd.read_pickle('SP500NCAGGSHARPE0205')
Aggregate = Aggregate.loc[:,~Aggregate.columns.duplicated()]
bas... |
from itertools import combinations
from random import choice, shuffle
from nose.tools import *
from nose.plugins.skip import SkipTest
from mock import Mock
from git_orm.models.query import (
Query, Q, Inversion, Intersection, Union, Slice, Ordered)
def generate_conditions():
operators = Q.OPERATORS.keys()
... |
"""Test tensorpac functions."""
import numpy as np
from scipy import stats
import matplotlib
import matplotlib.pyplot as plt
from tensorpac import Pac, EventRelatedPac, PreferredPhase
from tensorpac.utils import pac_trivec
from tensorpac.signals import pac_signals_wavelet
def normal(x, mu, sigma):
return ( 2. ... |
"""Saves the scheduler state to permanent storage.
"""
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.path
import time
from datetime import datetime
import click
import kazoo.exce... |
import mock
from oslo_config import cfg
from karbor.context import RequestContext
from karbor.services.protection.clients import cinder
from karbor.tests import base
class CinderClientTest(base.TestCase):
def setUp(self):
super(CinderClientTest, self).setUp()
self._public_url = 'http://127.0.0.1... |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = 'fab503df'.decode('hex') #chainparams.cpp pchMessageStart
P2P_PORT = 17333
ADDRESS_VERSION = 80 #PUBKEY_ADDRESS
RPC_PORT = 17335
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.... |
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log as logging
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.orm import exc
from neutron._i18n import _
from neutron._i18n import _LW
from neutron.db import agents_db
from neutron.db import agentschedulers_db ... |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_O_IBK_WSYH_ECACCTMCH').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
... |
import json
import hashlib
from django.http import HttpResponse
from django.conf import settings
def JSONResponse(content):
return HttpResponse(json.dumps(content), content_type="application/json")
def form_error_string(form):
"""
Form error as a single string
Display first error we find - user wil... |
import sublime
import sublime_plugin
import re
from .gotools_util import Buffers
from .gotools_util import GoBuffers
from .gotools_util import Logger
from .gotools_util import ToolRunner
from .gotools_settings import GoToolsSettings
class GotoolsFormatOnSave(sublime_plugin.EventListener):
def on_pre_save(self, view... |
"""Represent a file as a C++ constant string.
Usage:
python xxd.py VAR SOURCE DEST
"""
import sys
def main():
variable_name, input_filename, output_filename = sys.argv[1:]
with open(input_filename) as input_file:
input_text = input_file.read()
hex_values = ['0x{0:02x}'.format(ord(char)) for char... |
import json
import logging
from django.http import (
HttpResponseRedirect, HttpResponse, Http404, HttpResponseBadRequest
)
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from django.urls import reverse
from django.contrib import messages
from d... |
import re
from fabric.api import hide, run
from fabric.operations import get
from fabric.contrib.files import append, exists, sed
def get_daemon(initfile):
""" Parse DAEMON variable in the init file """
re_daemon = re.compile('^DAEMON=(.+)$', re.MULTILINE)
if not exists(initfile):
return None
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# Config
currency_list = (
('EUR', 'Euro', 'Euro'),
('AUD', 'Dólar australiano', 'Australian dollar'),
('BGN', 'Lev da Bulgária', 'Bulgarian Lev'),
('CAD', 'Dólar canadiano', 'Canadian dollar'),
('CHF', 'Franco suíço', 'Swiss franc'),
('CYP', 'L... |
import re
from measures.periodicValues.PeriodicValues import PeriodicValues
from measures.generic.GenericMeasure import GenericMeasure as GenericMeasure
import measures.generic.Units as Units
class TotalTrafficOverhead(GenericMeasure):
def __init__(self, period, simulationTime):
GenericMeasure.__in... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from abc import ABC, abstractmethod
from io import TextIOWrapper
from typing import List
from automergetool.amt_utils import CONFLICT_START, CONFLICT_SEP, CONFLICT_BASE, CONFLICT_END
class ImportsSolver(ABC):
"""
Defines an import conflicts solver class, ie: a ... |
import copy
class Item():
def __init__(self, name=None, code=None, cost=None, sell=None):
self.name = name
self.code = code
self.cost = cost
self.sell = sell
self.sub_items = [] #下層的item
def stats(self, champ):
pass
@staticmethod
def passive_effect(champ):
pass
def remove_stats(self, champ):
... |
from app import *
import unittest
from database import get_first, cursor
class FlaskTestCase(unittest.TestCase):
"""Testing class for the DeadPool Web App"""
# GET Requests - Testing Site Setup
def test_index(self):
tester = app.test_client(self)
response = tester.get('/', content_type='... |
#!/usr/bin/env python
import inkex
class C(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option("-s", "--size", action="store", type="string", dest="page_size", default="a4", help="Page size")
self.OptionParser.add_option("-o", "--orientation", action="store", type... |
"""Placeholder module, that's where the smart things happen."""
from pages.widgets_registry import get_widget
from pages import settings
from pages.models import Content
from pages.widgets import ImageInput, VideoWidget, FileInput
from django import forms
from django.core.mail import send_mail
from django import temp... |
from __future__ import with_statement
import os
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file ... |
"""Hadoopy Sliding Window
"""
__author__ = 'Brandyn A. White <<EMAIL>>'
__license__ = 'GPL V3'
import hadoopy
import numpy as np
class Mapper(object):
def __init__(self):
self._thresh = 0.
r = 1 # Non-max suppression neighbor radius
self._neighbor_multiples = [np.array([y, x])
... |
import unittest
from unittest import (
makeSuite,
TestCase
)
from stdm.data.configuration.stdm_configuration import StdmConfiguration
from stdm.settings.config_serializer import ConfigurationFileSerializer
from stdm.tests.data.utils import (
populate_configuration
)
config_path = 'D:/Temp/Temp... |
import os
# external control
import datetime
import time
import string
import urllib2
import math
import redis
import json
import eto
import py_cf
import base64
import load_files
class Schedule_Monitoring():
def __init__(self, redis ):
self.redis = redis
self.app_files = load_files.APP_FIL... |
#!/usr/bin/python
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# |R|a|s|p|b|e|r|r|y|P|i|-|S|p|y|.|c|o|.|u|k|
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# ultrasonic_2.py
# Measure distance using an ultrasonic module
# in a loop.
#
# -----------------------
# Import required Python libraries
# -------------------... |
r"""Find the full path to commands.
which(command, path=None, verbose=0, exts=None)
Return the full path to the first match of the given command on the
path.
whichall(command, path=None, verbose=0, exts=None)
Return a list of full paths to all matches of the given command on
the path.
whichgen(comman... |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
"""
ExtractMsg:
Extracts emails and attachments saved in Microsoft Outlook's .msg files
https://github.com/mattgwwalker/msg-extractor
"""
__author__ = "Matthew Walker"
__date__ = "2013-11-19"
__version__ = '0.2'
# --- LICENSE ---------------------------------------... |
"""
organise, sort, and filter list of dictionaries or similar objects
"""
import random
import biskit.tools as t
from biskit import EHandler
from biskit.errors import BiskitError
## allow relative imports when calling module by itself for testing (pep-0366)
if __name__ == "__main__" and __package__ is None:
imp... |
import os
import sys
import shutil
import setuptools
from distutils import log
from distutils.command.build_clib import build_clib
VERSION_MAJOR = 1
VERSION_MINOR = 1
VERSION_VBOXBIN = "5-0-18-6667"
VERSION = "{major:d}.{minor:d}".format(
major = VERSION_MAJOR,
minor = VERSION_MINOR,
)
BINDING_DIRECTORY = o... |
# -*- coding: utf-8 -*-
"""Tests of i18n/dummy.py"""
from unittest import TestCase
import ddt
from polib import POEntry
from i18n import dummy
@ddt.ddt
class TestDummy(TestCase):
"""
Tests functionality of i18n/dummy.py
"""
def setUp(self):
self.converter = dummy.Dummy()
def assertUni... |
"""
Seismic: Invert vertical seismic profile (VSP) traveltimes using smoothness
regularization and unknown layer thicknesses
"""
import numpy
from fatiando import utils
from fatiando.seismic.profile import layered_straight_ray, LayeredStraight
from fatiando.inversion.regularization import Smoothness1D
from fatiando.vis... |
#!/usr/bin/env python
import codecs
import os
import re
import operator
import logging
from localization_objects import *
# Regexp to parse and inspect strings in format JTL('Key Name', 'Key Comment')
JTL_REGEX = r"""JTL\(\\?['"](.+?)\\?['"],\s*\\?['"](.+?)\\?['"]\)"""
# Regexp to parse and inspect localization ent... |
"""Add statistic and statisticEntry tables
Revision ID: 4a5c5d68e81e
Revises: None
Create Date: 2016-02-08 07:15:14.998677
"""
# revision identifiers, used by Alembic.
revision = '4a5c5d68e81e'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Al... |
import os, sys
import compiler
from compiler.ast import Discard, Const
from compiler.visitor import ASTVisitor
import numbers
def pyfiles(startPath):
r = []
d = os.path.abspath(startPath)
if os.path.exists(d) and os.path.isdir(d):
for root, dirs, files in os.walk(d):
for f in files:
... |
import os
import functools
import IECore
import Gaffer
import GafferUI
Gaffer.Metadata.registerNode(
Gaffer.Reference,
"description",
"""
References a node network stored in another file. This can be used
to share resources among scripts, build powerful non-linear workflows,
and as the basis for custom asset... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 22 14:27:45 2017
@author: yume
"""
import numpy as np
import copy
from decide_robot_absolute_position import avg_vector
from decide_robot_absolute_position import decide_robot_absolute_position
from geometry import absolute_angle
from utility_visualization import vector_... |
from __future__ import print_function, division
from itertools import chain
from time import time
from networkx import connected_component_subgraphs
from namedlist import namedlist
from order_util import check_nonincreasing_envelope
from plot_ordering import to_pdf
from pqueue import PriorityQueue
from py3compat import... |
"""
WSGI config for ecit project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... |
# coding=utf-8
"""
The ELB collector collects metrics for one or more Amazon AWS ELBs
#### Configuration
Below is an example configuration for the ELBCollector.
You can specify an arbitrary amount of regions
```
enabled = true
interval = 60
# Optional
access_key_id = ...
secret_access_key = ...... |
"""
Django settings for OpenIdGenericProvider project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BAS... |
#!/usr/bin/python
"""
Based on voice_nav.py.
"""
import roslib; roslib.load_manifest('speech_rfpb')
import rospy
from geometry_msgs.msg import Twist
from std_msgs.msg import String
from math import copysign
class voice_cmd:
def __init__(self):
self.verbs = ['go','find','get']
... |
import pytest
import ggps
def expected_first_trackpoint():
return {
"elapsedtime": "00:00:00",
"heartratebpm": "85",
"latitudedegrees": "44.97431952506304",
"longitudedegrees": "-93.26310088858008",
"seq": "1",
"time": "2014-10-05T13:07:53.000Z",
"type": "T... |
"""
Data-driven tests for references.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import hashlib
import os
import unittest
# TODO it may be a bit circular to use pysam as our interface for
# accessing reference information, since this is the method... |
# coding: utf-8
"""Test installation of JupyterLab extensions"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import glob
import json
import os
import sys
from os.path import join as pjoin
from unittest import TestCase
try:
from unittest.mock import patch
ex... |
"""SConst.Tool.xst
Tool-specific img 2 elf
"""
import SCons.Action
import SCons.Builder
import SCons.Util
import SCons.Tool
import os
import sys
import utils
def _vendor_reset_emitter(target, source, env):
target = 'vendor_reset_img'
return target, source
_vendor_reset_builder = SCons.Builder.Builder(
... |
# -*- 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):
# Changing field 'CountyInmate.last_seen_date'
db.alter_column(u'countya... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Description {{{
"""
imposter.admin
~~~~~~~~~~~~~~
Admin interface for the Imposter weblog app
:copyright: (c) 2010-2011 by Jochem Kossen.
:license: BSD, see LICENSE.txt for more details.
"""
# }}}
# Imports {{{
from __future__ import with_statement... |
"""
==================
GMM classification
==================
Demonstration of Gaussian mixture models for classification.
See :ref:`gmm` for more information on the estimator.
Plots predicted labels on both training and held out test data using a
variety of GMM classifiers on the iris dataset.
Compares GMMs with sp... |
import RPi.GPIO as GPIO
import os
import sys
import getopt
# Pins LED
red = 22
green = 23
blue = 24
# GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Establecer modo pins
GPIO.setup(red, GPIO.OUT)
GPIO.setup(green, GPIO.OUT)
GPIO.setup(blue, GPIO.OUT)
# Desactivar color
GPIO.output(red, 0)
GPIO.output(green,... |
#pylint: disable-all
import unittest
from robot_localization.utils.point import Point2D, Point3D
class TestPoint(unittest.TestCase):
def test_Point2D(self):
print("\n[!] Point2D testing..")
p = Point2D(5, 4)
self.assertEqual(p.get_x_axis(), 5)
self.assertEqual(p.get_y_axis(), 4)
... |
from java import awt
from math import *
from jarray import array
class Graph(awt.Canvas):
def __init__(self):
self.function = None
def paint(self, g):
if self.function is None:
return self.error(g)
sz = self.size
xs = range(0, sz.width, 2)
xscale = 4*pi/sz.width
xoffset = -2*pi
yscale = -... |
"""Class implements the functions in data_preprocessor with BigQuery"""
from __future__ import absolute_import
from __future__ import print_function
import sys
import logging
from typing import List, Text
import pandas as pd
from ml_eda.preprocessing.preprocessors.bigquery import bq_client
from ml_eda.preprocessing... |
import random
from collections import deque
import sys
sys.path.append( '..' )
import tensorblock as tb
import numpy as np
##### PLAYER
class player:
### __INIT__
def __init__( self ):
self.num_stored_obsv = 0
### DUMMY FUNCTIONS
def prepare( self ): return None
def network( self ): ret... |
"""Display metadata about a given package."""
from __future__ import print_function
__docformat__ = 'epytext'
# =======
# Imports
# =======
import re
import os
import sys
from getopt import gnu_getopt, GetoptError
import gentoolkit.pprinter as pp
from gentoolkit import errors
from gentoolkit.keyword import Keyword... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tracker', '0011_auto_20150130_0207'),
]
operations = [
migrations.CreateModel(
name='Contact',
field... |
from docutils.nodes import raw
class PyEmbedRstHandler(object):
def __init__(self, pyembed):
self.pyembed = pyembed
def embed(self, arguments, options):
url = arguments[0]
max_width = options.get('max_width')
max_height = options.get('max_height')
embedding = self.py... |
"""
Copyright 2011 Jeff Garzik
AuthServiceProxy has the following improvements over python-jsonrpc's
ServiceProxy class:
- HTTP connections persist for the life of the AuthServiceProxy object
(if server supports HTTP/1.1)
- sends protocol 'version', per JSON-RPC 1.1
- sends proper, incrementing 'id'
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textwrap import dedent
from pants.backend.python.register import build_file_aliases as register_python
from pants.build_graph.address import Address
fr... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from preggy import expect
from holmes.models import KeysCategory
from tests.unit.base import ApiTestCase
from tests.fixtures import KeysCategoryFactory
class TestKeysCategory(ApiTestCase):
def test_can_create_key_category(self):
category = KeysCategoryFactory.... |
from os.path import dirname, abspath, join
from genpov import TemplatePoller
HEAD="""<?xml version="1.0" standalone="no" ?>
<!DOCTYPE cfepov SYSTEM "/usr/share/cgc-docs/cfe-pov.dtd">
<cfepov>
<cbid>service</cbid>
<replay>
<negotiate><type2 /></negotiate>
"""
WRITE_ORIG="""
<!-- Write the original bytes from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.