code
stringlengths
1
199k
__author__ = 'Stephanie' from ODMconnection import dbconnection from readSensors import readSensors from updateSensors import updateSensors from createSensors import createSensors from deleteSensors import deleteSensors __all__ = [ 'readSensors', 'updateSensors', 'createSensors', 'deleteSensors', ]
"""In the case that the Setup.py file fails to execute, please manually install the following packages, or execute the requirements.sh script.""" from distutils.core import setup setup(name='DPS East Hackathon Rule booklet.', version='1.0', description='DPS East Hackathon Rule booklet.', aut...
import logging from typing import cast from rebasehelper.logger import CustomLogger logger: CustomLogger = cast(CustomLogger, logging.getLogger(__name__)) class InputHelper: """Class for command line interaction with the user.""" @staticmethod def strtobool(message): """Converts a user message to a ...
import os, sys, re, StringIO sys.path.append('/Users/Jason/Dropbox/JournalMap/scripts/GeoParsers') from jmap_geoparser import * test = "blah blah blah 45º 23' 12'', 123º 23' 56'' and blah blah blah 32º21'59''N, 115º 23' 14''W blah blah blah" coords = coordinateParser.searchString(test) for coord in coords: assert c...
""" Created on Mon Nov 21 15:53:15 2016 @author: agiovann """ from __future__ import division from __future__ import print_function from builtins import zip from builtins import str from builtins import map from builtins import range from past.utils import old_div import cv2 try: cv2.setNumThreads(1) except: pr...
from turtlelsystem.TurtleSVGMachine import TurtleSVGMachine from nose.tools import assert_almost_equal def test_forward(): turtle = TurtleSVGMachine(width = 20, height = 20) turtle.do_command("FORWARD 10") assert_almost_equal(turtle.x, 20.0) def test_backward(): turtle = TurtleSVGMachine(width = 20, hei...
"""Module for the unix socket protocol This module implements the local unix socket protocol. You only need this module and the opcodes module in the client program in order to communicate with the master. The module is also used by the master daemon. """ import socket import collections import time import errno import...
__author__ = 'Marco Maio' import time class Handler(): def __init__(self, stocks_today=None, investments_by_name=None, investments_by_availability=None): # input data assessment if stocks_today is None: raise ValueError('Stocks_today container not specified!') elif investments_by...
import renpy import codecs import os import os.path import time image_prefixes = None filenames = None report_node = None def report(msg, *args): if report_node: out = u"%s:%d " % (renpy.parser.unicode_filename(report_node.filename), report_node.linenumber) else: out = "" out += msg % args ...
from datetime import datetime from euphorie.client import model from euphorie.client.tests.utils import addAccount from euphorie.client.tests.utils import addSurvey from euphorie.content.tests.utils import BASIC_SURVEY from euphorie.testing import EuphorieIntegrationTestCase from lxml import html from plone import api ...
from flask import Response from flask.views import View from bson import json_util from mcp import mongo class Map(View): def dispatch_request(self, komuna, viti): json = mongo.db.procurements.aggregate([ { "$match": { "komuna.slug": komuna, ...
""" Module implementing MainWindow. """ from PyQt4.QtGui import * from PyQt4.QtCore import * from Ui_mainWindow import Ui_MainWindow from baseclasses import * from splitDialog import splitDialog from aboutDialog import aboutDialog TITLE, CHAPTER, TRACK, DURATION, STARTTIME, FILENAME, ENDTIME = range(7) def makeClickab...
from django.conf.urls import patterns, include, url from django.contrib import admin from django.contrib.auth import views admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'lite_note.views.home', name='home'), url(r'^test','lite_note.views.new_home',name='new_home...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('usermodule', '0002_auto_20151108_2019'), ] operations = [ migrations.CreateModel( name='Period', fields=[ ('id', ...
from __future__ import division from deskbar.handlers.actions.CopyToClipboardAction import CopyToClipboardAction from deskbar.defs import VERSION from gettext import gettext as _ import deskbar.core.Utils import deskbar.interfaces.Match import deskbar.interfaces.Module import logging import math import re LOGGER = logg...
from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) exce...
"""Bio.SeqIO support for the binary Standard Flowgram Format (SFF) file format. SFF was designed by 454 Life Sciences (Roche), the Whitehead Institute for Biomedical Research and the Wellcome Trust Sanger Institute. You are expected to use this module via the Bio.SeqIO functions under the format name "sff" (or "sff-tri...
import subprocess import os class MakeException(Exception): pass def swapExt(path, current, replacement): path, ext = os.path.splitext(path) if ext == current: path += replacement return path else: raise MakeException( "swapExt: expected file name ending in %s, got fi...
import os import socket import subprocess import time import unittest import simplejson import func.utils from func import yaml from func import jobthing def structToYaml(data): # takes a data structure, serializes it to # yaml buf = yaml.dump(data) return buf def structToJSON(data): #Take data stru...
__author__ = 'ryanplyler' def sayhi(config): error = None try: server_output = "Executing action 'sayhi()'" response = "HI THERE!" except: error = 1 return server_output, response, error
""" EasyBuild support for building and installing MRtrix, implemented as an easyblock """ import glob import os from distutils.version import LooseVersion import easybuild.tools.environment as env from easybuild.framework.easyblock import EasyBlock from easybuild.tools.filetools import copy, symlink from easybuild.tool...
""" Virtualization test - Virtual disk related utility functions :copyright: Red Hat Inc. """ import os import glob import shutil import stat import tempfile import logging import re try: import configparser as ConfigParser except ImportError: import ConfigParser from avocado.core import exceptions from avocado...
from unittest import TestCase from cStringIO import StringIO from sys import exc_info from enkel.wansgli.apprunner import run_app, AppError, Response from enkel.wansgli.testhelpers import unit_case_suite, run_suite HEAD = "HTTP/1.1 200 OK\r\ncontent-type: text/plain\r\n" ERRHEAD = "HTTP/1.1 500 ERROR\r\ncontent-type: t...
from gimpfu import * import time import re def preview (image, delay, loops, force_delay, ignore_hidden, restore_hide): if not image: raise "No image given." layers = image.layers nlayers = len (layers) visible = [] length = [] i = 0 while i < nlayers: visible += [pdb.gimp_it...
from __future__ import print_function from Components.Task import PythonTask, Task, Job, job_manager as JobManager from Tools.Directories import fileExists from enigma import eTimer from os import path from shutil import rmtree, copy2, move class DeleteFolderTask(PythonTask): def openFiles(self, fileList): self.file...
import sys from cx_Freeze import setup, Executable includefiles = ['windows/libusb-1.0.dll', ('icons/buzzer.png', 'icons/buzzer.png'), 'README.md', 'LICENSE', 'C:\\Windows\\SysWOW64\\msvcr110.dll'] excludes = [] packages = [] buildOptions = {'packages': pa...
from PyQt4.QtCore import (QDate, QString, Qt, SIGNAL, pyqtSignature) from PyQt4.QtGui import (QApplication, QDialog, QDialogButtonBox) import moviedata_ans as moviedata import ui_addeditmoviedlg_ans as ui_addeditmoviedlg class AddEditMovieDlg(QDialog, ui_addeditmoviedlg.Ui_AddEditMovieDlg): def __init__(sel...
""" Copyright (C) 2014 smokdpi 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 distribu...
''' test_qgsatlascomposition.py -------------------------------------- Date : Oct 2012 Copyright : (C) 2012 by Dr. Hugo Mercier email : hugo dot mercier at oslandia dot com **************************************...
a, b = map(int,raw_input().split()) i=0 while(i<a): j=0 c=[] if(i%2==0): while(j<b): c.append('#') j=j+1 print (''.join(c)) else: k = int(i/2) if (k%2==0): while(j<(b-1)): c.append(".") j=j+1 c.append("#") print (''.join(c)) else: c.append('#') while(j<(b-1)): c.append("."...
import simplegui import math import random WIDTH = 800 HEIGHT = 600 score = 0 lives = 3 time = 0 game_mode = 0 # 0 = splash screen, 1 = game mode, 2 = game over ANGULAR_ACCEL_SCALAR = math.pi / 800.0 ANGULAR_FRICTION = 0.95 LINEAR_ACCEL_SCALAR = 0.25 LINEAR_FRICTION = 0.99 RANDOM_VEL_MAX = 4.0 RANDOM_VEL_MIN = 0.5 RAND...
""" AUTHOR: Peter Collins, 2005. This software is Copyright (C) 2004-2008 Bristol University and is released under the GNU General Public License version 2. MODULE: RunHill PURPOSE: A sample setup and configuration for the normalization algorithms. NOTES: See RunConfig.py for configuration options """ import sys impor...
from Plugins.Plugin import PluginDescriptor from Screens.PluginBrowser import * from Screens.Ipkg import Ipkg from Screens.HarddiskSetup import HarddiskSetup from Components.ProgressBar import ProgressBar from Components.SelectionList import SelectionList from Screens.NetworkSetup import * from enigma import * from Scr...
import os import sys import tnetstring def read_packets (filename): try: os.stat (filename) except OSError: print "No such file : %s"%filename sys.exit (1) pkts = open (filename).read () pkts = tnetstring.loads (pkts, 'iso-8859-15') for data in pkts: yield data if '__...
from polybori import BooleSet, interpolate_smallest_lex class PartialFunction(object): """docstring for PartialFunction""" def __init__(self, zeros, ones): super(PartialFunction, self).__init__() self.zeros = zeros.set() self.ones = ones.set() def interpolate_smallest_lex(self): ...
""" This is the Create_Modify_Interface function (along with its helpers). It is used by WebSubmit for the "Modify Bibliographic Information" action. """ __revision__ = "$Id$" import os import re import time import pprint import cgi from invenio.dbquery import run_sql from invenio.websubmit_config import InvenioWebSubm...
import glob import os import site from cx_Freeze import setup, Executable import meld.build_helpers import meld.conf site_dir = site.getsitepackages()[1] include_dll_path = os.path.join(site_dir, "gnome") missing_dll = [ 'libgtk-3-0.dll', 'libgdk-3-0.dll', 'libatk-1.0-0.dll', 'libintl-8.dll', 'libzz...
from Sensor import Sensor import nxt class ColorSensor(Sensor): name = 'color' def Initialize(self): #self.sensor = nxt.Light(self.robot.GetBrick(), self.port) #self.sensor.set_illuminated(0) self.sensor = nxt.Color20(self.robot.GetBrick(), self.port) def Scan(self): return s...
""" Implements compartmental model of a passive cable. See Neuronal Dynamics `Chapter 3 Section 2 <http://neuronaldynamics.epfl.ch/online/Ch3.S2.html>`_ """ import brian2 as b2 from neurodynex3.tools import input_factory import matplotlib.pyplot as plt import numpy as np b2.defaultclock.dt = 0.01 * b2.ms CABLE_LENGTH =...
__author__ = "V.A. Sole - ESRF Data Analysis" import os import numpy import time try: from PyMca import EdfFile from PyMca import TiffIO except ImportError: print("ArraySave.py is importing EdfFile and TiffIO from local directory") import EdfFile import TiffIO HDF5 = True try: import h5py except...
from Screen import Screen from Screens.ChoiceBox import ChoiceBox class ResolutionSelection(Screen): def __init__(self, session, infobar=None): Screen.__init__(self, session) self.session = session xresString = open("/proc/stb/vmpeg/0/xres", "r").read() yresString = open("/proc/stb/vmpeg/0/yres", "r").read() ...
from time import sleep import os import RPi.GPIO as GPIO import subprocess import datetime GPIO.setmode(GPIO.BCM) GPIO.setup(24, GPIO.IN) count = 0 up = False down = False command = "" filename = "" index = 0 camera_pause = "500" def takepic(imageName): print("picture") command = "sudo raspistill -o " + imageName +...
class City(object): def __init__(self, name): self.name = name def Name(self): return self.name class Home(object): def __init__(self, name, city): self.name = name self.city = city def Name(self): return self.name def City(self): return self.city clas...
import P1011 import unittest class test_phylab(unittest.TestCase): def testSteelWire_1(self): m = [10.000,12.000,14.000,16.000,18.000,20.000,22.000,24.000,26.00] C_plus = [3.50, 3.81, 4.10, 4.40, 4.69, 4.98, 5.28, 5.59, 5.89] C_sub = [3.52, 3.80, 4.08, 4.38, 4.70,...
from .extractor_crossplatform import CrossPlatformFileSystemExtractor from .extractor_epub import EpubMetadataExtractor from .extractor_exiftool import ExiftoolMetadataExtractor from .extractor_filetags import FiletagsMetadataExtractor from .extractor_guessit import GuessitMetadataExtractor from .extractor_jpeginfo imp...
import unittest class FooTest(unittest.TestCase): '''Sample test case -- FooTest()''' def setUp(self): '''Set up for testing...''' print 'FooTest:setUp_:begin' testName = self.shortDescription() if (testName == 'Test routine A'): print 'setting up for test A' ...
import webapp2 import time import dbcontroller as dc import speak import User import logging class MainHandler(webapp2.RequestHandler): def get(self): list = dc.refresh() lines = speak.speak(list) import twitter for user in User.users: for i in lines: str1...
__author__ = 'bruno' import unittest import algorithms.math.abacus as Abacus class TestAbacus(unittest.TestCase): def setUp(self): pass def test_abacus1(self): abacus = Abacus.generate_abacus(0) self.assertEqual(['|00000***** |', '|00000***** |', ...
""" Package represents the collection of resources the user is editing i.e. the "package". """ import datetime import shutil import logging import time import zipfile import uuid import re from xml.dom import minidom from exe.engine.path import Path, TempDirPath, toUnicode from exe.engine.no...
encoding = 'utf-8' dict = { '&About...': '&\xd8\xb9\xd9\x86...', '&Delete Window': '&\xd8\xa7\xd8\xad\xd8\xb0\xd9\x81 \xd8\xa7\xd9\x84\xd9\x86\xd8\xa7\xd9\x81\xd8\xb0\xd8\xa9', '&Describe Action': '&\xd8\xa3\xd9\x88\xd8\xb5\xd9\x81 \xd8\xa7\xd9\x84\xd8\xb9\xd9\x85\xd9\x84\xd9\x8a\xd8\xa9', '&Execute Action': '&\xd9\x86...
import sys from starstoloves.models import User as UserModel from starstoloves import model_repository from starstoloves.lib.track import lastfm_track_repository from .user import User def from_session_key(session_key): user_model, created = UserModel.objects.get_or_create(session_key=session_key) return User( ...
# -*- coding: utf-8 -*- """ translate variance and its formated character which have regularities for example: raw input: v={'aa': 12345, 'bbbb': [1, 2, 3, 4, {'flag': 'vvvv||||xxxxx'}, set(['y', 'x', 'z'])]} after `var2str.var2str(v)` v_str=<aa::12345##bbbb::<1||2||3||4||<flag::vvvv|xxxxx>||<y|||x|||z>>>...
from triple_draw_poker.model.Pot import Pot class HandDetails: def __init__(self): self.pot = Pot() self.raised = 0 self.street = 0 self.number_of_streets = 4 self.in_draw = False self.hands = [] self.dealt_cards_index = 0 def getDealtCardsIndex(self): ...
from src.tools.enum import enum import pyxbmct.addonwindow as pyxbmct from src.tools.dialog import dialog EnumMode = enum(SELECT=0, ROTATE=1) class EnumButton(object): def __init__(self, label, values, current, default, changeCallback=None, saveCallback=None, customLabels=None, mode=EnumMode.SELECT, returnValue=Fal...
import math """ Speed of light constant """ c = 3E8 """ Vacuum permittivity """ e0 = 8.8541E-12 """ Vacuum permeability """ u0 = 4E-7*math.pi def getEffectivePermitivity(WHratio, er): """ Returns the effective permitivity for a given W/H ratio. This function assumes that the thickenss of conductors is insignificant....
import sklearn.datasets as skds import numpy as np import random import theano.tensor as T import theano import matplotlib.pyplot as plt import math x = np.arange(-50., 50., 1) y = np.array(map(lambda tmp: 1.0/(1 + math.exp(-3 * tmp + 5.0)), x)) noise = np.random.uniform(-0.1, .1, size=len(x)) y += noise print x print ...
""" This implements a redirection for CERN HR Documents in the CERN Document Server. It's useful as a reference on how goto plugins could be implemented. """ import time import re from invenio.legacy.search_engine import perform_request_search from invenio.legacy.bibrecord import get_fieldvalues from invenio.legacy.bib...
import os.path import sys from PyQt5 import QtGui if sys.platform == 'win32': _search_paths = [] else: _search_paths = [ os.path.expanduser('~/.icons'), os.path.join(os.environ.get('XDG_DATA_DIRS', '/usr/share'), 'icons'), '/usr/share/pixmaps', ] _current_theme = None if 'XDG_CURRENT...
"""OpCodes module This module implements the data structures which define the cluster operations - the so-called opcodes. Every operation which modifies the cluster state is expressed via opcodes. """ import logging import re import operator from ganeti import constants from ganeti import errors from ganeti import ht _...
import re import string import sys import os USAGE = 'USAGE: parse.y <player.h> <playercore_casts.i> <playercore_arraysofclasses.i> <Jplayercore> <playercore> <player.java>' if __name__ == '__main__': if len(sys.argv) != 7: print USAGE sys.exit(-1) infilename = sys.argv[1] outfilename = sys.argv[2] aofc...
from spacewalk.common.rhnTranslate import _ from spacewalk.common import rhnFault, rhnFlags, log_debug, log_error from spacewalk.server.rhnLib import parseRPMName from spacewalk.server.rhnHandler import rhnHandler from spacewalk.server import rhnSQL, rhnCapability class Errata(rhnHandler): """ Errata class --- retr...
from django import forms from django.contrib.auth.models import User from django.forms import ModelForm from django.db import models User.add_to_class('usuario_sico', models.CharField(max_length=10, null=False, blank=False)) User.add_to_class('contrasenia_sico', models.CharField(max_length=10, null=False, blank=False))...
import sys import time from naoqi import ALProxy IP = "nao.local" PORT = 9559 if (len(sys.argv) < 2): print "Usage: 'python RecordAudio.py nume'" sys.exit(1) fileName = "/home/nao/" + sys.argv[1] + ".wav" aur = ALProxy("ALAudioRecorder", IP, PORT) channels = [0,0,1,0] aur.startMicrophonesRecording(fileName, "wa...
import re from PyQt4.QtCore import (Qt, SIGNAL, pyqtSignature) from PyQt4.QtGui import (QApplication, QDialog) import ui_findandreplacedlg MAC = True try: from PyQt4.QtGui import qt_mac_set_native_menubar except ImportError: MAC = False class FindAndReplaceDlg(QDialog, ui_findandreplacedlg.Ui_FindAndRep...
import json import ast import textwrap from mixbox import idgen from mixbox.namespaces import Namespace from stix.core import STIXHeader, STIXPackage from stix.common import InformationSource from stix.common.vocabs import VocabString from stix.incident import Incident from stix.incident.time import Time as StixTime fr...
import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../master')) sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../master/wkpf')) print os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../master/wkpf') from wkpf.pynvc import * fr...
import os import sys print help(sys) print help(os)
try: from io import StringIO except ImportError: try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import bs4 as BeautifulSoup import logging from thug.DOM.W3C.Element import Element from thug.DOM.W3C.Style.CSS.ElementCSSInlineStyle import ElementCSSInline...
import sys import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((600, 500)) pygame.display.set_caption("Drawing Lines") screen.fill((0, 80, 0)) color = 100, 255, 200 width = 8 pygame.draw.line(screen, color, (100, 100), (500, 400), width) pygame.display.update() while True: for e...
""" Function-like objects that creates cubic clusters. """ import numpy as np from ase.data import reference_states as _refstate from ase.cluster.factory import ClusterFactory class SimpleCubicFactory(ClusterFactory): spacegroup = 221 xtal_name = 'sc' def get_lattice_constant(self): "Get the lattice...
import math import random def finding_prime(number): num=abs(number) if num<4: return True for x in range(2,num): if num%x == 0: return False return True def finding_prime_sqrt(number): num=abs(number) if num<4: return True for x in range(2,int(math.sqrt(num))+1): if number%x == 0: return False return...
""" Low-level Python bindings for libdbus. Don't use this module directly - the public API is provided by the `dbus`, `dbus.service`, `dbus.mainloop` and `dbus.mainloop.glib` modules, with a lower-level API provided by the `dbus.lowlevel` module. """ import dbus.lowlevel as __dbus_lowlevel from _LongBase import _LongBa...
bl_info = { "name" : "text objects to-from xml", "author" : "chebhou", "version" : (1, 0), "blender" : (2, 7, 3), "location" : "file->export->text to-from xml", "discription" : "copys an text objectx from-to xml file", "wiki_url" : " https://github.com/chebhou", "tracker_url" : "https://...
from __future__ import print_function, division, absolute_import import difflib import locale import os import pprint import six import sys import tempfile try: import unittest2 as unittest except ImportError: import unittest import logging try: # 2.7+ logging.captureWarnings(True) except AttributeError...
""" Created on Wed Jun 26 11:09:05 2013 @author: jotterbach """ from numpy import * from ED_HalfFilling import EigSys_HalfFilling from DotProduct import scalar_prod from multiprocessing import * from multiprocessing import Pool import matplotlib.pyplot as plt from ParallelizationTools import info from os.path import * ...
"""Do not call std::string::find_first_of or std::string::find with a string of characters to locate that has the size 1. Use the version of std::string::find that takes a single character to locate instead. Same for find_last_of/rfind. """ error_msg = "Do not use find(\"a\"), use find('a')." regexp = r"""(?x) r?find(_...
global mods mods = []
import hashlib import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.colors as colors import matplotlib.cm as cm from matplotlib.patches import Rectangle import os import shutil import tempfile from sar_parser import SarParser LEGEND_THRESHOLD = 50 d...
import sys import os import os.path try: import builtins as builtin except ImportError: import __builtin__ as builtin from os.path import getmtime, exists import time import types from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion from Cheetah.Version import MinCompatibleVersionTuple as ...
""" .. module:: editor_subscribe_label_deleted The **Editor Subscribe Label Deleted** Model. PostgreSQL Definition --------------------- The :code:`editor_subscribe_label_deleted` table is defined in the MusicBrainz Server as: .. code-block:: sql CREATE TABLE editor_subscribe_label_deleted ( editor INTE...
import werkzeug from openerp import http, SUPERUSER_ID from openerp.http import request class MassMailController(http.Controller): @http.route('/mail/track/<int:mail_id>/blank.gif', type='http', auth='none') def track_mail_open(self, mail_id, **post): """ Email tracking. """ mail_mail_stats = re...
default_app_config = 'escolar.apps.EscolarConfig'
"""XLIFF classes specifically suited for handling the PO representation in XLIFF. This way the API supports plurals as if it was a PO file, for example. """ import re from lxml import etree from translate.misc.multistring import multistring from translate.misc.xml_helpers import setXMLspace from translate.storage impor...
import os import sys import unittest from unittest import mock import time import logging import tempfile from os.path import join sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from gallery_dl import config, extractor # noqa E402 class TestCookiejar(unittest.TestCase): @classmetho...
from os import path try: from lib.settings_build import Configure except ImportError: import sys from os.path import expanduser, join sys.path.append(join(expanduser("~"), 'workspace/automation/launchy')) from lib.settings_build import Configure class Default(Configure): def __init__(self): ...
from numpy import * from matplotlib.pyplot import * import scipy.constants as sc import copy import scipy.integrate as integ def hw5(m1, m2, a, e, tmax, tstep=0.001, tplot=0.025, method='leapfrog'): if method != 'leapfrog' and method != 'odeint': print("That's not a method") return() # initializ...
from django import forms from getresults_aliquot.models import Aliquot from .models import Order class OrderForm(forms.ModelForm): def clean_aliquot_identifier(self): aliquot_identifier = self.cleaned_data.get('aliquot_identifier') try: Aliquot.objects.get(aliquot_identifier=aliquot_iden...
import tempfile import os import storage.fileUtils as fileUtils import testValidation from testrunner import VdsmTestCase as TestCaseBase class DirectFileTests(TestCaseBase): @classmethod def getConfigTemplate(cls): return {} def testRead(self): data = """Vestibulum. Libero leo nostra, pede ...
try: from django.conf.urls import url, patterns except ImportError: from django.conf.urls.defaults import url, patterns from actstream import feeds from actstream import views from django.contrib.auth.decorators import login_required urlpatterns = patterns('actstream.views', # Syndication Feeds url(r'^f...
class Song(object): def __init__(self, lyrics): self.lyrics = lyrics def sing_me_a_song(self): for line in self.lyrics: print line happy_bday = Song(["Happy birthday to you", "I don't want to get sued", "So I'll stop right here"]) bulls_on_parade...
from __future__ import absolute_import import os import sys import shutil import unittest import xml.dom.minidom parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, parentdir) from pcs_test_functions import pcs,ac import rule empty_cib = "empty.xml" temp_cib = "temp.xml" class Dat...
""" .. module:: poes :synopsis: A module for reading, writing, and storing poes Data .. moduleauthor:: AJ, 20130129 ********************* **Module**: gme.sat.poes ********************* **Classes**: * :class:`poesRec` **Functions**: * :func:`readPoes` * :func:`readPoesFtp` * :func:`mapPoesMongo` * :func:`ov...
""" This file is part of Commix Project (http://commixproject.com). Copyright (c) 2014-2017 Anastasios Stasinopoulos (@ancst). 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 L...
import bpy from bpy.props import * from PyHSPlasma import * from .base import PlasmaModifierProperties from ..prop_world import game_versions from ...exporter import ExportError from ... import idprops class PlasmaVersionedNodeTree(idprops.IDPropMixin, bpy.types.PropertyGroup): name = StringProperty(name="Name") ...
import os.path from django.test import TestCase from django.core.urlresolvers import reverse from django.conf import settings from django.contrib.auth import get_user_model from avatar.settings import AVATAR_DEFAULT_URL, AVATAR_MAX_AVATARS_PER_USER from avatar.util import get_primary_avatar from avatar.models import Av...
"""Output a CSV file that can be imported to Petra""" import os import sys import calendar import csv from csv_dict import CSVDict, CSVKeyMissing def split_csv(table_file='Tabell.csv'): """Split account, cost center and project into three tables""" account = [] cost_center = [] project = [] with ope...
""" José Vicente Pérez Granada University (Spain) March, 2017 Testing suite for profiler.py Last modified: 19 June 2017 """ import time import profiler as p import praster as pr import numpy as np import matplotlib.pyplot as plt print("Tests for TProfiler methods") def test01(): """ Creates a TProfiler from an ...
import os import sys import binascii from smtplib import SMTPException from django.db import models from django.dispatch import receiver from django.conf import settings from django.contrib.auth.signals import user_logged_in from django.db.models.signals import post_save, post_migrate from django.utils.translation impo...
from __future__ import unicode_literals, absolute_import import logging import json from django.utils.dateparse import parse_datetime from django.utils import timezone from wechatpy.exceptions import WeChatClientException from common import wechat_client from .local_parser import LocalParser from remind.models import R...
from settings import CONTENT_SERVER """ context processor applied to all requests """ def settings_cp(request): return {'content_server': CONTENT_SERVER}