code stringlengths 1 199k |
|---|
from openpyxl.reader.strings import read_string_table
from openpyxl.tests.helper import compare_xml
def test_read_string_table(datadir):
datadir.join('reader').chdir()
src = 'sharedStrings.xml'
with open(src) as content:
assert read_string_table(content.read()) == [
'This is cell A1 in S... |
import platform
if platform.system().startswith('Win'):
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
elif platform.system().startswith('Linux'):
from wave import open as waveOpen
from ossaudiodev import open as ossOpen
try:
from ossaudiodev import AFMT_S16_NE
except ImportError:
... |
import os
import sys
if os.name == "nt" or sys.platform == "darwin":
from quodlibet.plugins import PluginNotSupportedError
raise PluginNotSupportedError
import dbus
from quodlibet import _
from quodlibet import app
from quodlibet.qltk import Icons
from quodlibet.plugins.events import EventPlugin
def get_topleve... |
import sys, testutils, random
import unittest
from Strangle import libbind
class ns_msgTestCase(unittest.TestCase):
"""Tests for the wrapper around the libbind ns_msg struct"""
def test000Exists(self):
"""Check that the ns_msg type object exists cleanly in the module"""
assert(libbind.ns_msg.__class__ is type... |
'''
given a list of stock price ticks for the day, can you tell me what
trades I should make to maximize my gain within the constraints of the
market? Remember - buy low, sell high, and you can't sell before you
buy.
Sample Input
19.35 19.30 18.88 18.93 18.95 19.03 19.00 18.97 18.97 18.98
'''
import argparse
def parse_... |
import sys
import time
import logging
import jobmanager.io.agents as agents
import jobmanager.io.jobs as jobs
from jobmanager.config import Config
from peewee import fn
from liveq.models import Agent, AgentGroup, Jobs
logger = logging.getLogger("teamqueue")
def processTeamQueue():
"""
This should be called periodical... |
import random
import time
from flask import (
request,
session,
flash,
redirect,
url_for,
Response,
render_template,
)
from NossiPack.Cards import Cards
from NossiPack.User import Userlist
from NossiPack.VampireCharacter import VampireCharacter
from NossiPack.krypta import DescriptiveError
f... |
"""Contains the AutoCompletor class."""
import gobject
import re
try:
from collections import defaultdict
except ImportError:
class defaultdict(dict):
def __init__(self, default_factory=lambda: None):
self.__factory = default_factory
def __getitem__(self, key):
if key in ... |
''' This module contains the TemplateVM implementation '''
import qubes
import qubes.config
import qubes.vm.qubesvm
import qubes.vm.mix.net
from qubes.config import defaults
from qubes.vm.qubesvm import QubesVM
class TemplateVM(QubesVM):
'''Template for AppVM'''
dir_path_prefix = qubes.config.system_path['qubes... |
import sys
def hook(mod):
if sys.version[0] > '1':
for i in range(len(mod.imports)-1, -1, -1):
if mod.imports[i][0] == 'strop':
del mod.imports[i]
return mod |
import sys
import os
sys.path.append(os.path.realpath("."))
import unittest
import cleanstream
import tagger
import pretransfer
import transfer
import interchunk
import postchunk
import adaptdocx
if __name__ == "__main__":
os.chdir(os.path.dirname(__file__))
failures = 0
for module in [tagger,
... |
import logging
import random
from . import ipc_test_pb2
from . import ipc_test
logger = logging.getLogger(__name__)
class IPCPerfTest(ipc_test.IPCPerfTestBase):
async def test_small_messages(self):
request = ipc_test_pb2.TestRequest()
request.t.add(numerator=random.randint(0, 4), denominator=random.... |
import glob
import fnmatch
import itertools
import logging
import os
import re
import six
import sys
import yaml
from .dockerfile import Dockerfile
from .image import ImageBuilder
from .config import Config
class Builder(object) :
def __init__(self, config=None, **kwds) :
self.logger = logging.getLogger(typ... |
import inspect
from func import logger
from func.config import read_config, BaseConfig
from func.commonconfig import FuncdConfig
from func.minion.func_arg import * #the arg getter stuff
class FuncModule(object):
# the version is meant to
version = "0.0.0"
api_version = "0.0.0"
description = "No Descript... |
import math as mth
import numpy as np
HEV=4.13620e-15
VERY_BIG=1e50
H=6.6262e-27
HC=1.98587e-16
HEV=4.13620e-15 # Planck's constant in eV
HRYD=3.04005e-16 # NSH 1204 Planck's constant in Rydberg
C =2.997925e10
G=6.670e-8
BOLTZMANN =1.38062e-16
WIEN= 5.879e10 # NSH 1208 Wien Disp Const in frequency units
H_OV... |
def format_path( str ):
while( str.find( '//' ) != -1 ):
str = str.replace( '//', '/' )
return str |
"""Provides the Item example classes.
"""
class Item(object):
def __init__(self, artist, title, year=None):
self.__artist = artist
self.__title = title
self.__year = year
def artist(self):
return self.__artist
def setArtist(self, artist):
self.__artist = artist
de... |
"""
@author: Will
"""
from django import forms
from app01 import models
class ImportFrom(forms.Form):
HOST_TYPE=((1,"001"),(2,"002")) #替換爲文件
host_type = forms.IntegerField(
widget=forms.Select(choices=HOST_TYPE)
)
hostname = forms.CharField()
def __init__(self,*args,... |
from __future__ import absolute_import, print_function
import copy
import os
import re
from bindings import pathmatcher
from . import error, pathutil, pycompat, util
from .i18n import _
from .pycompat import decodeutf8
allpatternkinds = (
"re",
"glob",
"path",
"relglob",
"relpath",
"relre",
... |
import numpy as np
from OpenGL.GL import *
from OpenGL.GLU import *
import time
import freenect
import calibkinect
import pykinectwindow as wxwindow
try:
TEXTURE_TARGET = GL_TEXTURE_RECTANGLE
except:
TEXTURE_TARGET = GL_TEXTURE_RECTANGLE_ARB
if not 'win' in globals():
win = wxwindow.Window(size=(640, 480))
def re... |
import re
p = re.compile(r'(\w+) (\w+)(?P<sign>.*)', re.DOTALL)
print re.DOTALL
print "p.pattern:", p.pattern
print "p.flags:", p.flags
print "p.groups:", p.groups
print "p.groupindex:", p.groupindex |
from models import Connection
from django import forms
class ConnectionForm(forms.ModelForm):
class Meta:
model = Connection
exclude = ('d_object_id',) |
'''
Objects and tools for processing MIDI data. Converts from MIDI files to
:class:`~MidiEvent`, :class:`~MidiTrack`, and
:class:`~MidiFile` objects, and vice-versa.
This module uses routines from Will Ware's public domain midi.py library from 2001
see http://groups.google.com/group/alt.sources/msg/0c5fc523e050c35e
''... |
import testtools
import openstack.cloud
from openstack.cloud import meta
from openstack.tests import fakes
from openstack.tests.unit import base
class TestVolume(base.TestCase):
def test_attach_volume(self):
server = dict(id='server001')
vol = {'id': 'volume001', 'status': 'available',
... |
from django.http import HttpResponse
from django.template import RequestContext, loader
from django.views.decorators.csrf import csrf_exempt
import django.shortcuts
from wlokalu.api import presence
from wlokalu.logging import getLogger, message as log
logger = getLogger(__name__)
@csrf_exempt
def list(request, nick = N... |
from urllib.request import urlopen
from urllib.parse import urlparse, parse_qs
from socket import error as SocketError
import errno
from bs4 import BeautifulSoup
MAX_PAGES_TO_SEARCH = 3
def parse_news(item):
'''Parse news item
return is a tuple(id, title, url)
'''
url = 'http://www.spa.gov.sa' + item['h... |
import time
from threading import Thread
import threading
from wtfj_ids import *
from wtfj_utils import *
class Printer:
''' Opens a new output window and prints messages sent to it '''
def __init__(self,header=''):
self._header = header
def send(self,string):
print(self._header+string)
class Console:
''' Allow... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('snapventure', '0004_auto_20161102_20... |
import os
import re
import subprocess
"""Fetch the .po files from KDE's SVN for GCompris
Run me from GCompris's top-level directory.
"""
SVN_PATH = "svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/"
SOURCE_PO_PATH = "/messages/kdereview/gcompris_qt.po"
OUTPUT_PO_PATH = "./po/"
OUTPUT_PO_PATTERN = "gcompris_%s.po"
fixer =... |
from xml.sax.saxutils import escape
import re
def ConvertDiagnosticLineToSonqarqube(item):
try:
id, line, message, source_file = GetDiagnosticFieldsFromDiagnosticLine(item)
WriteDiagnosticFieldsToFile(id, line, message, source_file)
except:
print 'Cant parse line {}'.format(item)
def Get... |
import os
import tempfile
import pipes
import subprocess
import time
import random
import shutil
try:
from wand.image import Image
from wand.display import display
except ImportError as e:
# cd /usr/lib/
# ln -s libMagickWand-6.Q16.so libMagickWand.so
print("Couldn't import Wand package.")
print("Please ref... |
import time
from datetime import datetime
from pydoc import locate
from unittest import SkipTest
from countries_plus.models import Country
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.test import override_settings, tag
from... |
from ert.cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB, EnkfFs, NodeId
from ert.enkf.data import EnkfConfigNode, GenKw, GenData, CustomKW
from ert.enkf.enums import ErtImplType
class EnkfNode(BaseCClass):
def __init__(self, config_node, private=False):
assert isinstance(config_node, EnkfCo... |
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_A_SUBJECT_D002015').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
sc.setLogLevel('WA... |
from runtests.mpi import MPITest
from nbodykit.lab import *
from nbodykit import setup_logging
from numpy.testing import assert_allclose
import tempfile
import os
@MPITest([1])
def test_hdf(comm):
import h5py
# fake structured array
dset = numpy.empty(1024, dtype=[('Position', ('f8', 3)), ('Mass', 'f8')])
... |
"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic import op
import sqlalchemy as sa
UNITIES = dict(NONE="",
HOUR=u"heure(s)",
DAY=u"jour(s)",
... |
from math import ceil
import numpy as np
from ipywidgets import widgets
from tqdm.notebook import tqdm
from matplotlib import pyplot as plt
import lib.iq_mixer_calibration
from drivers import IQAWG
from lib.data_management import load_IQMX_calibration_database, \
save_IQMX_calibration
from lib.iq_mixer_calibration ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: subscription_manifest
version_added: 1.0.0
short_description: Manage Subscription Manifests
description:
- Upload, refresh and delete Subscription Manifests
author: "Andrew Kofink (@akofink)"
options:... |
from typing import NamedTuple, List
from opv_import.model import ImageSet
CameraSetPartition = NamedTuple(
'CameraSetPartition',
[
('ref_set', ImageSet),
('images_sets', List[ImageSet]),
('start_indexes', List[int]),
('fetcher_next_indexes', List[int]),
('break_reason', s... |
"""
add word counts to Cornetto lexical units database file
The word count file should have three columns, delimited by white space,
containing (1) the count, (2) the lemma, (3) the main POS tag.
The tagset is assumed to be the Spoken Dutch Corpus tagset,
and the character encoding must be ISO-8859-1.
The counts appear... |
import asyncio
from unittest import mock
import pytest
from shanghai import event
from shanghai.logging import Logger, get_logger, LogLevels
debug_logger = get_logger('logging', 'debug')
debug_logger.setLevel(LogLevels.DDEBUG)
@pytest.fixture
def loop():
return asyncio.get_event_loop()
@pytest.fixture
def evt():
... |
from heapq import heapify, heappop, heappush
with open('NUOC.INP') as f:
m, n = map(int, f.readline().split())
height = [[int(i) for i in line.split()] for line in f]
queue = ([(h, 0, i) for i, h in enumerate(height[0])]
+ [(h, m - 1, i) for i, h in enumerate(height[-1])]
+ [(height[i][0], i, ... |
""" Loads hyperspy as a regular python library, creates a spectrum with random numbers and plots it to a file"""
import hyperspy.api as hs
import numpy as np
import matplotlib.pyplot as plt
s = hs.signals.Spectrum(np.random.rand(1024))
s.plot()
plt.savefig("testSpectrum.png") |
import inspect
import re
import pytest
from robottelo.logging import collection_logger as logger
IMPORTANCE_LEVELS = []
def pytest_addoption(parser):
"""Add CLI options related to Testimony token based mark collection"""
parser.addoption(
'--importance',
help='Comma separated list of importance ... |
from feeluown.utils.dispatch import Signal
from feeluown.gui.widgets.my_music import MyMusicModel
class MyMusicItem(object):
def __init__(self, text):
self.text = text
self.clicked = Signal()
class MyMusicUiManager:
"""
.. note::
目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。
... |
"""
A simple client to connect to the Cornetto database server.
Reads queries from standard input and writes results to standard output.
"""
__author__ = 'Erwin Marsi <e.marsi@gmail.com>'
__version__ = '0.6.1'
from sys import stdin, stdout, stderr, exit
from optparse import OptionParser, IndentedHelpFormatter
import xm... |
"""Fetch avhrr calibration coefficients."""
import datetime as dt
import os.path
import sys
import h5py
import urllib2
BASE_URL = "http://www.star.nesdis.noaa.gov/smcd/spb/fwu/homepage/" + \
"AVHRR/Op_Cal_AVHRR/"
URLS = {
"Metop-B":
{"ch1": BASE_URL + "Metop1_AVHRR_Libya_ch1.txt",
"ch2": BASE_UR... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: git
author:
- "Ansible Core Team"
- "Michael DeHaan"
version_added: "0.0.1"
short_description: Deploy software (or files) from git checkouts
description:
- Manage I(git) checkouts of reposit... |
import sys, os
os.environ['SPHINX_BUILD'] = '1'
sys.path.insert(0, os.path.abspath('../'))
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'Stetl'
copyright = u'2013+, Just van den Broecke'
version = ... |
def plotHistory(plot_context, axes):
"""
@type axes: matplotlib.axes.Axes
@type plot_config: PlotConfig
"""
plot_config = plot_context.plotConfig()
if (
not plot_config.isHistoryEnabled()
or plot_context.history_data is None
or plot_context.history_data.empty
):
... |
"""
Desc: django util.
Note:
---------------------------------------
"""
from hashlib import md5
def gen_md5(content_str):
m = md5()
m.update(content_str)
return m.hexdigest() |
import lazylibrarian
from lazylibrarian import logger, common, formatter
try:
from urlparse import parse_qsl #@UnusedImport
except:
from cgi import parse_qsl #@Reimport
import lib.oauth2 as oauth
import lib.pythontwitter as twitter
class TwitterNotifier:
consumer_key = "208JPTMMnZjtKWA4obcH8g"
consumer_... |
import numpy as np
import laspy as las
def point_in_poly(x,y,poly):
n = len(poly)
inside = False
p1x,p1y = poly[0]
for i in range(n+1):
p2x,p2y = poly[i % n]
if y > min(p1y,p2y):
if y <= max(p1y,p2y):
if x <= max(p1x,p2x):
if p1y != p2y:
... |
from flask import json
from unittest.mock import patch, Mock
from urbansearch.gathering.indices_selector import IndicesSelector
from urbansearch.server.main import Server
from urbansearch.server import classify_documents
from urbansearch.server.classify_documents import _join_workers
from urbansearch.workers import Wor... |
from findbilibili import *
def checkinfo2(content):
content[1] = content[1].decode('gbk')
key = content[1].encode('utf-8')
if key == '节操':
return '这种东西早就没有了'
result = animation(key) #搜动漫
return result
def animation(name):
url = bilibili(name)
try:
result = 'bilibili最后更新:第'... |
__author__ = """Co-Pierre Georg (co-pierre.georg@uct.ac.za)"""
import sys
from src.paralleltools import Parallel
if __name__ == '__main__':
"""
VARIABLES
"""
args = sys.argv
config_file_name = args[1]
"""
CODE
"""
parallel = Parallel()
parallel.create_config_files(config_file_nam... |
"""
mistune
~~~~~~~
The fastest markdown parser in pure Python with renderer feature.
:copyright: (c) 2014 - 2016 by Hsiaoming Yang.
"""
import re
import inspect
__version__ = '0.7.3'
__author__ = 'Hsiaoming Yang <me@lepture.com>'
__all__ = [
'BlockGrammar', 'BlockLexer',
'InlineGrammar', 'Inlin... |
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def display(s... |
"""import portalocker
with portalocker.Lock('text.txt', timeout=5) as fh:
fh.write("Sono in testLoxk2.py")
"""
from lockfile import LockFile
lock = LockFile('text.txt')
with lock:
print lock.path, 'is locked.'
with open('text.txt', "a") as file:
file.write("Sono in testLock2.py") |
__all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle',
'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort',
'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud',
'max', 'blackman', 'corrcoef', 'bartlett', 'eye', 'squeeze', 'sinc',
... |
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):
# Adding model 'ArticleComment'
db.create_table('cms_articlecomment', (
('id', self.gf('... |
import logging
import Queue
import random
import time
from spectrumwars.testbed import TestbedBase, RadioBase, RadioTimeout, RadioError, TestbedError, RadioPacket
log = logging.getLogger(__name__)
class Radio(RadioBase):
RECEIVE_TIMEOUT = 2.
def __init__(self, addr, dispatcher, send_delay):
super(Radio, self).__ini... |
"""add graphql ACL to users
Revision ID: 2d4882d39dbb
Revises: c4d0e9ec46a9
"""
from alembic import op
import sqlalchemy as sa
revision = '2d4882d39dbb'
down_revision = 'dc2848563b53'
POLICY_NAME = 'wazo_default_user_policy'
ACL_TEMPLATES = ['dird.graphql.me']
policy_table = sa.sql.table(
'auth_policy', sa.Column('... |
try:
from setuptools import setup
from setuptools import find_packages
except ImportError:
from distutils.core import setup
from pkgutil import walk_packages
import mn
# many pypy installs don't have setuptools (?)
def _find_packages(path='.', prefix=''):
yield prefix
prefix ... |
"""Software structure for generating Monte-Carlo collections of results.
NOTE: Highest resolution regions are implicitly assumed to be
FIPS-coded counties, but the logic does not require them to be. FIPS
language should be replaced with generic ID references.
A key structure is the make_generator(fips, times, values) ... |
from abc import ABC
import configargparse
from sklearn.externals import joblib
from termcolor import colored
class ScikitBase(ABC):
"""
Base class for AI strategies
"""
arg_parser = configargparse.get_argument_parser()
arg_parser.add('-p', '--pipeline', help='trained model/pipeline (*.pkl file)', re... |
import commandRunner as cr
import subprocess
import glob, os, platform, shutil, adb
from pathlib import Path
def combine_browsers_logs(udid):
cmd = 'rebot -N Combined --outputdir browserlogs/ '
for idx, device in enumerate(udid):
#Get all the output.xml files for the devices
if platform.system()... |
'''
hello
Usage:
hello (--help | --version)
Options:
--help -h display this help message and exit
--version print version information and exit
'''
import sys
import docopt
import hello
def main(argv=sys.argv[1:]):
try:
docopt.docopt(__doc__, argv=argv, version=hello.__version__)
ex... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # noqa
from future.utils import iterkeys
import vim
import os
import json
import re
from collections import defaultdict
from ycmd.utils import ( By... |
import os
import logging
import tempfile
import shutil
from graftm.sequence_search_results import SequenceSearchResult
from graftm.graftm_output_paths import GraftMFiles
from graftm.search_table import SearchTableWriter
from graftm.sequence_searcher import SequenceSearcher
from graftm.hmmsearcher import NoInputSequence... |
def trappedWater(a, size) :
# left[i] stores height of tallest bar to the to left of it including itself
left = [0] * size
# Right [i] stores height of tallest bar to the to right of it including itself
right = [0] * size
# Initialize result
waterVolume = 0
# filling left (list/array)
... |
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how to use this script. This docstring
will be printed by the script if there is an error or
if the user requests help (-h or --help).
EXAMPLES
TODO: Show some examples of how to use this script.
EXIT ... |
from exceptions import DropPage, AbortProcess |
import re
from django.utils.safestring import mark_safe
from django.contrib.admin.widgets import AdminFileWidget
from django.template.defaultfilters import slugify
from django.utils.encoding import smart_text
from unidecode import unidecode
from django.forms.widgets import FILE_INPUT_CONTRADICTION, CheckboxInput, Clear... |
import json
from collections import (
Counter,
defaultdict as deft
)
from copy import deepcopy as cp
from StringIO import StringIO
from TfIdfMatrix import TfIdfMatrix
from Tools import from_csv
class CategoryTree:
def __init__(self, categories_by_concept, terms,
categories, tfidf, max_depth... |
"""
File: foursquares.py
Draws squares in the corners of a turtle window.
One square is black, another is gray, and the
remaining two are in random colors.
"""
from turtlegraphics import Turtle
import random
def drawSquare(turtle, x, y, length):
turtle.up()
turtle.move(x, y)
turtle.setDirection(270)
tur... |
old_bl_idnames = {
'CentersPolsNode' : "centers",
'CircleNode' : "circle",
'ListItemNode' : "list_item",
'GenRangeNode' : "range",
'GenSeriesNode' : "series",
'SvReRouteNode': "reroute",
'VoronoiNode': "voronoi",
'ViewerNode': "viewer",
'EvalKnievalNode': "eval_knieval",
'Formul... |
"""
rita Pipeline
.. module:: rita
:synopsis: rita pipeline
.. moduleauthor:: Adolfo De Unánue <nanounanue@gmail.com>
"""
import os
import subprocess
from pathlib import Path
import boto3
import zipfile
import io
import csv
import datetime
import luigi
import luigi.s3
import pandas as pd
import sqlalchemy
from conte... |
"""
See |compute.subsystem|, |compute.network|, |compute.distance|, and
|compute.parallel| for documentation.
Attributes:
all_complexes: Alias for :func:`pyphi.compute.network.all_complexes`.
ces: Alias for :func:`pyphi.compute.subsystem.ces`.
ces_distance: Alias for :func:`pyphi.compute.distance.ces_distan... |
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent, fireEventAsync
from couchpotato.core.helpers.encoding import ss
from couchpotato.core.helpers.request import jsonified
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotat... |
from .tracker import *
from .merger import * |
"""Test class for Custom Sync UI
:Requirement: Sync
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: Repositories
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_string
from nailgun import entities
from robottelo import manifests
from robottelo.api.utils import... |
from keyring import get_password
from boto.iam.connection import IAMConnection
import lib.LoadBotoConfig as BotoConfig
from sys import exit
envs = ['dev', 'qa', 'staging', 'demo', 'prod']
for env in envs:
id = BotoConfig.config.get(env, 'aws_access_key_id')
key = get_password(BotoConfig.config.get(env, 'keyring'), ... |
"""
Created on Wed Sep 20 13:37:16 2017
Author: Peiyong Jiang : jiangpeiyong@impcas.ac.cn
Function:
旋转使得变换。
"""
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
plt.close('all')
emitX=12
alphaX=-10.
betaX=13.
gammaX=(1.+alphaX**2)/betaX
sigmaX=np.array([[betaX,-alphaX],[-alphaX,gammaX]])*e... |
import threading
import asyncio
async def hello():
print('Hello world! (%s)' % threading.currentThread())
await asyncio.sleep(1)
print('Hello again! (%s)' % threading.currentThread())
loop = asyncio.get_event_loop()
tasks = [hello(), hello()]
loop.run_until_complete(asyncio.wait(tasks))
loop.close() |
"""
Tests are performed against csr1000v-universalk9.03.15.00.S.155-2.S-std.
"""
import unittest
from iosxe.iosxe import IOSXE
from iosxe.exceptions import AuthError
node = '172.16.92.134'
username = 'cisco'
password = 'cisco'
port = 55443
class TestIOSXE(unittest.TestCase):
def setUp(self):
self.xe = IOSXE... |
from __future__ import absolute_import
from pywb.framework.wbrequestresponse import WbResponse, WbRequest
from pywb.framework.archivalrouter import ArchivalRouter
from six.moves.urllib.parse import urlsplit
import base64
import socket
import ssl
from io import BytesIO
from pywb.rewrite.url_rewriter import SchemeOnlyUrl... |
import os
from pygal import *
def listeEuler(f, x0, y0, pas, n):
x, y, L = x0, y0, []
for k in range(n):
L += [(x, y)]
x += pas
y += pas * f(x, y)
return L
def euler(f, x0, y0, xf, n):
pas = (xf - x0) / n
courbe = XY()
courbe.title = "Methode d Euler"
courbe.add("Solu... |
import os
import argparse
import pprint
import proteindf_bridge as bridge
import logging
import logging.config
def get_rest_of_frame_molecule(frame_molecule, selected_molecule):
# calc the rest
selector = bridge.Select_AtomGroup(selected_molecule)
selected = frame_molecule.select(selector)
rest_molecule... |
import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.output(LedPin, GPIO.HIGH) # Set LedPin high(+3.3... |
year = 2000
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
else:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year)) |
from allensdk.api.api import Api
import os, json
from collections import OrderedDict
class BiophysicalPerisomaticApi(Api):
_NWB_file_type = 'NWB'
_SWC_file_type = '3DNeuronReconstruction'
_MOD_file_type = 'BiophysicalModelDescription'
_FIT_file_type = 'NeuronalModelParameters'
def __init__(self, bas... |
import unittest
import ossie.utils.testing
import os
from omniORB import any
class ComponentTests(ossie.utils.testing.ScaComponentTestCase):
"""Test for all component implementations in sig_source_i"""
def testScaBasicBehavior(self):
######################################################################... |
"""
Created on Wed Jul 6 22:58:00 2016
@author: Diogo
"""
"""
Created on Sun Jun 26 19:08:00 2016
@author: Diogo
"""
def ImportGames():
games = list()
user_games = dict()
with open('C:\\Users\\Diogo\\Documents\\Monografia FIA\\UserGamesCleansed.txt', 'r', encoding = 'utf-8') as lines:
next(lines) # Skiping header... |
from django.contrib import admin
from models import FileMapping
admin.site.register(FileMapping) |
import ast
import json
import arrow
import elasticsearch
from bson import ObjectId
from flask import request
from eve.utils import config
from eve.io.base import DataLayer
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
def parse_date(date_str):
"""Parse elastic date... |
import platform
import glob
from .io import DxlIO, Dxl320IO, DxlError
from .error import BaseErrorHandler
from .controller import BaseDxlController
from .motor import DxlMXMotor, DxlAXRXMotor, DxlXL320Motor
from ..robot import Robot
def _get_available_ports():
""" Tries to find the available usb2serial port on your... |
from numpy import sqrt
from pacal.standard_distr import NormalDistr, ChiSquareDistr
from pacal.distr import Distr, SumDistr, DivDistr, InvDistr
from pacal.distr import sqrt as distr_sqrt
class NoncentralTDistr(DivDistr):
def __init__(self, df = 2, mu = 0):
d1 = NormalDistr(mu, 1)
d2 = distr_sqrt(Chi... |
from ert.cwrap import CWrapper, BaseCClass
from ert.enkf import ENKF_LIB
from ert.util import StringList
class SummaryKeyMatcher(BaseCClass):
def __init__(self):
c_ptr = SummaryKeyMatcher.cNamespace().alloc()
super(SummaryKeyMatcher, self).__init__(c_ptr)
def addSummaryKey(self, key):
as... |
import os
import subprocess
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{{ cookiecutter.project_slug }}{% endif %}'.commands.base import BaseCommand
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.