code
stringlengths
1
199k
import sys print sys.version_info
""" The Logger Class will log messages to console or to a file. If logged to console then text will colorize the message type. @author : Shane Bradley @contact : sbradley@redhat.com @version : 2.17 @copyright : GPLv2 """ import logging import os import sys class LogWriter : """ The Logger Class will ...
from ...mathematics.exceptions import InputValuesException from .geotransform import * def ij_transfer_func( i: Number, j: Number, geotransform: GeoTransform, z_transfer_func: Callable, i_shift=0.5, j_shift=0.5) -> float: """ Return a z value as the result of a fu...
import sys from PIL import Image if len(sys.argv) < 2: print "%s <img>\n" % sys.argv[0] sys.exit(1) i = Image.open(sys.argv[1]) pixels = i.load() width, height = i.size for y in range(height): for x in range(width): r=g=b=0 if pixels[x, y][0]%2==1: r=0 else: r=255 if pixels[x, y][1]%2==1: g=0 else: g=255 ...
from django import forms from .models import Redirect class RedirectAdminForm(forms.ModelForm): class Meta: model = Redirect exclude = ()
from __future__ import unicode_literals import sqlite3 import hashlib import os import stat import shutil import unittest import sys import datetime script_name = os.path.join( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ), 'brd') if not os.path.exists('brd.py'): os.symlink(script_name...
from rest_framework import status from rest_framework.serializers import ValidationError from rest_framework.views import APIView from rest_framework.response import Response from django.utils.translation import ugettext_lazy as _ from django.shortcuts import get_object_or_404 from common.utils import get_logger, get_o...
import sys def merge_headers(out, lfile, rfile): with open(lfile, "r") as l: linesl = l.readlines() with open(rfile, "r") as r: linesr = r.readlines() indexl = 0 indexr = 0 while indexl < len(linesl) and indexr < len(linesr): left = linesl[indexl].strip() right = line...
""" Periodic table of elements: mass, atomic number, name and electronic configuration. """ import sys def parse_configuration(conf): """Return a list of (n,l,occ) tuples""" spdf_to_l = {'s': 0, 'p': 1, 'd':2, 'f': 3} # expand rare gases configuration while conf[0] == '[': atom = conf[1:3] ...
"""A database for default values of settings.""" from __future__ import division, print_function import sys import numpy as N from .. import qtall as qt4 def _(text, disambiguation=None, context="Preferences"): """Translate text.""" return qt4.QCoreApplication.translate(context, text, disambiguation) defaultVal...
from hermes2d import Mesh, MeshView, H1Shapeset, PrecalcShapeset, H1Space, \ LinSystem, WeakForm, DummySolver, Solution, ScalarView, VonMisesFilter from hermes2d.examples.c08 import set_bc, set_forms from hermes2d.examples import get_sample_mesh P_INIT = 8 mesh = Mesh() mesh.load(get_sample_mesh()) shapeset = H...
""" Live reconfiguration stress test for ratio scheduler. """ from helpers import tempesta from . import reconf_stress __author__ = 'Tempesta Technologies, Inc.' __copyright__ = 'Copyright (C) 2017 Tempesta Technologies, Inc.' __license__ = 'GPL2' class SchedRatioStaticImplDefaultSg(reconf_stress.LiveReconfStress): ...
def formula(started): beans = started *500 jars = beans / 1000 crates = jars / 10 return beans, jars, crates start_point = 1000 beans, jars, crates = formula(start_point) print "Start point: %d" % start_point print "Beans: %d Jars: %d Crates: %d " % (beans,jars, crates) start_point /= 10 print "Now pass start_point...
""" """ import pygame from pygame.locals import * from .const import * from . import widget class Input(widget.Widget): """A single line text input. Example: w = Input(value="Cuzco the Goat",size=20) w = Input("Marbles") """ _value = None def __init__(self, value="", size=20, **param...
from invoke import task from invoke import run @task def clean(): run("cd lessons && make clean") @task def build(docs=False, impress=False, pdf=False): if docs: run("cd lessons && make html") if pdf: run("cd lessons && make latexpdf") if impress: run("cd lessons && hovercraft im...
'''Subprocess test case superclass''' import difflib import io import os import os.path import re import subprocess import sys import unittest process_timeout = 300 # Seconds def cat_dhcp_command(mode): '''Create a command string for dumping dhcp.pcap to stdout''' # XXX Do this in Python in a thread? sd_cmd...
import fpgaTest import fpgaTestUtil as util from pyle import datasaver import numpy as np from labrad.units import Unit,Value import time Hz,MHz,GHz = (Unit(ss) for ss in ['Hz','MHz','GHz']) DATAVAULT_PATH = ['','GHzDAC Calibration'] def makeDataset(cxn, board, name, indeps, deps, params=None): if params is None: ...
def getpriority(*args, **kwargs): # real signature unknown """ Return process priority """ pass def net_if_addrs(*args, **kwargs): # real signature unknown """ Retrieve NICs information """ pass def setpriority(*args, **kwargs): # real signature unknown """ Set process priority """ pass __loader...
from django.conf.urls import patterns, url from expense.views import * urlpatterns = patterns ('expenseManager.expense.views', url(r'expense/add/$', ExpenseCreate.as_view(), name='expense-add'), url(r'expense/(?P<pk>[0-9]+)/$', ExpenseUpdate.as_view(), name='expense-update'), url(r'expense/(?P<pk>[0-9]+)...
import Image im = Image.open('/home/douglas/images/tetuhi-examples/cowboy-tanks.jpg-sprites/alpha-2.png') w, h = im.size print im.size im.save('/tmp/orig.png') im2 = im.transform(im.size, Image.EXTENT, (2,50,120,123)) im2.save('/tmp/extent.png') im3 = im.transform(im.size, Image.AFFINE, (2,-1,0,-1,2,0)) im3.save('/tmp/...
class Arthropod(Organism): """An arthropod that has a fixed number of legs.""" def __init__(self, name, x, y, legs): """ (Arthropod, str, int, int, int) -> NoneType An arthropod with the given number of legs that exists at location (x, y) in the tide pool. """ Organism.__...
import cocos class Eat(object): """ Eat Action """ def __init__(self, prey, *args, **kwargs): """ Declare the prey """ self.prey = prey def done(self): """ We are done if our prey is dead, or ceases to exist More advanced eating may involve fin...
import struct import ps from volafox.vatopa.addrspace import FileAddressSpace from volafox.vatopa.ia32_pml4 import IA32PML4MemoryPae DATA_PROC_STRUCTURE = [[476+24+168, '=4xIIIII4xII88xI276xQII20xbbbb52sI164xI', 16, '=IIII', 283, '=IIIIIII255s', 108, '=12xI4x8x64xI12x'], [476+168, '=4xIIIII4xII64xI276xQII20xbbbb52s...
import sys import os import unittest import atexit import socket import errno from ..python.socket import find_available_port from .. import installation from .. import cluster as pg_cluster from .. import exceptions as pg_exc from ..driver import dbapi20 as dbapi20 from .. import driver as pg_driver from .. import ope...
import re import xmlrpclib Kim_Nguyen_G5 = '192.168.0.1' def CampusDirectoryZEM001PHONEVW (self, emplid): request = self.REQUEST RESPONSE = request.RESPONSE remote_addr = request.REMOTE_ADDR if remote_addr in ['192.168.0.1', Kim_Nguyen_G5, '127.0.0.1', ]: conn = getattr(self, 'Oracle_Database_C...
import logging import json import Pyro4 from django.shortcuts import render from django.http.response import HttpResponse, HttpResponseRedirect, \ HttpResponseServerError from django.core.urlresolvers import reverse from django.contrib import messages from py_arduino import DEVICE_FOR_EMULATOR, LOW, HIGH, \ OUT...
import xbmc,xbmcgui ''' def scrape_episode(title,show_year,year,season,episode,imdb): xbmc.log('title:'+title+'# season:'+season+'# episode:'+episode+'# year:'+year,xbmc.LOGNOTICE) from nanscrapers import scrape_episode_with_dialog progress = [] item = [] dp = xbmcgui.DialogProgress() dp.create...
''' Created on Jan. 26, 2015 @author: Tung Nguyen <nltung@gmail.com> ''' import sys, os, time, multiprocessing, optparse import subprocess, logging, datetime def parse_config(config_file): singleAln, partitionAln, partOpts, genericOpts = [], [], [], [] with open(config_file) as f: #lines = f.readlines() lin...
__plugin_name__ = "File Backend" __description__ = """ The File backend can handle the client database, the ACL rules database, and the site database. You can optionnaly choose either both three of them, or one or two only. """ __backend__ = True def __init_plugin__(): from sshproxy.config import ge...
from __future__ import unicode_literals import json import re import inputstreamhelper from codequick import Listitem, Resolver, Route import urlquick from resources.lib import web_utils from resources.lib.menu_utils import item_post_treatment from resources.lib.kodi_utils import get_selected_item_art, get_selected_ite...
with open('input', 'r') as f: data = f.readlines() data = [[int(d) for d in l.split()] for l in data] sums = [max(l) - min(l) for l in data] print(sum(sums))
""" """ import logging import datetime from pylons import request, config from pylons.decorators import jsonify from joj.lib.base import BaseController, render, c from joj.services.user import UserService from joj.services.model_run_service import ModelRunService from joj.services.dataset import DatasetService from joj...
import pandas as pd import quandl,math, datetime import numpy as np from sklearn import preprocessing, cross_validation, svm from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from matplotlib import style import urllib import pickle style.use('ggplot') '''urllib.urlretrieve('http://real-c...
from test import test_support import unittest import codecs import locale import sys, StringIO, _testcapi def coding_checker(self, coder): def check(input, expect): self.assertEqual(coder(input), (expect, len(input))) return check class Queue(object): """ queue: write bytes at one end, read byte...
import urllib, htmllib, formatter, re, sys url = sys.argv[1] website = urllib.urlopen("http://"+url) data = website.read() website.close() format = formatter.AbstractFormatter(formatter.NullWriter()) ptext = htmllib.HTMLParser(format) ptext.feed(data) links = [] links = ptext.anchorlist for link in links: if re.sear...
__author__ = 'mh719' import sqlite3 as lite import os import time import sys from exec_util import execCmd import chipqc_db def getHelpInfo(): return "[OPTIONAL STEP] Filter wiggle files" def addArguments(parser): parser.add_argument('-s','--skip',dest='skip',help="Skip filtering - use original files",action='s...
from collections import OrderedDict from datetime import datetime from docutils.core import publish_parts from flask import Flask, Markup, abort, render_template_string from flask.helpers import locked_cached_property from flask.ext.babel import Babel from mercurial import hg, ui as _ui import os import re template = u...
import unittest from ..lock import lock, unlock, LockError, PidLock, PidLockError from tempfile import mktemp from os import unlink, getpid from os.path import exists from multiprocessing import Process, Pipe #pylint: disable=no-name-in-module from contextlib import contextmanager class LockTimeoutError(IOError): p...
""" This module is a part fo OnlinePython project created at DTU for the course Data Mining Using Python. This module contains plotting functions. Created on Thu Dec 04 22:31:35 2014 @author: Bartosz """ import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import os import db MEGABYTE = 1024*1024*1.0...
""" Django settings for todolist 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__)) SECRET_KEY =...
from django.contrib.auth import authenticate, login, logout from books.models import * from user.models import * from user.forms import * from django.shortcuts import render, render_to_response, get_object_or_404 from django.http import HttpResponse, HttpResponseServerError, HttpResponseRedirect from django.views.decor...
import gobject as __gobject import gobject._gobject as __gobject__gobject import __main__ as ____main__ class Value(__gobject.GInterface): # no doc def get_current_value(self, *args, **kwargs): # real signature unknown pass def get_maximum_value(self, *args, **kwargs): # real signature unknown ...
""" Wrapper for GNOME/KDE/XFCE graphical editor """ import glob import os import signal import sys import command_mod import desktop_mod import subtask_mod PROGRAMS = { 'cinnamon': ['gedit'], 'gnome': ['gedit'], 'kde': ['kate'], 'mate': ['pluma'], 'xfce': ['mousepad'], } GENERIC = ['vi'] class Main:...
from gi.repository.Gtk import SizeGroup, SizeGroupMode from GSettingsWidgets import * from CinnamonGtkSettings import GtkSettingsSwitch from ExtensionCore import ExtensionSidePage import glob ICON_SIZE = 48 class Module: comment = _("Manage themes to change how your desktop looks") name = "themes" category ...
from __future__ import print_function from __future__ import unicode_literals from dnf.pycomp import PY3, is_py3bytes, unicode, setlocale import gettext import locale import os import sys import unicodedata """ Centralize i18n stuff here. Must be unittested. """ class UnicodeStream(object): def __init__(self, strea...
import argparse import sys from threading import Thread from miq_version import TemplateName from cfme.utils.conf import cfme_data from cfme.utils.log import add_stdout_handler from cfme.utils.log import logger from cfme.utils.providers import list_provider_keys from cfme.utils.template.base import ALL_STREAMS from cfm...
from __future__ import absolute_import from testutil.dott import feature, sh, testtmp # noqa: F401 ( sh % "cat" << r""" [extensions] automv= rebase= """ >> "$HGRCPATH" ) sh % "hg init repo" sh % "cd repo" sh % "printf 'foo\\nbar\\nbaz\\n'" > "a.txt" sh % "hg add a.txt" sh % "hg commit -m 'init repo with a'...
from DateTime import DateTime from imio import history as imio_history from imio.history.interfaces import IImioHistory from imio.history.testing import IntegrationTestCase from imio.history.utils import add_event_to_history from imio.history.utils import get_all_history_attr from imio.history.utils import getLastActio...
""" Hacked together random CR encounter generator. No GUI planned. By Chris Ward """ import argparse import csv from random import randint def coin_flip(): return randint(0, 1) def encounter_var(set_cr): d100_roll = randint(0, 99) # Distribution pulled from DMG pg. 49 #Each teir has distribution now...
from boss3.util.Session import * from boss3.bossexceptions import EndOfQueueException import bosslog import md5 import random import time import types log = bosslog.getLogger() class CustomQueue: def __init__(self, manager, dbh, parent): self.items = [] self.dbh = dbh self.parent = parent self.manager = manage...
from __future__ import unicode_literals from parsedoc.blocks import PHPFile, PHPClass, PHPFunction def test_PHPFile(): f = PHPFile('foo', 'bar') assert f.name == 'foo' assert f.comment == 'bar' assert 'foo' in str(f) assert 'bar' in str(f) def test_PHPFile_contains(): f = PHPClass('foo', 'bar') ...
class AbstractPostHocTestPlugin: ''' Abstract base class specifying interface for a post-hoc test ''' def __init__(self, preferences): self.name = 'Unnamed' def run(self, data, coverage, groupNames): ''' Must return the p-values, effect sizes, lower CIs, upper CIs, and labels for each contrast along with...
''' Created on Sep 10, 2017 @author: mmullero ''' from stjoernscrapper.core import Core, autolog, errorlog from stjoernscrapper.webcrawler import WebCrawler import re from selenium.common.exceptions import NoSuchElementException class NakupITesco(WebCrawler): ''' NakupITesco Crawling ''' def __init__(se...
from django.contrib import admin from . import models admin.site.register(models.UserProfile)
import os, eyeD3, uuid import ConfigParser config = ConfigParser.ConfigParser() config.read('config.ini') sysroots = [config.get('main', 'sysroots')] searchpath = [config.get('main', 'searchpath')] webroot = config.get('main', 'webroot') default_poster= config.get('main', 'default_poster') LICENSE_TERM = """ <cloudmusi...
__all__ = 'i18n', from PySide.QtCore import QObject class i18n(QObject): pass i18n = i18n()
import asyncio import os import pathlib import aiohttp import bs4 __author__ = 'Davide Canton' DIR = "gists" USER = "DavideCanton" CHUNK_SIZE = 1 << 16 MAX_CONNECTIONS = 20 MAX_PAGE = 30 URL = "https://gist.github.com" PAGE_URL = "https://gist.github.com/{}?page={}" async def get(*args, **kwargs): response = await ...
""" Custom indentation settings storage. Indentation mode is stored as number of spaces or special number TABS. """ import os from gi.repository import Gio, GLib SETTINGS_KEY = "org.gnome.gedit.preferences.editor" TABS = 0 filename = os.path.join(GLib.get_user_config_dir(), "gedit", "indent...
import sys import os.path import scipy.io.wavfile import numpy try: orig_filename = sys.argv[1] split_dir = sys.argv[2] except: print "Need wave filename to split, and directory to put them" sys.exit(1) sample_rate, data = scipy.io.wavfile.read(orig_filename) data_abs = abs(data) median = numpy.median(d...
from reaktoro import * from pytest import approx, raises from numpy import array def names(objects): """Extract the names of each object in a list.""" return [o.name() for o in objects] def range_species_in_phase(system, iphase): """Return the range of species indices in a phase.""" return range(system....
__author__ = 'zak' import json import uuid import ast import pprint import datetime from di_utils import * from clatoolkit.models import LearningRecord,SocialRelationship from xapi.statement.builder import socialmedia_builder, pretty_print_json from xapi.statement.xapi_settings import xapi_settings from xapi.oauth_cons...
import pkg_resources __version__ = pkg_resources.get_distribution('itcc').version del pkg_resources
letter_values = dict(zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', range(1, 27))) words = [word[1:-1] for word in open('p042_words.txt', 'r').read().split(',')] triangle_numbers = set([n * (n + 1) // 2 for n in range(1, 200)]) print(len([word for word in words if sum([letter_values[letter] for letter in word]) in triangle_numbers]...
import os import platform import sys import traceback import serial import serial.tools.list_ports import time class FlashLdr: "A representation of the AMSAT Golf UART Loader" # # Note: You should be able to make different classes to represent different # loaders with the same methods, and get this who...
""" ePSproc classes plot function wrappers 16/10/20 Methods for/from base class. TODO: should be able to simplify with subselection logic removed (bit ad hoc currently due to organic growth of this!) and/or rewrite as decorators. """ from matplotlib import pyplot as plt # For plot legends with Xarray plotter import...
from __future__ import unicode_literals from collections import defaultdict, OrderedDict from operator import itemgetter import transaction from flask import request, session, redirect, flash, jsonify from sqlalchemy import func, inspect from sqlalchemy.orm import joinedload, lazyload from werkzeug.exceptions import No...
import sys import os.path import time from datetime import datetime import base64 import random import string import os import types from itertools import islice src_path = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0] def ask(prompt, options='YN'): '''Prompt Yes or No,return the upper case 'Y' or '...
print('---------------------------TIC TAC TOE-----------------------------\n') print('\t\t\t___|__|___') print('\t\t\t___|__|___') print('\t\t\t | | ') print("please choose your symbol:\n1.Player1->X\n2.Player2->O\n>>") print('\t\t\t_1|_2_|_3__') print('\t\t\t_4|_5_|_6_') print('\t\t\t 7| 8 | 9 ') list_Pl1 = [] li...
import Game as g import Persistence.Exceptions.GameNotFoundException as gnfe import UI.Handlers.AuthenticatedHandler as ah class EditGameHandler(ah.AuthenticatedHandler): """Handles requests for the Edit Game page""" def get_page(self, args): """The Edit game page :param args: A dictionary conta...
''' Copyright 2014 Travel Modelling Group, Department of Civil Engineering, University of Toronto This file is part of the TMG Toolbox. The TMG Toolbox 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 Found...
def add(x,y): """Gib x plus y zurueck.""" return x + y print add(0,1)
from jroc.nlp.pos.PosManager import PosManager
from time import gmtime, strftime print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())) import time print(time.strptime("30 Nov 00", "%d %b %y")) print(time.time())
import sudoku_maker from defaults import * import pickle import os import tempfile import sys import sudoku_maker import sudoku from reportlab.lib.units import inch from reportlab.platypus import * from reportlab.lib.styles import getSampleStyleSheet from reportlab.rl_config import defaultPageSize from reportlab.lib.pa...
""" Unit tests for objects.py """ import collections import exceptions import objects import unittest import uuid class TestFunctions(unittest.TestCase): def test_new_handle(self): handle = objects.new_handle() tested_handle = str(uuid.UUID(handle, version=4)) self.assertEqual(handle, tested...
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...
__app__ = "MQTT to Cloud" __author__ = "Xose Pérez" __contact__ = "xose.perez@gmail.com" __copyright__ = "Copyright (C) 2013 Xose Pérez" __license__ = 'GPL v3' class CloudService(object): last_response = None def push(self, feed, stream, value): pass def loop(self): pass
PKG = 'robbie' NAME = 'move_head_demo' import roslib; roslib.load_manifest(PKG) import rospy from actionlib import SimpleActionClient from geometry_msgs.msg import PointStamped from robbie.msg import * def move_head(head_pan, head_tilt): # Creates a goal to send to the action server. goal = RobbieHeadGoal() ...
import pymysql.cursors class blog_post: def __init__(self): self.blog_posts = [] self.connection = pymysql.connect(host='localhost', user='blog', password='d5022a', db='blog'...
import vrep from time import sleep vrep.simxFinish(-1) simulID = vrep.simxStart('127.0.0.1',19997,True,True, 5000,5) vrep.simxSynchronous(simulID, True) for i in xrange(5): print "starting no : ", i print "now starting" vrep.simxStartSimulation(simulID, vrep.simx_opmode_oneshot_wait) vrep.simxSynchronou...
''' SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D. 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. T...
import os, sys import numpy as np import math from scipy.fftpack import fft, ifft, fftshift Tool_UtilFunc_DirStr = '../UtilFunc-1.0/' CCode_DirStr = '../SineModel-1.0/' sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), Tool_UtilFunc_DirStr)) sys.path.append(os.path.join(os.path.dirname(os.path.r...
import copy import json import pytest from randovania import get_data_path from randovania.bitpacking import bitpacking from randovania.bitpacking.bitpacking import BitPackDecoder from randovania.games.game import RandovaniaGame from randovania.layout.base.major_items_configuration import MajorItemsConfiguration def _c...
import statsmodels.formula.api as smf import sklearn.metrics as sm import pandas as pd import numpy as np import math import sys if len(sys.argv) != 2: print('bitcoin.py <path to data folder>') sys.exit(1) data_path = sys.argv[1] train1_90 = pd.read_csv(data_path+'/train1_90.csv') train1_180 = pd.read_csv(data_...
"""Sparse DIAgonal format""" from __future__ import division, print_function, absolute_import __docformat__ = "restructuredtext en" __all__ = ['dia_matrix', 'isspmatrix_dia'] import numpy as np from .base import isspmatrix, _formats from .data import _data_matrix from .sputils import isshape, upcast, upcast_char, getdt...
''' Header: Toolname: delayedSelectionDragger Part: Main Scripts Made by: Jakob Welner Owner: Jakob Welner ______________________________________________ Dependencies: OMT_to_selectionDragger.mel ______________________________________________ Description: Use as a press/release hotkey with following name an...
'''reload all user plugins''' import os import sys from paths import CONFIG __author__ = 'sentriz' COMMAND = 'restart' def main(bot, author_id, message, thread_id, thread_type, **kwargs): def send_message(message): bot.sendMessage(message, thread_id=thread_id, thread_type=thread_type) if not author_id i...
from colab.widgets.widget_manager import Widget class ParticipationChart(Widget): name = "participation_chart" template = 'widgets/participation_chart.html'
import logging from flask import Flask from flask import request from octronic.webapis.event.EventDB import EventDB from octronic.webapis.common import Constants events_db = EventDB() app = Flask(__name__) logging.basicConfig(level=logging.DEBUG) log = logging.getLogger(__name__) @app.route('/event',methods=['POST']) d...
from django.utils.translation import ugettext_lazy as _ from django.shortcuts import render from django.views import View from django.contrib.sites.shortcuts import get_current_site from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse, reverse_lazy from django.contrib.auth.decorator...
import sys import io from math import log, tan, sqrt from time import mktime, strptime from xml import sax version = '1.01' verbose = True class TrackLog: class Trkseg: # for GPX <trkseg> tags def __init__(self, points=None): self.points = points or [] def __len__(self): retu...
from util import MAXINT from geometry import * def douglas(st, tolerance=.001, plane=None, _first=True): """ Perform Douglas-Peucker simplification on the path 'st' with the specified tolerance. The '_first' argument is for internal use only. The Douglas-Peucker simplification algorithm finds a subset ...
from PyQt5 import QtGui, QtCore from oyoyo.client import IRCClient from oyoyo.cmdhandler import DefaultCommandHandler from oyoyo import helpers, services import logging import random import socket from time import time from mood import Mood from dataobjs import PesterProfile from generic import PesterList from version ...
def main(): testfunc(one = 1, two = 2, four = 42) def testfunc(**kwargs): print("This is a test function", kwargs["one"], kwargs["four"]) print("Must be named, tuple then keywords in that order.") if __name__ == "__main__": main()
import unittest import sys import os from PyQt5 import QtWidgets,QtWebEngineWidgets,QtWebEngineCore class TestBrowser(unittest.TestCase): tmp_dir = os.path.join(os.path.expanduser('~'),'.config','hlspy') url = 'https://duckduckgo.com' dm = 'duckduckgo.com' ua = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:45.0) Gecko/...
from itertools import chain from multiqc.plots import linegraph def plot_qhist(samples, file_type, **plot_args): """Create line graph plot of histogram data for BBMap 'qhist' output. The 'samples' parameter could be from the bbmap mod_data dictionary: samples = bbmap.MultiqcModule.mod_data[file_type] ""...
import os import csv import logging from chirp import chirp_common, errors, directory LOG = logging.getLogger(__name__) class OmittedHeaderError(Exception): """Internal exception to signal that a column has been omitted""" pass def get_datum_by_header(headers, data, header): """Return the column correspondi...
"""qBittorrent Client.""" from __future__ import unicode_literals from requests.auth import HTTPDigestAuth from .generic import GenericClient from .. import app class QBittorrentAPI(GenericClient): """qBittorrent API class.""" def __init__(self, host=None, username=None, password=None): """Constructor. ...
class Person: def __init__(self, name, mobile_phone=None, office_phone=None, private_phone=None, email=None): self.name = name self.mobile = mobile_phone self.office = office_phone self.private = private_phone self.email = email def add_m...
import gettext import locale import os import platform import sys if platform.system() != "Windows": import wxversion wxversion.ensureMinimal('2.8') sys.path.insert(0, os.path.dirname(__file__)) sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "dependencies", "timelinelib", "pysvg-0.2.1")) sys.p...