content string |
|---|
import copy
from backend.common.errors import ConfigurationError
from backend.common.utils import purge_settings, import_module, \
import_by_path, complex_types, deserialize_complex_types, \
serialize_complex_types
from functools import wraps
from motor import MotorReplicaSetClient, MotorClient
from pymongo.com... |
# KVS_test.py 27/05/2016 D.J.Whale
#
# Tester for Key Value Store
import unittest
from lifecycle import *
from KVS import KVS, NotPersistableError
#---- DUMMY TEST CLASSES ------------------------------------------------------
class TV():
def __init__(self, id):
print("Creating TV %s" % id)
sel... |
#!/usr/bin/env python
'''
ooiui.core.routes.m2m
Defines the application routes
'''
from ooiui.core.app import app
from flask import request, render_template, Response, jsonify
from flask import stream_with_context
from ooiui.core.routes.common import get_login
import requests
import urllib2
#M2M Interface
@app.route... |
"""empty message
Revision ID: 1b34cefe5f92
Revises: 10136334dff5
Create Date: 2016-06-18 13:32:26.921934
"""
# revision identifiers, used by Alembic.
revision = '1b34cefe5f92'
down_revision = '10136334dff5'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
def upgrade():
### commands auto... |
"""
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 required by applicable law or agreed to in writing, software
distri... |
from PySide.QtGui import *
from PySide.QtCore import *
class Dialog(QDialog):
""""""
def __init__(self, parent, title, widget):
""""""
QDialog.__init__(self, parent, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
self.setWindowTitle(title)
self.resize(340, 200)
vbox = Q... |
# code modified from https://github.com/zambonin/alice-and-bob
# thank you @zambonin for your contributions to the open source code that is used by ccxt!
"""keccakf1600.py
Keccak is a family of hash functions based on the sponge construction. It was
chosen by NIST to become the SHA-3 standard. This code implements th... |
import logging
import httplib2
import time
from testtools import TestCase
from mock import Mock
from troveclient import client
from troveclient import exceptions
"""
Unit tests for client.py
"""
class ClientTest(TestCase):
def test_log_to_streamhandler(self):
client.log_to_streamhandler()
self.... |
import math
import time
from gadget import GadgetBase, IndicatorStatus, BackgroundStatus
from dothat import lcd
from dothat import backlight
class DotHatGadget(GadgetBase):
NUM_COLS = 16
NUM_ROWS = 3
MIN_LED_BRIGHTNESS = 0
MAX_LED_BRIGHTNESS = 255
NUM_LEDS = 6
ANIM_INTERVAL_SECONDS = 0.01
... |
import tensorflow as tf
import training_input_cole as inp
import opening as op
import tarfile
import numpy as np
import boardchange_km as bc
import itertools
import random
U, D, R, L = 0, 1, 2, 3
def random_move(x, y):
dir = random.randrange(4)
while (y == 18 and dir == U) or (y == 0 and dir == D) or (x == 1... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (<EMAIL>)
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, e... |
# -*- coding: utf-8 -*-
# (C) 2015 Muthiah Annamalai
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
from __future__ import print_function
from opentamiltests import *
class Words(unittest.TestCase):
def test_lexico_compare( self ):
res = [0,1,-1]
self.assertEqual( list(m... |
"""
A python class to manage fetching and caching of images by URL
"""
"""
Copyright 2012-2014 Anthony Beville
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/LICE... |
import time
import numpy as np
import logging
try:
import scipy.sparse as sparse
from scipy.sparse.linalg import spsolve
except:
pass
from .models import Recommender
from .utils import tomatrix
__all__ = ["WMF"]
log = logging.getLogger(__name__)
class WMF(Recommender):
def __init__(self, checkins,... |
"""Document (Model) query functions.
"""
__authors__ = [
'"Sverre Rabbelier" <<EMAIL>>',
]
from soc.cache import sidebar
from soc.cache import home
from soc.logic.models import work
from soc.logic.models import linkable as linkable_logic
import soc.models.document
import soc.models.work
class Logic(work.Logic... |
import os, sys, re
# add python module logger to path
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'logger'))
from logger import Logger
class Register():
""" Register
Represents the names and masks of the registers
and methods for smart comparison.
"""
def __init__(self, name=None, fields=None, ... |
#!/usr/bin/env python
class BaseCodec(object):
"""
Base audio/video codec class.
"""
encoder_options = {}
codec_name = None
ffmpeg_codec_name = None
def parse_options(self, opt):
if 'codec' not in opt or opt['codec'] != self.codec_name:
raise ValueError('invalid codec... |
from unittest import TestCase
from plivo import plivoxml
class GetInputElementTest(TestCase):
def test_set_methods(self):
expected_response = '<Response><GetInput action="https://foo.example.com" digitEndTimeout="50" ' \
'executionTimeout="100" finishOnKey="#" hints="1 2 3" inp... |
"""
거래내역 확인
"""
import base64
import simplejson as json
import hashlib
import hmac
import httplib2
import time
ACCESS_KEY = ''
SECRET_KEY = ''
currency = 'strat-krw'
def get_encoded_payload(payload):
dumped_json = json.dumps(payload)
encoded_json = base64.b64encode(dumped_json)
return encoded_json
def get_sign... |
from __future__ import absolute_import
import warnings
VERSION = (1, 2, 3, "alpha", 0) # following PEP 386
DEV_N = None
def get_version():
version = "%s.%s" % (VERSION[0], VERSION[1])
if VERSION[2]:
version = "%s.%s" % (version, VERSION[2])
if VERSION[3] != "final":
version = "%s%s%s" %... |
import attr
from cfme.modeling.base import BaseCollection, BaseEntity, parent_of_type
from cfme.utils.appliance import DummyAppliance
import pytest
@attr.s
class DummyApplianceWithCollection(DummyAppliance):
def __attrs_post_init__(self):
from cfme.modeling.base import ApplianceCollections
self.c... |
import unittest
from conans.test.utils.tools import TestClient
from conans.util.files import load, save
from conans.client.conf import default_settings_yml
from conans.model.settings import Settings
class UpdateSettingsYmlTest(unittest.TestCase):
""" This test is to validate that after adding a new settings, that... |
from PIL import Image
from hashlib import md5
import re
import requests
import sys
from StringIO import StringIO
from candidates.models import fix_dates, PopItPerson
from candidates.popit import (
PopItApiMixin, popit_unwrap_pagination, get_base_url
)
from django.core.management.base import BaseCommand
from slum... |
import os
import shutil
from tests import TestCase
from mutagen._compat import cBytesIO
from mutagen.mp3 import MP3, error as MP3Error, delete, MPEGInfo, EasyMP3
from mutagen.id3 import ID3
from tempfile import mkstemp
class TMP3(TestCase):
silence = os.path.join('tests', 'data', 'silence-44-s.mp3')
silence_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is a very ugly helper script to keep up to date with file types in
Gary C. Kessler's FTK_sigs_GCK archive.
"""
import os
import xml.etree.ElementTree as ET
import binascii
import json
import puremagic
folder = "FTK_sigs_GCK"
sigs = []
for file in os.listdir... |
# -*- coding: utf-8 -*-
# :coding=utf-8:
# base settings - imported by other settings files, then overridden
import os.path
import posixpath
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
def env_or_default(NAME, default):
return os.environ.get(NAME, de... |
from __future__ import absolute_import, division, print_function, unicode_literals
from ..utils.mixins import LoggingMixin
from abutils.core.sequence import Sequence
class VDJ(LoggingMixin):
"""
Args:
-----
sequence: The query sequence, in any format that ```abutils.core.sequence.Sequence``` c... |
#coding=utf-8
from rest_framework import serializers
from django.contrib.auth.models import User
from biz.account.models import Contract, Quota, Operation
class ContractSerializer(serializers.ModelSerializer):
quotas = serializers.ReadOnlyField(source="get_quotas")
start_date = serializers.DateTimeField(fo... |
# -*- coding: utf-8 -*-
"""
XFormInstanceParser class module - parses an instance XML.
"""
# todo: this has been copied from xform_manager, we need to figure out
# where this code is actually going to live.
import re
from xml.dom import minidom
from pyxform.utils import unicode
XFORM_ID_STRING = "_xform_id_string"
... |
LOCALE_DICT = {
"ach": ("Acholi", "Acholi"),
"af": ("Afrikaans", "Afrikaans"),
"an": ("Aragonese", "aragonés"),
"ar": ("Arabic", "عربي"),
"as": ("Assamese", "অসমীয়া"),
"ast": ("Asturian", "Asturianu"),
"az": ("Azerbaijani", "Azərbaycanca"),
"be": ("Belarusian", "Беларуская"),
"bg": ... |
"""
DNS resolution methods
"""
from __future__ import absolute_import
import collections
import logging
import socket
import dns.exception
import dns.rdatatype
import dns.resolver
_LOGGER = logging.getLogger(__name__)
# Code of _build_ functions below copied from srvlookup.py
# https://github.com/aweber/srvlooku... |
"""
Error and Exceptions in the SciTokens library
"""
class SciTokensException(Exception):
"""
Base class for exceptions in the SciTokens library
"""
pass
class MissingKeyException(SciTokensException):
"""
No private key is present.
The SciToken required the use of a public or private ke... |
from PySide import QtCore, QtGui
from PySide.QtCore import QRect, QPoint
class PaletteWidget(QtGui.QWidget):
# Color changed signal
changed = QtCore.Signal()
@property
def color(self):
return QtGui.QColor.fromHsvF(self._hue, self._saturation, self._value)
@color.setter
def color(sel... |
import modulespecific
import unittest
class TestResource(modulespecific.ModuleSpecificTestCase):
"""Test the Resource interface."""
def setUp(self):
"""Create and connect to a repository."""
self.basic_repo = self.test_module.BasicRepository()
self.repo = self.basic_repo... |
#!/usr/bin/env python
"""
definir qual tipo de tarefa tem mais por evento e no geral
"""
# It will connect to DataStoreClient
from sciwonc.dataflow.DataStoreClient import DataStoreClient
import ConfigDB_Analysis_AverageEvent_0
# connector and config
client = DataStoreClient("postgres", ConfigDB_Analysis_AverageEvent_... |
"""
Tests for misc.py "include" directive.
"""
import os.path
import sys
from __init__ import DocutilsTestSupport
from docutils.parsers.rst import states
def suite():
s = DocutilsTestSupport.ParserTestSuite()
s.generateTests(totest)
return s
mydir = 'test_parsers/test_rst/test_directives/'
include1 = os... |
"""Module containing classes related to GCE disks.
Disks can be created, deleted, attached to VMs, and detached from VMs.
Use 'gcloud compute disk-types list' to determine valid disk types.
"""
import json
from perfkitbenchmarker import disk
from perfkitbenchmarker import flags
from perfkitbenchmarker.providers.gcp ... |
try:
import psana
except:
print 'Using the module "lcls" without psana capabilities.'
psana = None
import numpy as np
_EBeamType = None
_feeType = None
_evt = None
_currentFiducial = None
if psana is not None:
EBeamTypeList = (
psana.Bld.BldDataEBeamV0,
psana.Bld.BldDataEBeamV1... |
class English:
#this class defines the word classes of the english languages
def init(self):
self.name = 'English'
def noun(self):
'''
noun:identifies
Example-
a person (man, girl, engineer, friend)
a thing (horse, wall, flower, country)
an idea, quality, or state (anger, courage, ... |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
import os
import sys
from distutils.core import setup, Distribution
from distutils.command.install_lib import install_lib
from distutils import util
from distutils.file_util import write_file
AppName = 'wok'
AppVersion = '1.1.1'
def normpath (path):
"""Norm a pa... |
"""
Handshake tests using s2nc against Openssl s_server
Openssl 1.1.0 removed SSLv3, 3DES, an RC4, so we won't have coverage there.
"""
import argparse
import os
import sys
import subprocess
import itertools
import multiprocessing
from multiprocessing.pool import ThreadPool
from s2n_test_constants import *
from time i... |
""" Il filtro """
import logging
from lib.htmlfbapi.src import htmlfbapi
from lib.htmlfbapi.src import version as htmlfbapi_version
from lib.htmlfbapi.src.lib.fbwrapper.src.shared import caching_levels
import filter_components
import version
# Configurazione del sistema di logging
logger = logging.getLogger(vers... |
import romaji
import kana
import thumb
from segment import unichar_half_to_full
HalfSymbolTable = {}
for i in range(32, 127):
if not chr(i).isalnum():
HalfSymbolTable[unichar_half_to_full(chr(i))] = chr(i)
HalfNumberTable = {}
for i in range(10):
HalfNumberTable[unichar_half_to_full(str(i))] = str(i)... |
__author__ = 'AeroCano'
import jderobot, time, threading
lockLand = threading.Lock()
lockTakeOff = threading.Lock()
class ExtraI(jderobot.ArDroneExtra):
def __init__(self):
print ("Extra start")
self.landDecision = False
self.takeOffDecision = False
def land(self,xxx):
self... |
import unittest
import boto3
from moto import mock_s3
from airflow.configuration import conf
from airflow.models import DAG, TaskInstance
from airflow.providers.amazon.aws.operators.s3_to_sftp import S3ToSFTPOperator
from airflow.providers.ssh.operators.ssh import SSHOperator
from airflow.utils import timezone
from a... |
# -*- coding: utf-8 -*-
from __future__ import division
from collections import namedtuple
import cadquery as cq
# text_lines is a list of text lines.
# "CadQuery" in braille (converted with braille-converter:
# https://github.com/jpaugh/braille-converter.git).
text_lines = [u'⠠ ⠉ ⠁ ⠙ ⠠ ⠟ ⠥ ⠻ ⠽']
# See http://www.t... |
import os
import shutil
import sys
import tempfile
import unittest
try:
from importlib import reload # Python 3.4+ only.
except ImportError:
# Otherwise, we will stick to Python 2's built-in reload.
pass
import py4j
from pyspark import SparkContext, SQLContext
from pyspark.sql import Row, SparkSession
fr... |
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 TopEvents(Choreography):
def __init__(self, temboo_session):
"""
Create a new... |
from __future__ import print_function
import requests, json, time
if __name__ == "__main__":
from properties import orgid, key, token, devicetype, deviceid
import ibmiotf.api
api = ibmiotf.api.ApiClient({"auth-key": key, "auth-token": token})
# get mappings
result = api.getMappingsOnDeviceType(... |
"""Provides a convenient wrapper for spawning a test lighttpd instance.
Usage:
lighttpd_server PATH_TO_DOC_ROOT
"""
import codecs
import contextlib
import httplib
import os
import random
import shutil
import socket
import subprocess
import sys
import tempfile
import time
from pylib import constants
from pylib impo... |
"""Support for Gogogate2 garage Doors."""
from __future__ import annotations
import logging
from ismartgate.common import (
AbstractDoor,
DoorStatus,
TransitionDoorStatus,
get_configured_doors,
)
from homeassistant.components.cover import (
DEVICE_CLASS_GARAGE,
DEVICE_CLASS_GATE,
SUPPORT_... |
import os
import json
from weakref import WeakValueDictionary
import pygame
class GenericAssetManager(object):
def __init__(self, path):
self.path = path
self.cache = WeakValueDictionary()
def _load_asset(self, *args):
try:
asset = self.load(*args)
except (IOErro... |
#--
# Script to test the JavaScript hash algorithms
# This produces an HTML file, that you load in a browser to run the tests
#--
import hashlib, base64, hmac
all_algs = ['md5', 'sha1', 'ripemd160', 'sha256', 'sha512']
short = {'ripemd160': 'rmd160'}
test_strings = ['hello', 'world', u'fred\u1234'.encode('utf-... |
"""
Organ is a collection of tools for "digesting" tabular data.
"""
VERSION = "0.4.3"
def templategetter(tmpl):
"""
This is a dirty little template function generator that turns single-brace
Mustache-style template strings into functions that interpolate dict keys:
>>> get_name = templategetter("{fi... |
import unittest
import numpy as np
import GPy
class PriorTests(unittest.TestCase):
def test_studentT(self):
xmin, xmax = 1, 2.5*np.pi
b, C, SNR = 1, 0, 0.1
X = np.linspace(xmin, xmax, 500)
y = b*X + C + 1*np.sin(X)
y += 0.05*np.random.randn(len(X))
X, y = X[:, None]... |
from oslo.config import cfg
from nova.compute import api as compute_api
from nova.compute import manager as compute_manager
import nova.context
from nova import db
from nova import exception
from nova.network import api as network_api
from nova.network import manager as network_manager
from nova.network import model a... |
import pyopencl as cl
from operator import attrgetter
from typing import List, Iterator
def get_default_device(use_gpu: bool = True) -> cl.Device:
"""
Retrieves the GPU device with the most global memory if available, otherwise returns the CPU.
:param use_gpu: Determines whether to obtain a GPU or CPU dev... |
"""
This is the default template for our main set of AWS servers.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
import json
from .common import *
from logsettings import get_logger_config
import os
from p... |
"""
Ethernet port for Ethernet link end points.
"""
from .port import Port
class EthernetPort(Port):
"""
Ethernet port.
:param name: port name (string)
:param nio: NIO instance to attach to this port
"""
def __init__(self, name, nio=None):
Port.__init__(self, name, nio)
@sta... |
"""
tests for the can-run command
"""
import pscheduler
import unittest
class CanRunTest(pscheduler.ToolCanRunUnitTest):
name = 'powstream'
def test_invalid(self):
#empty
expected_errors=["Missing test type"]
self.assert_cmd('{}', expected_valid=False, expected_errors=expected_errors)... |
# -*- coding: cp1252 -*-
import sys
import ui
from abstractviews import AbstractFormView
from ui.Ui_publishForm import Ui_PublishForm
from PyQt4 import QtCore, QtGui
import os
models = None
publisher = None
class PublishDoIt:
def doLoad(self):
self.paternFile.setText(self.model.patternFile)
... |
# -*- coding: utf-8 -*-
"""ResNet50 model for Keras.
# Reference:
- [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
Adapted from code contributed by BigMoyan.
"""
from __future__ import print_function
from __future__ import absolute_import
import warnings
from ..layers import Input... |
#!/usr/bin/env python
import os
import sys
import sqlite3
import urllib
import unittest
import StringIO
from gzip import GzipFile
import xml.etree.ElementTree as ET
from parameterized import parameterized
xmlns = {
'_': 'http://linux.duke.edu/metadata/common',
'rpm': 'http://linux.duke.edu/metadata/rpm',
}
... |
import unittest
from unittest.mock import Mock
from os import path
import sys
diretorio_desse_arquivo = path.dirname(__file__)
diretorio_huaula = path.join(diretorio_desse_arquivo, '..')
diretorio_huaula = path.abspath(diretorio_huaula)
sys.path.append(diretorio_huaula)
from cursoaulahu.telefonista import Telefonista... |
from getpass import getpass
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.urlresolvers import reverse
import requests
from requests.auth import HTTPDigestAuth
from corehq.apps.app_manager.models import import_app
class Command(BaseCommand):
arg... |
import os
import random
import subprocess
from collections import defaultdict
# Same as multiprocessing, but thread only.
# We don't need to spawn new processes for this.
import multiprocessing.dummy
from multiprocessing import Manager
from . import hosts
from . import settings
class Plowshare(object):
"""Uplo... |
import scipy as sp
import scipy.stats as st
import scipy.special
import fastlmm.util.mingrid as mingrid
import pdb
import logging
class chi2mixture(object):
'''
mixture here denotes the weight on the non-zero dof compnent
'''
__slots__ = ['scale','dof','mixture','imax','lrt','scalemin','scal... |
import mxnet as mx
import logging
import os
import time
def _get_lr_scheduler(args, kv):
if 'lr_factor' not in args or args.lr_factor >= 1:
return (args.lr, None)
epoch_size = args.num_examples / args.batch_size
if 'dist' in args.kv_store:
epoch_size /= kv.num_workers
begin_epoch = args... |
"""
Unit tests for rotation module
"""
import pytest
import numpy as np
from fa_kit import rotation
from fa_kit import rotation_tf
TEST_DIM = 100
def test_varimax_python():
"""Test varimax rotation python implementation"""
in_comps = np.eye(TEST_DIM)
rot = rotation.VarimaxRotatorPython()
rot_comp... |
########################################################################
# amara/writers/treevisitor.py
"""
This module supports document serialization in XML or HTML syntax.
"""
import sys
from xml.dom import Node
from amara import tree
from amara.namespaces import XML_NAMESPACE, XMLNS_NAMESPACE
#import amara.writer... |
import sys
import time
try:
import pymongo
except ImportError:
pymongo = None # This is handled gracefully in main()
from collectors.lib import utils
from collectors.etc import mongodb3_conf
DB_NAMES = []
CONFIG_CONN = []
MONGOS_CONN = []
REPLICA_CONN = []
USER = ''
PASS = ''
INTERVAL = 15
CONFIG_METRICS ... |
import numpy as np
import bpy
from bpy.props import BoolProperty, EnumProperty, FloatVectorProperty, IntProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import zip_long_repeat, ensure_nesting_level, throttle_and_update_node, updateNode
from sverchok.utils.curve.core import SvC... |
"""Reader for existing document trees."""
from docutils import readers, utils, transforms
class Reader(readers.Reader):
"""
Adapt the Reader API for an existing document tree.
The existing document tree must be passed as the ``source`` parameter to
the `docutils.core.Publisher` initializer, wrapped... |
"""Test Zenodo deposit REST API."""
from __future__ import absolute_import, print_function
import json
from flask import url_for
from invenio_communities.models import Community
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from invenio_search import current_search
from mock import patch
from s... |
from AppKit import NSColor, NSImage, NSAffineTransform, NSCompositeSourceOver, \
NSRectFillUsingOperation
MenuImageBackgroundColor = NSColor.colorWithCalibratedRed_green_blue_alpha_(0.35, 0.35, 0.37, 1.0)
MenuImageGlyphColor = NSColor.whiteColor()
def MenuImageRepresentationFactory(glyph):
font = glyph.font... |
from django.http import HttpResponse
from django.test import RequestFactory, TestCase
from django.test.utils import override_settings
from nose.tools import eq_
from csp.decorators import csp, csp_replace, csp_update, csp_exempt
REQUEST = RequestFactory().get('/')
class DecoratorTests(TestCase):
def test_csp_... |
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
# A tool to help manage Xonotic maps
# <EMAIL>
import argcomplete
import argparse
import logging
import os
from xmm import __version__
from xmm.config import conf
from xmm.server import LocalServer
from xmm.server import ServerCollection
from xmm.exceptions import Hash... |
# coding=utf-8
"""
This file contains a definition for the data categories page
"""
from PiMFD.Applications.MFDPage import MFDPage
from PiMFD.UI.Panels import StackPanel
from PiMFD.UI.Widgets.MenuItem import TextMenuItem
__author__ = 'Matt Eland'
class DataPage(MFDPage):
def __init__(self, controller, applicati... |
"""
====================================
Linear algebra (:mod:`scipy.linalg`)
====================================
.. currentmodule:: scipy.linalg
Linear algebra functions.
.. seealso::
`numpy.linalg` for more linear algebra functions. Note that
although `scipy.linalg` imports most of them, identically named... |
#!/usr/bin/env python
#encoding: utf8
import sys, rospy, math
from pimouse_ros.msg import MotorFreqs
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
from pimouse_ros.srv import TimedMotion
class Motor():
def __init__(self):
if not self.set_power(False): sys.exit(1)
... |
from zerver.lib.test_classes import WebhookTestCase
class GoogleCodeInTests(WebhookTestCase):
STREAM_NAME = "gci"
URL_TEMPLATE = "/api/v1/external/gci?&api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = "gci"
def test_abandon_event_message(self) -> None:
expected_topic = "student-yqqtag"
... |
from django.contrib import admin
from django_mailer import models
class Message(admin.ModelAdmin):
list_display = ('to_address', 'subject', 'date_created')
list_filter = ('date_created',)
search_fields = ('to_address', 'subject', 'from_address', 'message',)
date_hierarchy = 'date_created'
ordering... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('basic_newsletter', '0006_auto_20150417_1712'),
]
operations = [
migrations.AlterField(
model_name='newsletter',
... |
import six
import unittest
from tempfile import NamedTemporaryFile
from django.conf import settings
from django.core.management import call_command
from testfixtures import LogCapture
from course_modes.models import CourseMode
from course_modes.tests.factories import CourseModeFactory
from student.models import Cours... |
from tempest_lib.common.utils import data_utils
from tempest.api.identity import base
from tempest import test
class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
@test.idempotent_id('b537d090-afb9-4519-b95d-270b0708e87e')
def test_user_update(self):
# Test case to check if updating of user attribu... |
from webkitpy.layout_tests.models import test_expectations
from webkitpy.common.net import layouttestresults
TestExpectations = test_expectations.TestExpectations
TestExpectationParser = test_expectations.TestExpectationParser
class BuildBotPrinter(object):
# This output is parsed by buildbots and must only be... |
"""Package contenant la commande 'voile'."""
from primaires.interpreteur.commande.commande import Commande
from .border import PrmBorder
from .choquer import PrmChoquer
from .empanner import PrmEmpanner
from .hisser import PrmHisser
from .plier import PrmPlier
class CmdVoile(Commande):
"""Commande 'voile'"""... |
#!/usr/local/bin/python
import glob,random,os
import optparse
usage= '%prog [options] '
parser= optparse.OptionParser(usage=usage)
parser.add_option("-n",dest="nlearn",type="int",default=1,
help="number of samples as a learning set.")
parser.add_option("--dir-learn",dest="dir_learn",type="string",
... |
refconstants = {
"G": 6.674 * (10 ** -11)
}
# Planet variables
mer = {
"mass": 3.285 * (10 ** 23),
"radius": 2440,
}
ven = {
"mass": 4.867 * (10 ** 24),
"radius": 6052,
}
ear = {
"mass": 5.972 * (10 ** 24),
"radius": 6371,
"syncorbit": 35786,
}
mar = {
"mass": 6.39 * (10 ** 23),
"radius": 3390,
}
jup = {... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
('sitedata', '__first__'),
]
operations = [
migrations.CreateModel(
name='Article',
... |
#!/usr/bin/env python
'''
Copyright 2011--2014 Eviatar Bach
This file is part of reqscan.
reqscan 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 ve... |
# -*- coding: utf-8 -*-
"""
Management of vocabularies, terms, and their mapping to URI-s. The main class of this module (L{TermOrCurie}) is,
conceptually, part of the overall state of processing at a node (L{state.ExecutionContext}) but putting it into a separate
module makes it easider to maintain.
@summary: Managem... |
""" Support level6 operator test cases.
"""
import numpy as np
import tvm
from tvm import te
from tvm import relay
import tvm.testing
# TODO(mbrookhart): Enable when VM supports heterogenus execution
# @tvm.testing.uses_gpu
def test_dynamic_topk():
def verify_topk(k, axis, ret_type, is_ascend, dtype):
shap... |
import urllib
from datetime import timedelta
from xml.etree import ElementTree as ET
from django.http import HttpResponse, Http404
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
from django.utils.translation import get_lang... |
import os
import time
import datetime
import posixpath # Must use posixpath
from urllib import urlencode
import sickbeard
from sickbeard import logger
from sickbeard import tvcache
from sickrage.helper.encoding import ek, ss
from sickbeard.bs4_parser import BS4Parser
from sickrage.helper.common import try_int, conver... |
# -*- coding: utf-8 -*-
"""1_full.py
Example code for requesting data via the U.S. Government Printing Office
(GPO) API.
Portions of this code were adapted from code by the Sunlight Foundation
Congressional Words package.
Created on Sun Feb 14 10:30:23 2016
Dates take the form:
Year-Month-Date
2005-02-14
-s or --st... |
"""
Uses Capture.Writers.VideoWriter to write extracted data streams into one .avi file
"""
# Utility modules
import sys
from ..utils import *
from ..utils.SQL import *
import Player
import ProgressBar
from ..Capture import Writers
class ConvertKinect(Writers.VideoWriter, Player.KinectDataPlayer):
def __in... |
import os
def newGenerator(modname, width, height, kwargs):
g = globals()
# if hasattr(g, modname):
# mod = getattr(g, modname)
# modpath = mod.__file__
# print mod, 'existed, reload', modpath
# if modpath.endswith('.py'):
# try:
# os.remove(modpath + 'c')
# except Exception, e:
# pass
# try... |
# -*- coding: utf-8 -*-
"""
eve-demo settings
~~~~~~~~~~~~~~~~~
Settings file for our little demo.
PLEASE NOTE: We don't need to create the two collections in MongoDB.
Actually, we don't even need to create the database: GET requests on an
empty/non-existant DB will be served correctly ('200'... |
# -*- encoding: utf-8 -*-
import xadmin
from xadmin import views
from xadmin.plugins.auth import UserAdmin
from django.contrib.auth.models import User
from .models import EmailVerifyCode, Banner, UserProfile
_author_ = 'shishengjia'
_date_ = '04/01/2017 20:21'
class BaseSetting(object):
enable_themes = True
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.