code
stringlengths
1
199k
import re import os.path from io import open from setuptools import find_packages, setup PACKAGE_NAME = "azure-mgmt-batch" PACKAGE_PPRINT_NAME = "Batch Management" package_folder_path = PACKAGE_NAME.replace('-', '/') namespace_name = PACKAGE_NAME.replace('-', '.') with open(os.path.join(package_folder_path, 'version.py...
from django.contrib import auth from django.contrib.auth.decorators import * from django.contrib.auth.models import User from django.shortcuts import * from django.http import * from django.core.paginator import * from ..models import * from .. import Utils import json import time from django.views.decorators.csrf impo...
import sys from PyQt5 import QtCore, QtWidgets def qt_message_handler(mode, context, message): if mode == QtCore.QtInfoMsg: mode = 'INFO' elif mode == QtCore.QtWarningMsg: mode = 'WARNING' elif mode == QtCore.QtCriticalMsg: mode = 'CRITICAL' elif mode == QtCore.QtFatalMsg: ...
import warnings import holidays import numpy as np import pandas as pd import patsy from scipy.stats import chi2 from sklearn import linear_model class SeasonalElasticNetCVModel(object): ''' Linear regression using daily frequency data to build a model of formatted energy trace data that takes into account HDD,...
import threading, time, os, signal, sys, operator class MyThread(threading.Thread): """this is a wrapper for threading.Thread that improves the syntax for creating and starting threads. """ def __init__(self, target, *args): threading.Thread.__init__(self, target=target, args=args) self....
from __future__ import unicode_literals import re import nose from django.conf import settings from django.contrib import messages from django.contrib.auth.models import AnonymousUser, User from django.core.exceptions import ValidationError from django.http import HttpResponse, HttpResponseRedirect from django.test.cli...
from django.db import models from apps.myerp.models import PurchaseOrder, Employee RELATED_NAME_PREFIX = '%(app_label)s_%(class)s_' class WFNode01(models.Model): """01流程节点表""" START, NORMAL, END, OTHER = 's', 'n', 'e', 'o' node_type_enum = ( (START, 'start'), (NORMAL, 'normal'), (END...
import os import json from fabric.api import cd from fabric.contrib import files from fabric.state import _AttributeDict from cloudbio.flavor.config import get_config_file from utils import build_properties, upload_config, config_dir DEFAULTS = dict( path='/var/chef', data_bags=config_dir(os.path.join('chef', '...
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField, TextAreaField from wtforms.validators import Required, EqualTo, Length class ChangePasswordForm(FlaskForm): # 旧密码字段 old_password = PasswordField('Old password', validators=[Required()]) # 新密码字段 password = Passwo...
from django.db import models from django.contrib.auth.models import User class Category(models.Model): name = models.CharField(max_length=128, unique=True) views = models.IntegerField(default=0) likes = models.IntegerField(default=0) def __unicode__(self): return self.name class Page(models.Model): category = mo...
import datetime import multiprocessing import threading import time def critical_section(cs_lock: threading.Lock): """ Decorator which uses acquires the specified lock when entering in the decorated function and releases it once out of the decorated function. :param cs_lock: :return: """ def...
import sys import time from scipy.special import binom as binom from timer import Timer from util import * import numpy as np class SATCounter: def __init__(self, sat_problem, verbose=True, use_regular=False): """ Each SATCounter solves a specific sat problem that must be specified at creation """ s...
"""Implement the Erikson Flanker Task described in Eichele 2008 (doi: doi: 10.1073/pnas.0708965105)""" from psychopy import core, visual, gui, data, event, sound, logging from psychopy.tools.filetools import fromFile, toFile import time, numpy as np import AppKit # for monitor size detection isPractice = False # g...
class Position: """The position in the board""" def __init__(self, row, column): self.row = row self.column = column def getRow(self): return self.row def getColumn(self): return self.column def getRelativePosition(self, size, orientation): endPosition = None ...
import _plotly_utils.basevalidators class ShowticklabelsValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__( self, plotly_name="showticklabels", parent_name="carpet.baxis", **kwargs ): super(ShowticklabelsValidator, self).__init__( plotly_name=plotly_name, ...
import time import pytest from slackeventsapi.server import SlackEventAdapterException def test_event_emission(adapter): test_event_emission.event_handled = False # Events should trigger an event @adapter.on('reaction_added') def event_handler(event_data): test_event_emission.event_handled = Tru...
import collections import os import logging import threading import wandb EventJobDone = collections.namedtuple("EventJobDone", ("job", "success")) logger = logging.getLogger(__name__) class UploadJob(threading.Thread): def __init__( self, done_queue, stats, api, file_stream,...
class HttpException(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class AuthException(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class GenericException(Excepti...
from setuptools import setup, find_packages setup( name='textlytics', version='0.0.1', packages=find_packages(exclude=['docs', 'tests', '*.tests']), package_data={ 'textlytics': ['data/*'], }, author=u'Lukasz Augustyniak', author_email='luk.augustyniak@gmail.com', license='BSD', ...
""" pyexcel.plugins.sources.params ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Local magic workds :copyright: (c) 2015-2017 by Onni Software Ltd. :license: New BSD License """ MEMORY = 'memory' FILE_TYPE = 'file_type' FILE_NAME = 'file_name' FILE_STREAM = 'file_stream' SESSION = 'session' TABLE = 'tabl...
""" realestate -------------------------------------------------------------------- """ __version__ = '3.0.0' __author__ = "someone" content = { 'real-estate_headline': ['<#realestate_shortheadline#>'], 'realestate_headline': ['<#realestate_shortheadline#>'], 'realestate_section': ['<#re...
""" key_krumhansl.py Key analysis: Basic Krumhansl """ import music21 from leadreader.analyses.base import BaseAnalysis class KeyKrumhansl(BaseAnalysis): """ http://web.mit.edu/music21/doc/moduleReference/moduleAnalysisDiscrete.html """ def name(self): return 'key_krumhansl' def description(...
"""Tests for the services module.""" import pytest from soco.events_base import Event, parse_event_xml DUMMY_EVENT = """ <e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0"> <e:property> <ZoneGroupState>&lt;ZoneGroups&gt;&lt; ZoneGroup Coordinator="RINCON_000XXX01400" ID="RINCON_...
from math import factorial import dice import pprint import combin from combin import generateArrangements def numArrangements(items): itemCounts = {k: 0 for k in items} for i in items: itemCounts[i] += 1 divisor = 1 for (k,v) in itemCounts.iteritems(): divisor *= factorial(v) return...
from __future__ import print_function import logging from flask import Flask, render_template from flask_s3 import FlaskS3 from flaskext.markdown import Markdown app = Flask(__name__) app.config["FLASKS3_BUCKET_NAME"] = "{{ cookiecutter.s3_bucket_name }}" app.config["FLASKS3_BUCKET_DOMAIN"] = "s3-{{ cookiecutter.aws_re...
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin from django.db import models from django.utils import timezone from askcoding.base.models import UUIDModel class UserManager(BaseUserManager): use_in_migrations = True def _create_user(self, email, password, is_staff, is_...
import os import time import cauldron from cauldron import environ from cauldron.environ.response import Response from cauldron.test import support from cauldron.test.support import scaffolds class TestSync(scaffolds.ResultsTest): """...""" def test_sync_project(self): """Should synchronize local files ...
from django.contrib import admin from blog.models import Entry admin.site.register(Entry)
""" Unit tests for the vector renderer """ from __future__ import absolute_import from __future__ import unicode_literals import unittest import numpy as np import vtk from vtk.util import numpy_support from .. import vectorRenderer from ... import utils from six.moves import range class DummyColouringOpts(object): ...
from __future__ import unicode_literals from django.apps import AppConfig from django import forms from django.contrib.auth.forms import UserCreationForm from django.http import HttpResponseRedirect from django.shortcuts import render class SignupsConfig(AppConfig): name = 'signups' def register(request): if re...
import sys, os import functools sys.path.append(os.path.abspath('sphinxext')) sys.path.append(os.path.abspath('../antk/models/')) sys.path.append(os.path.abspath('../antk/datascripts/')) sys.path.append(os.path.abspath('../antk/core/')) sys.path.append(os.path.abspath('../antk/datascripts/ml100k/')) extensions = [ ...
""" This class is an unmodified copy of one from a blog post written by Lennart Regebro at: http://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/ No license terms were specified in the blog post. It has been included as a minor convenience. If we ever need to purge our code of ext...
import _plotly_utils.basevalidators class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__(self, plotly_name="hoverlabel", parent_name="funnel", **kwargs): super(HoverlabelValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
import clr clr.AddReference('System.Data') from System import Array, Object, DBNull from System.Data.Common import DbConnectionStringBuilder def _load_type(assembly, typename): import clr clr.AddReference(assembly) type = __import__(typename) for component in typename.split('.')[1:]: type = geta...
from numpy import * from math import * inp = open('input.txt', 'r') out = open('output.txt', 'w') A, f, a, b, c = [], [], [], [], [] n, m = 5, 5 for line in inp: # читаем А и b temp = [float(x) for x in line.split()] f.append(temp.pop()) A.append(temp) for i in range(n): # переименовываем переменный главн...
from objects.resources.ConfigReader import ConfigReader class StartScreenLocalization(ConfigReader): def __init__(self, config, section_name): ConfigReader.__init__(self, config, section_name) @property def title_label(self): return self.get_config_property('initial_screen_title') @prope...
"""Various lexer functions used by the parsers.""" from bibpy.lexers.biblexer import BibLexer from bibpy.lexers.name_lexer import NameLexer from bibpy.lexers.namelist_lexer import NamelistLexer import funcparserlib.lexer as lexer from funcparserlib.lexer import Token def remove_whitespace_tokens(tokens): """Remove ...
from spider import * sys.path.append("..") from utils import Utils class ProjectsSpider(Spider): def __init__(self): Spider.__init__(self) self.school = "projects" self.utils = Utils() def doWork(self): self.getDARPAProjects() self.getDARPAOpenProjects() self.getA...
import unittest import json as json import pickle import ipdb as ipdb import segment_phrases.segment_phrases as seg import cky as cky import phrase_table.DB_Phrase_Table as DB_Phrase_Table from pprint import pprint import preprocess.tokenizer as tokenizer class TestCKY(unittest.TestCase): # setup -- create a new CK...
import unittest from src.match_parantheses import match_parantheses class MatchParantheses(unittest.TestCase): def test_match_parantheses(self): s = '' actual = match_parantheses(s) self.assertTrue(actual, 'empty string respects the rule of '+ 'parantheses o...
import os, sys import subprocess if __name__ == '__main__': try: android_home = os.environ["ANDROID_BUILD_TOP"] except KeyError: print "ANDROID_BUILD_TOP is not set - should have been set while building android" sys.exit() inFolder = android_home + '/../sapphire/bin/classes/sapphire/...
import numpy as np from scipy.spatial import Delaunay from SimPEG import Utils, Mesh def PolygonInd(mesh, pts): # if mesh.dim == 2: hull = Delaunay(pts) inds = hull.find_simplex(mesh.gridCC) >= 0 # else: return inds def readSeepageModel(fname, mesh=None, xsurf=None, ysurf=None): fluiddata = pd.r...
''' Copyright (C), 2015, Mark Bakker. Mark Bakker, Delft University of Technology mark dot bakker at tudelft dot nl TimML is a computer program for the simulation of steady-state multiaquifer flow with analytic elements and consists of a library of Python scripts and FORTRAN extensions. ''' __name__='timml' __author__=...
from __future__ import absolute_import from __future__ import print_function from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.embeddings import Embedding from keras.layers.recurrent import LSTM from keras.optimizers import Adam import pickle import time impo...
""" DESCRIPTION: You are given two sequences. Write a program to determine the longest common subsequence between the two strings (each string can have a maximum length of 50 characters). NOTE: This subsequence need not be contiguous. The input file may contain empty lines, these need to be ignored. INPUT: The first ar...
def binary_search(alist, item): first = 0 last = len(alist) - 1 found = False while first <= last and not found: pos = 0 midpoint = (first + last) // 2 if alist[midpoint] == item: pos = midpoint found = True else: if item < alist[midpoi...
expected = [ { "id": "SD1-data", "type": "supplementary-material", "asset": "data", "component_doi": "10.7554/eLife.00013.004", "sibling_ordinal": 1, "label": "Figure 1—source data 1.", "full_label": "Figure 1—source data 1.", "position": 1, "o...
import string import zlib import base64 import ExpIO import ExpUtil from Player import * from Room import * from Command import * RESULT_NOTHING = 0 RESULT_NORMAL = 1 RESULT_DESCRIBE = 2 RESULT_WIN = 4 RESULT_DIE = 8 RESULT_END_GAME = 16 RESULT_NO_CHECK = 32 RESULT_SUSPEND = 64 RESULT_RESUME = 128 SUSPEND_INTERACTIVE =...
import unittest import numpy as np import matplotlib.pyplot as plt x=0.0 xrange=2000 f = open('potential.d','w') for i in range(1, xrange+1, 1): f.write("%s %10s %10s %10s\n" % (i, x, (2.0-2.0*(x-10)**2)**2, -16.0*(x-10)+16.0*(x-10)**3)) # f.write("%s %10s %10s %10s\n" % (i, x, (2.0-2.0*(x-10)**2)**2, 0)) x=x+...
_version_major = 0 _version_minor = 1 _version_micro = 0 __version__ = "{0:d}.{1:d}.{2:d}".format( _version_major, _version_minor, _version_micro)
""" Extract text from the text-code stream and comment it. Supports three modes of normalization and commenting: 1. Don't add any comments 2. Add comments 3. Remove text, leave code only Since several operations are quite expensive, it actively uses caching. Exported functions: beautify(text, lang, opti...
""" PipelineGtfsubset.py - Tasks for GTF subsetting =============================================== Reference --------- """ import CGAT.Experiment as E import os import MySQLdb import pysam import CGAT.IOTools as IOTools import CGAT.GTF as GTF import CGATPipelines.Pipeline as P class SubsetGTF(): def __init__(self,...
""" sinecosine.py Author: <your name here> Credit: <list sources used, if any> Assignment: In this assignment you must use *list comprehensions* to generate sprites that show the behavior of certain mathematical functions: sine and cosine. The sine and cosine functions are provided in the Python math library. These fun...
import shelve import re import atexit directory = None outputs = [] my_user_id = None slack_client = None def setup(bot, config): global my_user_id global slack_client global directory dir_file = config.get('TEAM_DB_FILE') or 'teams.db' directory = shelve.open(dir_file) slack_client = bot.slack_...
from .lib.ext import TaxonFlask from .app import db, assets, alembic def init_app(env): assert env in ('development', 'testing', 'production') app = TaxonFlask(__name__) app.config.from_object('taxonwiki.config.{0}Config' .format(env.capitalize())) db.init_app(app) assets....
import sys import os import glob def identify_regions(globstr, src_dir, cutoff=1): """Identifies regions above cutoff in bam files. Input argument specifies the bam files to work on. Outputs .regions files. Returns nothing. src_dir is the directory with the required perl script. """ print "Identifying regions abo...
ACCOUNT_CREDIT_SCORES = 1 ACCOUNT_LIKE_SCORE = 50 ACCOUNT_GOAL_SCORE = 5 ACCOUNT_UPDATE_SCORE = -10 GOAL_LIKE_SOCRE = 20 GOAL_UPDATE_SCORE = 1 GOAL_UPDATE_DAY = -5 ACTION_SCORE = { 'signin': 1, 'signup': 10, 'update': 1, 'finish': 10, 'create': -5, 'restore': -10, 'called': -1, }
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy.ext.declarative import declarative_base from psiturk_config import PsiturkConfig config = PsiturkConfig() config.load_config() DATABASE = config.get('Database Parameters', 'database_url') engine = create_engine(...
import imp import sys from importlib import import_module from optparse import make_option from django.conf import settings from django.core.management.base import BaseCommand try: from django.apps import apps as django_apps HAS_DJANGO_APPS = True except ImportError: # Django 1.6 HAS_DJANGO_APPS = False...
from configparser import ConfigParser import functools import logging import os import sys LOG_FORMAT = ( '[%(asctime)s] [%(process)d] ' '[%(levelname)s] [{app_name:s}/%(name)s] %(message)s' ) LOG_DATE_FORMAT = '%Y-%m-%d %H:%M:%S %z' CONFIG_VALUE = 'SERVICE_CONFIG' config = ConfigParser() def setup_logging(app_...
import autosar ws = autosar.workspace() package=ws.createPackage("DataType", role="DataType") package.createSubPackage('DataTypeSemantics', role='CompuMethod') package.createSubPackage('DataTypeUnits', role='Unit') BatteryCurrent_T = package.createIntegerDataType('BatteryCurrent_T', min=0, max=65535, offset=-1600, scal...
try: import cPickle as pickle except: import pickle from base64 import b64decode from django.db import models from django.utils.translation import ugettext_lazy as _ from django.db.models import Sum from feincms.content.application.models import app_reverse from forum.managers import TopicManager __all__ = [ ...
import sendgrid import json import os sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY')) response = sg.client.user.account.get() print(response.status_code) print(response.body) print(response.headers) response = sg.client.user.credits.get() print(response.status_code) print(response.body) print...
"""Tests for the general many-body problem. Some general tensor operations requiring range and dummies in the drudge are also tested here. """ import pytest from sympy import IndexedBase, conjugate, Symbol, symbols, I, exp, pi, sqrt from drudge import GenMBDrudge, CR, AN, Range @pytest.fixture(scope='module') def genmb...
a = int(input()) b = int(input()) if a > b: print(a) else: print(b)
import django.contrib.auth import pytest import models @pytest.fixture def user(): User = django.contrib.auth.get_user_model() return User.objects.create_user('john', 'john@example.com', 'password') @pytest.mark.django_db def test_issue_auto_now(user): issue = models.Issue(reporter=user) issue.save() ...
print "pew" print "pew" print "pew" print "pew" print "pew" print "pew" print "Hi" print "Hi" print "Hi" print "Hi" print "Hi" print "Hi" print "Hi" print "Hi" print False print True print 3 print 4 print 5 print 52413 print True, False print 0.0 print 0.7, 0.23, 0.13 print "Hello, world", "Python", "beans" print ("Nat...
def recvol(l, w, h): return l*w*h def recsurfarea(l, w, h): return 2*l*w + 2*l*h + 2*w*h def output(h, l, w, rpsa, rpv): out = """ So the height of the rectangular prism is {}, the length of the rectangular prism is {}, and the width of the rectangular prism is {}. Correct? Then the surface area of that recta ngular...
from mock import patch from nose.tools import assert_equal from gittip.elsewhere import github from gittip.models import Elsewhere from gittip.testing import Harness, DUMMY_GITHUB_JSON from gittip.testing.client import TestClient class TestElsewhereGithub(Harness): def test_github_resolve_resolves_correctly(self): ...
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...
from math import ceil from PySide import QtCore, QtGui, QtNetwork, QtXml class DisplayShape: def __init__(self, position, maxSize): self.metadata = {} self.image = QtGui.QImage() self.pos = position self.targetPos = QtCore.QPointF() self.maxSize = maxSize self.interac...
''' I/O package ''' import os as _os if _os.name == 'java': import jython.jycore as _core #@UnusedImport import jython.jyio as _io #@UnusedImport loadnexus = _io.loadnexus else: import python.pycore as _core #@Reimport import python.pyio as _io #@Reimport _asIterable = _core.asIterable _toList = _c...
""" EasyBuild support for building and installing R packages, implemented as an easyblock @author: Stijn De Weirdt (Ghent University) @author: Dries Verdegem (Ghent University) @author: Kenneth Hoste (Ghent University) @author: Jens Timmerman (Ghent University) @author: Toon Willems (Ghent University) """ import shutil...
import re import sys from .loggers import * from .csvs import read_csv_from_file from .directory import browse_dialog_file from .regexes import re_model_name, re_table_name from collections import OrderedDict logger_ensembles = create_logger("ensembles") def addTable(D): """ Add any table type to the given data...
__author__ = 'Parham Alvani' import logging import sys import os import time def count_lines(filename): """ Count the number of lines in file. If the file can't be opened, it should be treated the same as if it was empty """ input_file = None try: input_file = open(filename, 'r') ...
""" jaraco.itertools Tools for working with iterables. Complements itertools and more_itertools. """ from __future__ import absolute_import, unicode_literals, print_function import operator import itertools import collections import math import warnings import six from six.moves import queue, xrange as range import in...
import six from translate.storage import base, po, xliff from translate.tools import podebug PO_DOC = """ msgid "This is a %s test, hooray." msgstr "" """ XLIFF_DOC = """<?xml version='1.0' encoding='utf-8'?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.1" version="1.1"> <file original="NoName" source-language="...
import sys, os, fileinput, re, string, getopt previous = "" commentre = re.compile("^#") for top_srcdir in [".", "..", "../..", "../../..", "../../../.."]: top_srcdir = os.path.normpath(top_srcdir) #if os.path.exists(os.path.join(top_srcdir, "..", "config", "makedepend.py")): if os.path.exists(os.path.join(...
import json import urllib import subprocess import os import time import sys url_base = os.environ.get('URL_BASE') api = os.environ.get('API') ver = "7" arch = "x86_64" count = 4 def get_nodes(ver="7", arch="x86_64", count=4): get_nodes_url = "%s/Node/get?key=%s&ver=%s&arch=%s&count=%s" % ( url_base, api, v...
""" Usually I will have more PDF files in my Downloads path like 300 and 400 pdf files. Sometimes it will be tough to search something I need. So this program move them to appropriate folder in minute of time. """ from os import listdir from os.path import isfile,join import fnmatch import shutil path="/home/ak/D...
"""CPython core set of bytecode opcodes based on version 2.3 This is used in bytecode disassembly among other things. This is similar to the opcodes in Python's opcode.py library. If this file changes the other opcode files may have to be adjusted accordingly. """ from xdis.opcodes.base import ( compare_op, con...
import sys import os import datetime import logging import re import gtk import gobject import __builtin__ if not hasattr(__builtin__, '_'): __builtin__._ = lambda x: x if __name__ == '__main__': sys.path.insert(0, os.path.abspath("./../../")) logging.basicConfig(level=logging.DEBUG) from rednotebook.data i...
import MaKaC.webinterface.rh.welcome as welcome def index(req, **params): return welcome.RHWelcome( req ).process( params )
def read(filename): """ Reads a json file """
__package__ = 'examples' __author__ = 'Barbaglia, Guido - Murzilli, Simone' __email__ = 'guido.barbaglia@gmail.com; simone.murzilli@gmail.com;' __license__ = 'GPL2'
import unit.utils as uu from extractors.text.base import BaseTextExtractor """ Text extractor test class mixins with common functionality. """ class CaseTextExtractorOutputTypes(object): EXTRACTOR_CLASS = None SOURCE_FILEOBJECT = None @classmethod def setUpClass(cls): cls.maxDiff = None ...
import configurator, os p = configurator.start_it_up(getBundlePath(), "Default_Scene_with_Cube.blend") try: wait(Pattern("startup_screen.png").similar(0.90), 5); type(Key.ESC); hover(Pattern("startup_screen.png").similar(0.90)); type(Key.ESC) click(Pattern("export_scene_button.png").similar(0.90)) wait(1.5)...
import sys sys.stdout.write(raw_input().decode('base64'))
import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) from Products.UWOshOIE.tests.uwoshoietestcase import UWOshOIETestCase from Products.CMFCore.WorkflowCore import WorkflowException from Products.UWOshOIE.Extensions.WorkflowScriptHelpers import * class TestWorkflowHelpers(U...
import logging logger = logging.getLogger() import time import threading import Queue import hwsim_utils import utils def check_grpform_results(i_res, r_res): if i_res['result'] != 'success' or r_res['result'] != 'success': raise Exception("Failed group formation") if i_res['ssid'] != r_res['ssid']: ...
""" The module `taskqueue.worker` contains the abstract class :class:`BaseWorker`. All your worker plugins should be derived from it. Your custom functionality should be put into the method `handle_task()`. And if you want to modify the way how task results are reported or tracked then override the method `report_resul...
total = 0 for n in range(2,10000000): #if not(n%1000): print n if sum([int(c)**5 for c in list(str(n))]) == n: print n total += n print 'Sum:', total
"""Create the psyplot icon This script creates the psyplot icon with a dpi of 128 and a width and height of 8 inches. The file is saved it to ``'icon1024.pkl'``""" import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cf from matplotlib.text import FontProperties fontpath = '/Library/Font...
""" @author: Fabio Erculiani <lxnay@sabayon.org> @contact: lxnay@sabayon.org @copyright: Fabio Erculiani @license: GPL-2 B{Matter TinderBox Toolkit}. """ import os import shlex from _entropy.matter.utils import convert_to_unicode, get_stringtype class GenericSpecFunctions(object): def ne_string(...
import json import time from wurfl_cloud import update_device __license__ = """ Copyright (c) 2015 ScientiaMobile Inc. The WURFL Cloud Client is intended to be used in both open-source and commercial environments. To allow its use in as many situations as possible, the WURFL Cloud Client is dual-licensed. You may c...
from json import load from os.path import exists try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen from enigma import eTimer from Components.ActionMap import HelpableActionMap from Components.config import config from Components.Label import Label from Components.Opkg import Opkg...
""" pyext.py - tool chain for building python extension modules Copyright (C) 2010 Daniel Meliza <dmeliza@dylan.uchicago.edu> Created 2010-03-29 """ import os import SCons from SCons.Builder import Builder from SCons.Action import Action import distutils.sysconfig def generate(env,**kw): pybase = distutils.sysconfi...
import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) DATABASE_PASSWORD = 'my_database_password' # database password DATABASE_HOST = 'my_database_host.someplace.com' # database host name DATABASE_NAME = 'mydatabase' # database name DATABASE_PORT = 5432 # database port, 5432 is the default port for postg...
from Screens.Screen import Screen from Components.Sources.CanvasSource import CanvasSource from Components.ActionMap import ActionMap, NumberActionMap from Components.SystemInfo import SystemInfo from Tools.Directories import fileExists from enigma import gFont, getDesktop, gMainDC, eSize, RT_HALIGN_RIGHT, RT_WRAP def ...
''' 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 distributed in the hope that it will be ...