code
stringlengths
1
199k
import shutil import tempfile import sys import libtorrent as lt from time import sleep import string def magnet2torrent(magnet): tempdir = tempfile.mkdtemp() ses = lt.session() params = { 'save_path': tempdir, 'duplicate_is_error': True, 'storage_mode': lt.storage_mode_t(2), ...
from distutils.core import setup setup(name='DMS', version='1.0.8', description='DMS Master System', author='Matthew Grant', author_email='matt@mattgrant.net.nz', url='http://mattgrant.net.nz/software/dms', packages=['dms', 'dms.app', 'dms.database'])
""" This is a modified version of django-avatar. This is just a copy of the django-avatar app from https://github.com/grantmcconnaughey/django-avatar but modified to work when avatars are linked to contacts, not a user model at all and I'm loathe to shoehorn the Contact model into a User model definition just for the s...
import re import os import requests import xlrd import urllib import time from bs4 import BeautifulSoup import zipfile import getpass save_url = "http://tkkc.hfut.edu.cn/student/exam/manageExam.do?1479131327464&method=saveAnswer" index = 1 headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_auto_20170223_1850'), ] operations = [ migrations.AlterField( model_name='extract', name='money', field=...
import sys PY3 = False if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int import re from core import tmdb from core import httptools from core.item import Item from core import servertools from core import scrapertools from bs4 import BeautifulSoup from channelselector import get_thumb fro...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible.errors import AnsibleError, AnsibleParserError from ansible.parsing import DataLoader from ansible.playbook.attribute import Attribute, FieldAttribute from ansible.playbook.play import Play from ansible.playbo...
class Hand(object): def __init__(self): self.hand = [] def add(self, card): self.hand.append(card) def create(self, typed_hand): for i in range(0, len(typed_hand), 2): self.hand.append((typed_hand[i], typed_hand[i+1])) def status(self): return self.hand if __na...
"""Unit tests for the :mod:`iris.fileformats` package.""" import iris.tests as tests class TestField(tests.IrisTest): def _test_for_coord(self, field, convert, coord_predicate, expected_points, expected_bounds): (factories, references, standard_name, long_name, units, attrib...
import requests import sys base_url = 'http://lgapi-eu.libapps.com/1.2/az' auth_url = 'http://lgapi-eu.libapps.com/1.2/oauth/token' auth_credentials = {'client_id': '267', 'client_secret': '47c133be1eff42f213051f55865bd59b', 'grant_type': 'client_credentials'} try: r = reques...
import click import glob import os import logging import pytz import re from datetime import datetime from podgen import Podcast, Episode, Media, Person, Category from mutagen.id3 import ID3 from mutagen.id3._util import ID3NoHeaderError @click.command() @click.option('--name', required=True, help='the name of the podc...
from random import random from opc.utils.prof import timefunc poly = { 2: (2, 1), 3: (3, 2), 4: (4, 3), 5: (5, 3), 6: (6, 5), 7: (7, 6), 8: (8, 6, 5, 4), 9: (9, 5), 10: (10, 7), 11: (11, 9), 12: (12, 11, 14), 13: (13, 12, 11, 8), 14: (14, 13, 12, 2), 15: (...
'''Descriptor classes defined in this file are "intermediary" classes that gather, from the user application, information about found gen- or workflow- classes.''' import types, copy import appy.gen as gen from . import po from .model import ModelClass from .utils import produceNiceMessage, getClassName TABS = 4 ...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('ouvidoria', '0001_initial'), ] operations = [ migrations.AlterField( model_...
import io import re from glob import glob from os.path import basename from os.path import dirname from os.path import join from os.path import splitext from distutils.core import setup from setuptools import find_packages, setup def read(*names, **kwargs): return io.open( join(dirname(__file__), *names), ...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='DoublesMatch', fields=[ ('id', models.AutoField(verbose_name='ID', serialize...
"""Cylc site and user configuration file spec.""" import os from typing import List, Optional, Tuple, Any from pkg_resources import parse_version from cylc.flow import LOG from cylc.flow import __version__ as CYLC_VERSION from cylc.flow.exceptions import GlobalConfigError from cylc.flow.hostuserutil import get_user_hom...
import os import sys import VTKConvert if len(sys.argv) == 1 : print "Usage: processISISData file-name1 file-name2 ...\n processISISDATA dir-name" exit(1) names=[] is_dir = os.path.isdir(sys.argv[1]) if is_dir : names = os.listdir(sys.argv[1]) else: for i in range(1,len(sys.argv)): names...
from django.dispatch import receiver from django_fsm import signals from core.editor.models import IssueSubmission from core.editor.models import IssueSubmissionStatusTrack @receiver(signals.post_transition, sender=IssueSubmission) def register_status_track(sender, instance, name, source, target, **kwargs): # Regis...
import os from trepan.processor.command import base_cmd as Mbase_cmd from trepan.processor import frame as Mframe class UpCommand(Mbase_cmd.DebuggerCommand): signum = -1 category = 'stack' min_args = 0 max_args = 1 name = os.path.basename(__file__).split('.')[0] ne...
from new_address_widget import NewAddressWidget from existing_address_widget import ExistingAddressWidget
import types from appy import Object from appy.gen import Field from appy.px import Px from DateTime import DateTime from BTrees.IOBTree import IOBTree from persistent.list import PersistentList class Calendar(Field): '''This field allows to produce an agenda (monthly view) and view/edit events on it.''' ...
tab_cat = "\t Iam tab In" new_line = "I am split \n on a line" back_cat = "I am \\ a \\ cat" fat_cat = """ I will do a list \t * Cat food \t * Fishes \t * Catnip \n \t * GRass """ fat_CCAT = ''' hahah this is ok also ''' print tab_cat print new_line print back_cat print fat_cat print fat_CCAT
import os import re import sys from omsdk.sdkcreds import UserCredentials from omsdk.sdkcenum import EnumWrapper, TypeHelper from omsdk.lifecycle.sdkcredentials import iBaseCredentialsApi from omdrivers.enums.iDRAC.iDRACEnums import * from omdrivers.enums.iDRAC.iDRAC import Privilege_UsersTypes PY2 = sys.version_info[0...
def f(): """ Comment """
def process_rawq(self, cmd, cmd2): while self.rawq: if self.iacseq: if cmd: pass elif cmd2: if self.option_callback: self.option = 2 else: self.option = 3 def listener(data): while 1: ...
from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0025_office_min_work_hours_for_credit'), ] operations = [ migrations.AddField( model_name='hoursbalance', ...
import os from tornado.web import addslash import sickchill.start from sickchill import logger, settings from sickchill.helper import try_int from sickchill.oldbeard import config, filters, helpers, ui from sickchill.views.common import PageTemplate from sickchill.views.routes import Route from . import Config @Route('...
DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'yourip', # Or path to database...
import logging import pygame import os import time import backlight import sprites import volumebar import controlbar import images import mpc import signalcatcher import gpio import timer import trackinfo logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger('radioplayer') def main(): screen.fill(bac...
from harpia.GladeWindow import GladeWindow from harpia.amara import binderytools as bt import gtk from harpia.s2icommonproperties import S2iCommonProperties import os import gettext APP='harpia' DIR=os.environ['HARPIA_DATA_DIR']+'po' _ = gettext.gettext gettext.bindtextdomain(APP, DIR) gettext.textdomain(APP) class Pro...
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "smsbot.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
""" ======================================================================== Functionalities and filters connected with ITK/VTK (:mod:`medpy.itkvtk`) ======================================================================== .. currentmodule:: medpy.itkvtk The methods in this module require the `WrapITK <https://code.goo...
BOT_NAME = 'sat' SPIDER_MODULES = ['sat.spiders'] NEWSPIDER_MODULE = 'sat.spiders' USER_AGENT = 'sat (+http://www.openearth.eu)' DOWNLOADER_MIDDLEWARE = [ 'scrapy.contrib.downloadermiddleware.httpauth.HttpAuthMiddleware' ] ITEM_PIPELINES = { 'sat.pipelines.JsonWriterPipeline' : 100, 'sat.pipelines.Duplicate...
import codecs import os import re from setuptools import setup version = 'devel' changelog = 'debian/changelog' if os.path.exists(changelog): head = codecs.open(changelog, encoding='utf-8').readline() match = re.compile('.*\((.*)\).*').match(head) if match: version = match.group(1) setup( name='...
import numpy as np t1ma_nm1 = {'0.90,009': 1.83, '0.90,019': 1.73, '0.90,029': 1.70, '0.90,039': 1.68, '0.90,059': 1.67, '0.90,099': 1.66, '0.90,199': 1.65, '0.99,009': 3.25, '0.99,019': 2.86, '0.99,029': 2.76, ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- author: James Hogarth module: jenkins_script short_description: Execute...
import logging import os.path from pylons import request from dirac.lib.base import * from dirac.lib.webconfig import gWebConfig from dirac.lib.sanitizeInputs import sanitizeAllWebInputs from DIRAC import gLogger from DIRAC.Core.DISET.AuthManager import AuthManager from DIRAC.Core.Security import CS, X509Certificate gA...
from os import path import controller, webbrowser, tkMessageBox import Tkinter as tk class View(tk.Frame): controller = None current_dir = "~" items_selected = [] action = None main_list = None topMenu = None contextMenu = None...
""" /*************************************************************************** vector_selectbypoint A QGIS plugin Select vector features, point and click. ------------------- begin : 2014-04-07 copyright : (C) 20...
import sys, rospy from pimouse_ros.msg import LightSensorValues def get_freq(): f = rospy.get_param('lightsensors_freq',10) try: if f <= 0.0: raise Exception() except: rospy.logerr("value error: lightsensors_freq") sys.exit(1) return f if __name__ == "__main__": devfil...
import sys, sqlite3, os, inspect, json from os.path import expanduser from pyexcel_ods import save_data, get_data from collections import OrderedDict from bbdd import Bbdd class Ods: def __init__(self, directory=expanduser("~/betcon.ods"), directory_bd = None): self.directory = directory self.directory_bd = direct...
import sys for line in open (sys.argv[1], 'r'): s = line.rstrip().split(' ') output = "" iterZeros = iter(s) for t in iterZeros: if t == '0': output += next(iterZeros) else: output += '1' * len(next(iterZeros)) print int('0b' + output, 2)
"""Test target identification, iteration and inclusion/exclusion.""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import collections import os import re import errno import itertools import abc from . import types as t from .util import ( ApplicationError, display, ...
import logging from gi.repository import GLib, GObject class Timer(GObject.Object): """Dynamic timer that allows dynamically changing frequency""" timeout = GObject.Property(type=GObject.TYPE_UINT) def __init__(self, function, **kwargs): super().__init__(**kwargs) assert (callable(function))...
import sys from Bio import SeqIO import Script def usage(): sys.stderr.write("""methreport.py - Report methylation rate at CG and GC positions. Usage: methreport.py [-gcg] infile [outfile] `Infile' should be a multi-FASTA file in which the first sequence is assumed to be the reference. All other sequences should ha...
from decimal import Decimal from uuid import UUID import datetime from dateutil.parser import parse as parse_date from requests.compat import urlparse TRUTHY_VALS = {'true', 'yes', '1'} DT_RET = {'char', 'string', 'bin.base64', 'bin.hex'} DT_INT = {'ui1', 'ui2', 'ui4', 'i1', 'i2', 'i4'} DT_DECIMAL = {'r4', 'r8', 'numbe...
import math, sys import svgwrite PROGNAME = sys.argv[0].rstrip('.py') def create_svg(name): svg_size_width = 900 svg_size_height = 1600 font_size = 20 square_size = 30 title1 = name + ': Part 5 tiling with multiple def, groups, use, translate and scale.' sqrt3 = math.sqrt(3) # do this calc once...
from django.http import HttpResponse, Http404 from django.views.decorators.csrf import csrf_exempt from django.shortcuts import get_object_or_404, render, redirect from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.urls import r...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'core'} DOCUMENTATION = """ --- module: junos_linkagg version_added: "2.4" author: "Ganesh Nalawade (@ganesh...
import matlab import numpy as np import opennft.config as c class FD: def __init__(self, xmax, module = None): self.module = module # names of the dofs self.names = ['X', 'Y', 'Z', 'pitch', 'roll', 'yaw', 'FD'] self.mode = { 'tr': ['tr', 'translational', 'tr_sa'], ...
from scipy.linalg import expm, norm import numpy as np def rot_mat(axis, theta): return expm(np.cross(np.eye(3), axis/norm(axis)*theta)) def rotate_vector(v, axis, theta): M = rot_mat(axis, theta) return np.tensordot(M,v,axes=([0],[1])).T #np.dot(M, v) def rotate_around_z(v, theta): return rotate_vector...
import requests import json class NoComposites(Exception): def __init__(self, message): self.message = message class NotFoundError(Exception): def __init__(self, message): self.message = message class AuthenticationError(Exception): def __init__(self, message): self.message = message...
""" This module deals with relative dates (2d, 5y, Monday, today, etc.) """ from datetime import date, timedelta import calendar import re def _add_months(p_sourcedate, p_months): """ Adds a number of months to the source date. Takes into account shorter months and leap years and such. https://stackover...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('rango', '0005_bares_views'), ] operations = [ migrations.AddField( model_name='tapas', name='likes', field=models.Int...
import sys import os import djcelery from django.conf import settings djcelery.setup_loader() from datetime import timedelta DEBUG = True TEMPLATE_DEBUG = DEBUG DEFAULT_CANDIDATE_EXTRA_INFO = { "portrait_photo": "http://votainteligente.cl/static/img/candidate-default.jpg", 'custom_ribbon': 'ribbon text' } DEFAU...
import autophy import sys if len(sys.argv) < 2: print "usage: clean_phlawd_sourcedb.py <sourcedb_filename>" sys.exit(0); db = autophy.Database(sys.argv[1]) response = raw_input("Are you sure you want to wipe the database? All tables except taxonomy will be erased?\n" \ "enter yes or no: ") ...
''' Outputs an HTML webpage to stdout to visualize a set of colors ''' def mkColor(name, color): ''' Converts a `name` and `rgb` (any CSS format) to a few CSS lines ''' return '.color-{} {{\n\tcolor: {}\n}}\n'.format(name, color) CSS_COLORS = { 'white': 'Beige', 'black': 'DarkSlateGrey', 'blue':...
import boto3 regions_name=['cn-northwest-1', 'cn-north-1'] start_filter = [ {'Name': 'tag:AutoStart', 'Values': ['true', 'True', 'TRUE']}, {'Name': 'instance-state-name', 'Values': ['stopped']} ] def regional_start_ec2(region_name='cn-northwest-1'): print("Auto Start EC2 in region {}".format(region_name)) ...
from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.setEnabled(True) MainWindow.resize(974, 502) MainWindow.setAutoFillBackground(False) MainWindow.setStyleSheet("background-c...
""" Create cluster job files to align a batch of reads to a genome, using bwa. """ from sys import argv,stdin,stdout,stderr,exit from re import compile from math import ceil def usage(s=None): message = """ usage: make_bwa_jobs [options] --base=<path> path prefix; other filenames can use "{base}" to ...
""" This modules provides classes and functions for using the kombine sampler packages for parameter estimation. """ import numpy from pycbc.inference.sampler_base import BaseMCMCSampler class KombineSampler(BaseMCMCSampler): """This class is used to construct the MCMC sampler from the kombine package. Para...
i = input() while i != 10: print i i = i + 1 print input()
import sys, os, threading, time, logging, select, Queue import perf log = logging.getLogger("ashd.serve") seq = 1 seqlk = threading.Lock() def reqseq(): global seq with seqlk: s = seq seq += 1 return s class closed(IOError): def __init__(self): super(closed, self).__init__("T...
from enum import Enum, unique import math @unique class Direction(Enum): """The six cardinal directions on a hexigonal grid Named as <axis>_<sign>, so Q_POS is in the positive direction on the q axis. """ Q_POS = 0 R_POS = 1 S_POS = 2 Q_NEG = 3 R_NEG = 4 S_NEG = 5 class HexCell: ...
import re import serial.tools.list_ports def main(): print "Listing all serial devices, pick the one you want and use the line in config.ini.\n" for (port, name, hwid) in serial.tools.list_ports.comports(): print "\ndeviceN_port={0}".format(port) if hwid not in ["n/a", None]: print "...
""" hdnet ~~~~~ Hopfield denoising network :copyright: Copyright 2014, Christopher Hillar, Felix Effenberger :license: GPLv3, see LICENSE for details. """ """hdnet init code""" __version__ = 'v0.1' from .data import * from .hopfield import * from .learner import * from .maths import * from .patterns...
import numpy as np import pystan import statsmodels.api as sm from scipy.stats import uniform, bernoulli, poisson def ztp(N, lambda_): """Zero truncated Poisson distribution""" temp = [poisson.pmf(0, item) for item in lambda_] p = [uniform.rvs(loc=item, scale=1-item) for item in temp] ztp = [int(poisson...
from dec import dec from file2txt import file2txt from dec2str import dec2str from date2str import date2str from dbsqlite import Db def isoz(accounts, diax='.'): ''' [['20.00.00',0, 15], ['38.00.00', 34, 67]] ''' dv = {} lena = len(accounts[0]) for acc in accounts: ach = lmohier(acc[0], ...
import os from GangaCore.Runtime.GPIexport import exportToGPI from GangaCore.GPIDev.Base.Proxy import GPIProxyClassFactory from GangaLHCb.Lib.Applications import AppsBaseUtils from GangaCore.Utility.logging import getLogger from .GaudiPython import GaudiPython from .Bender import Bender from .BenderScript import Bender...
""" numerictypes: Define the numeric type objects This module is designed so "from numerictypes import \\*" is safe. Exported symbols include: Dictionary with all registered number types (including aliases): typeDict Type objects (not all will be available, depends on platform): see variable sctypes for w...
from django.contrib import admin from .models import Repos admin.site.register(Repos)
import sys sys.path += ["../"] from mingus.containers.NoteContainer import NoteContainer from mingus.containers.Note import Note import unittest class test_NoteContainers(unittest.TestCase): def setUp(self): self.n1 = NoteContainer() self.n2 = NoteContainer("A") self.n3 = NoteContainer(["A", "C", "E"]) self.n4...
from django import forms from django.conf import settings from django.contrib.auth import authenticate, login from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect from django.core.urlresolvers import reverse from django.utils import simplejson as json from django.db.mod...
''' :copyright: Copyright since 2006 by Oliver Schoenborn, all rights reserved. :license: BSD, see LICENSE.txt for details. ''' from topicutils import stringize class ListenerNotValidatable(RuntimeError): ''' Raised when an attempt is made to validate a listener relative to a topic that doesn't have (yet) a...
""" Module to contain internal system macros for operating on a configuration. """ import inspect import rose.macro import compulsory import duplicate import format import rule import trigger import value MODULES = [compulsory, duplicate, format, rule, trigger, value] class DefaultTransforms(rose.macro.MacroTransformer...
""" move_base_square.py - Version 1.1 2013-12-20 Command a robot to move in a square using move_base actions.. Created for the Pi Robot Project: http://www.pirobot.org Copyright (c) 2012 Patrick Goebel. All rights reserved. This program is free software; you can redistribute it and/or modify it und...
''' The index is a mapping of work stems to lists of objects whose attributes contain the strings. The results are type, object pairs. Basic workflow to build the search index: For each term-- - reduce it to a set of words - subtract stopwords - stem each word and add the term's id to the search index - add the...
import os import tempfile def mkstemppath(suffix='', prefix='tmp', dir=None, text=False): """Return the name of a temporary file that we can use.""" f = tempfile.NamedTemporaryFile(delete=True) name = f.name f.close() return name
from util import hook, http, timesince from datetime import datetime from BeautifulSoup import BeautifulSoup import re baseurl = "http://www.metal-archives.com/" api_url = "http://ws.audioscrobbler.com/2.0/?format=json" @hook.command('maband', autohelp=False) @hook.command(autohelp=False) def maband(inp, conn=None, bot...
masker = NiftiMasker(haxby_data.mask_vt[0]) X = masker.fit_transform(func_file) plot_roi(masker.mask_img_)
class Solution: def intToRoman(self, num: int) -> str: r = str() c, num = num // 1000, num % 1000 r += 'M' * c c, num = num // 100, num % 100 if c == 9: r += 'CM' elif c in range(5, 9): r += 'D' + 'C' * (c - 5) elif c == 4: ...
from __future__ import unicode_literals from django.apps import AppConfig class PadronConfig(AppConfig): name = 'padron' verbose_name = 'Padron Colorado'
""" maya2katana Copyright (C) 2016-2019 Andriy Babak, Animagrad 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 v...
import os import shutil import itertools from slpkg.messages import Msg from slpkg.utils import Utils from slpkg.__metadata__ import MetaData as _meta_ class NewConfig(Utils): """Manage .new configuration files """ def __init__(self): self.meta = _meta_ self.msg = Msg() self.red = se...
""" Inproc transport classes. """ import asyncio from ..common import ( AsyncBox, ClosableAsyncObject, CompositeClosableAsyncObject, cancel_on_closing, ) class Channel(ClosableAsyncObject): def on_open(self, path): super().on_open() self._path = path self._linked_channel = No...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('notes', '0001_initial'), ] o...
""" Created on Sat Feb 21 16:05:41 2015 @author: Vidar Tonaas Fauske """ from .mainwindowbase import MainWindowBase, tr import os import inspect from functools import partial from qtpy import QtGui, QtCore, QtWidgets from qtpy.QtCore import Qt from qtpy.QtWidgets import QDialogButtonBox from hyperspyui.smartcolorsvgico...
from __future__ import absolute_import, division, print_function from builtins import * # 'future' module import sys import logging import states if __name__ == '__main__': if '-v' in sys.argv: logging.basicConfig(level=logging.DEBUG) states.start()
import re import fs, fs.errors from fs.base import FS as fsFS class AppSourceConnectionError(Exception): pass class AppSourceConnection(object): """An AppSourceConnection provides methods to access apps in an AppSource.""" @staticmethod def create(source, options): """Returns a new AppSourceConn...
from typing import Union import pysonic Playable = Union[pysonic.Song, pysonic.Album, pysonic.Artist, pysonic.Folder]
import socket import ssl import os import Queue import threading import time exec(open(os.path.join(os.path.dirname(__file__), "configs" + os.sep + "config.py"), "r").read()) if MPD: import mpd class ConnectionMan: def __init__(self, threaddict, httpresp, global_confman): global thread_types thr...
""" Display recursively the content of a given cell of a view. """ __docformat__ = 'restructuredtext' from qtpy import QtCore from qtpy import QtGui from qtpy import QtWidgets import vitables.utils def getArrayDimensions(shape): """ Get the dimensions of the grid where the cell will be zoomed. The zoomed ce...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('erudit', '0068_article_has_copyright_restriction'), ] operations = [ migrations.RemoveField( model_name='article', name='has_copy...
import os, sys, operator try: file_dis = sys.argv[1] ord_colon = int(sys.argv[2]) except: print("Use: "+ sys.argv[0] + " `file_name` column (with column>=0)") print("Sort the lines of the file in such a way that the chosen column is growing") sys.exit(1) file_ord=file_dis+'_ord' # sorted file out...
__author__ = 'calthorpe_analytics' class Range: def __init__(self, start, end): self.start = start self.end = end def length(self): return self.end - self.start def overlaps(self, other): return not(self.end < other.start or other.end < self.start) def name(self): ...
""" Check for problems that might break the build in non-IMP repository code: - a module without a README.md - missing or incomplete submodules """ import os import sys import os.path import shutil import platform import tools def check_readme(): for module, g in tools.get_modules("."): if not os.path.exist...
from math import inf from lib import rev_range def search_free(arr): """ Given the price of a stock over n days. Buy & sell are unlimited. Returns the maximum possible profit. Solution is greedy. Time complexity is O(n). Space complexity is O(1). :param arr: list[num] :return: num """ n = le...
class Tournament: def __init__(self, id, name, venueID, round, player_count, last_winnerID, awardID): self.ID = id self.Name = name self.VenueID = venueID self.Round = round self.PlayerCount = player_count self.LastWinnerID = last_winnerID self.AwardID = award...
""" Illustrative example for a numerical irreducible decomposition. This python3 script illustrates a two-stage cascade to compute candidate generic points on all components, on all dimensions of the solution set. """ pols = ['(x^2 + y^2 + z^2 - 1)*(y - x^2)*(x - 0.5);', \ '(x^2 + y^2 + z^2 - 1)*(z - x^3)*(y - ...