code
stringlengths
1
199k
from run import run_base class run_names(run_base): # Verify behavior when multiple --name options passed def init_subargs(self): cont = self.sub_stuff["cont"] name_base = cont.get_unique_name() names = [] for number in xrange(self.config['names_count']): name = ('%s_...
import codecs import collections import json import os from PyQt4 import QtGui, QtCore from PyQt4.QtCore import Qt # , SIGNAL from PyQt4.QtGui import QDialog from PyQt4.QtGui import QMessageBox from brickv import config from brickv.data_logger.event_logger import EventLogger, GUILogger from brickv.data_logger.gui_conf...
from ahkab.testing import NetlistTest from ahkab import options options.plotting_show_plots = False def test(): nt = NetlistTest('ekv1') nt.setUp() nt.test() nt.tearDown() test.__doc__ = "EKV NMOS DC sweep" if __name__ == '__main__': nt = NetlistTest('ekv1') nt.setUp() nt.test()
""" Simple class wrappers for the various external commands needed by git-buildpackage and friends """ import subprocess import os import signal import sys from contextlib import contextmanager from tempfile import TemporaryFile import gbp.log as log class CommandExecFailed(Exception): """Exception raised by the Co...
from service import Main Main().get_params
import os import subprocess from collections import OrderedDict, defaultdict from .step import Step from .exceptions import * from ..genomic_io.fastq import FastqFile from ..genomic_io.fasta import FastaFile, FastaEntry from ..genomic_io.functions import make_fasta_from_fastq from ..annotation.intron import get_intron_...
""" Tests for general functionality of the KGML parser, pathway and visualisation modules """ from __future__ import with_statement import os import unittest from Bio.Graphics.ColorSpiral import ColorSpiral from Bio import MissingExternalDependencyError try: from reportlab.pdfgen.canvas import Canvas from r...
""" Django settings for tango_with_django_project project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ import os BASE_DIR = os.path.dirname(os.path.dirname(__file...
""" Classes and functions dealing with rpm package representations. """ import rpm import os import os.path import misc import i18n import re import fnmatch import stat import warnings from subprocess import Popen, PIPE from rpmUtils import RpmUtilsError import rpmUtils.miscutils from rpmUtils.miscutils import flagToSt...
""" This plugin sends a message to a channel when an area repops """ import time from string import Template from plugins.aardwolf._aardwolfbaseplugin import AardwolfBasePlugin NAME = 'Aardwolf Repop' SNAME = 'repop' PURPOSE = 'Send repop messages to a channel' AUTHOR = 'Bast' VERSION = 1 AUTOLOAD = False class Plugin(...
"""Base email backend class.""" class BaseEmailBackend(object): """ Base class for email backend implementations. Subclasses must at least overwrite send_messages(). open() and close() can be called indirectly by using a backend object as a context manager: with backend as connection: ...
from django.shortcuts import render, render_to_response from django.template.context import RequestContext from .models import * def linuxicerik(request, altbaslik): icerikler = icerik.objects.get(altbaslik=altbaslik) return render_to_response("linuxicerik.html", locals(), content_type=RequestContext(request)) ...
"""Flask :class:`~flask.sessions.SessionInterface` implementation.""" import six from datetime import timedelta, datetime from flask import current_app, request from flask.helpers import locked_cached_property from flask.sessions import SessionInterface as FlaskSessionInterface from uuid import uuid4 from werkzeug.exce...
import log class Command: "Extracts protocol, id, command, and arg from mail filter input" def __init__(self, user='', liszt = []): #log.logger.debug('Command.__init__()') self.proto = 'IRC' self.id = user self.cmd = 'NOOP' self.arg = '' self.handsflag = False ...
""" Build word vector clusters for datasets input: dataset word vecs output: vec clusters(classes) centroid_map """ import doc2vec try: import cPickle as pickle except ImportError: import pickle def build_clusters(data_folder, path, dataset): print "Building clusters on"...
from __future__ import unicode_literals from collections import Counter from molbiox.algor import interval def find_next_contigs(samfile, contig, insertmax, orientation='fr'): """ :param samfile: pysam.calignmentfile.AlignmentFile object :param contig: contig id (an integer) :param insertmax: ...
import cgi def printHeader( title ): print """Content-type: text/html <?xml version = "1.0" encoding = "UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head><title>%s</title></head> <body>""" % title printHeader( "Using '...
import logging import sys from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.common import FirstbootOnlySpokeMixIn from pyanaconda.ui.categories.system import SystemCategory from pyanaconda.ui.gui.utils import really_hide log = logging.getLogger(__name__) RHSM_PATH = "/usr/share/rhsm" sys.path.append(R...
from passlib.hash import pbkdf2_sha512 from omf.model.dbo import db from omf.common.userRole import Role from flask_login import UserMixin class User(db.Model, UserMixin): __tablename__ = "users" id = db.Column(db.Integer, nullable=False, primary_key=True) username = db.Column(db.String(80), nullable=False)...
import os import errno import json from datetime import timedelta from gi.repository import GLib, GObject, Gtk from .clocks import Clock from .utils import Alert, Dirs, LocalizedWeekdays, SystemSettings, TimeString, WallClock from .widgets import Toolbar, ToolButton, SymbolicToolButton, SelectableIconView, ContentView ...
axt_message = ''' struct axt_message { uint32_t num_points; uint32_t version; uint32_t scanner_type; uint32_t ecu_id; uint32_t timestamp_sensor; double start_angle; double end_angle; uint32_t scan_counter; int8_t * channel; int8_t * point_status; float *x; float *y; ...
""" SpamReport model defines spam reports for specific revisions of reviews. Only one spam report can be created by a single user for a specific revision. """ from critiquebrainz.data import db from sqlalchemy.dialects.postgresql import UUID from critiquebrainz.data.model.mixins import DeleteMixin from datetime import ...
__author__ = 'Freelander, Bravo17, Just a baka' __version__ = '1.0.17' import b3, threading from b3 import functions import b3.events import b3.plugin import urllib2, urllib import os.path import StringIO import gzip import time import socket import re, sys user_agent = "B3 Cod7Http plugin/%s" % __version__ class Cod...
from Core.models import BookDetail from Core.models import Book from Core.keys import API_KEY from pattern.it import parsetree as it_parsetree from pattern.en import parsetree as en_parsetree from pattern.search import search import requests import json from lxml import html def remove_uncorrect_tokens(tokens): """...
""" sample program 1 """ from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from appinstance import AppInstance, AppInstanceRunning import time def mai...
class Solution: # @param a list of integers # @return an integer def removeDuplicates(self, A): if len(A) == 0 : return 0 i,j,LEN = 0, 1, len(A) while j < LEN : if A[i] != A[j] : A[i+1], i = A[j], i+1 j += 1 return i+1
from datetime import datetime import dbentry import os import time import random import read_init as sensor def get_temp(): """ Get temperature data. """ # TODO: Call sensor routine to get temperature cur_temp = random.randint(0, 100) return cur_temp; def write_to_file(temp, date_obj): """ Write...
from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response from django.contrib import auth from django.template import Context from social.layers.layers_manager import * from social.rest.layers import create_layer, delete_layer, request_layer from social.rest.notes import...
"Find people who are not related to the selected person" from gi.repository import Gtk from gi.repository import GObject from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext ngettext = glocale.translation.ngettext # else "nearby" comments are ignored from gramps.gen.const import URL_MA...
'''command to send changesets as (a series of) patch emails The series is started off with a "[PATCH 0 of N]" introduction, which describes the series as a whole. Each patch email has a Subject line of "[PATCH M of N] ...", using the first line of the changeset description as the subject text. The message contains two ...
import sys, os from corpus import * import hdp import cPickle import random, time from numpy import cumsum, sum from itertools import izip from optparse import OptionParser from glob import glob np = hdp.np def parse_args(): parser = OptionParser() parser.set_defaults(T=300, K=20, D=-1, W=-1, eta=0.01, alpha=1.0, g...
import pygame from pygame.locals import * import sys from datetime import datetime BLANCO = (255,255,255) class Clock( ): sec_anterior = -1 minutes = 0 seconds = 0 sec_toShow = -1 starting = True def get_min_sec( self, time ): mi_sec = time[14] + time[15] + time[16] + time[17] + time[18]...
import matplotlib matplotlib.use('Agg') from boids.flock import Flock from mock import Mock, patch from nose.tools import assert_equal, assert_almost_equal import os import yaml def test_bad_boids_regression(): regression_data=yaml.load(open(os.path.join(os.path.dirname(__file__), ...
""" This file is part of AWE Copyright (C) 2012- University of Notre Dame This software is distributed under the GNU General Public License. See the file COPYING for details. """ import traceback import os class TypeException (Exception): pass class _typecheck(object): def __init__(self, method=True): self....
""" hecuba.manager ~~~~~~~~~~~~ Manager CLI :copyright: (c) 2016 by Hugo Cisneiros. :license: GPLv2, see LICENSE for more details. """ from . import hecuba, db, auth, models, log from flask.ext.script import Manager, Command, prompt_pass, prompt_choices, prompt_bool from flask.ext.migrate import Mig...
"""Rozwiązanie zadania 203.""" import sys import re if len(sys.argv) >= 3: WORD = str(sys.argv[1]) WORD_LEN = len(WORD) MAX_N = int(sys.argv[2])+1 else: MAX_N = 15 WORD = "have" WORD_LEN = len(WORD) for line in sys.stdin: a = [m.start() for m in re.finditer(WORD, line)] for i in a: ...
""" /*************************************************************************** RuGeocoder A QGIS plugin Geocode your csv files to shp ------------------- begin : 2012-02-20 copyright : (C) 2012 by Nikulin Evgeni...
import pandas as pd from pandas import DataFrame df = pd.read_csv('Graduation_Outcomes_by_SchoolLevel_Gender_2005-2011.csv', index_col = 'School Name') df2 = df[df['Total Cohort Num'] > 5] df3 = df2[range(1,8)] print df3.head()
import sys from app.models import ( CommonColumns, Owner, User, LotUser, Lot, StreamLot, Stream, Hashtag, TweetHashtag, Mention, TweetMention, URL, TweetURL, Media, TweetMedia, Tweet, app, db ) db.drop_all(app=app) db.create_all(app=app)
"""Thread-safe Least Recently Used (LRU) cache for storing tiles.""" from __future__ import with_statement from threading import RLock, Thread from collections import deque import time class TileCache(object): """TileCache objects are used for caching tiles in memory. Tiles can be accessed in much that same way...
import pickle import os import os.path import re import shutil import sys import tempfile import threading import urllib import urlparse import quodlibet import quodlibet.config import quodlibet.formats import quodlibet.library from qlsync import * from qlsync.shifters import ShifterError def ascify(s): """Convert ...
""" WSGI config for questproj 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.6/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWh...
import udj class OwnerLibTestCases(udj.testhelpers.tests06.testclasses.LibTestCases): username='kurtis' userpass='testkurtis' class AdminLibTestCases(udj.testhelpers.tests06.testclasses.LibTestCases): username='lucas' userpass='testlucas'
from django.contrib import admin from ds.models import DService class DServiceAdmin(admin.ModelAdmin): list_display = ('DS_Type', 'DS_TiersDemandeur', 'DS_Sujet', 'statut') list_filter = ('DS_Type', 'DS_TiersDemandeur', 'DS_Sujet', 'statut') search_fields = ['DS_Type', 'DS_TiersDemandeur', 'DS_Sujet' ] admin.site.re...
from src import EventManager, ModuleManager, utils TAG = utils.irc.MessageTag(None, "inspircd.org/bot") class Module(ModuleManager.BaseModule): @utils.hook("received.message.private") @utils.hook("received.message.channel") @utils.kwarg("priority", EventManager.PRIORITY_HIGH) def message(self, event): ...
''' @author : quanticio44 @contact : quanticio44@gmail.com @license : See with Quanticio44 @summary : Restore operation @since : 22/08/2014 ''' import os import zipfile import tarfile import tempfile import subprocess import core.common.tools import core.common.backupstoredbfile class restoreFileSystem(object): ...
""" RED Plugin Copyright (C) 2014-2015 Matthias Bolte <matthias@tinkerforge.com> program_info_delphi.py: Program Delphi Info Widget 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 ...
import os import glob import gettext __trans = gettext.translation('pisi', fallback=True) _ = __trans.ugettext import pisi.context as ctx import pisi.actionsapi import pisi.actionsapi.get as get from pisi.actionsapi.shelltools import system from pisi.actionsapi.shelltools import can_access_file from pisi.actionsapi.she...
from nose.tools import eq_ as eq import os from cStringIO import StringIO from gitosis import init, repository, run_hook from gitosis.config import GitosisRawConfigParser as RawConfigParser from gitosis.test.util import maketemp, readFile def test_post_update_simple(): tmp = maketemp() repos = os.path.join(tmp,...
''' PEace ======= A Python library for reading Portable Executable files. Simple to use, simple to read. PE = PEace('path_to_pe') PE.Sections contains an array of all the PE Sections with their fields and values PE.getSectionByName('.section') returns the section given by the name argument PE.ImportModules contains an...
__author__ = 'Dario' import threading import subprocess import time import sys import io import os import logging import socket import traceback import psutil import ExternalProfitServer import SwitcherData from SwitcherData import SwitcherData as SD from console.switcher import HTMLBuilder from errorReports import Err...
import pipes import os import string import unittest from test.support import TESTFN, run_unittest, unlink, reap_children if os.name != 'posix': raise unittest.SkipTest('pipes module only works on posix') TESTFN2 = TESTFN + "2" s_command = 'tr %s %s' % (string.ascii_lowercase, string.ascii_uppercase) class SimplePi...
import subprocess, os, urllib.request from bs4 import BeautifulSoup from Bio import motifs from Bio.Alphabet.IUPAC import unambiguous_dna from Bio.Seq import Seq import numpy as np def read_bed(infile, region_chrom, region_start, region_end): intervals = [] if region_start: region_start = int(region_start) if region...
class RationalNumber: def __init__(self, numerator, denominator): self.numerator = numerator self.denominator = denominator def __str__(self): return "Numerator: " +str(self.numerator) + " Denominator: " +str(self.denominator) def __add__(self, object): print "Add in invoked"...
from __future__ import absolute_import import errno import msvcrt import os import re import stat import sys import tempfile import time from typing import IO, Optional import bindings from edenscmnative import osutil from . import encoding, error, pycompat, win32, winutil from .i18n import _ try: # pyre-fixme[21]:...
import fauxfactory import pytest from cfme.base.credential import Credential from cfme.cloud.tenant import Tenant from cfme.infrastructure.host import Host from cfme.utils.appliance.implementations.ui import navigate_to from cfme.utils.log import logger @pytest.fixture(scope="session") def category(appliance): """ ...
import os import sys reload(sys) sys.setdefaultencoding('UTF8') # @UndefinedVariable try: namearchive = raw_input("Ingrese el nombre del archivo que desea transformar: ").replace(".txt", "") archivo = open(namearchive + ".txt", "r") except: print "El archivo no existe!" exit() l = [] nw = [] for i in a...
class RenameFieldForExact(object): def __init__(self, untokenizedFields, untokenizedPrefix): self._untokenizedFields = [f for f in untokenizedFields if not f.endswith('*')] self._untokenizedFieldPrefixes = [f[:-1] for f in untokenizedFields if f.endswith('*')] self._untokenizedPrefix = untok...
import matplotlib as mpl from ..options import get_option from .theme import theme from .elements import element_rect class theme_matplotlib(theme): """ The default matplotlib look and feel. The theme can be used (and has the same parameter to customize) like a :class:`matplotlib.rc_context` manager. ...
from __future__ import (absolute_import, division, print_function) from six.moves import (filter, input, map, range, zip) # noqa import iris.tests as tests import logging import cartopy.crs as ccrs import cf_units import iris.cube import iris.coords import iris.tests.stock from iris.coord_systems import * logger = log...
import json import warnings from past.builtins import basestring from .template import PYWR_PROTECTED_NODE_KEYS, pywr_template_name from .core import BasePywrHydra, data_type_from_field from pywr.nodes import NodeMeta from hydra_pywr_common import data_type_from_component_type import logging log = logging.getLogger(__n...
def get_real_floor(n): if n <= 0: return n return n - 1 - (n >= 13)
import time import maestro try: servo = maestro.Controller() servo.setRange(0,3000,8200) servo.setRange(1,4000,8000) # about 5 clicks per full motion # 1040 for left/right + is left, - is right. # 800 for up/down + is up, - is down. x = servo.getPosition(1) - 800 servo.setAccel(1,6) servo.setTarget(...
r""" Total Key press by program ========================== Show the use of the keyboard in each program """ import matplotlib.pyplot as plt import sqlite3 import pandas as pd con = sqlite3.connect("/home/oscar/dev/selfspy/.testpy3/selfspy.sqlite") process = pd.read_sql_query("SELECT id, name from process", con, ...
{ 'name': 'Purchase Date to Move Out Date', 'version': '1.0', 'category': 'Sale', 'description': """ Change purchase Order Line Date impact Customer (out) Moves Date ================================================================ The aim of this module is to deal with floating picking in dates that imp...
""" This script was created by Sergey Tomin for Workshop: Designing future X-ray FELs. Source and license info is on GitHub. August 2016. Modified in 2017, S.Tomin """ from time import time from copy import deepcopy from ocelot import * from ocelot.gui.accelerator import * from ocelot.adaptors.astra2ocelot import * D_1...
"""164. Numbers for which no three consecutive digits have a sum greater than a given value https://projecteuler.net/problem=164 How many 20 digit numbers n (without any leading zero) exist such that no three consecutive digits of n have a sum greater than 9? """
import numpy as np from xlwings import Range from datetime import datetime from scipy import interpolate import write_utils as wu import sys reload(sys) sys.setdefaultencoding('utf8') import map_interactive as mi from map_interactive import pll import map_utils as mu class dict_position: """ Purpose: Cl...
import sys from osgeo.utils.gdal_polygonize import * # noqa from osgeo.utils.gdal_polygonize import main from osgeo.gdal import deprecation_warn deprecation_warn('gdal_polygonize', 'utils') sys.exit(main(sys.argv))
from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('scoping', '0199_technology_group'), ] operations = [ migrations.CreateModel( name='DocStatement', fields=[ ('id', models...
from __future__ import unicode_literals import os import sys sys.path.append(os.curdir) from baseconf import * from collections import OrderedDict SITENAME = u'Python Norte' AUTHOR = u'PyNorte' THEME = "themes/malt" MALT_BASE_COLOR = "blue-grey" META_DESCRIPTION = '''O PyNorte é um grupo de usuários (profissionais e ...
import sys, locale expressions = """ locale.getpreferredencoding() type(my_file) my_file.encoding sys.stdout.isatty() sys.stdout.encoding sys.stdin.isatty() sys.stdin.encoding sys.stderr.isatty() sys.stderr.encoding sys.getdefaultencoding()...
import bpy from PyHSPlasma import * import weakref from .explosions import * from . import utils _BL2PL = { "AREA": plLimitedDirLightInfo, "POINT": plOmniLightInfo, "SPOT": plSpotLightInfo, "SUN": plDirectionalLightInfo, } _FAR_POWER = 15.0 class LightConverter: def __init__(self, exporter): ...
''' Created on 15 Φεβ 2013 @author: tedlaz ''' sqlco = u"INSERT INTO m12_co VALUES (1,'{0}','{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')" from PyQt4 import QtCore, QtGui,Qt from utils import dbutils,widgets from osyk import osyk from utils.qtutils import fFindFromList import datet...
from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Box.uuid' db.delete_column(u'appulet_box', 'uuid') # Deleting field 'Route...
from PyQt5 import QtCore, QtGui, QtWidgets class Ui_ArcheoCAD(object): def setupUi(self, ArcheoCAD): ArcheoCAD.setObjectName("ArcheoCAD") ArcheoCAD.resize(344, 728) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHori...
'''Test module for ChatTextEdit widget''' import sys import os from PyQt4 import QtGui import gui import e3 from gui.qt4ui import AvatarChooser class SessionStub (object): class ConfigDir (object): def get_path(*args): return '/home/fastfading/src/emesene/emesene2/'\ 'messen...
import cherrypy from radical.auth import AuthController, require, member_of, name_is from radical.lib.tool import template class ProfileHandler: # all methods in this controller (and subcontrollers) is # open only to members of the admin group _cp_config = { 'auth.require': [] } @cherrypy.ex...
""" Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE). http://www.logilab.fr/ -- mailto:contact@logilab.fr Raw metrics checker """ import tokenize from ..logilab.common.ureports import Table from ..interfaces import IRawChecker from ..checkers import BaseRawChecker, EmptyReport from ..reporters import diff_string d...
""" Remote care specific test that tests things that were not covered by other tests in the apps. .. note:: Needs to be extended with tests for all core code. :subtitle:`Class definitions:` """ import datetime from django.forms import TextInput from django.test import TestCase from core.forms import DisplayWidget, ...
""" Pints the list of MIDI devices available for inpout use. """ import sys import os import pygame import pygame.midi from pygame.locals import * try: # Ensure set available for output example set except NameError: from sets import Set as set def print_device_info(): pygame.midi.init() _print_device_i...
""" mtpy/mtpy/analysis/niblettbostick.py Contains functions for the calculation of the Niblett-Bostick transformation of impedance tensors. The methods follow - Niblett - Bostick - Jones - J. RODRIGUEZ, F.J. ESPARZA, E. GOMEZ-TREVINO Niblett-Bostick transformations are possible in 1D and 2D. Functions: @UofA, 2013 ...
""" Request module """ from tools import pathjoin class Request(object): path = 'requests' def __init__(self, bin=None, body={}, content_length=0, content_type='', form_data={}, headers={}, id='', method='', path='/', query_string={}, remote_addr='', time=None, **kwargs): self.bin = bin ...
import os import subprocess import sys import tempfile from textwrap import dedent from unittest import mock import fixtures from testtools.matchers import Contains, Equals, Not, StartsWith import snapcraft from . import ProjectLoaderBaseTest from tests.fixture_setup.os_release import FakeOsRelease class EnvironmentTes...
from rest_framework import viewsets, mixins from .models import Article from .serializers import ArticleSerializer, ArticleDetailSerializer class ArticlesViewSet (viewsets.ReadOnlyModelViewSet): serializer_class = ArticleSerializer queryset = Article.objects def list(self, request): response = super...
def _is_iter(val): "Checks if value is a list or tuple" return isinstance(val, tuple) or isinstance(val, list) def _iter_join(val): "Joins values of iterable parameters for the fancy view, unless it equals None, then blank" return "(" + ", ".join(["{:6g}".format(v) for v in val]) + ")" if val is not Non...
from __future__ import print_function from openturns import * from otfftw import * from time import * myFFTW = FFTW() print("myFFTW=", myFFTW) size = 8 data = ComplexCollection(size) for i in range(size): data[i] = (i + 1.0) - 0.2j * (i + 1.0) print("data=", data) result = myFFTW.transform(data) print("result=", re...
from flask import render_template, request, Blueprint, session, url_for from sqlalchemy import func from app import mod_public, db, api from app.mod_public.forms import ContactForm, SearchForm from app.models import Book, Bid, Auction mod_public = Blueprint('public', __name__, url_prefix='/') @mod_public.route('/') @mo...
from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from django.utils.translation import ugettext as _ from cmsplugin_youtube.models import YouTube as YouTubeModel import re class YouTubePlugin(CMSPluginBase): model = YouTubeModel name = _("YouTube") render_template = "cmsplugi...
BCM = "123" IN = 0 OUT = 1 HIGH = 1 LOW = 0 print "GPIO Simulate" def setmode(a): pass def setup(a,b): pass def input(a): return 0 def output(a,b): pass class PWM: def __init__(self,a,b): pass def start(self,a): pass def ChangeDutyCycle(self,a): pass
import numpy as np from pysisyphus.calculators.AnaPotBase import AnaPotBase class Rosenbrock(AnaPotBase): def __init__(self): V_str = "(1-x)**2 + 100*(y - x**2)**2" xlim = (-2.5, 2.5) ylim = (-1.5, 3.5) levels = np.logspace(-5, 10, 50, base=2) super().__init__(V_str=V_str, xl...
import unittest import unittest.mock from kobato.prompt import Prompt, PromptException, confirm class TestPrompt(unittest.TestCase): def test_basic_input(self): p = Prompt(allow_multiple=False, case_sensitive=False) p.add_action('y', help='Yes, submit current post to point.im and remove draft') ...
from omsdk.sdkcenum import EnumWrapper, TypeHelper TypeState = EnumWrapper('TMS', { 'UnInitialized' : 'UnInitialized', 'Initializing' : 'Initializing', 'Precommit' : 'Precommit', 'Committed' : 'Committed', 'Changing' : 'Changing', }).enum_type class TypeBase(object): def __init__(self): ...
import traceback import sys import ConfigParser import re import os import netifaces from IPy import IP MANAGED_INTERFACE_NAMES = ('eth', 'br', 'ens', 'enp', 'eno') def formatExceptionInfo(maxTBlevel=5): cla, exc, trbk = sys.exc_info() excName = cla.__name__ try: excArgs = exc.__dict__["args"] e...
""" A module containing definitions for base plugin classes for swk. swk - A tiny extendable utility for running commands against multiple hosts. Copyright (C) 2016 Pavel "trueneu" Gurkov see swk/main.py for more information on License and contacts """ import abc import shlex import logging class SWKPlugin(object): ...
from bs4 import BeautifulSoup import os import re import requests import subprocess import sys import tabulate class OutColors: DEFAULT = '\033[0m' BW = '\033[1m' LG = '\033[0m\033[32m' LR = '\033[0m\033[31m' SEEDER = '\033[1m\033[32m' LEECHER = '\033[1m\033[31m' def helper(): print(OutColor...
from flask import Flask, make_response, request, current_app, jsonify, json from functools import update_wrapper from os import path FILEDIR = '' def corsDecorator(f): def new_func(*args, **kwargs): resp = make_response(f(*args, **kwargs)) resp.cache_control.no_cache = True # Turn ...
""" Defines the behavior of Psychopy's Builder view window Part of the PsychoPy library Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd. Distributed under the terms of the GNU General Public License (GPL). """ from __future__ import absolute_import, division, print_function import os, sys i...
import os import platform import shutil import unittest from abjad.tools import abjadbooktools from abjad.tools import systemtools @unittest.skipIf( platform.python_implementation() != 'CPython', 'Only for CPython.', ) class TestLaTeXDocumentHandler(unittest.TestCase): test_directory = os.path.dirname(_...
""" Copyright 2016 Walter José and Alex de Sá This file is part of the RECIPE Algorithm. The RECIPE 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 ve...