code
stringlengths
1
199k
""" Linux helper """ __version__ = '1.0' import struct import sys import os import fcntl import platform import ctypes import fnmatch import errno import array import subprocess import os.path from ctypes import * from chipsec.helper.oshelper import Helper, OsHelperError, HWAccessViolationError, UnimplementedAPIError, ...
import networkx as nx import pygraphviz as pgv import process_ifdb_data as pid sys_list=['adrift','hugo','inform','tads','zil'] def author_system_dict(authors,sys_dict,data): '''Returns a dictionary of dictionaries representing authoring system use. Keys are authors. Values are dictionaries where keys are autho...
class Shape: """Represent a actor""" def __init__(self, lineno): self.lineno = lineno def draw(self, canvas): pass def draw_helper(self, index, canvas): pass class Line(Shape): def __init__(self, lineno, fillColor, width, coords): Shape.__init__(self, lineno) ...
""" libvirt configuration related utility functions """ import logging import re from avocado.core import exceptions from virttest import utils_config from virttest import utils_libvirtd from virttest import utils_split_daemons from virttest import remote from virttest.utils_test import libvirt def remove_key_in_conf(v...
import os import sys import pygtk import glob import subprocess import difflib def do_diff(out,f0,f1): fromlines = open(f0, 'U').readlines() tolines = open(f1, 'U').readlines() diff = difflib.HtmlDiff().make_file(fromlines,tolines,f0,f1) a = open(out, "w") a.write(diff) a.close() def gen_vector(name): f=open(nam...
import Skype4Py import datetime import time import random import logging import sqlite3 from hashlib import sha1 from collections import deque FORMAT=u'%(name)s %(thread)d %(levelname)s: %(message)s' logging.basicConfig(format=FORMAT, level=logging.INFO) logging.getLogger('').setLevel(logging.INFO) logging.getLogger('...
from ply import * keywords = ( 'REPETIR','UN','TIENE','Y','ES','FIN','VECES','COMMENT','MLCOMMENT', 'USAR' ) tokens = keywords + ( 'MAS','MENOS','MULTIPLICADO','DIVIDIDO','POTENCIA', 'LPAREN','RPAREN','LT','LE','GT','GE','NE', 'COMMA','SEMI', 'INTEGER','FLOAT', 'STRING', 'ID','NEWLINE' ) t_i...
from __future__ import absolute_import from ._functionwrappers import (add_key, request_key, keyctl_get_keyring, keyctl_join_session_keyring, keyctl_update, key...
""" Suite of functions that help manage movie data Contains the movie class. """ from builtins import str from builtins import range from past.utils import old_div import cv2 from functools import partial import h5py import logging from matplotlib import animation import numpy as np import os from PIL import Image # $...
import configparser import os class Tokens: def __init__(self): self.token_file = os.path.expanduser('~/.bugz_tokens') self.tokens = configparser.ConfigParser() self.tokens.read(self.token_file) def get_token(self, connection): if connection in self.tokens.sections(): ...
"""Utility functions for indexer data processing.""" import re from flask import current_app from invenio_indexer.utils import schema_to_index from invenio_search import current_search def record_to_index(record): """Get index/doc_type given a record. It tries to extract from `record['$schema']` the index and d...
import itertools import pdb def part_1(contents): total = 0 for line in contents: minval = -1 maxval = -1 for value in line: if minval == -1: minval = value if maxval == -1: maxval = value if minval > value: ...
import time import threading import datetime as dt from types import FloatType import os try: import cPickle as pickle except ImportError: import pickle import serial from chimera.instruments.telescope import TelescopeBase from chimera.interfaces.telescope import SlewRate, AlignMode, TelescopeStatus from chimer...
import sys def main(argv): try: kataName = argv[1] except: print 'Please enter a katalet name.' exit(2) print 'The katalet you have selected is', kataName if __name__ == "__main__": main(sys.argv[1:])
from glob import glob from os.path import join import sys from setuptools import setup, find_packages import bioframework def jip_modules(path=bioframework.JIP_PATH): return glob(join(path, '*.jip')) setup( name = bioframework.__projectname__, version = bioframework.__release__, packages = find_packages...
from generic_start import * from graph_util import * from parse_world import * from setup_util import *
import sys from session_scanner import * if __name__ == "__main__": print "Starting" image = cv2.imread(sys.argv[1]) splitter = Splitter(image) cropped_dir = splitter.crop() columns = OCR('build/' + cropped_dir)() counter = Counter(columns) print counter.count()
class Action: def __init__(self): self.exitCode = 0 def execute(): raise NotImplementedError
from pycassa.system_manager import * sys = SystemManager() sys.drop_keyspace('example_consumer_Buyer')
import re from sqlalchemy.orm import aliased, sessionmaker from sqlalchemy.sql import bindparam from models import engine, Actor, Command, PlayerText from api import api, run_method Session = sessionmaker(bind=engine) session = Session() command_queries = {} command_queries['character'] = \ session.query(Command).\...
from django.conf.urls.defaults import patterns, include, url urlpatterns = patterns('', # Examples: url(r'^login', 'sleep.views.login', name='login'), url(r'^authorize', 'sleep.views.authorize', name='authorize'), url(r'^', 'sleep.views.index', name='index'), # Uncomment the admin/doc line below to ...
""" Dusty Gas transport model. The Dusty Gas model is a mulicomponent transport model for gas transport through the pores of a stationary porous medium. This example shows how to create a transport manager that implements the Dusty Gas model and use it to compute the multicomponent diffusion coefficients. """ fr...
import susetest class Feature(object): def __init__(self): pass @staticmethod def isSupportedFeature(name): return name in ('selinux', 'systemd', 'dnf', 'zypper') @staticmethod def createFeature(name): if name == 'selinux': from .selinux import SELinux return SELinux() if name == 'systemd': from ....
import string from spacewalk.common import log_debug, rhnFault import rhnSQL, rhnChannel class Kickstart: def __init__(self, ks_dict, pkgs): self.id = ks_dict['id'] self.label = ks_dict['label'] self.base_path = ks_dict['base_path'] self.channel_id = ks_dict['channel_id'] sel...
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, \ SuSEPlugin class Conntrackd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin): """conntrackd - netfilter connection tracking user-space daemon """ plugin_name = 'conntrackd' profiles = ('network', 'cluster') ...
from functools import wraps from PyQt4 import QtGui from PyQt4 import QtCore import logging logger = logging.getLogger('camelot.view.model_thread') _model_thread_ = [] class ModelThreadException(Exception): pass def model_function(original_function): """Decorator to ensure a function is only called from within ...
#!/usr/bin/env python import sys from urlparse import parse_qsl import xbmcgui import xbmcplugin __url__ = sys.argv[0] __handle__ = int(sys.argv[1]) VIDEOS = {'Animals': [{'name': 'Crab', 'thumb': 'http://www.vidsplay.com/vids/crab.jpg', 'video': 'http://www.vidsplay.com/v...
from django.db import models class Habit(models.Model): id=models.CharField(max_length=30,primary_key=True); name=models.CharField(max_length=100) def __unicode__(self): return u'%s %s' % (self.id, self.name) class HabitRecords(models.Model): date=models.CharField(max_length=30,primary_key=True); weekday=models....
from plone.app.contentrules.browser.traversal import RuleNamespace from BTrees.OOBTree import OOBTree from Products.CMFCore.utils import getToolByName def install(portal): setup_tool = getToolByName(portal, 'portal_setup') setup_tool.runAllImportStepsFromProfile('profile-uwosh.watchthis:default') ##add page...
from ventana import Ventana from formularios import utils import pygtk pygtk.require('2.0') import gtk from framework import pclases from informes.barcode.EANBarCode import EanBarCode import mx.DateTime try: from psycopg import ProgrammingError as psycopg_ProgrammingError except ImportError: from psycopg2 impor...
"""Wrapper class around a file like "/usr/bin/env" This class makes certain file operations more convenient and associates stat information with filenames """ import stat, errno, socket, time, re, gzip, pwd, grp from duplicity import tarfile from duplicity import file_naming from duplicity import globals from duplicity...
""" .. autoclass:: NameTag """ class NameTag(object): """ Sets the name of a test (useful for putting multiple tests in the same file):: --- - name: "My Test" --- - name: "My Second Test" """ NAME = "name" def __init__(self, spec): assert isinstance(spec, ...
""" Various utilities Authors: Ed Rousseau <rousseau@redhat.com>, Zack Cerza <zcerza@redhat.com, David Malcolm <dmalcolm@redhat.com> """ __author__ = """Ed Rousseau <rousseau@redhat.com>, Zack Cerza <zcerza@redhat.com, David Malcolm <dmalcolm@redhat.com> """ import os import sys import subprocess import cairo import pr...
from sos.plugins import Plugin, RedHatPlugin import os.path class AtomicHost(Plugin, RedHatPlugin): """ Atomic Host """ plugin_name = "atomichost" option_list = [ ("info", "gather atomic info for each image", "fast", False) ] def check_enabled(self): return self.policy.in_container()...
import configurator, os p = configurator.start_it_up(getBundlePath(), "prefab_locator_navigation.blend") try: mouseMove(Location(0,0)); wait("3dview_prefab_loc_navigation-1.png", 5) hover(Location(400, 400)) # move cursor abowe 3D view type("g0" + Key.TAB + "0" + Key.TAB + ".1" + Key.ENTER) # move locator...
import sys, os, re, socket, shutil, subprocess, traceback, tarfile UPLIB_HOME = os.path.normpath(sys.argv[1].rstrip("\\")) UPLIB_VERSION = sys.argv[2] SOURCE_DIR = os.path.dirname(os.path.dirname(__file__)) print "source dir is", SOURCE_DIR import _winreg as wreg class WindowsRegistry: # see the Python Cookbook, #1...
""" MODULE: r.sim.terrain AUTHOR(S): Brendan Harmon <brendan.harmon@gmail.com> PURPOSE: Dynamic landscape evolution model COPYRIGHT: (C) 2016 Brendan Harmon and the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that com...
import MalmoPython import os import sys import time sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) # flush print output immediately def Menger(xorg, yorg, zorg, size, blocktype, variant, holetype): #draw solid chunk genstring = GenCuboidWithVariant(xorg,yorg,zorg,xorg+size-1,yorg+size-1,zorg+size-1,blockt...
""" Backend for sqlite database. """ import sqlite3 import logging import re sqlite3.paramstyle = 'qmark' class Sqlite: """ The Sqlite class is an interface between the DBAPI class which is the Gramps backend for the DBAPI interface and the sqlite3 python module. """ @classmethod def get_summary...
from modules.pastafari.servers.launcher import start start()
""" /*************************************************************************** DataPlotly A QGIS plugin D3 Plots for QGIS ------------------- begin : 2017-03-05 git sha : $Format:%H$ copyright ...
from functools import partial def spam(a, b, c, d): print(a, b, c, d) spam(1, 2, 3, 4) s1 = partial(spam, 1) s1(2, 3, 4) s2 = partial(spam, d=42) s2(1, 2, 3) s3 = partial(spam, 1, 2, d=42) s3(3) s3(4) s3(5) points = [ (1, 2), (3, 4), (5, 6), (7, 8) ] import math def distance(p1, p2): x1, y1 = p1 x2, y2 = p2...
import bpy from bpy.types import Operator from bpy.props import ( IntProperty, BoolProperty, FloatProperty, EnumProperty, ) import os import bmesh import time import blf from bpy_extras.view3d_utils import location_3d_to_region_2d C = bpy.context D = bpy.data ...
from neolib.plots.Step import Step from neolib.shop.MainShop import MainShop class FindItem(Step): _paths = { 'img': './/img[@src=%s]' } _SHOPS = [94, 95, 96] _ITEMS = ['http://images.neopets.com/items/acp_coinpurse.gif', 'http://images.neopets.com/items/acp_chococoin.gif', ...
import struct def reg(x): return 1 << ['r0', 'r1', 'r2', 'r3', 'sp', 'pc'].index(x) def asm(lines): labels = {} pc = 0 handlers = dict( push=lambda a: [2, 0, reg(a), 0], pop=lambda a: [2, reg(a), 0, 0], ldi=lambda dst, a: [1, reg(dst), *struct.pack("<H", eval(a, labels))], ...
from rhsmlib.dbus import constants __all__ = [ 'SUB_SERVICE_NAME', 'FACTS_DBUS_NAME', 'FACTS_DBUS_INTERFACE', 'FACTS_DBUS_PATH', 'FACTS_VERSION', 'FACTS_NAME', ] SUB_SERVICE_NAME = "Facts" FACTS_DBUS_NAME = constants.BUS_NAME + '.' + SUB_SERVICE_NAME FACTS_DBUS_INTERFACE = constants.BUS_NAME + '...
import xbmc,xbmcaddon,xbmcgui,os,time,sys import skinSwitch AddonID = 'plugin.program.VikingsWizard' ADDON=xbmcaddon.Addon(id='plugin.program.VikingsWizard') ADDONPATH = xbmc.translatePath(os.path.join('special://home/addons/' + AddonID)) AddonTitle = "[COLOR aqua]Vikings Wizard[/COLOR]" HOME = xbmc.translatePath('spe...
"""\ Functions to expose over the RPC interface. For all modify* and delete* functions that ask for an 'id' parameter to identify the object to operate on, the id may be either * the database row ID * the name of the object (label name, hostname, user login, etc.) * a dictionary containing uniquely identifying field...
from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen from Screens.Console import Console from Screens.ChoiceBox import ChoiceBox from Screens.MessageBox import MessageBox from Components.ActionMap import ActionMap, HelpableActionMap from Components.Label import Label from Components.Language im...
import numpy from solverls.lsproblem import LSProblem from solverls.spectral import conj_grad __author__ = 'alfredoc' class LSProblemTimeSlab(LSProblem): def solve(self): self.f = numpy.zeros(self.mesh.dof) self.residual = 0 for el in self.mesh.elem: self.set_operators(el) ...
""" Python Obit ImageFit class This class enables fitting models to images ImageFit Members with python interfaces: * List - used to pass instructions to processing """ from __future__ import absolute_import from __future__ import print_function import Obit, _Obit, OErr, Image, ImageDesc, InfoList, FitRegion, FitModel ...
import requests from json import loads, dumps base_url = "https://api.zoomeye.org" def get_search_results(token, dork, facet="", search_type="host", page=1): ''' 获取json格式的原始数据。 ''' header = {"Authorization": "JWT %s" % token} response = requests.get( base_url + "/" + search_type + "/search?q...
from Sire.IO import * from Sire.MM import * from Sire.Mol import * from Sire.Move import * from Sire.MM import * from Sire.System import * from Sire.CAS import * from Sire.Vol import * from Sire.Units import * import Sire.Stream protodir = "/Users/chris/Work/ProtoMS/" print("Parameterising the oscillator...") oscillato...
from ventana import Ventana import utils import pygtk pygtk.require('2.0') import gtk, gtk.glade, time, sqlobject import sys try: import pclases except ImportError: from os.path import join as pathjoin; sys.path.append(pathjoin("..", "framework")) import pclases import mx try: import geninformes except ...
from node import nullid, short from i18n import _ import os import revlog, util, error def verify(repo): lock = repo.lock() try: return _verify(repo) finally: lock.release() def _normpath(f): # under hg < 2.4, convert didn't sanitize paths properly, so a # converted repo may contain ...
class AppAlreadyRegistered(Exception): pass
""" brickv (Brick Viewer) Copyright (C) 2011-2012 Olaf Lüke <olaf@tinkerforge.com> Copyright (C) 2012 Bastian Nordmeyer <bastian@tinkerforge.com> Copyright (C) 2012, 2014-2015 Matthias Bolte <matthias@tinkerforge.com> advanced.py: GUI for advanced features This program is free software; you can redistribute it and/or m...
try: import os from preludecorrelator import siteconfig def get_config_filename(fname, module=None, package="prelude-correlator"): return os.path.join(siteconfig.conf_dir, fname) def get_data_filename(fname, module=None, package="prelude-correlator", profile=None): return os.path.join(si...
__author__ = 'xieshaoxin'
""" .. moduleauthor:: Bogdan Neacsa <bogdan.neacsa@codemart.ro> .. moduleauthor:: Ionel Ortelecan <ionel.ortelecan@codemart.ro> """ import json import cherrypy import tvb.interfaces.web.controllers.base_controller as base from tvb.interfaces.web.controllers.users_controller import logged from tvb.interfaces.web.control...
''' Goes through the input files creating a structure like this [ { "jurisdiccion":[ ], "inciso":[ ], "ubicacion_geografica":[ ], "fuente_fin":[ ], "finalidad":[ { "funcion":[ { "id":"1", "name":"Salud" ...
from __future__ import absolute_import from time import localtime, time, strftime, mktime from enigma import eEPGCache, eListbox, eListboxPythonMultiContent, loadPNG, gFont, getDesktop, eRect, eSize, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_VALIGN_TOP, RT_WRAP, BT_SCALE, BT_KEEP_ASPECT_RA...
from __future__ import generators from __future__ import absolute_import __author__ = "Vasilis Vlachoudis" __email__ = "Vasilis.Vlachoudis@cern.ch" import random from math import acos, asin, atan2, copysign, cos, degrees, fmod, hypot, pi, pow, radians, sin, sqrt import rexx _accuracy = 1E-15 _format = "%15g" def sign(...
""" /*************************************************************************** VFRImporter A QGIS plugin Tool for import RUIAN data ------------------- begin : 2015-03-16 copyright : (C) 2015 by Jan Klima ...
from collections import defaultdict class Solution(object): def findMinHeightTrees(self, n, edges): """ :type n: int :type edges: List[List[int]] :rtype: List[int] """ if n == 1: return [0] neighbors = defaultdict(list) degrees = defaultdict(int) ...
import urllib2 import string import shutil,os class DownloaderURLLIB2(): name = 'test.html' repositories_download="repositories.txt" black_list = [] def set_name(self,name): self.name = name def get(self,url): import urllib2 response = urllib2.urlopen(url) return resp...
from __future__ import print_function '''Helper functions to create and store ALSA events Helper functions for the alsaseq module. They provide frequent MIDI event funtions that return an ALSA event ready to be sent with the alsaseq.output() function. A class is also provided to read and store events in text files. no...
import random print random.random() print random.choice([1,3,4,5])
from .Nginx import Nginx, NginxConfigException from .PHP import PHP from .MongoDB import MongoDB from .MySQL import MySQL from .Redis import Redis
"""external signature requests @contact: Debian FTP Master <ftpmaster@debian.org> @copyright: 2018 Ansgar Burchardt <ansgar@debian.org> @license: GNU General Public License version 2 or later """ import json import sqlalchemy.sql as sql import daklib.gpg from daklib.config import Config from daklib.dbconn import DBCon...
""" Special containers that don't logically belong somewhere else """ import __builtin__ from collections import defaultdict from grendel.util.decorators import typechecked, IterableOf from grendel.util.sentinal_values import ArgumentNotGiven class CustomHashDict(object): ############## # Attributes # #####...
import qkit import os import logging if qkit.cfg.get('startdir',False): os.chdir(qkit.cfg.get('startdir')) if qkit.cfg.get('startscript',False): _scripts = qkit.cfg.get('startscript') if type(_scripts) not in (list, tuple): _scripts = [_scripts, ] for _s in _scripts: if os.path.isfile(_s...
'''Module for antivirus control over AMQP.''' from __future__ import unicode_literals from __future__ import print_function import pyclamd from kombu import Connection from kombu import Exchange from kombu import Queue import json import base64 import uuid import datetime from multiprocessing import Pool import time im...
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kegweb.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
import matplotlib matplotlib.use('Agg') from matplotlib.pyplot import * import localgroup import triangle import sklearn from sklearn import mixture import numpy as np import pickle import matplotlib.patches as mpatches import sys gmm_N = int(sys.argv[1]) save_path = "/afs/slac.stanford.edu/u/ki/mwillia1/Thesis/LocalGr...
""" An object of this class stores various messages from other modules and shows them according to configuration. """ from vtk import vtkTextActor import time class ScreenLog(object): """ Holds data and functions for the text log. """ def __init__(self, clusterviz_config): """ Initialise...
import sys, re, string import PyV8 from DOMException import DOMException from Node import Node class CharacterData(Node): def __init__(self, doc, data): self._data = data Node.__init__(self, doc) def __str__(self): return str(self.data) def getData(self): return self._data ...
FILENAME = "DKSF_60.4.2_MB.mib" MIB = { "moduleName" : "DKSF-60-4-X-X-X", "DKSF-60-4-X-X-X" : { "nodetype" : "module", "language" : "SMIv2", "organization" : """NetPing East, Alentis Electronics""", "contact" : """developers@netping.ru""", "descrip...
from __future__ import division, absolute_import from __future__ import print_function, unicode_literals from django.db import models from django.core.exceptions import ( ObjectDoesNotExist, MultipleObjectsReturned, ) import jsonfield import jieba from ._global import SEP from django.conf import settings is_loa...
import re from config import * from util import * def ReadCropAttrs(cropFile): if not os.path.exists(cropFile): cropFile = TXT_DB_DIR + os.sep + CROP_FILE f = open(cropFile) lines = f.readlines() f.close() attrDic = {} fields = [item.replace('"', '') \ for item in re.split(...
{ 'name': 'Enapps Import Data tool', 'version': '18', 'depends': [ 'base', ], 'author': 'ENAPPS LTD', 'description': '''Import cvs files''', 'website': 'http://ennaps.co.uk/', 'category': 'Tool', 'init_xml': [], 'demo_xml': [ ], 'update_xml': [ ...
import unittest class TestFake(unittest.TestCase): def test_upper(self): self.assertEqual('foo'.upper(), 'FOO') if __name__ == '__main__': unittest.main()
''' Copyright (C) 2007 Aaron Spike (aaron @ ekips.org) Copyright (C) 2007 Tavmjong Bah (tavmjong @ free.fr) 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 you...
import string from chempy import cpv import os from pymol import cmd from cmd import DEFAULT_ERROR, DEFAULT_SUCCESS, _raising POINTS = 0.0 LINES = 1.0 LINE_LOOP = 2.0 LINE_STRIP = 3.0 TRIANGLES = 4.0 TRIANGLE_STRIP = 5.0 TRIANGLE_FAN = 6.0 STOP ...
""" WSGI config for cse360_webapp 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.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cse360_webapp.settings") from djang...
import asyncio import signal import sys import Ice Ice.loadSlice('Hello.ice') import Demo class HelloI(Demo.Hello): def __init__(self, loop): self.loop = loop def sayHello(self, delay, current): if delay == 0: print("Hello World!") else: # return the concurrent fu...
from gettext import gettext as _ try: from sugar3.graphics import iconentry # check first sugar3 because in os883 gi.repository is found but not sugar3 from gi.repository import Gtk except ImportError: import gtk as Gtk from sugar.graphics import iconentry class SearchToolbar(Gtk.Toolbar): def _...
''' Created on 2013-10-17 @author: zhangzhi @contact: z2care@gmail.com ''' from abc import abstractmethod class Sender(): @abstractmethod def send(self): pass class SMSSender(Sender): def send(self): print "I'm SMSSender!" class MailSender(Sender): def send(self): print "I'm Mail...
from resources.lib.handler.requestHandler import cRequestHandler from resources.lib.parser import cParser from resources.lib.config import cConfig from resources.hosters.hoster import iHoster class cHoster(iHoster): def __init__(self): self.__sDisplayName = 'Exashare' self.__sFileName = self.__sDisplayName...
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pandas import Series, DataFrame from numpy.random import normal N=10 # サンプルを取得する位置 x の個数 M=[0,1,3,9] # 多項式の次数 def create_dataset(num): dataset = DataFrame(columns=['x','y']) for i in range(num): x = float(i)/float...
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.base import ObjectDoesNotExist class PrereqQuerySet(models.query.QuerySet): def get_all_parent_object(self, parent_object): ...
from django.apps import AppConfig from ..gro_api.models import DynamicOptions from ..gro_api.utils import system_layout from .schemata import all_schemata class LayoutConfig(AppConfig): name = 'gro_api.layout' def ready(self): # Use DynamicOptions for dynamic models dynamic_fields = [] d...
from keeper.tasklist import TaskList from keeper.source import TaskSource import io import pytest def test_simple(): data = io.StringIO(""" task1 task2 task3 task4 task5 task51 task6 task7 task8 """) tasklist = TaskList(task_source=TaskSource(filename='test/somefile', stream=data)) task1 = ...
from __future__ import print_function import optparse import json from Bio import SeqIO usage_line = """ annotate_fasta.py Version 1.0 (28 August, 2014) License: GNU GPLv2 To report bugs or errors, please contact Daren Card (dcard@uta.edu). This script is provided as-is, with no support and no guarantee of proper or de...
def replace_char_at(my_string, index, char): my_string = my_string[:index] + my_string[index:index+1].replace(my_string[index], char) + my_string[index+1:] return my_string print replace_char_at("hello", 1, "T")
__version__ = '1.1' from ElasticSearchLib import ElasticSearchLib class ElasticSearchLibrary(ElasticSearchLib): ROBOT_LIBRARY_SCOPE = 'GLOBAL'
from __future__ import absolute_import, print_function import time from threading import Event from virtwho import log from virtwho.config import DestinationToSourceMapper, VW_GLOBAL from virtwho.datastore import Datastore from virtwho.manager import Manager from virtwho.virt import Virt, info_to_destination_class try:...
def two_sum(A, target): need = {} first = 1 second = 1 indices = range(len(A)) for index in indices: if A[index] in need: first += need.get(A[index]) second += index break else: need[target - A[index]] = index return first, second d...
''' Created on Nov 14, 2014 Implementation of a text based hands and head tracking module @author: Arturo Curiel ''' import zope.interface as zi import zope.component as zc import pandas as pd import numpy as np try: import magic except: import nixtla.core.tools.magic_win as magic import os from nixtla.core.bas...
from seecr.test import IntegrationTestCase, CallTrace from meresco.lucene import Fields2LuceneDoc, DrilldownField from meresco.core import Transaction from weightless.core import consume from meresco.lucene.fieldregistry import FieldRegistry class Fields2LuceneDocTest(IntegrationTestCase): maxDiff = None def te...