code stringlengths 1 199k |
|---|
from __future__ import print_function
from py3hax import *
import tornet
import simtime
import client
import options
def trivialSimulation(args):
num = 1000 if not args.total_relays else args.total_relays
print("Number of nodes in simulated Tor network: %d" % num)
net = tornet.Network(num)
# Decorate th... |
import time,hashlib
try: from sqlite3 import dbapi2 as database
except: from pysqlite2 import dbapi2 as database
from resources.lib.modules import control
def fetch(items, lang, user):
try:
t2 = int(time.time())
dbcon = database.connect(control.metacacheFile)
dbcur = dbcon.cursor()
excep... |
import select
import sys
use_mod = None
if 'epoll' in select.__dict__:
print "use epoll"
use_mod = 'epoll'
from epollreactor import EpollReactor as Reactor
elif 'kqueue' in select.__dict__:
print "use kqueue"
use_mod = 'kqueue'
from kqueuereactor import KqueueReactor as Reactor
elif 'poll' in se... |
import argparse, re, sys, errno, os
def run():
try:
scanFile = open(args.inputFile, 'r')
except IOError as err:
print('I/O Error')
print('Error(' + format(err.errno) + '): ' + format(err.strerror))
sys.exit(1)
if (args.outputFile):
try:
writeFile = open(results.outputFile, 'w')
except IOError as er... |
import sys
import os
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import urllib
import urllib2
import re
NB_ITEM_PAGE = 28
def _get_keyboard( default="", heading="", hidden=False ):
""" shows a keyboard and returns a value """
keyboard = xbmc.Keyboard( default, heading, hidden )
keyboard.doModal()
... |
from django.utils import translation
from .helpers import default_language
__title__ = 'slim.translations'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2013-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = (
'short_language_code',
'is_primary_language'
)
def sho... |
application = 'example'
def getDetails(env=None):
return [
{'env': 'test', 'release': '9.9'},
{'env': 'preprod', 'release': '2.4', 'url': "http://www.google.com"},
{'env': 'prod', 'release': '2.3a', 'notes': "But wait, there's more"},
] |
from __future__ import unicode_literals
from django.db import models, migrations
import ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
('news', '0002_article_head'),
]
operations = [
migrations.AlterField(
model_name='article',
name='text',
... |
from Cerebrum.default_config import * |
__author__ = 'RKazakov'
class RowSaver:
def __init__(self):
pass
def save(self, row):
raise NotImplementedError() |
import collections.abc
import pytest # type: ignore
from rebasehelper.spec_content import SpecContent
from rebasehelper.tags import Tags, Tag
@pytest.mark.public_api
class TestTags:
def test_contructor(self):
spec = SpecContent('')
tags = Tags(spec, spec)
assert isinstance(tags, Tags)
d... |
"""
Module simplifying manipulation of XML described at
http://libvirt.org/formatbackup.html
"""
from virttest import xml_utils
from virttest.libvirt_xml import base, accessors, xcepts
class BackupXML(base.LibvirtXMLBase):
"""
Domain backup XML class. Following are 2 samples for push mode backup xml
and pul... |
from __future__ import division
import numpy as np
from sklearn.neighbors import NearestNeighbors
from DensityEstimator import DensityEstimator
from VectorGaussianKernel import VectorGaussianKernel
from multi_flatten import multi_flatten
class TruncatedKDE(DensityEstimator):
def __init__(self, d_points, num_subsamp... |
"""
Functions for model handling
"""
from ..ll_api import *
from .hl_api_helper import *
__all__ = [
'ConnectionRules',
'CopyModel',
'GetDefaults',
'Models',
'SetDefaults',
]
@check_stack
def Models(mtype="all", sel=None):
"""Return a tuple of model names, sorted by name.
All available model... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'money.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
) |
from django.db import models
from tournament.models import Judge
class judge_feedback(models.Model):
score_choice = (
(1,'1'),
(2,'2'),
(3,'3'),
(4,'4'),
(5,'5'),
)
judge = models.ForeignKey(Judge)
fair_score = models.IntegerField(choices = score_choice)
clarity_score = models.In... |
class APIResponse:
# Error messages to return to the client via the API.
errors = {
1 : {
'message' : 'No URL was provided',
'status' : 400
}
}
'''
These values represent the total number of alphanumeric combinations possible (value)
for each character limit (key). These values are used... |
from Products.Zuul.form import schema
from Products.Zuul.interfaces.device import IDeviceInfo
from Products.Zuul.interfaces.component import IComponentInfo
from Products.Zuul.utils import ZuulMessageFactory as _t
class IIBM7000DeviceInfo(IDeviceInfo):
total_mdisk_capacity = schema.TextLine(title=_t('Total Capacity si... |
sockets = {
'criar_marcador': []
} |
import uuid
from django.db import transaction
from os.path import splitext, basename
from django.db import models
from django.dispatch import receiver
from django.db.models.signals import post_save
from common.vocab import neonion
from common.mixins import ResourceMixin
from common.sparql import insert_data
from common... |
from .FileSystemTestCase import FileSystemTestCase
from vimswitch.Settings import Settings
from vimswitch.DiskIo import getDiskIo
from vimswitch.ApplicationDirs import getApplicationDirs
from vimswitch.Application import Application
class TestApplicationDirs(FileSystemTestCase):
def setUp(self):
FileSystemT... |
from django.test import TestCase
from octo_nemesis.models.stateset_model import StateSet
from django.test import Client # for view tests
class StateSetTest(TestCase):
# test
RGB_SET_DESCRIPTION = "the three primary colors"
def setUp(self):
# Every view test needs a client.
self.client = Cli... |
import logging
import os
import ctypes
from miro.plat.frontends.widgets import timer
from miro.plat import usbutils
from miro import app
GWL_WNDPROC = -4
WndProcType = ctypes.WINFUNCTYPE(ctypes.c_long, ctypes.c_int, ctypes.c_uint,
ctypes.c_int, ctypes.c_int)
class DeviceTracker(object):... |
from __future__ import unicode_literals
import re
from django.utils import timezone
from datetime import datetime
class Sheet(object):
def __init__(self, xlsheet):
self.xlsheet = xlsheet
def get_menu_date(self):
menu_date = re.findall(r'\d{2}.\d{2}.\d{2}',
self.xls... |
__author__ = "Abraham Macias Paredes <amacias@solutia-it.es>"
__copyright__ = "Copyright (C) 2015, Junta de Andalucía" + \
"<devmaster@guadalinex.org>"
__license__ = "GPL-2"
import logging
import gettext
from gecosws_config_assistant.view.GladeWindow import GladeWindow
from gecosws_config_assistant.dto.GecosAccessD... |
""" Read ID3 tags from a file.
Ned Batchelder, http://nedbatchelder.com/code/modules/id3reader.html
"""
__version__ = '1.53.20070415' # History at the end of the file.
import struct, sys, zlib
_encodings = ['iso8859-1', 'utf-16', 'utf-16be', 'utf-8']
_simpleDataMapping = {
'album': ('TALB', 'TAL', 'v1... |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class inetutils(ShutItModule):
def is_installed(self, shutit):
return shutit.file_exists('/root/shutit_build/module_record/' + self.module_id + '/built')
def build(self, shutit):
shutit.send('mkdir -p /tmp/build/inetutils')
shutit... |
__author__ = 'Ivan Dortulov'
from HttpRequest import HttpRequest
import queue
class Connection(object):
# Argument for recv and send
CHUNK_SIZE = 256
def __init__(self, socket, client_address, server):
self.server = server
self.socket = socket
self.client_address = client_address
... |
import sys
def read_time(document):
with open(document) as f:
content = f.read()
word_count = count_words(content)
readtime = calculate_read_time(word_count)
readtime = min_to_hour(readtime) if (readtime > 59) else str(readtime) + ' minute'
return readtime
def count_words(content):
word_list = content.split(... |
import numpy as np
import pytest
from numpy.testing import assert_equal
from threadpoolctl import threadpool_info
import MDAnalysis as mda
from MDAnalysisTests.datafiles import PSF, DCD
from MDAnalysis.transformations.base import TransformationBase
class DefaultTransformation(TransformationBase):
"""Default values ... |
from mpi4py import MPI
def genListOfLists(numElements):
data = [[0]*3 for i in range(numElements)]
for i in range(numElements):
#make small lists of 3 distinct elements
smallerList = []
for j in range(1,4):
smallerList = smallerList + [(i+1)*j]
# place the small list ... |
import message
import sys
import subprocess
import cPickle as pickle
user_agent = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.742.112 Chrome/12.0.742.112 Safari/534.30"
def get_uri(uri):
# The following would have avoived going to disk, but unfortunately,
# w... |
from __future__ import with_statement
import gtk
import sys, os
from lib import *
from libu import *
from libsetting import *
class update_manager_setting(Set):
@classmethod
def f(cls):
label = gtk.Label(_('the behavior of update manager:'))
label.set_alignment(0, 0)
o = GConfCheckButton... |
import codecs
try:
codecs.lookup('mbcs')
except LookupError:
ascii = codecs.lookup('ascii')
func = lambda name, enc=ascii: {True: enc}.get(name=='mbcs')
codecs.register(func)
from distutils.core import setup
setup(name = "teiler",
packages = ["teiler"],
version = "0.1.0",
description =... |
from django.shortcuts import render_to_response, redirect
from .forms import SubscribeForm
from django.template.context import RequestContext
from .models import PackageWatchers, Watcher, Package
from .github import check_repo
import contact
def index(request, form=None):
packages = Package.objects.all()
subscr... |
from core.Graph import *
from gui.RadialNet import NetNode
import re
COLORS = [(0.0, 1.0, 0.0),
(1.0, 1.0, 0.0),
(1.0, 0.0, 0.0)]
BASE_RADIUS = 5.5
NONE_RADIUS = 4.5
def calc_vulnerability_level(node, host):
"""
"""
xml_ports = host.search_children('port', deep=True)
node.set_info({'... |
import gconf
import gtk
import gobject
from mercurial import hg, ui, util, repo
from mercurial.node import short
import nautilus
import os
import subprocess
import sys
import tempfile
import time
import urllib
TORTOISEHG_PATH = '~/tools/tortoisehg-dev'
TERMINAL_KEY = '/desktop/gnome/applications/terminal/exec'
class Hg... |
"""
Django settings for DataCatcher project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
BA... |
"""
/***************************************************************************
audioRecorder
A QGIS plugin
Effectively onduct direct to digital map biographies and traditional land
use studies
-------------------
begin : 2014-05-1... |
import logging
from time import sleep
from argparse import ArgumentParser
from socket import error as SocketError
from scapy.config import conf
from scapy.packet import bind_layers
import pysap
from pysap.SAPNI import SAPNI
from pysap.SAPDiagClient import SAPDiagConnection
from pysap.SAPDiag import SAPDiag, SAPDiagDP, ... |
__title__ = 'dash.contrib.plugins.memo.apps'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = 'Copyright (c) 2013-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('Config',)
try:
from django.apps import AppConfig
class Config(AppConfig):
name = label = 'dash... |
"""
***************************************************************************
VectorSplit.py
---------------------
Date : September 2014
Copyright : (C) 2014 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
************************************... |
from django.core.urlresolvers import reverse
from django.db import transaction
from django.test import TestCase, TransactionTestCase
from django.test.utils import override_settings
from simon_app.management.commands.probeapi_traceroute import ProbeApiTraceroute
class ProbeapiParserTestCase(TransactionTestCase):
PRO... |
'''
@author: Pedro Peña Pérez
'''
import sys
import logging
from exe.engine.persistxml import encodeObjectToXML
from exe.engine.path import Path
from exe.engine.package import Package
from exe.export.scormexport import ScormExport
from exe.export.imsexport import IMSExport
from exe.export.websiteexport import WebsiteEx... |
import PIL
from PIL import Image
import StringIO
import os.path as op
import uuid
from app import app
from auth import *
ALLOWED_EXTENSIONS = set(['jpg','JPG','JPEG','jpeg','gpx','GPX'])
UPLOAD_FOLDER = op.join(op.dirname('__file__'),'uploads')
def allowed_file(filename):
return '.' in filename and \
fil... |
from ..utils.views import ColabProxyView
class JenkinsProxyView(ColabProxyView):
app_label = 'jenkins' |
"""
Youwatch urlresolver XBMC Addon
Copyright (C) 2015 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is ... |
from translate.misc import wStringIO
from translate.storage import po, xliff
from translate.storage.test_base import first_translatable, headerless_len
from translate.tools import pogrep
class TestPOGrep:
def poparse(self, posource):
"""helper that parses po source without requiring files"""
dummyfi... |
import ev3_nengo.ev3link
if not hasattr(ev3_nengo, 'link'):
ev3_nengo.link = ev3_nengo.ev3link.EV3Link('192.168.0.103')
link = ev3_nengo.link
print(link.dir('/sys/class/tacho-motor'))
print(link.dir('/sys/class/lego-sensor'))
import nengo
import numpy as np
import time
class EV3(nengo.Network):
def __init__(sel... |
from turtlelsystem.LSystem import LSystem, LSystemOverflow
from nose.tools import raises
ALGAE_START = "A"
ALGAE_RULES = {
"A": "AB",
"B": "A"
}
ALGAE_RESULTS = ["A", "AB", "ABA", "ABAAB", "ABAABABA", "ABAABABAABAAB"]
def test_results():
def trial(system, n, result):
assert system.nth(n) == result
... |
from . import partner_ledger_xls
from . import partners_ledger |
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog, upgrade=False):
Dialog.setObjectName("Dialog")
Dialog.resize(500, 180)
self.upgradePlugin=upgrade
self.gridlayout = QtGui.QGridLayout(Dialog)
self.gridlayout.setObjectName("gridlayout")
... |
import os
import socket
import sys
from builtins import ConnectionResetError, ConnectionRefusedError
from django.core.management.base import BaseCommand, CommandError
from paramiko import SSHException
from getresults_csv.server import Server
from getresults_csv.csv_file_handler import CsvFileHandler
from getresults_csv... |
def recursive(N, M):
for i in range(N):
s = 'y'+str(i)+' = '
for j in range(M):
s = s + ' ' + str(j) + str(j+i)
print s
def recursive2(N=4, M=1):
M= 2
a = ['a'+str(i) for i in range(M)] |
import sys
from cpip.core import PpLexer, IncludeHandler
def main():
print('Processing:', sys.argv[1])
myH = IncludeHandler.CppIncludeStdOs(
theUsrDirs=['proj/usr',],
theSysDirs=['proj/sys',],
)
myLex = PpLexer.PpLexer(sys.argv[1], myH)
if __name__ == "__main__":
main() |
__author__ = 'drichner'
"""
docklr -- appinit.py
Copyright (C) 2014 Dan Richner
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 version... |
""" lsa DCE/RPC """
import dcerpc as __dcerpc
import talloc as __talloc
class TranslatedSid(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(S, *more): # real signature unknown; restored from __doc__
... |
from django.contrib import admin
from survey.models import Survey, Module, Question, SurveyQuestion, Invite
from django.forms import TextInput, Textarea
from django.db import models
admin.site.register(Module)
admin.site.register(Question)
admin.site.register(Invite)
class SurveyQuestionInline(admin.TabularInline):
... |
"""OMDb models.
"""
import re
class Storage(dict):
"""An object that is like a dict except `obj.foo` can be used in addition
to `obj['foo']`.
Raises Attribute/Key errors for missing references.
>>> o = Storage(a=1, b=2)
>>> assert o.a == o['a']
>>> assert o.b == o['b']
>>> o.a = 2
>>> pr... |
import re
import sys
import json
import codecs
output_stream = codecs.getwriter("utf-8")(sys.stdout)
input_stream = codecs.getreader("utf-8")(sys.stdin, errors="ignore")
error_stream = codecs.getwriter("utf-8")(sys.stderr)
def is_integer(value):
try:
a = int(str(value))
if a > sys.maxint or a < -sys.maxint - ... |
__author__ = 'darioml'
import operator
import numpy as np
import math
class environment(object):
def __init__(self, size):
self.size = int(size)
self.reset()
def reset(self):
self.current_location = (self.size/2,self.size/2)
def set_rewards(self, locations):
self.rewards = lo... |
"""Changes to identity table
Revision ID: c4ca265d296c
Revises: 9c3a319111a0
Create Date: 2016-02-02 22:45:36.139066
"""
revision = 'c4ca265d296c'
down_revision = '9c3a319111a0'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
... |
"""
CmpRuns - A simple tool for comparing two static analyzer runs to determine
which reports have been added, removed, or changed.
This is designed to support automated testing using the static analyzer, from
two perspectives:
1. To monitor changes in the static analyzer's reports on real code bases, for
regres... |
from __future__ import division
import sys, os, re
import numpy as np
import readnew
from glob import glob
import yaml
import os.path
filename_location = sys.argv[1]
N = int(sys.argv[2]) # the number of atoms.
filename = sys.argv[3:]
for f in filename:
avg_gamma = []
min_moves = []
name = '%s.yaml' % (f)
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Artikel',
fields=[
('id', models.AutoField(primary_key=True, serialize=False... |
"""
Batch script to generate a multi-frequency FITS beam from a template cassBeam input file
"""
import sys,os,os.path
from subprocess import call
import numpy as n
import pyrap.tables as pt
cbBin='/usr/local/bin/cassbeam'
c2fScript = os.path.dirname(__file__)+'/cass2fits.py'
if __name__ == '__main__':
from optpars... |
from SipContact import SipContact
from SipAddress import SipAddress
from UaStateGeneric import UaStateGeneric
from CCEvents import CCEventDisconnect, CCEventRing, CCEventConnect, CCEventFail, CCEventRedirect
class UasStateUpdating(UaStateGeneric):
sname = 'Updating(UAS)'
connected = True
def recvRequest(sel... |
import os.path
import subprocess
from tito.common import run_command, info_out, error_out
from tito.release import KojiReleaser
class CoprReleaser(KojiReleaser):
""" Releaser for Copr using copr-cli command """
REQUIRED_CONFIG = ['project_name']
cli_tool = "copr-cli"
NAME = "Copr"
def __init__(self,... |
import os
import subprocess
from gi.repository import GExiv2
exif = None
image_extensions = [".jpg", ".png", ".bmp"]
rules_nikon_d7200 = { "-1" : { "operations" : ["resize", "delete"], "folder" : "Rejected", "max_size" : "1000", "jpg_qual" : "70" },
"0" : { "operations" : ["none"] },
... |
import sys
copy = ["Daniel", "Oliver"]
passw = {"Daniel": "Feathers", "Oliver": "Cat"}
admin = {"Daniel": 1, "Oliver": 0}
passchgpriv = {"Daniel": 1}
nul = 0
rootpriv = {"Daniel": 1, "Oliver": 0}
badcommand = "Unrecognized command"
def login():
#Create login prompt and record the command issued by the user
user... |
import os
from xl import settings, transcoder
from xl.nls import gettext as _
from xlgui.preferences import widgets
name = _("CD")
basedir = os.path.dirname(os.path.realpath(__file__))
ui = os.path.join(basedir, "cdprefs_pane.ui")
FORMAT_WIDGET = None
class OutputFormatPreference(widgets.ComboPreference):
name = 'c... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='file',
name='timestamp',
field=models.Da... |
import GemRB
import GUICommon
import CommonTables
import GUICommonWindows
from GUIDefines import *
from ie_stats import *
from ie_action import ACT_CAST
PriestWindow = None
PriestSpellLevel = 0
def InitPriestWindow (Window):
global PriestSpellWindow
PriestSpellWindow = Window
Button = Window.GetControl (0)
Button.O... |
"""
/***************************************************************************
AttributeSplit
A QGIS plugin
Split a layer by attribute values
-------------------
begin : 2015-11-06
copyright : (C) 2015 by Zoltan ... |
__author__ = "Abraham Macias Paredes <amacias@solutia-it.es>"
__copyright__ = "Copyright (C) 2015, Junta de Andalucía" + \
"<devmaster@guadalinex.org>"
__license__ = "GPL-2"
import logging
import gettext
from gettext import gettext as _
from gecosws_config_assistant.view.GladeWindow import GladeWindow
from gi.repos... |
from setuptools import find_packages, setup
def get_requirements():
with open("requirements.txt") as f:
return f.read().splitlines()
setup(
name="emojisum",
version="1.0.0",
packages=find_packages(where="src"),
url="",
license="",
author="Tamir Bahar",
author_email="",
descri... |
"""These are various utilities for rekall."""
import __builtin__
import cPickle
import cStringIO
import importlib
import itertools
import json
import ntpath
import re
import shutil
import socket
import sys
import tempfile
import threading
import traceback
import time
import weakref
import sortedcontainers
from rekall i... |
from Constants import *
from Communication import Communication
class HookedGL:
def __init__(self, address, port):
from Communication import Communication
self.address = address
self.port = port
self.comms = Communication(address, port)
self.comms.connect()
self.comm ... |
import numpy as np
import scipy as np
from solvers import *
from interp import *
from core import *
class Species(object):
dtype = np.double
def __init__(self, N, q, m,
z0=None, y0=None, x0=None,
vz0=None, vy0=None, vx0=None):
self.N = N
self.q = q
sel... |
from PVG import *
Canvas().draw(Circle()).save("circle.png") |
i = int(raw_input(''))
n = 0
print('*')*i
n = 0
for n in range(0, i-2):
print (('*')+(' ')*(i-2)+('*'))
n = 0
print('*')*i |
import config
import utils
import telebot
from telebot import types
bot = telebot.TeleBot(config.token)
@bot.message_handler(commands=['show'])
def show(message):
try:
command, arg = message.text.split(" ", 1)
markup=utils.gen_markup(command,arg)
bot.send_message(message.chat.id, 'choose a v... |
from pydantic import BaseModel, validator, NonNegativeInt, constr
from data.model.validators import check_valid_uuid
from typing import Optional, List
class ArtistRecord(BaseModel):
""" Each individual record for top artists
Contains the artist name, MessyBrainz ID, MusicBrainz IDs and listen count.
"""
... |
from django.test import TestCase
from ..models import event_alias
from ..models import event_alias_type
from ..models import event
import random
class test_event_alias(TestCase):
def setUp(self):
self.subject = event_alias(name='Name')
# Set up an Event Alias Type:
self.subject_event_alias_t... |
from flask import Response, request, Flask
from pymongo import MongoClient
from bson.objectid import ObjectId
import json
app = Flask(__name__)
app.debug = True
client = MongoClient()
db = client.lunch
@app.route('/')
def home():
#
return 'Lunches App'
@app.route('/lunch/', methods=['GET'])
def index():
# l... |
import sys
sys.path.insert(0, './RAID')
sys.path.insert(0, './workloads')
sys.path.insert(0, './Disks')
import math
import matplotlib.pyplot as plt
import RAIDinterface
import ssdsim
import hddsim
import posixsim as psx
import numpy as np
def simulate():
# New RAID interface
#R0 = RAIDinterface.RAID0(RAIDtype=0, disk... |
from .tensor import *
from .construct import * |
from __future__ import absolute_import
from edenscm.mercurial import commands, error, hg, node, phases, registrar, scmutil
from edenscm.mercurial.i18n import _
from . import common
cmdtable = {}
command = registrar.command(cmdtable)
hex = node.hex
@command(
"fold|squash",
[
("r", "rev", [], _("revision ... |
def brewer_hack(nm = 'RdBu', typ = 'diverging',N=11,rev=True,cmap_name='newcmap'):
'''
def brewer_hack(nm = 'RdBu', typ = 'diverging',N=11,rev=True,cmap_name='newcmap'):
'''
import brewer2mpl
import matplotlib as mpl
N_brewer = N
if N > 11:
N_brewer = 11
junk = brewer2mpl.get_map(nm,... |
"""
UTILITIES
- parse a propfind request body into a list of props
"""
from xml.dom import minidom
from string import lower, split, atoi, joinfields
import urlparse
from StringIO import StringIO
from constants import RT_ALLPROP, RT_PROPNAME, RT_PROP
from status import STATUS_CODES
VERSION = '0.8'
AUTHOR = 'Simon Pamie... |
"""Check to see the source state for a particular package
Success if there is src ready to build
service_state has more details
Packages which don't use a service are indistinguishable from a
successful service run.
:term:`Workitem` fields IN:
:Parameters:
:ev.namespace (string):
Used to contact th... |
import itertools
import json
import classifiedunicodevalue
from classifiedunicodevalue import ClassifiedUnicodeValue
import unicodecsv
from version import savutilName, savutilVersion
def compressedValueSequence (s, jsonType=None):
length = sum (1 for _ in s [1])
value = s [0]
if value is not None:
if jsonType == "... |
"""
Macondo
==================================
"""
from datetime import datetime, timedelta
from opendrift.readers import reader_netCDF_CF_generic
from opendrift.models.openoil import OpenOil
o = OpenOil(loglevel=20) # Set loglevel to 0 for debug information
reader_globcurrent = None
try:
reader_globcurrent = read... |
from django.conf.urls import url
from django.contrib.auth.views import logout
from . import views
urlpatterns = [
url(r'^register/$', views.Register.as_view(), name='user-register'),
url(r'^verify/(?P<code>\w{32})/$', views.Verify.as_view(), name='user-verify'),
url(r'^password/modify/$', views.PasswordModi... |
from lib import hw
from lib.vector import Vector
from math import ceil, pi, copysign
from time import time
from threading import Thread, Event, Lock
import subprocess
import cv2
import numpy as np
import PIL.Image
class Image(object):
"""Image wrapper with helper functions for conversion between cv/numpy and PIL fo... |
"""
"""
import datetime as dt
from dateutil.relativedelta import relativedelta
import math
from joj.utils import constants
class SpinupHelper(object):
"""
Manages spin-up for model runs
"""
def calculate_spinup_start(self, driving_start, run_start, duration_in_years):
"""
Calculate the s... |
import sys, os
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
source_suffix = '.rst'
source_encoding = 'utf-8'
master_doc = 'index'
project = u'PuppetMaster'
copyright = u'2010, Damien Garaud'
version = '0.1'
release = '0.1'
language = 'en'
exclude_patterns = ['_build']
show_authors = True
pygments... |
"""
Django settings for repo project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'qn... |
from django.db import models
class RequiresConsentFieldsModelMixin(models.Model):
consent_model = models.CharField(
max_length=50,
null=True,
editable=False)
consent_version = models.CharField(
max_length=10,
null=True,
editable=False)
class Meta:
abst... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0008_auto_20150205_1926'),
]
operations = [
migrations.AlterField(
model_name='city',
name='email',
field=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.