code stringlengths 1 199k |
|---|
import logging
import sys
from avocado.core import exit_codes, output
from avocado.core import loader
from avocado.core import test
from avocado.core.plugin_interfaces import CLICmd
from avocado.utils import astring
class TestLister(object):
"""
Lists available test modules
"""
def __init__(self, args):... |
"""
Read a marker definitions file and a Galaxy genome segment extractor
output in interval format; perform a lookup in the dbSNP index
database (see build_index) to get the true rs label; output a new
marker definitions file with the true rs label and the extended mask.
"""
import shelve, csv
from contextlib import ne... |
import smbus
import csv
import time, os
import datetime
Number = 120
TimeDelay = 300
def GetTime() :
now = datetime.datetime.now()
return (str(now.hour)+":"+str(now.minute)+"."+str(now.second))
def GetCPUTemp() :
res = os.popen("vcgencmd measure_temp").readline()
#print res
return(res.replace("temp=... |
try:
# py2exe 0.6.4 introduced a replacement modulefinder.
# This means we have to add package paths there, not to the built-in
# one. If this new modulefinder gets integrated into Python, then
# we might be able to revert this some day.
# if this doesn't work, try import modulefinder
try:
... |
__author__ = 'aimee'
choicelist = ['1:wait', '2:fight', '3:run away']
print('Dragon Slayer')
print('Let the Games Begin ')
name = input('Name your character: ')
print('The Sun sets over the Town of Thrones, across the town there is a sense of fear the Dragon might apear')
print('You are, ' + name + ', the young warrior... |
def gcdRec(a, b):
if b ==0:
return a
else:
return gcdRec(b, a%b)
def gcdIter(a, b):
div = min(a,b)
if max(a, b)%min(a, b) == 0:
return min(a, b)
if min(a, b) ==1:
return min(a, b)
while div >0:
if a%div==0 and b%div == 0:
return div
div... |
from typing import Union, Callable
from .path import Path
class Constant(Path):
"""Simplest condition. It will send value until condition is reached."""
def __init__(self,
time: float,
cmd: float,
condition: Union[str, bool, Callable],
send_one: bool = Tru... |
import unittest
from httplib import BAD_REQUEST
from httplib import FORBIDDEN
from httplib import NOT_FOUND
from django.test import TestCase
from tcms.xmlrpc.api import build
from tcms.xmlrpc.tests.utils import make_http_request
from tcms.tests.factories import ProductFactory
from tcms.tests.factories import TestBuildF... |
"""
Implements a parser for the Valve Data Format (VDF,) or as often
refered KeyValues.
Currently only provides parsing functionality without the ability
to serialise. API designed to mirror that of the built-in JSON
module.
https://developer.valvesoftware.com/wiki/KeyValues
"""
import string
im... |
'''
in comments of this module,
a-b means there's an edge between a and b
a->b means there's a directed edge from a to b
a--b means there's a path between a and b, ignoring direction of edges
a-->b means there's a path between a and b
'''
def trans(g, e):
#calculates transitiveness of an edge in a graph
#at_as ... |
from __future__ import division
import wave
import matplotlib
import matplotlib.ticker as tck
import matplotlib.pyplot as plt
import numpy as np
import sys
import matplotlib.colors as clr
from scipy import signal
from scipy import interpolate
def gen_ticks(stop, start=10):
yield start
for s in range(1, 10):
... |
"""
/***************************************************************************
QuickMapServices
A QGIS plugin
Collection of internet map services
-------------------
begin : 2014-11-21
git sha : $Format:%H$
... |
from analyse_hrtf import write_file
from os.path import join
def main():
out = []
for i in range (0, 361, 15):
for j in range (0, 181, 15):
out.append([{'r': 1, 'a': i, 'e': j}, [[i, j, 0, 0, 0, 0, 0, 0], [i, j, 0, 0, 0, 0, 0, 0]]])
header_string = """
#include "hrtf_tests.h"
// ... |
"""Unit tests for the parallel features of the memh5 module."""
import unittest
import os
import glob
import numpy as np
import h5py
from caput import memh5, mpiarray, mpiutil
comm = mpiutil.world
rank, size = mpiutil.rank, mpiutil.size
class TestMemGroupDistributed(unittest.TestCase):
"""Unit tests for MemGroup.""... |
from sys import stdin
from itertools import imap
from collections import Counter
if __name__ == '__main__':
s = stdin.readline().strip()
t = stdin.readline().strip()
# Counter difference between two strings
dh = Counter(imap(lambda a, b:a!=b, s, t))[True]
print(dh) |
import wtforms
from .base import CSRFProtectedForm
class ConfirmDeleteForm(CSRFProtectedForm):
"""
Form for confirming deletions.
"""
pass
class UrlForm(CSRFProtectedForm):
"""
Form for entering URLs to check matches with data source(s) or to get transformed URLs.
"""
url = wtforms.field... |
from LightMysql import LightMysql
if __name__ == '__main__':
# config info, necessary parameters host, port, user, passwd, db
dbconfig = {
'host':'127.0.0.1',
'port': 3306,
'user':'danfengcao',
'passwd':'123456',
'db':'test',
'charset':'utf8'}
db = LightMysql(... |
import unittest
from mcvirt.client.rpc import Connection
from mcvirt.parser import Parser
from mcvirt.constants import PowerStates, LockStates
from mcvirt.utils import get_hostname
def skip_drbd(required):
"""Skip DRBD wrapper."""
def wrapper_gen(f):
"""Wrapper method call."""
# Disable docstrin... |
"""<module internal="yes" />
"""
from Subnet import Subnet, InetSubnet, Inet6Subnet
class BuiltinProxy():
"""<class internal="yes"/>
"""
def __init__():
pass
class BaseZone(object):
"""
<class internal="yes"/>
"""
zones = {}
def __init__(self, name, addrs=(), hostnames=(), admin_parent=Non... |
import sys
from PyQt4 import QtCore, QtGui
class Ui_B_Options(object):
def setupUi(self, B_Options):
B_Options.setObjectName("B_Options")
B_Options.resize(QtCore.QSize(QtCore.QRect(0,0,627,530).size()).expandedTo(B_Options.minimumSizeHint()))
self.vboxlayout = QtGui.QVBoxLayout(B_Options)
... |
import sys, os
sys.path.append(os.path.dirname(__file__))
from icalendar import Calendar, cal, prop
from dateutil import tz as tzmod
from cStringIO import StringIO
import pytz
import urllib2
import datetime
import rruler
DEB_OBJ = None
SECONDS_PER_DAY=24*60*60
def seconds(timediff):
return SECONDS_PER_DAY * timedif... |
"""
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
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 2 of the License, or
(at your option) any later... |
import os
import subprocess
from functools import wraps
from time import gmtime, strftime , localtime
import datetime
from bal.lasso.lasso import *
from bal.core.prepare import get_executables
arguments = get_commandline_arguments()
if arguments.U != None:
input_files = [arguments.U]
elif arguments.mate_1 and argum... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('plants', '0003_auto_20150810_0028'),
]
operations = [
migrations.AlterField(
model_name='plant',
name='site',
field=m... |
"""
WSGI config for socketioapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "socketioapp.settings")
from django.co... |
import os
from selenium import webdriver
from time import sleep
class EXML2JS:
path = "http://url/index.html"
input_path = "E:/url/panels"
output_path = "E:/urls/"
new_js = '''function t(text)
{
var p = new eui.sys.EXMLParser();
var doc = egret.XML.parse(text);
delete doc.a... |
import requests
import elementtree.ElementTree as ET
order_items = []
filename = 'lastupdate.txt'
target = open(filename, 'r')
last_id = target.read()
target.close()
payload = {'min_id': last_id, 'limit' : '250'}
print "Importing Orders Since Last Update"
r = requests.get('https://<STORE URL>/api/v2/orders', params=pay... |
import sys
try:
import web
except ImportError as e:
print(e)
sys.exit(1)
try:
from dc2.admincenter.globals import logger
except ImportError as e:
print(e)
sys.exit(1)
try:
from jinja2 import Environment, FileSystemLoader
except ImportError as e:
print(e)
sys.exit(1)
try:
from dc2... |
import math
import os
import urllib
if __name__ == '__main__':
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'astrometry.net.settings'
from astrometry.net.log import *
from astrometry.net.tmpfile import *
from astrometry.net import settings
def plot_sdss_image(wcsfn, plotfn, image_scale=1.0, debug_ps=None):
... |
import xbmc, xbmcaddon, xbmcgui, xbmcplugin,os,base64,sys,xbmcvfs
import platform
import urllib2,urllib
from urllib import FancyURLopener
import re
import speedtest
import glob
import common as Common
import wipe
import installer
import update
import parameters
import maintenance
import plugintools
import backuprestore... |
"""
Topic: 将装饰器定义成类
Desc :
"""
import types
from functools import wraps
class Profiled:
def __init__(self, func):
wraps(func)(self)
self.ncalls = 0
def __call__(self, *args, **kwargs):
self.ncalls += 1
return self.__wrapped__(*args, **kwargs)
def __get__(self, instance, cls):... |
from setuptools import setup, find_packages
import os
setup(
name='fake2db',
version='0.3.0',
author='Emir Ozer',
author_email='emirozer@yandex.com',
url='https://github.com/emirozer/fake2db',
description='Generate test databases filled with fake data (current support - sqlite, mysql, postgresql... |
import os, xbmc
from utilities import Debug
global _RawXbmcDb__conn
_RawXbmcDb__conn = None
class RawXbmcDb():
# make a httpapi based XBMC db query (get data)
@staticmethod
def query(str):
global _RawXbmcDb__conn
if _RawXbmcDb__conn is None:
_RawXbmcDb__conn = _findXbmcDb()
... |
import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random
import sim_creatures
from util import *
description = \
"""
As you grope your way through the darkness, a swarm of rats suddenly erupts from
ahead and streams past you. As the echo of their chittering rece... |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.admin import dashboard
from openstack_dashboard.openstack.common.log import policy_is
class DbMonitor(horizon.Panel):
name = _("Data Center")
slug = 'dbmonitor'
img = '/static/dashboard/img/nav/dbmonit... |
import rabinpoly
lib = rabinpoly
window_size = 32
min_segment_size = 1024
avg_segment_size = 8192
max_segment_size = 65536
rp = lib.rp_new(window_size,
avg_segment_size, min_segment_size, max_segment_size, 1024*128)
assert rp.contents.window_size == window_size
assert rp.contents.T[1] == 13827942727904890243
lib.rp_f... |
import Common.LongFilePathOs as os
import re
import sys
import uuid
import struct
import codecs
import copy
from UserDict import IterableUserDict
from cStringIO import StringIO
from array import array
from Common.LongFilePathSupport import OpenLongFilePath as open
from CommonDataClass import *
from Common.Misc import s... |
"""
This file contains the clone server utility which launches a new instance
of an existing server.
"""
import os
import subprocess
import sys
import time
import shutil
def clone_server(conn_val, options):
"""Clone an existing server
This method creates a new instance of a running server using a datadir
se... |
import os
import sys
import socket
import glob
UID = 4711
GID = 4711
def main(treeroot, force):
if treeroot == "/":
print "Refusing to use / as treeroot"
sys.exit(1)
if treeroot[-1] == os.sep: treeroot = treeroot[:-1]
treeroot += os.sep + "nfs4st"
if not os.path.exists(treeroot):
... |
""" Call scripts to processes data and make plots.
Assumes data has been downloaded to data_retrieval/data
.. moduleauthor:: Neil Swart <neil.swart@ec.gc.ca>
"""
import os
import sys
import subprocess
from analysis_plotting import run_plotting
from data_processing import run_processing
def run(datapath):
os.chd... |
__author__ = "Karol Będkowski"
__copyright__ = "Copyright (c) Karol Będkowski, 2009-2010"
__version__ = "2010-05-24"
import wx
import wx.gizmos as gizmos
class DlgEditValues(wx.Dialog):
def __init__(self, parent, data):
wx.Dialog.__init__(self, parent, -1, style=(wx.DEFAULT_DIALOG_STYLE | \
wx.RESIZE_BORDER | wx... |
from wrapanapi.virtualcenter import VMWareSystem
from cfme.common.provider import DefaultEndpoint, DefaultEndpointForm
from . import InfraProvider
from cfme.exceptions import ItemNotFound
class VirtualCenterEndpoint(DefaultEndpoint):
pass
class VirtualCenterEndpointForm(DefaultEndpointForm):
pass
class VMwarePr... |
"""BibFormat element - Prints authors
"""
__revision__ = "$Id$"
import re
from urllib import quote
from cgi import escape
from invenio.config import CFG_SITE_URL
from invenio.messages import gettext_set_language
def format_element(bfo, limit, separator=' ; ',
extension='[...]',
print_links="yes",
... |
"""Define fixtures for tests."""
import json
import httpretty
from six.moves import urllib_parse
def register_github_api():
"""Register GitHub API endpoints."""
register_oauth_flow()
register_endpoint(
'/user',
USER('auser', email='auser@inveniosoftware.org')
)
register_endpoint(
... |
import datetime
import logging
import os
import re
import threading
import cairo
import glib
import gobject
import pygst
pygst.require('0.10')
import gst
import pygtk
pygtk.require('2.0')
import gtk
import pango
from xl.nls import gettext as _
from xl import (
common,
covers,
event,
formatter,
playe... |
import os
from gvsbuild.utils.base_expanders import Tarball
from gvsbuild.utils.base_project import Project, project_add
from gvsbuild.utils.utils import convert_to_msys
@project_add
class Libvpx(Tarball, Project):
def __init__(self):
Project.__init__(
self,
"libvpx",
arc... |
'''
READ THIS YOU WILL REGRET IT OTHERWISE
Because Reasons:
Protobuf messages are used to communincate via IPC channel with the IPC Server
in a runnning simulation.
The python bindings for those messages is generated by the protoc compiler from
the .proto file.
This *_pb2.py file must be generated BEFORE setuptools ins... |
import math
class OutOfRangeError(ValueError):
pass
K0 = 0.9996
E = 0.00669438
E2 = E * E
E3 = E2 * E
E_P2 = E / (1.0 - E)
SQRT_E = math.sqrt(1 - E)
_E = (1 - SQRT_E) / (1 + SQRT_E)
_E2 = _E * _E
_E3 = _E2 * _E
_E4 = _E3 * _E
_E5 = _E4 * _E
M1 = (1 - E / 4 - 3 * E2 / 64 - 5 * E3 / 256)
M2 = (3 * E / 8 + 3 * E2 / 32... |
from pylab import *
from scipy import *
import csv
x = []
y = []
color = []
area = []
areas = {}
filename = 'Recorded_Crime_volumes_v0.1_Final.csv'
with open( filename, 'r' ) as csvfile:
reader = csv.reader(csvfile, delimiter=',')
count = 0
for row in reader:
if count == 0:
... |
import time
import os
import sys
import commands
import logging
import config
from utils import *
init_logging(config.ACE_GLOBAL_LOG_PATH)
class dbHandler(DBBase) :
def __init__(self) :
super(dbHandler, self).__init__(config.db)
def Add(self, mac) :
sql = "INSERT INTO Devices(MacAddr, Name, Stat... |
import os, sys, socket, getopt
try:
import IceCertUtils
except Exception as ex:
print("couldn't load IceCertUtils, did you install the `zeroc-icecertutils'\n"
"package from the Python package repository?\nerror: " + str(ex))
sys.exit(1)
def usage():
print("Usage: " + sys.argv[0] + " [options]"... |
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as ... |
'''
The Order Taker User Interface for the coffee bar workflow (Winter Intensives Lab 5)
This is where you define the fields that appear on the screen (application) the order
taker sees and tell WMP how this application (user interface) fits into the overall
workflow.
Note: the comments here assume you have already re... |
"""Plugin for Boardgamegeek"""
from bs4 import BeautifulSoup
from collector.core.plugin import PluginCollector
from collector.core.schema import Schema
class PluginBoardGameGeek(PluginCollector):
"""Boardgamegeek pluginclass"""
website = 'http://www.boardgamegeek.com'
name = 'Boardgamegeek'
description ... |
import collections
import urllib2
from debian_bundle import deb822
mirrors = collections.defaultdict(set)
masterlist = urllib2.urlopen("http://anonscm.debian.org/viewvc/"
"webwml/webwml/english/"
"mirror/Mirrors.masterlist?revision=HEAD")
for mirror in deb822.De... |
import sqlite3 as sql3
from apscheduler.schedulers.blocking import BlockingScheduler #pip install apscheduler==3.0.0
from datetime import datetime,timedelta
import time
import logging
LIMIT = 400
sched = BlockingScheduler()
@sched.scheduled_job('interval', days=1)
def doCleanUp():
count1 = getInstagramCount()
count2 ... |
from rpc import RPC
from xbmcswift2 import Plugin
import re
import requests
import xbmc,xbmcaddon,xbmcvfs,xbmcgui
import xbmcplugin
import base64
plugin = Plugin()
big_list_view = False
def addon_id():
return xbmcaddon.Addon().getAddonInfo('id')
def log(v):
xbmc.log(repr(v))
def get_icon_path(icon_name):
if... |
'''
vidics scraper for Exodus forks.
Nov 9 2018 - Checked
Oct 23 2018 - Cleaned and Checked
Updated and refactored by someone.
Originally created by others.
'''
import re
import requests
from bs4 import BeautifulSoup
from datetime import datetime
try:
from urllib import quote
except ImportError:... |
from lnst.Common.Utils import bool_it
from lnst.Controller.Task import ctl
from lnst.Controller.PerfRepoUtils import netperf_baseline_template
from lnst.Controller.PerfRepoUtils import netperf_result_template
from lnst.RecipeCommon.IRQ import pin_dev_irqs
from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment... |
""" Wrk script generator """
__author__ = 'Tempesta Technologies, Inc.'
__copyright__ = 'Copyright (C) 2017-2018 Tempesta Technologies, Inc.'
__license__ = 'GPL2'
from . import remote
class ScriptGenerator(object):
""" Generate lua script """
request_type = "GET"
uri = "/"
headers = []
body = ""
... |
__all__ = [ 'Text' ]
from gi.repository import Pango, PangoCairo
import image
class Text(image.CairoTexture):
def draw(self, cr):
"""
Render the cairo context
"""
if self.color:
cr.set_source_rgba(*self.color.to_cairo())
layout = PangoCairo.create_layout(cr)
... |
from os.path import join
from lxml.etree import parse, RelaxNG, LxmlError, XML
from enkel.rngdata import RNGDIR
from enkel.model.field.xmlf import LxmlFieldValidationError
rng_file = join(RNGDIR, "staticcms", "post.rng")
def validate_post_field(fieldname, xml, offset):
""" L{enkel.model.field.xmlf.XmlField} compatible... |
import logging
import os
import socket
import subprocess
import pwd
import shutil
import daemon
import qubesdb
import sys
import signal
class RuleParseError(Exception):
pass
class RuleApplyError(Exception):
pass
class FirewallWorker(object):
def __init__(self):
self.terminate_requested = False
... |
import datetime
from django.db.models import ProtectedError
from specifyweb.specify import models
from specifyweb.specify.api_tests import ApiTests
from ..exceptions import BusinessRuleException
class AppraisalTests(ApiTests):
def test_delete_blocked_by_collection_objects(self):
appraisal = models.Appraisal... |
import os
import sys
from glob import glob
from os.path import join
from socket import gethostname
import numpy
def find_file(arg, dir, files):
#looks if the first element of the list arg is contained in the list files
# and if so, appends dir to to arg. To be used with the os.path.walk
if arg[0] in files:
... |
import fauxfactory
import pytest
from widgetastic_patternfly import Dropdown
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.markers.env_markers.provider import ONE_PER_TYPE
from cfme.utils.appliance.implementations.ui import navigate_to
pytestmark = [
pytest.mark.tier(2),
pytest... |
"""HEPData end to end testing of accounts."""
import flask
from conftest import e2e_assert, e2e_assert_url
from invenio_accounts import testutils
from itsdangerous import URLSafeTimedSerializer
from flask_security import utils
def test_user_registration_and_login(live_server, env_browser):
"""E2E user registration ... |
"""
Django settings for email_sender 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/
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_K... |
import re
from jabbapylib.podium import podium
from jabbapylib.filesystem import fs
import py.test
from time import sleep
def test_get_hostname():
assert podium.get_hostname()
def test_get_home_dir():
username = podium.get_username()
assert username in podium.get_home_dir()
def test_get_username():
test... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import itertools, operator, os, math
from types import MethodType
from threading import Event, Thread
from Queue import LifoQu... |
import time
import sublime
import sublime_plugin
from ..anaconda_lib.helpers import (
check_linting, get_settings, check_linting_behaviour,
ONLY_CODE, NOT_SCRATCH, LINTING_ENABLED, is_code
)
from ..anaconda_lib.linting.sublime import (
ANACONDA, erase_lint_marks, run_linter,
last_selected_lineno, update... |
hiddenimports = ['cffi','bcrypt'] |
"""Base class for serial devices. Includes some convenience methods to open
ports and check for the expected device
"""
from __future__ import absolute_import, print_function
from builtins import str
from builtins import range
from builtins import object
import sys
import time
from psychopy import logging, constants
tr... |
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestCase):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'array_form... |
"""
Inspired by:
https://skippylovesmalorie.wordpress.com/2010/02/12/how-to-generate-a-self-signed-certificate-using-pyopenssl/
"""
from __future__ import unicode_literals
import os
from datetime import datetime
from datetime import timedelta
from getpass import getpass
from django.conf import settings
from django.core... |
"""
Entry point for the pyqtc worker.
"""
import logging
import os
import sys
import rope.base.project
from rope.base import worder
from rope.contrib import codeassist
import messagehandler
import rpc_pb2
import symbolindex
class ProjectNotFoundError(Exception):
"""
An action was requested on a file that was not fo... |
import sys, os
if len(sys.argv) != 4 or "-h" in sys.argv:
print("\nUsage:\t$ python fotc.py [tree file] [outgroup] [output file name]");
print("---->\t[tree file]: A file containing one or more unrooted, newick formatted trees, one per line.");
print("---->\t[outgroup]: A tip label in all present in all trees at whi... |
import arcpy, sys
try:
fc = sys.argv[1] # Get input shape file name from user
print "Input shapefile =", fc
except IndexError:
print "Need input for processing"
print "Usage: <shapefile name (required)> <workspace(optional) default='C:/Temp'>"
sys.exit(0) #Program exists here. No more... |
from django.contrib.auth import authenticate, logout, login
from django.contrib.auth import get_user_model
from django.http import HttpResponse
from app.models import Label, Place, Guide, Question, Answer
from hashlib import md5
import json
import re
LOGIN_OK_CODE = 200
LOGIN_OK = 'Login success'
LOGOUT_OK_CODE = 201
L... |
"""
This module contains the basic API for splinter drivers and elemnts.
"""
from splinter.meta import InheritedDocs
from splinter.request_handler.request_handler import RequestHandler
class DriverAPI(RequestHandler):
"""
Basic driver API class.
"""
__metaclass__ = InheritedDocs
driver_name = None
... |
"""Code coverage utilities."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import re
import time
from xml.etree.ElementTree import (
Comment,
Element,
SubElement,
tostring,
)
from xml.dom import (
minidom,
)
from . import types as t
f... |
import string
import random
LOWERLETTERS = list(string.ascii_lowercase)
UPPERLETTERS = list(string.ascii_uppercase)
SYMBOLS = list(string.punctuation)
NUMBER = list(range(0,10))
pwdLength = 20
numbers = []
for n in NUMBER:
numbers.append(str(n))
characters = LOWERLETTERS + UPPERLETTERS + SYMBOLS + numbers
def text_... |
__author__ = 'bhargava'
import os, sys, subprocess
import collections
import filecmp
import unittest
import glob
statout = collections.namedtuple('StatusOutPair', ['ret', 'out'])
def execwrapper(args, errMsg):
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, executable="/bin/... |
from decouple import config, Csv
import django.conf.global_settings as default
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY', default='secret_key')
API_KEY = config('API_KEY', default='api_key')
RECAPTCHA_SITE_KEY = config(
'RECAPTCHA_SITE_KEY',
... |
"""
A minimal front end to the Docutils Publisher, producing HTML from PEP
(Python Enhancement Proposal) documents.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates (X)HTML from reStructuredText-f... |
"""
Authors: Hung-Hsin Chen <chenhh@par.cse.nsysu.edu.tw>
License: GPL v2
"""
from __future__ import division
from time import time
from datetime import datetime
import os
import numpy as np
import pandas as pd
from pyomo.environ import *
from pyomo.opt import SolverStatus, TerminationCondition
from PySPPortfolio.pysp_... |
'''
Effective seismological trace viewer.
'''
from __future__ import absolute_import
import os
import sys
import signal
import logging
import time
import re
import zlib
import struct
import pickle
from pyrocko.streaming import serial_hamster
from pyrocko.streaming import slink
from pyrocko.streaming import edl
from pyr... |
"""InaSAFE Disaster risk tool by Australian Aid - Metadata for PAGER Earthquake
Impact Function on Population.
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Sof... |
import re
import pandas as pd
from xlrd import XLRDError
class ExcelParsing:
def __init__(self, file):
self.file = file
@staticmethod
def parse_excel(file):
""" returns a dataframe object, checks binary """
try:
return pd.read_excel(file)
except XLRDError:
... |
import numpy as np
import random as rd
import time
import matplotlib.pyplot as plt
import sqlite3
import time
import os
deb = time.time()
def determination_maxi(liste, but):
"""
goal: find how many music you can take
input: list, integer
output: integer
"""
somme = liste[0]
i = 0
while(s... |
import sys
import re
import itertools
import argparse
import hashlib
import copy
from cpt_gffParser import gffParse, gffWrite, gffSeqFeature
from Bio.Blast import NCBIXML
from Bio.SeqFeature import SeqFeature, FeatureLocation
from gff3 import feature_lambda
from collections import OrderedDict
import logging
logging.bas... |
""" ownNotes
Copyright (C) 2013 Benoît HERVIER <khertan@khertan.net>
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 2 of the License, or
(at your option) any later ... |
'''
Reading the *Whole* file as a string:
xfile = open('mbox.txt')
inp = xfile.read()
print(len(inp))
File handle as a Sequence
- A file handle open for read can be treated as a sequence of strings where
each line in the file is a string in the sequence
- We can use the for statement to iterate through a sequence
- R... |
from __future__ import absolute_import
from django.conf import settings
from django.db import models
from .base import BaseWsModel
class WsAuthGroup(BaseWsModel):
"""
This is a class for representing authorization groups specific to the Web Sight platform.
"""
# Columns
name = models.CharField(max_l... |
import docker
from io import BytesIO
baseDockerfile = '''
# Use an official Python runtime as a parent image
FROM python:2.7-slim
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
ADD . /app
# Install any needed packages specified in requirements.tx... |
import re
import numpy
import scipy.integrate # Simpson's rule implementation for integrating dA/dQ
import os
import pickle
kb = 1
log_dir = 'ag_logs_target/'
kt = 0.741
min_Q = 100
max_Q = 200
num = max_Q - min_Q + 1
class WindowStats:
def __init__(self, N, center, spring, mean, sd):
self.N = N
self.center = cent... |
import pandas as pd
'''
Little program created by Felipe Ramos, just to process and agroup some typed data in a research by CEFAT
'''
path = 'analyser/uncleaned/'
path = path + input("Selecione o nome do arquivo xlsx: (dentro da pasta uncleaned)\n> ")
def converter(cidade):
if cidade in ['Pirangi', 'Cotovelo', 'Piu... |
import numpy as np
import math
import skimage
from skimage import morphology
from skimage import measure
from scipy import ndimage as ndi
import matplotlib.pyplot as plt
import SClass
def segment(coordinates,byAxis,difs):
[x,y]=byAxis
[difX,difY]=difs
seguits=[]
#Monta una imatge amb les traces, amb un gruix fix se... |
from jyimportlib import importjar, importbin, importdir
importbin()
importjar("srldb.jar")
importjar("tumutils.jar")
importjar("weka_fipm.jar")
from java.util import Vector, HashMap
from java.lang import String, Double
import jarray
from weka.classifiers.trees import J48, DecisionStump, RandomForest
from weka.classifie... |
"""
Expect-like stuff
"""
import re
import time
import logging
import socket
import sys
CTRL_C = '\x03'
class ExpectFailed(AssertionError):
'''
Exception to represent expectation error
'''
pass
class Expect(object):
'''
Stateless class to do expect-ike stuff over connections
'''
@staticm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.