code
stringlengths
1
199k
import curses import sys import time import os.path import random import pickle from curses import wrapper gamedims = [5,22] currPos = [10,10] currPosList = [1,3] def main(stdscr):#{ curses.start_color() curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_...
__author__ = 'Sergey Efimov'
from django.conf.urls import url, include from django.conf import settings from paying_for_college.views import LandingView from django.contrib import admin urlpatterns = [ # url(r'^admin/', include(admin.site.urls)), url(r'^$', LandingView.as_view(), name='pfc-landing'), url(r'^compare-financial-ai...
""" Crawls a terrain raster from a starting point and "floods" everything at the same or lower elevation by producing a mask image of 1,0 values. """ import numpy as np from linecache import getline def floodFill(c,r,mask): """ Crawls a mask array containing only 1 and 0 values from the starting point (c=column...
"""Builder for Current and Pending Reports.""" import datetime as dt import sys import time from argparse import RawTextHelpFormatter import nameparser from regolith.helpers.basehelper import SoutHelperBase, DbHelperBase from regolith.dates import month_to_int, month_to_str_int from regolith.fsclient import _id_key fro...
from xml.etree.ElementTree import ElementTree from xml.etree.ElementTree import Element import xml.etree.ElementTree as etree from xml.dom import minidom import io """ using xml.etree.ElementTree """ def prettify(elem): """Return a pretty-printed XML string for the Element. """ rough_string = etree.tostring...
from distutils.core import setup setup( name = 'voxgenerator', packages = ['voxgenerator', 'voxgenerator.core', 'voxgenerator.plugin', 'voxgenerator.pipeline', 'voxgenerator.generator', 'voxgenerator.service', 'voxge...
""" .. module:: equity_master/tests :synopsis: equity_master module unit test package This package is designed to demonstrate TDD best practices: - Structured approach to test data creation - Per module unit test (not achievable due to time constraints) - Per public and critical private class method, instance meth...
import logging class BaseDebugInterface(object): def __init__(self, debuger): self.robotDebuger = debuger self.debugCtx = debuger.debugCtx self.logger = logging.getLogger("rbt.int") self.bp_id = 0 def start(self, settings): """start debug interface.""" pass de...
import unittest import time import logging import platform from tests import URLTEST_LOCAL_MEDIA from tests import utils from virtinst import Guest from virtinst import urlfetcher from virtinst import util from virtinst.urlfetcher import FedoraDistro from virtinst.urlfetcher import SuseDistro from virtinst.urlfetcher i...
import chromiumos.gen_autosuspend_rules print('# pci:v<00VENDOR>d<00DEVICE> (8 uppercase hexadecimal digits twice)') for entry in chromiumos.gen_autosuspend_rules.PCI_IDS: vendor, device = entry.split(':') vendor = int(vendor, 16) device = int(device, 16) print('pci:v{:08X}d{:08X}*'.format(vendor, devic...
import os import hashlib import datetime from django.db import models from django.conf import settings from django.contrib.auth.models import User from django.db import connection from django.db.models.signals import post_save def set_user_password(user, password): if user and password: password = password....
import ns.core class MyModel(object): """Simple model object to illustrate event handling.""" ## \return None. def Start(self): """Start model execution by scheduling a HandleEvent.""" ns.core.Simulator.Schedule(ns.core.Seconds(10.0), self.HandleEvent, ns.core.Simulator.Now().GetSeconds()) ...
""" import_errors test. """ import os import subprocess import import_basic from mysql.utilities.exception import MUTLibError, UtilError class test(import_basic.test): """Import Data This test executes the import utility on a single server. It tests the error conditions for importing data. It uses the i...
''' ps = psi4.Solver with psi4.quite_run(): ps.prepare_chkpt(mo_coeff, fock_on_mo, nelec, e_scf, nuclear_repulsion) ecc = ps.energy('CCSD', c.shape[1], hcore_on_mo, eri_on_mo) rdm1, rdm2 = ps.density(mo_coeff.shape[1]) eccsdt = ps.energy('CCSD(T)', c.shape[1], hcore_on_mo, eri_on_mo) rdm1, rdm2 = ps...
from pisi.actionsapi import shelltools, get, autotools, pisitools def setup(): autotools.configure ("--prefix=/usr\ --disable-static") def build(): autotools.make () def install(): autotools.rawInstall ("DESTDIR=%s" % get.installDIR()) pisitools.dodoc ("README", "ChangeLog", "L...
import time class Timer(object): ''' Simple timer control ''' def __init__(self, delay): self.current_time = 0 self.set_delay(delay) def pause(self, pause): if pause >= self.delay: self.current_time = time.clock() self.next_time = self.current_time + p...
import networkx as nx import networkx.algorithms as alg import numpy as np import matplotlib.pyplot as plt twitter = nx.Graph() twitter.add_node('Tom', {'age': 34}) twitter.add_node('Rachel', {'age': 33}) twitter.add_node('Skye', {'age': 29}) twitter.add_node('Bob', {'age': 45}) twitter.add_node('Mike', {'age': 23}) tw...
"""Test suite for the TG app's models""" from __future__ import unicode_literals from nose.tools import eq_ from wiki20 import model from wiki20.tests.models import ModelTest class TestGroup(ModelTest): """Unit test case for the ``Group`` model.""" klass = model.Group attrs = dict( group_name = "tes...
from django.core.serializers import json from django.http import HttpResponseNotFound, HttpResponse from django.views.generic import View from rest_test_data.models import Simple from rest_test_data.views import BaseTestDataRestView from nose.tools import assert_equal, assert_is_instance from mock import Mock, patch de...
__author__ = 'mark' import crcmod import logging import sys crc16 = crcmod.mkCrcFun(0x018408, 0xFFFF, True, 0x0000) logger = logging.getLogger('utilities.staribuscCrc') def checkcrc(buffer0): logger.debug("Check crc was called.") buffer0 = buffer0.encode('utf-8') rxcrc = buffer0[-4:] # assign the received ...
from __future__ import absolute_import from __future__ import print_function from future.utils import iteritems import abc import copy from twisted.internet import defer from twisted.python import log from buildbot import config from buildbot.reporters import utils from buildbot.util import httpclientservice from build...
from time import time import unittest from unittest.mock import patch, Mock from urllib.error import URLError from suds import WebFault from ..exceptions import ( ConnectError, ServiceError, ApiLimitError, AccountFault, TableFault, ListFault) from .. import client class InteractClientTests(unittest.TestCase): "...
import struct VOS_NT_WINDOWS32 = 0x00040004 VFT_APP = 0x00000001 RT_VERSION = 16 class VersionError(Exception): pass def w32_uc(text): """convert a string into unicode, then encode it into UTF-16 little endian, ready to use for win32 apis""" if type(text) is str: return unicode(text, "unicode-es...
import sys import argparse from threading import Thread, Lock from struct import unpack from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from httplib import HTTPResponse, HTTPSConnection from SocketServer import ThreadingMixIn import socket, os, select import time, sys, random import threading import selec...
''' Created on Jul 04, 2016 Modified on Aug 05, 2016 Version 0.01.b @author: rainier.madruga@gmail.com A simple Python Program to scrape the ESPN FC website for content. 2016-07Jul-04 RWN Initial Creation of the file to parse out league information and teams from the BBC si...
import csv from geopy import geocoders from collections import defaultdict import json def checkgeocode(geocode): #return len(geocode) if len(geocode) < 9: return "0"+str(geocode) else: return geocode with open('casualty.csv', 'rb') as f: reader = csv.reader(f) codelist = dict() for row in reader: ...
__author__ = 'lxr0827' import pymysql,requests,json import datetime APPID = "wx243dd553e7ab9da7" SECRET = "57f109fd1cce0913a76a1700f94c4e2d" AccessTokenURL = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + APPID + '&secret=' + SECRET r = requests.get(AccessTokenURL) if (r.status_code == ...
from collections import defaultdict class Solution: def longestDecomposition(self, text: str) -> int: num = 0 L = len(text) l, r = 0, L - 1 mp1 = defaultdict(int) mp2 = defaultdict(int) while l < r: mp1[text[l]] += 1 mp2[text[r]] += 1 ...
import time import sys import string import urllib2 import re import types from bs4 import BeautifulSoup import xml.etree.cElementTree as ET class crawler_wikipedia: # the start url: startUrl = u'' # the prefix of wikipedia api string apiPrefix = u'http://zh.wikipedia.org/w/api.php?action=query&prop=ext...
def get_timestamp(): import time return int(time.time()) def load_name_map(map_file_path): from os.path import isfile import ConfigParser config = ConfigParser.RawConfigParser() config.read(map_file_path) if not config.has_section("effort"): raise Exception("Missing effort in {0}".fo...
import os import sys if sys.version_info[:2] == (2, 6): import unittest2 as unittest else: import unittest from avocado.utils import process basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..') basedir = os.path.abspath(basedir) class StandaloneTests(unittest.TestCase): def setUp(s...
"""Module for running microtests on how well the extraction works - this module is STANDALONE safe""" import ConfigParser import glob import traceback import codecs import bibclassify_config as bconfig import bibclassify_engine as engine log = bconfig.get_logger("bibclassify.microtest") def run(glob_patterns, v...
from PyQt4 import QtGui, QtCore class Walls(QtGui.QGraphicsPixmapItem): def __init__(self, name): super(Walls, self).__init__() self.setPixmap(QtGui.QPixmap(name)) def create_walls(): obstacles = [] wall1 = Walls("./resources/images/obstacle1.png") wall1.setPos(175, 102) wall2 = Wall...
import os BASEDIR = os.path.abspath(os.path.dirname(__file__)) DEBUG = False DB_HOST = 'localhost' DB_NAME = 'scoremodel' DB_USER = 'scoremodel' DB_PASS = 'scoremodel' use_ssl = False SSL_CA = '/etc/mysql/certs/ca-cert.pem' SSL_KEY = '/etc/mysql/keys/client-key.pem' SSL_CERT = '/etc/mysql/certs/client-cert.pem' WTF_CSR...
from chronotope.model.base import PublicationWorkflowBehavior from chronotope.model.base import SQLBase from chronotope.model.category import CategoryRecord from chronotope.model.location import LocationRecord from chronotope.utils import ensure_uuid from chronotope.utils import html_index_transform from cone.app.model...
from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x05\x96\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x18\x00\x00\x00\x18\x08\x06\x00\x00\x00\xe0\x77\x3d\xf8\ \x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\ \x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0d\xd7\x...
""" MUSE -- A Multi-algorithm-collaborative Universal Structure-prediction Environment Copyright (C) 2010-2017 by Zhong-Li Liu 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 version 2 of the...
"""Simple macros created by recording actions This plugin provides macro recording """ import os import wx from wx.lib.pubsub import Publisher from peppy.yapsy.plugins import * from peppy.actions import * from peppy.actions.minibuffer import * from peppy.major import MajorMode from peppy.majormodematcher import MajorMo...
from pisi.actionsapi import shelltools, get, autotools, pisitools def setup(): autotools.configure ("--prefix=/usr\ --disable-static\ --disable-docs\ --docdir=/usr/share/doc/fontconfig-2.10.2") def build(): autotools.make () def insta...
""" .. module:: instrument_alias_type The **Instrument Alias Type** Model. Here's a complete table of values, from the MusicBrainz database dump of 2017-07-22: +----+-----------------+--------+-------------+-------------+--------------------------------------+ | id | name | parent | child_order | description...
import stage import gameloop import math import random import config import gamestate as gs direction = (0, 0) lastPos = (0, 0) snake = [] speed = 1 apples = [] grow = config.initial_size - 1 score = 0 lives = 1 livesMax = 1 def update(): moveSnake() checkCatch() checkPositionAllowed() def checkCatch(): ...
from __future__ import print_function, division, absolute_import from subscription_manager.ga import GObject as ga_GObject from subscription_manager.ga import Gtk as ga_Gtk def wrap_line(line, max_line_size=100): if len(line) < max_line_size: return line ret = [] l = "" for w in line.split(): ...
"""A very simple logger that tries to be concurrency-safe.""" import os, sys import time import traceback import subprocess import select LOG_FILE = '/var/log/nodemanager.func' LOG_NONE=0 LOG_NODE=1 LOG_VERBOSE=2 LOG_LEVEL=1 def set_level(level): global LOG_LEVEL assert level in [LOG_NONE,LOG_NODE,LOG_VERBOS...
import unittest import string from pprint import pprint import XGram, XGram.Parser, XGram.Exceptions from XGram.Generator.Prebuilt import Codons from XGram.Model import Annotation import Bio.Data.CodonTable class GeneratorCodonsTest(unittest.TestCase): """ A test class for testing a grammar """ def setU...
import codecs import logging logger = logging.getLogger(__name__) class TextAnalyzer: def __init__(self): logger.debug('-- Initializing TextAnalyzer --') """ Deze functie leest een stopwoorden file (stoplist_tno.tab) in en retourneert deze woorden in een dictionary """ def readStopWordsF...
''' Poodle implementation with a client <--> proxy <--> server ''' import argparse import random import re import select import socket import SocketServer import ssl import string import sys import struct import threading import time from utils.color import draw from pprint import pprint from struct import * class ...
from asgiref.sync import async_to_sync from channels.generic.websocket import JsonWebsocketConsumer from django.conf import settings from django.utils import timezone from .models import Route class BusConsumer(JsonWebsocketConsumer): groups = ["bus"] def connect(self): self.user = self.scope["user"] ...
""" Server implementation config for bofhd. History ------- This class used to be a part of the bofhd server script itself. It was moved to a separate module after: commit ff3e3f1392a951a059020d56044f8017116bb69c Merge: c57e8ee 61f02de Date: Fri Mar 18 10:34:58 2016 +0100 """ from __future__ import print_f...
import os from gi.repository import Gio, Gdk, Gtk, GtkSource, Pluma from .outputpanel import OutputPanel from .capture import * def default(val, d): if val is not None: return val else: return d def current_word(document): piter = document.get_iter_at_mark(document.get_insert()) start = ...
''' run with ex: mpiexec -n 10 python article_simulated_estimate_mpi.py Created on Jul 11, 2014 @author: jonaswallin ''' from __future__ import division import time import scipy.spatial as ss import article_simulatedata from mpi4py import MPI import numpy as np import BayesFlow as bm import matplotlib import matplotlib...
from __future__ import with_statement from fabric.api import local, abort, run, cd, env from fabric.context_managers import prefix env.directory = '/home/pestileaks/pestileaks' env.activate = 'source /home/pestileaks/env/bin/activate' env.user = 'pestileaks' env.hosts = ['pestileaks.nl'] env.restart = 'killall -HUP gun...
import urllib2 import os import re import time print '---------------------------------------------------------------' print 'Name: Luoo.net-Mp3 crawler ' print 'version: v1.0' print 'author: ChenYao' print 'data: 2013/9/4' print 'Introductions: the music will Downloaded to path D:\\Luoo.net\\' print '-------------...
from zope.interface import Interface class IUWOshThemeLayer(Interface): """ Marker interface that defines a browser layer """
from generator import Generator import logging class Phobia(Generator): """ Define a phobia to be used in your game """ def __init__(self, redis, features={}): Generator.__init__(self, redis, features) self.logger = logging.getLogger(__name__) # Double parse the template to fill in templ...
""" Author: S.H. Version: 0.1 Date: 2015-01-17 Description: Scan ip: 74.125.131.0/24 74.125.131.99-125 74.125.131.201 Only three format above. Read ip form a ip.txt, and scan all port(or a list port). """ import os import io import socket fileOpen = open("ip.txt", 'r') fileTemp = open("temp.txt...
"""Statistics for all network connections currently known by the netfilter subsystem.""" import os import rrdtool from components.common import * from templates.connections.index import index as ConnectionsPage DATA_SOURCE = "/proc/net/ip_conntrack" class NetworkConnections(StatsComponent): """Network Connections S...
import re from datetime import datetime, date from decimal import Decimal from translations import _t, _a from model import Model from lib.query_builder import Query from lib.money import Money import payment import membership import package import settings class Installment(Model): table = 'installments' fields_fo...
import Adafruit_BBIO.GPIO as GPIO import Adafruit_BBIO.ADC as ADC import Adafruit_BBIO.PWM as PWM import time from math import * class Motor : """Classe définissant un moteur, caractérisé par : - le rapport de cycle de son PWM - la pin de son PWM - son sens de rotation - la pin de son sens de rotation ...
""" Helper functions related to the creation, listing, filtering and destruction of providers The list_providers function in this module depend on a (by default global) dict of filters. If you are writing tests or fixtures, you want to depend on this function as a de facto gateway. The rest of the functions, such as ge...
"""sparql_select_result.py Data structure for storing the results of SPARQL SELECT queries""" __all__ = ["SPARQLSelectResult"] from xml.etree import ElementTree as et class SPARQLSelectResult(object): def __init__(self): self.variables = [] self.results = [] def parse(self, s): tree = et.fromstring(s) head = ...
''' DATA exchange class, also holds global variables for thread management. Generalized version based on TIP. ''' import time import os from threading import Lock import numpy as np from qkit.storage import store as hdf_lib from qkit.gui.plot import plot as qviewkit class DATA(object): ''' DATA class. Controls ...
import sys import os from com.googlecode.fascinator.common import FascinatorHome sys.path.append(os.path.join(FascinatorHome.getPath(),"harvest", "workflows")) from baserules import BaseIndexData class IndexData(BaseIndexData): def __activate__(self, context): BaseIndexData.__activate__(self,context...
from pylint.checkers import strings TEST_TOKENS = ( '"X"', "'X'", "'''X'''", '"""X"""', 'r"X"', "R'X'", 'u"X"', "F'X'", 'f"X"', "F'X'", 'fr"X"', 'Fr"X"', 'fR"X"', 'FR"X"', 'rf"X"', 'rF"X"', 'Rf"X"', 'RF"X"', ) def test_str_eval() -> None: for t...
u""" Тесты на ДЗ#5. """ __author__ = "wowkalucky" __email__ = "wowkalucky@gmail.com" __date__ = "2014-11-17" import datetime from hw5_solution1 import Person def tests_for_hw5_solution1(): u"""Тесты задачи 1""" petroff = Person("Petrov", "Petro", "1952-01-02") ivanoff = Person("Ivanov", "Ivan", "2000-10-20"...
import Machines from Machines import LOWEST_PRIORITY from Transitions import TransitionMap def nfa_to_dfa(old_machine, debug = None): """ Given a nondeterministic Machine, return a new equivalent Machine which is deterministic. """ # We build a new machine whose states correspond to sets of states # in the ...
""" pyextend.core.math ~~~~~~~~~~~~~~~~~~ pyextend core math tools. :copyright: (c) 2016 by Vito. :license: GNU, see LICENSE for more details. """ def isprime(n): """Check the number is prime value. if prime value returns True, not False.""" n = abs(int(n)) if n < 2: return False...
from __future__ import with_statement import os def create_init_file(name, env): ''' Create package initialization file. e.g. init_package_env.sh :param name: file name to be created. :type name: string :param env: the environment object. :type env: :class:`.Environment` :return: None ''...
''' direct .. moduleauthor:: Edwin Tye <Edwin.Tye@gmail.com> ''' from __future__ import division, print_function, absolute_import from .sqp import * from .ip import * from .ipBar import * from .ipPD import * from .ipPDC import * from .ipPDandPDC import * from .approxH import * from .trust import * __all__ = [s for s in...
from Tkinter import * root = Tk() root.title('first test window') frm = Frame(root) frm_l = Frame(frm) Label(frm_l, text='left_top').pack(side=TOP) Label(frm_l, text='left_bottom').pack(side=BOTTOM) frm_l.pack(side=LEFT) frm_r = Frame(frm) Label(frm_r, text='right_top').pack(side=TOP) Label(frm_r, text='right_bottom')....
from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('loginapp', '0001_initial'), ] operations = [ migrations.RenameField( model_name='registration', old_name='comments', new_name...
__author__ = 'Alexandre Menai amenai@amenai.net' ''' The weather module intends to grab pilot weather from the aviation weather services in the USA ''' WEAHTER_HOSTNAME="aviationweather.gov" METAR_PATH="/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=" import httplib i...
from mock import patch from django.conf import settings from django.test import TestCase from django_any.models import any_model from django.utils import unittest from django.contrib.auth.models import User from django.test.client import Client from django.test.client import RequestFactory from django.test.utils import...
from pygame.font import Font from types import StringType, UnicodeType __all__ = ['initFont', 'renderText', 'getTextSize', 'getLineSize'] fontFaces = {} fontCache = {} misses = 0 hits = 0 def initFont(name, ttfFile, size, bold = 0, italic = 0, underline = 0): global fontFaces if name in fontFaces: del fontFaces[nam...
import os class generic(object): def __init__(self,myspec): self.settings=myspec self.settings.setdefault('CHROOT', 'chroot') def setarch(self, arch): """Set the chroot wrapper to run through `setarch |arch|` Useful for building x86-on-amd64 and such. """ if os.uname()[0] == 'Linux': self.settings['CHR...
""" Credentials management. """ import talloc as __talloc AUTO_KRB_FORWARDABLE = 0 AUTO_USE_KERBEROS = 0 DONT_USE_KERBEROS = 1 FORCE_KRB_FORWARDABLE = 2 MUST_USE_KERBEROS = 2 NO_KRB_FORWARDABLE = 1 class CredentialCacheContainer(__talloc.Object): # no doc def __init__(self, *args, **kwargs): # real signature un...
""" *************************************************************************** SpatialJoin.py --------------------- Date : October 2013 Copyright : (C) 2013 by Joshua Arnott Email : josh at snorfalorpagus dot net ********************************************...
""" Copyright (C) 2018 MuadDib ---------------------------------------------------------------------------- "THE BEER-WARE LICENSE" (Revision 42): @tantrumdev wrote this file. As long as you retain this notice you can do whatever you want with this stuff. Just Ask first when not released through ...
from downloadCommon import DownloadCommon, getSeqName from DdlCommonInterface import DdlCommonInterface import re class FbDownloader(DownloadCommon): def __init__(self): self.strDbms = 'firebird' def connect(self, info): try: import kinterbasdb except: print "Miss...
import os.path import time import transmission as send import shelving as db def first_check(): if os.path.isfile('check.db') == False: db.prime() else: if send.passthru(['mode','?']) == 'play': db.update_shelf() else: perform_start_tasks() def perform_start_tasks(): last_known_check = db.query('time') ...
from pathlib import PosixPath import pytest from rpmlint.cli import process_lint_args from rpmlint.config import Config from rpmlint.lint import Lint @pytest.mark.parametrize('test_arguments', [['-c', 'rpmlint/configs/thisdoesntexist.toml']]) def test_parsing_non_existing_config_file(test_arguments): with pytest.ra...
''' Created on 17/2/2015 @author: Antonio Hermosilla Rodrigo. @contact: anherro285@gmail.com @organization: Antonio Hermosilla Rodrigo. @copyright: (C) 2015 by Antonio Hermosilla Rodrigo @version: 1.0.0 ''' import sys from PyQt4 import QtCore from PyQt4 import QtGui from PyQt4 import uic from os import sep,pardir,getcw...
from boxbranding import getBoxType, getImageType, getImageDistro, getImageVersion, getImageBuild, getImageFolder, getImageFileSystem, getBrandOEM, getMachineBrand, getMachineName, getMachineBuild, getMachineMake, getMachineMtdRoot, getMachineRootFile, getMachineMtdKernel, getMachineKernelFile, getMachineMKUBIFS, getMac...
import os import unittest class TestBase(unittest.TestCase): @classmethod def datafilename(cls, name): fname = os.path.join( os.path.dirname(__file__), "data", name, ) assert os.path.exists(fname) return fname
"""Popup menu for Advene elements. Generic popup menu used by the various Advene views. """ from gi.repository import Gtk import re import os from gettext import gettext as _ import advene.core.config as config from advene.model.package import Package from advene.model.annotation import Annotation, Relation from advene...
import argparse import sys import datetime import submit_external_command from glusternagios import utils GLUSTER_HOST_GROUP = "gluster-host" def parse_input(): parser = argparse.ArgumentParser(description="Nagios plugin to handle " "brick status events") parser....
import tornado.ioloop import tornado.iostream import socket import struct import NotifyTCPServer def readPacketHeader(): stream.read_bytes(NotifyTCPServer.PACKET_HEADER_LEN, parsePacketHeader) def parsePacketHeader(data): sign,cmd,bodySize = struct.unpack('>2sHH', data) print "Sign: %s, Command: %s, Size: %s" % (sig...
import cPickle as pkl import networkx as nx import numpy as np import os import scipy.spatial from ..handler.basics import chunkify from ..processing.general import single_conn_comp_img from syconnmp.shared_mem import start_multiprocess_obj, start_multiprocess from ..handler.compression import VoxelDict, AttributeDict...
"""BibFormat element - ScienceWise.info This elements displays a linking icon to ScienceWise.info for arXiv records. """ import cgi import re from invenio.config import CFG_SITE_URL, CFG_SITE_LANG from invenio.messages import gettext_set_language _RE_MODERN_ARXIV = re.compile('(arxiv:)?(?P<number>\d{4}.\d{4}(v\d+)?)') ...
import os import shutil from mutagen._compat import cBytesIO from mutagen.ogg import OggPage from mutagen.oggspeex import OggSpeex, OggSpeexInfo, delete from tests import add from tests.test_ogg import TOggFileType from tempfile import mkstemp class TOggSpeex(TOggFileType): Kind = OggSpeex def setUp(self): ...
from ChannelSelection import ChannelSelection, BouquetSelector, SilentBouquetSelector from Components.ActionMap import ActionMap, HelpableActionMap from Components.ActionMap import NumberActionMap from Components.Harddisk import harddiskmanager from Components.Input import Input from Components.Label import Label from ...
from django.contrib import admin from .models import EssNutr, FoodCategory admin.site.register(EssNutr) admin.site.register(FoodCategory)
import models def borradoPlan(sender, **kwargs): borrada = kwargs['instance'] if borrada.tipo == "pr": aBorrar = models.PlanPrepago.objects.filter(codplan=borrada) else: aBorrar = models.PlanPostpago.objects.filter(codplan=borrada) aBorrar.delete() def insertadoServicio(sender, **kwargs): insertad...
""" This class transforms an eXe node into a page on a self-contained website """ import logging import re from cgi import escape from urllib import quote from exe.webui.blockfactory import g_blockFactory from exe.engine.error import Error from exe.engine.path i...
from flask_wtf import Form from flask_babel import gettext from wtforms import StringField, validators class ApplicationForm(Form): name = StringField(gettext('Application name'), [ validators.DataRequired(message=gettext("Application name field is empty.")), validators.Length(min=3, message=gettext...
from __future__ import print_function import sys sys.path.append('..') from src.sim import Sim from src.packet import Packet from networks.network import Network class BroadcastApp(object): def __init__(self, node): self.node = node def receive_packet(self, packet): print(Sim.scheduler.current_t...
from .trace_decorator import getLog from .exception import StateError class State(object): def __init__(self): self._state = [] # can be "unknown", "success" or "fail" self.result = "unknown" self.state_log = getLog("mockbuild.Root.state") def state(self): if not len(self...
from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns = patterns('', url(r'^$', 'LAK_2014.views.index', name='index'), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contr...
import threading import time class Status: lock = None statusno =0 def __init__(self): self.lock = threading.Lock() def update(self, add): self.lock.acquire() self.statusno = self.statusno + add self.lock.release() def get(self): self.lock.acquire() n ...
from django.views.generic import DetailView from entries.models import Entry class EntryView(DetailView): model = Entry template_name = "entry.html" context_object_name = 'entry' slug_field = 'sname' slug_url_kwarg = 'entry_sname'