code stringlengths 1 199k |
|---|
__version__ = "1.2.3" |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import re
import unittest2
import warnings
import httpretty as hp
from coinbase.client import Client
from coinbase.client import OAuthClient
from coinbase.erro... |
from engine.constants import BOARD_INDEX, C_PERM_INDEX, WK_SQ_INDEX, BK_SQ_INDEX, EN_PAS_INDEX, NORTH, SOUTH, \
RANK2, RANK7, WKC_INDEX, WQC_INDEX, BKC_INDEX, BQC_INDEX, CASTLE_VOIDED, CASTLED, A1, A8, E1, E8, C1, C8, G1, \
G8, H1, H8, WHITE, BLACK, HALF_MOVE_INDEX, FULL_MOVE_INDEX, TURN_INDEX, B8, B1, D1, D8, ... |
""" 1. Parse log file of a webserver
2. Print the filename and number of bytes delivered for 200 responses
"""
import re
import sys
from os import path
import operator
import itertools
log_file_path = "server.log"
log_data = []
pattern = re.compile(r'\[(?P<time>.+)\](\s+\")(?P<requestType>\w+)(\s+)(?P<fileName>.*?)... |
import datetime
from flask.ext.bcrypt import generate_password_hash
from flask.ext.login import UserMixin
from peewee import *
DATABASE = SqliteDatabase(':memory:')
class User(Model):
email = CharField(unique=True)
password = CharField(max_length=100)
join_date = DateTimeField(default=datetime.datetime.now)... |
import setuptools
from setuptools import setup, find_packages
if setuptools.__version__ < '0.7':
raise RuntimeError("setuptools must be newer than 0.7")
version = "0.1.3"
setup(
name="pinger",
version=version,
author="Pedro Palhares (pedrospdc)",
author_email="pedrospdc@gmail.com",
description="... |
import cv2
import numpy as np
class VideoCamera(object):
def __init__(self):
self.video = cv2.VideoCapture(0)
def __del__(self):
self.video.release()
def get_frame(self):
success, image = self.video.read()
ret, jpeg = cv2.imencode('.jpg', image)
return jpeg.tostring() |
"""
Implements counterwallet asset-related support as a counterblock plugin
DEPENDENCIES: This module requires the assets module to be loaded before it.
Python 2.x, as counterblock is still python 2.x
"""
import os
import sys
import time
import datetime
import logging
import decimal
import urllib.request
import urllib.... |
def Woody():
# complete
print "Reach for the sky but don't burn your wings!"# this will make it much easier in future problems to see that something is actually happening |
import subprocess
import re
import os
from app import util
BLAME_NAME_REX = re.compile(r'\(([\w\s]+)\d{4}')
def git_path(path):
"""Returns the top-level git path."""
dir_ = path
if os.path.isfile(path):
dir_ = os.path.split(path)[0]
proc = subprocess.Popen(
['git', 'rev-parse', '--show-t... |
from django.urls import reverse_lazy
from django.shortcuts import redirect
from itertools import chain
from datetime import datetime
from decimal import Decimal
from djangosige.apps.base.custom_views import CustomDetailView, CustomCreateView, CustomListView
from djangosige.apps.estoque.forms import EntradaEstoqueForm, ... |
import serial
port = "COM5"
baud = 19200
try:
ser = serial.Serial(port, baud, timeout=1)
ser.isOpen() # try to open port, if possible print message and proceed with 'while True:'
print ("port is opened!")
except IOError: # if port is already opened, close it and open it again and print message
ser.close... |
import spacy
nlp = spacy.load('en')
text = open('customer_feedback_627.txt').read()
doc = nlp(text)
for entity in doc.ents:
print(entity.text, entity.label_)
doc1 = nlp(u'the fries were gross')
doc2 = nlp(u'worst fries ever')
doc1.similarity(doc2)
nlp.add_pipe(load_my_model(), before='parser') |
import csv
import json
import random
import os
import re
import itertools
import shutil
currentDatabase = ''
def showDatabases():
return (next(os.walk('./db'))[1])
def createDatabase(databaseName):
newDatabaseDirectory = (r'./db/') + databaseName
if not os.path.exists(newDatabaseDirectory):
#Create directory
os.... |
import os, sys, re
import optparse
import shutil
import pandas
import numpy
import gc
import subprocess
version="0.70A"
date="10/11/2016"
print "-----------------------------------------------------------------------"
print "Welcome to the MSstats wrapper for Galaxy, Wohlschlegel Lab UCLA"
print "Written by William Bar... |
import base64
def weirdEncoding(encoding, message):
return base64.b64decode(message, encoding).decode() |
from qdec_partial import get_ip_name
from qdec_partial import QDEC |
import sys
p = os.path.dirname(os.path.abspath(__file__))
p = os.path.join(p, '..', '..')
sys.path.insert(0, p)
from pyqtgraph.Qt import QtCore, QtGui
from DockArea import *
from Dock import *
app = QtGui.QApplication([])
win = QtGui.QMainWindow()
area = DockArea()
win.setCentralWidget(area)
win.resize(800,800)
from Do... |
from scrapy import Spider
from scrapy.http import Request
from firmware.items import FirmwareImage
from firmware.loader import FirmwareLoader
class FoscamSpider(Spider):
name = "foscam"
allowed_domains = ["foscam.com"]
start_urls = [
"http://www.foscam.com/download-center/firmware-downloads.html"]
... |
from django.utils import simplejson
from dajaxice.decorators import dajaxice_register
from django.utils.translation import ugettext as _
from django.template.loader import render_to_string
from dajax.core import Dajax
from django.db import transaction
from darkoob.book.models import Book, Review
@dajaxice_register(meth... |
from osmcache.cli import base
if __name__ == '__main__':
base() |
"""
Run hugs pipeline.
"""
from __future__ import division, print_function
import os, shutil
from time import time
import mpi4py.MPI as MPI
import schwimmbad
from hugs.pipeline import next_gen_search, find_lsbgs
from hugs.utils import PatchMeta
import hugs
def ingest_data(args):
"""
Write data to database with ... |
import numpy as np
import networkx
from zephyr.Problem import SeisFDFDProblem
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.ticker as ticker
import matplotlib
matplotlib.rcParams.update({'font.size': 20})
cellSize = 1 # m
freqs = [2e2] # Hz
density = 2700 ... |
import os.path as osp
import os
USE_GPU = False
AWS_REGION_NAME = 'us-east-2'
if USE_GPU:
DOCKER_IMAGE = 'dementrock/rllab3-shared-gpu'
else:
DOCKER_IMAGE = 'dwicke/parameterized:latest'
DOCKER_LOG_DIR = '/tmp/expt'
AWS_S3_PATH = 's3://pytorchrl/pytorchrl/experiments'
AWS_CODE_SYNC_S3_PATH = 's3://pytorchrl/pyt... |
"""
load score-level asroutput files into a pandas df
"""
import re
import pandas as pd
def mr_csvs():
"""
load data/mr.p and generate two csv files.
:return:
"""
x = pickle.load(open('data/mr.p', "rb"))
revs, W, W2, word_idx_map, vocab = x[0], x[1], x[2], x[3], x[4]
print("mr.p has been loa... |
"""
Wikipedia lookup plugin for Botty.
Example invocations:
#general | Me: what is fire
#general | Botty: wikipedia says, "Fire is the rapid oxidation of a material in the exothermic chemical process of combustion, releasing heat, light, and various reaction products. Slower oxidative processes like rusti... |
import logging
import rethinkdb as r
log = logging.getLogger(__name__)
class Database():
def __init__(self, bot):
self.bot = bot
self.db_name = self.bot.config.rname
self.db = None
r.set_loop_type("asyncio")
self.ready = False
def get_db(self):
"""
Returns... |
import pygame
import sys
from game import constants, gamestate
from game.ai.easy import EasyAI
from game.media import media
from game.scene import Scene
CONTINUE = 0
NEW_GAME = 1
QUIT = 2
OPTIONS = [
('Continue', 'opt_continue', lambda scene: scene.game_running),
('2 Player', 'start_2_player', None),
('Vs C... |
"""
Qizx Python API bindings
:copyright: (c) 2015 by Michael Paddon
:license: MIT, see LICENSE for more details.
"""
from .qizx import (
Client, QizxError, QizxBadRequestError, QizxServerError,
QizxNotFoundError, QizxAccessControlError, QizxXMLDataError,
QizxCompilationError, QizxEvaluationError, QizxTimeou... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.AutoField(serialize=False, primary_key=True, v... |
import unittest
"""
Given an unordered array of integers, find the length of longest increasing subsequence.
Input: 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
Output: 6 (0, 2, 6, 9, 11, 15)
"""
"""
A great explanation of the approach appears here:
http://www.geeksforgeeks.org/longest-monotonically-increasing-... |
"""Retriever script for direct download of vertnet-mammals data"""
from builtins import str
from retriever.lib.models import Table
from retriever.lib.templates import Script
import os
from pkg_resources import parse_version
try:
from retriever.lib.defaults import VERSION
except ImportError:
from retriever impor... |
from delta_variance import DeltaVariance, DeltaVariance_Distance |
from msrest.serialization import Model
class CheckNameRequest(Model):
"""CheckNameRequest.
:param name: Workspace collection name
:type name: str
:param type: Resource type. Default value:
"Microsoft.PowerBI/workspaceCollections" .
:type type: str
"""
_attribute_map = {
'name': ... |
blank_datafile = '/home/kyleb/Dropbox/UCSF/cas9/FCS/150916-3.1/kyleb/150916-rfp-cas9/96 Well - Flat bottom_002/Specimen_001_F1_F01_046.fcs'
script_output_dir = 'script_output'
sample_directory = '/home/kyleb/Dropbox/UCSF/cas9/FCS/150916-3.1/kyleb/150916-rfp-cas9/96 Well - Flat bottom_002'
rows_in_plate = 'ABCDEFGH'
col... |
import time
from matrix_client.client import MatrixClient
from matrix_client.api import MatrixRequestError
from requests.exceptions import ConnectionError, Timeout
import argparse
import random
from configparser import ConfigParser
import re
import traceback
import urllib.parse
import logging
import os
import sys
impor... |
import os
import urllib
from glob import glob
import dask.bag as db
import numpy as np
import zarr
from dask.diagnostics import ProgressBar
from netCDF4 import Dataset
def download(url):
opener = urllib.URLopener()
filename = os.path.basename(url)
path = os.path.join('data', filename)
opener.retrieve(ur... |
import sys, os
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'Optcoretech'
copyright = u'2014, Sheesh Mohsin'
version = '0.1'
release = '0.1'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
html_theme = 'default'
html_static_path = ['_... |
import random
class ImageQueryParser:
def __init__(self):
pass
def parse(self, query_string):
tab = query_string.split(" ")
last = tab[-1].lower()
is_random = False
index = 0
if last.startswith("-"):
if last == "-r":
is_random = True
... |
import math
def area(a, b, c):
A1 = ((4*math.pi)*a**2)
A2 = ((4*math.pi)*b**2)
A3 = ((4*math.pi)*c**2)
Avg = (A1+A2+A3)/3
return Avg
def output(a, b ,c , d, e):
return """
Hello there, {}!
equation: ((4*math.pi)*{}**2)((4*math.pi)*{}**2)((4*math.pi)*{}**2)
Calculating average area of three spheres...
the answer i... |
from turtle import *
shape("turtle")
forward(100)
left(120)
forward(100)
left(120)
forward(100)
left(120)
done() |
from setuptools import setup, find_packages
setup(name='BIOMD0000000360',
version=20140916,
description='BIOMD0000000360 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000360',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages()... |
f = open('test_content.txt', 'r')
print(f.read())
f.close()
with open('test_content.txt', 'r') as f:
print(f.read()) |
import os
from thlib.side.Qt import QtWidgets as QtGui
from thlib.side.Qt import QtGui as Qt4Gui
from thlib.side.Qt import QtCore
from thlib.environment import env_mode, env_inst, env_write_config, env_read_config
import thlib.global_functions as gf
import thlib.ui.checkin_out.ui_drop_plate as ui_drop_plate
import thli... |
import csv, re
from cobra.core import Gene,Model
from settings import REACTION_PREFIX
def read_ec_numbers(fname):
rxn2ec = {row[0]:row[1] for row in csv.reader(open(fname))}
ECs_rxns = {}
for rxn,ec in rxn2ec.items():
if not re.search('^[1-6]\.[0-9][0-9]*\.[0-9][0-9]*',ec):
continue
... |
from __future__ import division
import sys
from utils import *
from igraph import Graph
import cPickle as pickle
import logging as log
import scipy.sparse as sps
if __name__ == '__main__':
log.basicConfig(level=log.DEBUG,
format='%(asctime)s:%(levelname)s:%(message)s')
matrix_file_name = sys.argv[... |
from aces.tools import mkdir, mv, cd, cp, mkcd, shell_exec,\
exists, write, passthru, toString, pwd, debug, ls, parseyaml
import aces.config as config
from aces.binary import pr
from aces.runners import Runner
from aces.graph import plot, series, pl, fig
from aces.script.vasprun import exe as lammpsvasprun
import a... |
from sys import argv
| |
__author__ = 'stasstels'
import cv2
import sys
image = sys.argv[1]
targets = sys.argv[2]
img = cv2.imread(image, cv2.IMREAD_COLOR)
with open(targets, "r") as f:
for line in f:
print line
(_, x, y) = line.split()
cv2.circle(img, (int(x), int(y)), 20, (255, 0, 255), -1)
cv2.namedWindow("image", cv2.W... |
import os
import sys
import tools
import json
print("The frame :")
name = raw_input("-> name of the framework ?")
kmin = float(raw_input("-> Minimum boundary ?"))
kmax = float(raw_input("-> Maximum boundary ?"))
precision = float(raw_input("-> Precision (graduation axe) ?"))
nb_agent_per_graduation = int(raw_input("->... |
class Controller(object):
def __init__(self, model):
self._model = model
self._view = None
def register_view(self, view):
self._view = view
def on_quit(self, *args):
raise NotImplementedError
def on_keybinding_activated(self, core, time):
raise NotImplementedError... |
import sys
import re
import random
l1conf = []
def parseconfig(conf):
global l1conf
l1conf.extend([[],[],[]])
with open(conf, "r") as fp:
for line in fp:
if line.startswith("CONFIG_first_card_"):
kv = line.split("=")
l1conf[0].append((kv[0][len("CONFIG_first_card_"):], kv[1].strip("\"\'\r\n\t")))
eli... |
from distutils.core import setup, Extension
poppler_install_path = '/usr'
import multivio
setup(
name='multivio',
version=multivio.__version__,
description='Multivio server.',
long_description='''Multivio is a project...''',
license=multivio.__license__,
url='http://www.multivio.org',
ext_mo... |
import glob, imp
import events
class EventManager:
def __init__(self):
self.Chat_Message_Event = events.ChatMessageEventHandler()
self.Player_Join_Event = events.PlayerJoinEventHandler()
self.Player_Leave_Event = events.PlayerLeaveEventHandler()
self.Player_Move_Event = events.Player... |
name='Light Blue Fun Timexxxx'
author='Travis Wells'
shortname='litebluebg' # out file will be shortname with a 'vxp' extension
color=(155,204,224) # Set to the Red,Green,Blue of the color you want.
uniqueid=0 # Set to 0 if you don't have one.
import os
import sys
sys.path.append('code')
import zipfile
import pygame
fr... |
import os, sys
import stat
import shutil
import time
import subprocess
import storage
import selinux
from flags import flags
from constants import *
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
import backend
import isys
import iutil
import packages
import logging
log = logging.getLogger("anaconda")
cl... |
from wx import ImageFromStream, BitmapFromImage, EmptyIcon
import cStringIO, zlib
def getData():
return zlib.decompress(
'x\xda\x01}\x08\x82\xf7\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\
\x00\x00 \x08\x02\x00\x00\x00\xfc\x18\xed\xa3\x00\x00\x00\x03sBIT\x08\x08\
\x08\xdb\xe1O\xe0\x00\x00\x085IDATH\x89\xb5... |
"""
-------------------------------------
N A C S P Y T H O N S C R I P T
-------------------------------------
NACS version: 2.0.2745 - pre3
NACS architecture: CENTOS 5.11 (X86_64)
File generated at Tue Jan 20 16:55:05 2015
On host 'lse86' by 'cae42'
"""
from __future__ import division
try:
from nacs.scripting ... |
import ir_translation
import update |
import unittest, tempfile, os, glob, logging
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared import xml_utils, ElementTree
class xml_test_data(unittest.TestCase):
def get_tmp_files(self, prefix, sufix):
path_string = os.path.join('/tmp', "%s*%s" % ... |
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class IPSec(Plugin):
"""ipsec related information
"""
plugin_name = "ipsec"
packages = ('ipsec-tools',)
class RedHatIpsec(IPSec, RedHatPlugin):
"""ipsec related information for Red Hat distributions
"""
files = ('/etc/r... |
from mock import patch
import networkx as nx
from nav.models.manage import SwPortVlan, Vlan
from nav.netmap import topology
from nav.topology import vlan
from .topology_testcase import TopologyTestCase
class TopologyLayer2TestCase(TopologyTestCase):
def setUp(self):
super(TopologyLayer2TestCase, self).setUp... |
from __future__ import unicode_literals
"""
AllSkyMap is a subclass of Basemap, specialized for handling common plotting
tasks for celestial data.
It is essentially equivalent to using Basemap with full-sphere projections
(e.g., 'hammer' or 'moll') and the `celestial` keyword set to `True`, but
it adds a few new method... |
"""
"""
import time, sys, os
sys.path.insert(1, os.path.dirname( os.path.abspath(__file__) ) + '/../../')
from pxStats.lib.StatsPaths import StatsPaths
from pxStats.lib.LanguageTools import LanguageTools
CURRENT_MODULE_ABS_PATH = os.path.abspath(__file__).replace( ".pyc", ".py" )
"""
- Small function that adds px... |
import logging
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
from streamlink.utils import parse_json
log = logging.getLogger(__name__)
class Mitele(Plugin):
_url_re = re.compile(r"https?:... |
from gi.repository import Gtk
from gi.repository import Gdk
import logging
from virtManager.baseclass import vmmGObjectUI
from virtManager.asyncjob import vmmAsyncJob
from virtManager import uiutil
from virtinst import StoragePool
PAGE_NAME = 0
PAGE_FORMAT = 1
class vmmCreatePool(vmmGObjectUI):
def __init__(self,... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('jumpserver.views',
# Examples:
url(r'^$', 'index', name='index'),
# url(r'^api/user/$', 'api_user'),
url(r'^skin_config/$', 'skin_config', name='skin_config'),
url(r'^login/$', 'Login', name='login'),
url(r'^logout/$', '... |
import os
import sys
import unittest
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." )
pth = root_folder #+ os.sep + 'worldbuild'
sys.path.append(pth)
from worldbuild.crafting import craft as mod_craft
class TestTemplate(unittest.TestCase):
def setUp(self):
unittest.... |
from modules.Utils import runCommand
import re
import sys
def parseOptions(command):
so, se, rc = runCommand("gofed %s --help" % command)
if rc != 0:
return []
options = []
option_f = False
for line in so.split("\n"):
if line == "Options:":
option_f = True
continue
if option_f == True:
if line == ""... |
'''
Created on 24 Feb 2015
@author: oche
'''
from __future__ import unicode_literals
from __future__ import division
import argparse
import os
import sys
import time
import re
import logging
import json
import numpy
from plotter import makeSubPlot
from os.path import expanduser
from util import validURLMatch, validYout... |
"""This module represents the Greek language.
.. seealso:: http://en.wikipedia.org/wiki/Greek_language
"""
from __future__ import unicode_literals
import re
from translate.lang import common
from translate.misc.dictutils import ordereddict
class el(common.Common):
"""This class represents Greek."""
# Greek uses... |
import re
from lxml.cssselect import CSSSelector
from zope.testbrowser.browser import Browser
from splinter.element_list import ElementList
from splinter.exceptions import ElementDoesNotExist
from splinter.driver import DriverAPI, ElementAPI
from splinter.cookie_manager import CookieManagerAPI
import mimetypes
import l... |
from __future__ import print_function, division, absolute_import
import logging
import sys
import six
import decorator
import dbus.service
import json
import re
from rhsmlib.dbus import exceptions
log = logging.getLogger(__name__)
__all__ = [
'dbus_handle_exceptions',
'dbus_service_method',
'dbus_service_si... |
from unittest import TestCase
class TestLoadUser(TestCase):
def test_find_user(self):
from backend import load_user
user = load_user('Neill', 'password')
self.assertIsNotNone(user)
self.assertEqual(user.password, "Password")
user = load_user("Tony")
self.assertIsNone(... |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
try:
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
except ImportError:
USE_MATPLOTLIB = False... |
from routersploit.modules.creds.cameras.arecont.ssh_default_creds import Exploit
def test_check_success(target):
""" Test scenario - testing against SSH server """
exploit = Exploit()
assert exploit.target == ""
assert exploit.port == 22
assert exploit.threads == 1
assert exploit.defaults == ["a... |
from random import shuffle
import pytest
from utils import testgen
from utils.version import current_version
from cfme.web_ui import paginator, summary_title
from cfme.containers.pod import Pod, paged_tbl as pod_paged_tbl
from cfme.containers.provider import ContainersProvider, paged_tbl as provider_paged_tbl,\
nav... |
import json
import re
from trac.admin import IAdminCommandProvider
from trac.attachment import Attachment, IAttachmentChangeListener
from trac.core import Component, implements
from trac.versioncontrol import (
RepositoryManager, NoSuchChangeset, IRepositoryChangeListener)
from trac.web.api import HTTPNotFound, IRe... |
from pyramid.httpexceptions import (
HTTPException,
HTTPFound,
HTTPNotFound,
HTTPBadRequest,
HTTPConflict,
)
from pyramid.security import Authenticated
from pyramid.view import view_config
from perpetualfailure.db import session
from perpetualfailure.knowledgebase.models import (
KB_Article,
... |
import os
from PyQt4.QtCore import Qt, SIGNAL
from PyQt4.QtGui import QScrollBar, QAbstractSlider
class hexScrollBar(QScrollBar):
def __init__(self, whex):
QScrollBar.__init__(self)
self.init(whex)
self.initCallBacks()
def init(self, whex):
self.whex = whex
self.heditor =... |
import omf.cosim
glw = omf.cosim.GridLabWorld('6267', 'localhost', 'GC-solarAdd.glm', '2000-01-01 0:00:00')
glw.start()
print (glw.readClock())
print (glw.read('test_solar', 'generator_status'))
glw.write('test_solar','generator_status', 'OFFLINE')
print ('Switched off solar')
print (glw.read('test_solar', 'generator_s... |
import cv2
import copy
import numpy
import math
INPUT_DIRECTORY = 'input/'
OUTPUT_DIRECTORY = 'output/'
IMAGE_FILE_EXTENSION = '.JPG'
MAX_INTENSITY = 255 # 8-bit images
def laplacianFilter(image):
"""Approximates the second derivative, bringing out edges.
Referencing below zero wraps around, so top and left sides w... |
import sys
sys.path.insert(0, './')
sys.path.insert(0, '../')
sys.path.insert(0, '../../') |
import os
import sys
import shutil
import subprocess
homedir = os.getcwd()
directory = "lis-next"
if os.path.exists(directory):
shutil.rmtree(directory)
def run(cmd):
output = subprocess.call(cmd,shell=True)
return output
def buildrhel5():
print "Cleaning up LISISO direcroty"
os.makedirs(directory)
run("git clone... |
from CoaSim import *
cm = CustomMarker(0.1)
assert cm.position == 0.1
class MyMarker(CustomMarker):
def __init__(self,pos):
CustomMarker.__init__(self,pos)
def defaultValue(self):
return 1
def mutate(self, parentAllele, edgeLength):
return parentAllele+1
mm = MyMarker(0.5)
assert mm.... |
import os
import shutil
import portage
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
from portage.localization import _
import selinux
from selinux import is_selinux_enabled
def copyfile(src, dest):
src = _unicode_encode(src, encoding=_encodings['fs'], errors='s... |
import renpy.display
from renpy.display.render import render, Render, Matrix2D
class Solid(renpy.display.core.Displayable):
"""
:doc: disp_imagelike
A displayable that fills the area its assigned with `color`.
::
image white = Solid("#fff")
"""
def __init__(self, color, **properties):
... |
from main import KeyboardHandler
import threading
import thread
import pyatspi
def parse(s):
"""parse a string like control+f into (modifier, key).
Unknown modifiers will return ValueError."""
m = 0
lst = s.split('+')
if not len(lst):
return (0, s)
d = {
"shift": 1 << pyatspi.MODI... |
from .Plugin import Plugin
class Plugins(list):
def __init__(self):
list.__init__(self)
@property
def length(self):
return len(self)
def __getattr__(self, key):
return self.namedItem(key)
def __getitem__(self, key):
try:
key = int(key)
return s... |
import xml.etree.cElementTree
from os import environ, unlink, symlink, path
from Tools.Directories import SCOPE_SKIN, resolveFilename
import time
from Tools.StbHardware import setRTCoffset
class Timezones:
def __init__(self):
self.timezones = []
self.readTimezonesFromFile()
def readTimezonesFromFile(self):
try:... |
import math
import random
import mapp
import geom
class Robot:
def __init__(self, mapp, num_particles):
"""
Initialize the robot with a map.
Inputs:
mapp: a Map object on which the robot will move.
"""
self.d_sigma = 0.05 # Uncertainty for distances.
self.... |
from Globals import *
from globals import *
from Config import config
from HTML import page_factory
from Tables import tables
from Sessions import sessions
from URLParse import URI
from Log import log
from mod_python import apache
import os
from CoreDM import dms
def document(req,
title='',
sh... |
"""
Sandbox for "swell-foop" command
"""
import glob
import os
import signal
import sys
import network_mod
import subtask_mod
class Main:
"""
Main class
"""
def __init__(self) -> None:
try:
self.config()
sys.exit(self.run())
except (EOFError, KeyboardInterrupt):
... |
import logging
from autotest.client.shared import error
from virttest import aexpect, utils_misc
@error.context_aware
def run_autotest_regression(test, params, env):
"""
Autotest regression test:
Use Virtual Machines to test autotest.
1) Clone the given guest OS (only Linux) image twice.
2) Boot 2 V... |
from Screens.Screen import Screen
from Components.GUIComponent import GUIComponent
from Components.VariableText import VariableText
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Button import Button
from Components.FileList import FileList
from Components.ScrollLabel imp... |
"""
SuperSocket.
"""
from __future__ import absolute_import
from select import select, error as select_error
import errno
import os
import socket
import struct
import time
from scapy.config import conf
from scapy.consts import LINUX, DARWIN, WINDOWS
from scapy.data import MTU, ETH_P_IP
from scapy.compat import raw, byt... |
import py, sys, platform
import pytest
from testing import backend_tests, test_function, test_ownlib
from cffi import FFI
import _cffi_backend
class TestFFI(backend_tests.BackendTests,
test_function.TestFunction,
test_ownlib.TestOwnLib):
TypeRepr = "<ctype '%s'>"
@staticmethod
de... |
import logging
import re
import urllib2
class M3U8(object):
def __init__(self, url=None):
self.url = url
self._programs = [] # main list of programs & bandwidth
self._files = {} # the current program playlist
self._first_sequence = None # the first sequence to start fetching
... |
from django.apps import AppConfig
class FinancesConfig(AppConfig):
name = "finances" |
"""Extensions/plugins dispatchers."""
import copy
import logging
import sys
from stevedore import EnabledExtensionManager
from .settings import settings
from ..utils import stacktrace
class Dispatcher(EnabledExtensionManager):
"""
Base dispatcher for various extension types
"""
#: Default namespace pref... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.