code
stringlengths
1
199k
from channels.routing import include from channels.routing import route from otree.channels.routing import channel_routing from redirect.consumers import ws_admin_connect as redirect_ws_admin_connect,\ ws_admin_message as redirect_ws_admin_message,\ ws_admin_disconnect as redirect_ws_admin_disconnect from mineu...
""" Check status of all nodes submitted to the OSDF server, determine parent-child hierarchy, detect any missing or mis-linkage to incorrect node. """ import sys import os import re import csv import logging import time COOLNESS = True def log_it(logname=os.path.basename(__file__)): """log_it setup""" curtime =...
import re import sys import os import math input_file = open(sys.argv[1], 'r') output_file = open(os.path.splitext(sys.argv[1])[0]+'.ltm' , 'w') regex_input = re.compile(r'[\s]*([\d]*)((?:,(?:[RLUDJKXCGSQNF]|[\d]*))*)') regex_comment = re.compile(r'[\s]*(#|[\s]*$)') intput_strs = "^<>+Z~" mapped_keys = ['ff52', 'ff51',...
""" Set astroid node This node represents the Python set object. Attributes: - elts (List[Expr]) - The elements in this set, which can be any immutable/hashable type expression. Example 1: - elts -> [] Example 2: - elts -> [Const(int(1)), Const(int(2)), Const(str(hi))] Type-checking: ...
"User" import copy import string import random import hashlib import time import datetime from itertools import groupby, ifilter from operator import attrgetter from ..model import ModelView, ModelSQL, fields from ..wizard import Wizard, StateView, Button, StateTransition from ..tools import safe_eval from ..backend im...
import github.GithubObject class GitignoreTemplate(github.GithubObject.BasicGithubObject): @property def source(self): return self._NoneIfNotSet(self._source) @property def name(self): return self._NoneIfNotSet(self._name) def _initAttributes(self): self._source = github.Gith...
from PyQt4 import QtGui, QtCore, QtWebKit import os class jsObject(QtCore.QObject): filePath = '' def __init__(self,parent): QtCore.QObject.__init__(self) self.editorHtml = '' def insertHtml(self): return self.editorHtml html = QtCore.pyqtProperty(str,fget=insertHtml) class Webbr...
import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'DamageEventResult.result_type' db.add_column(u'lizard_damage_damageeventresult', 'result_type', s...
from .polyhedron import Polyhedron from .right_cuboid import RightCuboid __all__ = ['Polyhedron', 'RightCuboid']
import Queue import threading eventQueue = Queue.Queue() def runInThread(threadFunc, callback): """ Executes threadFunc in a new thread. The result of threadFunc will be pass as the first argument to callback. callback will be called in the main thread. """ def helper(): # Execute threadfunc in new thread res...
VERSION = '0.0' GENES_COMPATIBILITY = '0.0' import os.path from kvarq.genes import Genome, Reference, SNP, Test, Testsuite, Genotype def tsv2SNPs(path, genome, reference): tests = [] for line in file(path): parts = line.strip().split('\t') name = parts[0] pos = int(parts[1]) base...
import pytest from qtpy import QtCore from qtpy.QtCore import QModelIndex, QSize from qtpy.QtWidgets import QStyledItemDelegate, QStyleOptionViewItem from ert_gui.model.node import Node from ert_gui.model.snapshot import SnapshotModel from ert_gui.simulation.view.realization import RealizationWidget class MockDelegate(...
import os import sys from trac.web.main import dispatch_request from trac.web.wsgi import WSGIGateway class CGIGateway(WSGIGateway): wsgi_multithread = False wsgi_multiprocess = False wsgi_run_once = True def __init__(self): WSGIGateway.__init__(self, dict(os.environ)) def _write(self, data)...
""" The Job Scheduling Executor takes the information gained from all previous optimizers and makes a scheduling decision for the jobs. Subsequent to this jobs are added into a Task Queue and pilot agents can be submitted. All issues preventing the successful resolution of a site candidate are disco...
import sys import os import time import logging import datetime def test(): logging.basicConfig(filename='log/test.log',format='%(levelname)s:%(asctime)s %(message)s', level=logging.INFO) logging.info('Start today test now!') def main(): test() if __name__=='__main__': main()
from django.template.response import TemplateResponse def index(request): response = TemplateResponse(request, 'index.html', {}) return response
x=17 y=1 a1="" a2="" a3="" a4="" a5="" a6="" a7="" repetidos=0 sumatotal=0 guardador=0 while x*y<1000: a1="" if x*y<100: a1="0"+str(x*y) else: a1=str(x*y) for x1 in range(0,10): a2="" a2=str(x1)+a1 if int(a2[:3])%13==0: for x2 in range(...
import os import tarfile from functools import wraps from .exif import dt_get from operator import itemgetter import tempfile def needs_tar(f): @wraps(f) def wrapper(self, *args, **kwargs): if self.tarfile is None: self.open() return f(self, *args, **kwargs) return wrapper def ne...
import logging import time from urllib import urlencode from django.conf import settings from django.http import HttpResponse from sigasync.sigasync_spooler import get_spoolqueue def spooler_http_gateway(request, spooler): logger = logging.getLogger("sigasync.views.spooler_http_gateway") data = request.POST.cop...
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('menu', '0011_menulink_weight'), ('entries', '0003_auto_20160601_1717'), ] operations = [ migrations.AddField( ...
import sys from config import es as default_es from elasticsearch import helpers def add_document(entries, es_index='memex', es_doc_type='page', es=None): if es is None: es = default_es es_entries = [] for doc in entries: entry = {"_index": es_index, "_type": es_doc_type, ...
"""This is an initial pytest sample file""" def func(x): return x + 1 def test_answer(): assert func(3) == 5
for d in range (2,9+1): for n in range (1,d-1): for c in range (1,9+1): if abs(float(n)/float(d) - (float(c)*10.0+float(n))/(float(d)*10 + float(c))) <0.00000000000000000000000000000000000001: print abs(float(n)/float(d) - (float(c)*10.0+float(n))/(float(d)*10 + float(c))) print "Found a possible: " + str...
from misc import * try: import re import os import gtk import gio import json import logging from xdg import BaseDirectory except Exception, exception: fatal_error('Fatal error loading Cardapio libraries', exception) import sys sys.exit(1) class IconHelper: def __init__(self)...
import sys, urllib import xbmcplugin, xbmcaddon, xbmcgui from BeautifulSoup import BeautifulSoup import weblogin, gethtml super_verbose_logging = False class HockeyUtil: def __init__(self, settings, cookiepath): self.__settings__ = settings self.cookiepath = cookiepath self.__dbg__ = setting...
import csv import lsb_release from datetime import datetime release_name = lsb_release.get_distro_information()['CODENAME'] release_description = lsb_release.get_distro_information()['DESCRIPTION'] def trisquel_eol(): with open('/usr/share/distro-info/trisquel.csv', 'r') as distro_data: trisquel...
import code import subprocess from PyQt5.QtNetwork import QHostAddress from PyQt5.QtNetwork import QTcpServer def run_code(codes): interpreter = code.InteractiveInterpreter() interpreter.runcode(codes) def run_code_from_file(fileName): subprocess.Popen(['python', fileName]) def isAvailable(port): server...
""" Apply permissions on a datasource. """ import sys import opal.core import opal.perm PERMISSIONS = { 'add-table': 'TABLE_ADD', 'administrate': 'DATASOURCE_ALL' } def add_arguments(parser): """ Add command specific options """ opal.perm.add_permission_arguments(parser, PERMISSIONS.keys()) ...
import Instruments import Fridge_Interfaces import os, io, datetime, time import logging import numpy as np # developed with version 1.10.4 import scipy as sp #developed with version 0.17.0 from scipy import signal import tables import matplotlib as mpl import matplotlib.pyplot as plt import contextlib import KAM data_...
from solvepack import *
from __future__ import print_function import glob import sys from PIL import BdfFontFile from PIL import PcfFontFile VERSION = "0.4" if len(sys.argv) <= 1: print("PILFONT", VERSION, "-- PIL font compiler.") print() print("Usage: pilfont fontfiles...") print() print("Convert given font files to the P...
import os, time, zlib data1 = '<html><body>Two lines should be visible.<br/>The second line.</body></html>' cd1 = zlib.compress(data1) length = len(cd1) next_chunk = hex(length - 10)[2:] os.write(1, "Date: Sun, 20 Jan 2008 15:24:00 GMT\r\nServer: ddd\r\nTransfer-Encoding: chunked\r\nContent-Encoding: deflate\r\nConnect...
import MaKaC.webinterface.rh.xmlGateway as mod_rh_xmlGateway from indico.web.flask.wrappers import IndicoBlueprint legacy = IndicoBlueprint('legacy', __name__) legacy.add_url_rule('/xmlGateway.py/getCategoryInfo', 'xmlGateway-getCategoryInfo', mod_rh_xmlGateway.RHCategInfo, ...
import os settings_dir = os.path.abspath(os.path.dirname(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = '' # Or p...
"""Generate files from templates using the Cheetah template engine. For more information about Cheetah, see http://www.cheetahtemplate.org Configuration Options encoding = (html_entities|utf8|strict_ascii) template = filename.tmpl # must end with .tmpl stale_age = s # age in seconds...
from gi.repository import Gtk, Gio from . import bibtexparser from . import fuzzywuzzy from .gi_composites import GtkTemplate @GtkTemplate(ui='/home/wolfv/Programs/uberwriter/uberwriter/plugins/bibtex/bibtex_item.glade') class BibTexItem(Gtk.Box): __gtype_name__ = 'BibTexItem' title_label = GtkTemplate.Child() ...
""" Created on Fri Jan 29 20:46:05 2016 Caculate the bifurcation diagram for the logistic map. @author: nightwing """ from tqdm import tqdm from numpy import linspace import matplotlib.pyplot as plt situations = [] #this list store [u,value_x] def LOGISTIC_MAP(x,u): n = 1 #initial value of n n_end = 1...
from sys import exit import argparse useurllib3 = False try: import urllib3 useurllib3 = True except: pass configURL = "http://www.fklama.de/unshac/unshacConfig.example.py" useGPG = True gpg_path = "gpg" gpg_passphrase = "eePhaeyeew2aev5aicaengiethee2soo" wget_bin = "wget" ...
from engine import Engine from twisted.application import service, internet from twisted.python.log import ILogObserver from twisted.internet import reactor, task import sys, os sys.path.append(os.path.dirname(__file__)) from kademlia.network import Server from kademlia import log class Kademlia_Engine(Engine): def __...
def createWidgets(): x = lorris.getWidth() + 20 y = 0 lorris.newWidget(WIDGET_ROTATION, "rot_test", 400, 400, x, y) x += rot_test.width + 20 lorris.newWidget(WIDGET_SLIDER, "rot_x", 300, 120, x, y) y += rot_x.height+10 lorris.newWidget(WIDGET_SLIDER, "rot_y", 300, 120, x, y) y += rot_x.h...
from pylab import * import pywt import Image N = 256 h = zeros(N) l = zeros(N) l[0] = .5 l[1] = .5 h[0] = .5 h[1] = -.5 L, H = fft(l), fft(h) clf() plot(range(0, N/2), abs(L[0:N/2])) xlim(0, N/2) title('Haar $|L_k|$') savefig('haar_lowpass_spectrum.pdf') clf() plot(range(0, N/2), abs(H[0:N/2])) xlim(0, N/2) title('Haar...
from PyQt5.QtCore import ( QThread, QTimer, Qt, QSettings, QByteArray, pyqtSignal, QT_VERSION_STR, PYQT_VERSION_STR ) from PyQt5.QtGui import QIcon, QCursor, QTextCursor, QTextDocument from PyQt5.QtWidgets import ( QAction, QMainWindow, QApplication, QSystemTrayIcon, QMenu, QTextBrowser, QToolBar, QMess...
import cairo, math, sys import cairoplot from series import Series if '--non-random' in sys.argv: random = lambda : 1.0 print 'Plotting nonrandom data' else: import random random = random.random test_scatter_plot = 1 test_dot_line_plot = 1 test_function_plot = 1 test_vertical_bar_plot = 1 test_horizonta...
""" Camera setup and camera models used in par2vel """ import numpy import scipy import re import numbers from PIL import Image class Camera(object): """Base class for camera models""" # valid keywords in camera file - used as variables in the class keywords = {'pixels': 'Image size in pixel (two integers: ...
import getopt, sys, os, re, csv, xml.dom.minidom, xml.dom def usage(): print """ usage: props2csv.py -d <directory> -c <csv file path> <directory> is a folder containing .fzp files. save a csv file of props, tags, etc. to <csv file path> """ def main(): try: opts, args = getopt.getopt(sy...
import neo import numpy as np import matplotlib.pyplot as plt import quantities as pq import os def concatenate_spiketrains(spike_trains): ''' Concatenate multiple spiketrains Parameters ---------- spike_trains : list, tuple A list containing neo.SpikeTrain to be concatenated. Returns ...
""" This subpackage contains code more or less specific to the Time Delay Challenge (tdc) """ __all__ = ["util", "est", "run", "vario", "splopt", "optfct", "metrics", "stats", "combiconf"] import est import util import run import vario import splopt import optfct import metrics import stats import combiconf
import zope.deprecation zope.deprecation.moved( 'zope.app.testing.ztapi', "Zope 3.5", )
""" plan_learning.py - This module contain the procedure used for learning plans from experience. Copyright (C) 2016 Stephan Chang 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 ...
import os from pypers.steps.qiime import Qiime class PickClosedReferenceOtus(Qiime): spec = { "version": "20150512", "descr": [ "Picks OTUs using a closed reference and constructs an OTU table.", "If a taxonomy map file is provided, Taxonomy is assigned." ], "...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json import re from itertools import chain from ansible.module_utils._text import to_bytes, to_text from ansible.module_utils.network_common import to_list from ansible.plugins.cliconf import CliconfBase, enable_mode class Cl...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: aci_bd_subnet short_description: Manage Subnets (fv:Subnet) de...
import re import random import stringutils class ArgumentParser(): """ArgumentParser takes care of argument parsing in Moped. In most cases, calling parse_argument_string(string) will suffice. """ def __init__(self, mpdcommunal): self.mpc = mpdcommunal self.syntax_pattern = '[r+!]*<[^>]*...
commands = [] while True: try: commands.append(input().split()) except: break j = 0 previous_d = 0 values = {'a': j, 'b': 0, 'c': 0, 'd': 0} res = [] i = 0 while i < len(commands): command = commands[i] if command[0] == 'cpy': from_reg = command[1] to_reg = command[2] ...
import urllib import sqlite3 import datetime import traceback import sickbeard from sickbeard import logger from sickbeard.common import * from sickbeard import db from sickbeard import exceptions from lib.tvdb_api import tvdb_api, tvdb_exceptions class TVRage: def __init__(self, show): self.show = show ...
import sublime_plugin class BigineNewCommand(sublime_plugin.WindowCommand): def run(self): view = self.window.new_file() view.set_syntax_file('Packages/Bigine/Bigine.tmLanguage') view.set_name('untitled.bws') view.run_command('insert_snippet', { 'name': 'Packages/Bigine/S...
from os import path from gi.repository import Gtk from locale import gettext as _ class NewArchive: def __init__(self,main_window,name): builder = Gtk.Builder() builder.add_from_file(path.dirname(path.dirname(path.abspath(__file__))) + "/glade/dialog_NewArchive.glade") builder.connect_signals(self) builder.set...
""" Yum Add Repo ------------ **Summary:** add yum repository configuration to the system Add yum repository configuration to ``/etc/yum.repos.d``. Configuration files are named based on the dictionary key under the ``yum_repos`` they are specified with. If a config file already exists with the same name as a config en...
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Department', fields=[ ('...
"""add-user-external-app-acl Revision ID: 973415c5ec91 Revises: 31000c80366b """ from alembic import op import sqlalchemy as sa revision = '973415c5ec91' down_revision = '31000c80366b' POLICY_NAME = 'wazo_default_user_policy' ACL_TEMPLATES = [ 'confd.users.me.external.apps.read', 'confd.users.me.external.apps.*...
import bpy import bmesh from collections import OrderedDict from . import cpuv_properties from . import cpuv_common __author__ = "Nutti <nutti.metro@gmail.com>, Mifth" __status__ = "production" __version__ = "3.2" __date__ = "20 Jun 2015" class CPUVTransferUVCopy(bpy.types.Operator): """Transfer UV copy.""" bl_...
""" Purpose: unit tests Author: Andrey Korzh <ao.korzh@gmail.com> Created: 08.08.2017 """ import unittest from sys import argv from os import path as os_path from csv import DictWriter as csv_DictWriter from scraper3.scrxPDF.scrxPDF1707 import * class unitsTest(unittest.TestCase): def setUp(self): ...
import arcpy from arcpy import env from arcpy.sa import * env.overwriteOutput = "True" arcpy.env.extent = "MAXOF" mxd = arcpy.mapping.MapDocument("CURRENT") df=arcpy.mapping.ListDataFrames(mxd,"*")[0] TravSpd_kph = "TravSpd_kph" SegSpd = "SegSrchSpd" SegSpd_poly = "SegSpd_poly" Search_Segments = "Planning\Search_Segmen...
import discord from discord.ext import commands from random import randint from random import choice as randchoice from .utils.dataIO import fileIO from .utils import checks import datetime import time import os import asyncio class Trivia: """General commands.""" def __init__(self, bot): self.bot = bot...
from simplerpcgen.misc import SourceFile def emit_struct(struct, f): f.writeln("struct %s {" % struct.name) with f.indent(): for field in struct.fields: f.writeln("%s %s;" % (field.type, field.name)) f.writeln("};") f.writeln() f.writeln("inline rrr::Marshal& operator <<(rrr::Mar...
import bpy from bpy.types import Panel from bpy.app.translations import pgettext_iface as iface_ class ModifierButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "modifier" bl_options = {'HIDE_HEADER'} class DATA_PT_modifiers(ModifierButtonsPanel, Panel): bl_label = ...
import getopt, sys, os, re, time, shutil def usage(): print """ usage: copyif.py -s <source directory> -d <dest directory> copies files from source into dest, if the file already exists in dest """ def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hs:d:", ["help", "source","dest"]) ...
"""Test snatching.""" from __future__ import print_function import unittest from medusa import app, common, providers from medusa.search.core import search_providers from medusa.tv import Episode, Series from tests.legacy import test_lib as test TESTS = { "Dexter": {"a": 1, "q": common.HD, "s": 5, "e": [7], "b": 'D...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import datetime import os import traceback import textwrap from ansible.compat.six import iteritems from ansible import constants as C from ansible.errors import AnsibleError, AnsibleOptionsError from ansible.plugins import module_l...
""" Test function for design optimization f* = -3456. x* = 24.0, 12.0, 12.0 """ from DesOptPy import OptimizationProblem import numpy as np class TP037: x = [1, 1] def SysEq(self): print(self.x) self.f = -self.x[0] * self.x[1] * self.x[2] self.g = ( np.ones( [...
import json from urllib import urlencode from urllib2 import urlopen from django.conf import settings BASE_URL = 'http://www.mapquestapi.com/geocoding/v1/address?' def geocode(address): url = BASE_URL + 'key=%s&' % settings.PLACES_MAPQUEST_KEY + urlencode({ 'location': address, }) geocoded = json.lo...
from actes.serializers import ActeSerializer from rest_framework import serializers from .models import Conseil, LigneOrdonnance, Medicament, Ordonnance class LigneOrdonnanceSerializer(serializers.HyperlinkedModelSerializer): """docstring for LigneOrdonnaceSerializer.""" ordonnance = serializers.PrimaryKeyRelat...
import os import re import json import subprocess class TagRules(object): # Initialization # -------------------------- def __init__(self): super().__init__() # Do initializations of the object, like setting variables, etc. # You can also load external data here. # For exampl...
import numpy as np from pathlib import Path bins = Path(__file__).parent / 'binaries' coef = np.load(bins / 'coef.npy', ) intercept = np.load(bins / 'intercept.npy', ) powers = np.load(bins / 'powers.npy', ) def MIM(real, n, t): return np.sum(coef*(np.product(np.array([real, n, t])**powers, axis=1))) + intercept
"""Plugin for Avaya 1220IP and 1230IP using the 04.01.13.00 SIP software.""" common_globals = {} execfile_('common.py', common_globals) MODELS = [u'1220IP', u'1230IP'] VERSION = u'04.01.13.00' class AvayaPlugin(common_globals['BaseAvayaPlugin']): IS_PLUGIN = True pg_associator = common_globals['BaseAvayaPgAssoc...
import sys import unittest import Framework import AllTests def main(argv): if "--record" in argv: Framework.activateRecordMode() argv = [arg for arg in argv if arg != "--record"] unittest.main(module=AllTests, argv=argv) if __name__ == "__main__": main(sys.argv)
import argparse, sys from dxfwrite import DXFEngine as dxf from math import * from generators.cycloidgenerator import CycloidGenerator parser = argparse.ArgumentParser(description="Generate cycloid gears", formatter_class=argparse.ArgumentDefaultsHelpFormatter) CycloidGenerator.add_opti...
from neuroProcesses import * # Provides a hierarchy to get object's path try: import numpy as np # Needed to use matrix and list except ImportError: raise ValidationError(_t_('Impossible to import numpy')) # Raises an exception name = _t_('Visualization of Trials Variability') # Process name in the GUI category...
import time from subprocess import check_output import pytest from os.path import dirname, join from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from syncloudlib.integration.screenshots import screenshots...
import os import time import paho.mqtt.client as paho import Adafruit_DHT as dht from urllib.parse import urlparse mqtt = { "server":"m12.cloudmqtt.com", "port":13960, "user":"fndyggak", "pass":"Y33UVZ8Gh_7d" } def on_connect(mosq, obj, rc): print("rc: " + str(rc)) def on_message(mosq, obj, msg): ...
import asyncio, logging import plugins import threadmanager from sinks import start_listening from sinks.base_bot_request_handler import BaseBotRequestHandler as IncomingRequestHandler logger = logging.getLogger(__name__) class WebFramework: def __init__(self, bot, configkey, RequestHandler=IncomingRequestHandler):...
import sys import getopt import json def usage(): print 'This script is able to remove the tickets having ' print 'at least one of the labels given in parameter or having a ticket number in the specified list' print print 'If an output filename is specified, the script will keep all the tickets ' print 'not contai...
import unittest as ut import importlib_wrapper try: import pint # pylint: disable=unused-import except ImportError: tutorial = importlib_wrapper.MagicMock() skipIfMissingFeatures = ut.skip( "Python module pint not available, skipping test!") else: tutorial, skipIfMissingFeatures = importlib_wra...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import sys from nose.plugins.skip import SkipTest if sys.version_info < (2, 7): raise SkipTest("F5 Ansible modules require Python >= 2.7") from ansible.module_utils.basic import AnsibleModule try: from ...
import os import glob from distutils.core import setup from distutils.core import Command from llvm_p86 import pre from llvm_p86 import tokens from llvm_p86 import grammar from llvm_p86 import main class PrepareCommand(Command): description = "Prepare the source code by generating lexer and parser tables" user_...
""" ======================================= Calculate number of Si in a LAMOST pixel ======================================= *By: Jianrong Deng 20170517 ------------------- """ pixel_size = 12 * 12 # in um^2 pixel_thick = 200 # in um rho_Si = 2.33 # in g/cm^3 N_A = 6.02 * pow(10,23) # Avogadro constant A_Si...
import sys MAX_VALUE = 999999999 vertexNum = 5 d = [0,0,0,0,0] pre = [0,0,0,0,0] visited = [False,False,False,False,False] adjacentMatrix = [ [ 0,10, 0, 5, 0], [ 0, 0, 1, 2, 0], [ 0, 0, 0, 0, 4], [ 0, 3, 9, 0, 2], [ 7, 0, 6, 0, 0] ] def InitializeSingleSource(s): for u in range(vertexNum): d[u] = MAX_VALUE pr...
import sys, time, threading, RoA, string, random, socket from random import randint from binascii import hexlify import DH Ro = RoA.RoA(False) port = 50000 key = "savsecro"*4 user = "[%s] " %raw_input("Username: ") try: socket.setdefaulttimeout(2) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect...
import configparser import feedparser from unittest.mock import patch, Mock, MagicMock from sonnenhut.common import fetchrss from data import RSS_SINGLE_ENTRY @patch('sonnenhut.common.feedparser.parse') def test_fetchrss(mock_parse): def get(section, key): data = {'rss_article_no': '7', 'rss_url': ''} ...
from collections import OrderedDict import pickle import re from ...sorts import * from ...exceptions import * from msml import sorts from ..sequence import executeOperatorSequence from msml.exceptions import MSMLUnknownModuleWarning from ...log import debug,info, error, warn from .operator import * __author__ = "Alexa...
import os import time import re import urllib import urllib2 import cookielib import base64 import mimetools import itertools import xbmc import xbmcgui import xbmcvfs from xbmctorrent import plugin RE = { 'content-disposition': re.compile('attachment;\sfilename="*([^"\s]+)"|\s') } class HTTP: def __init__(self...
import os from eve import Eve try: port = int(os.environ['PORT']) except: port = 80 app = Eve() app.run(host="0.0.0.0", port=port)
import os import sys from utils import * import re infile = sys.argv[1] lines = read_file(infile) def escapeDoubleUnderscores(lines): esc_list = list() for l in lines: l = l.strip() esc_l = l.replace('__','\_\_') esc_list.append(esc_l) return esc_list def checkWeirdColon(l): if '...
from kivy.app import App from kivy.clock import Clock from kivy.uix.label import Label from kivy.uix.popup import Popup from kivy.uix.boxlayout import BoxLayout from kivy.uix.gridlayout import GridLayout from kivy.uix.floatlayout import FloatLayout from kivy.uix.relativelayout import RelativeLayout from kivy.uix.accord...
import logging from gettext import translation from babel import parse_locale import formencode import pylons import pylons.i18n from pylons.i18n import add_fallback, LanguageError, get_lang from pylons.configuration import config from pylons import session log = logging.getLogger(__name__) def sanitize_language_code(l...
from setup.database.etl.data_sources.data_source import DataSource class GeneExpressionDataSource(DataSource): def __init__(self, gene_expression_file='expression.gct', additional_options=None): read_options = { 'skiprows': 2, 'delim_whitespace': True } if additional_...
from pylammps.Computes.Compute import Compute from pylammps.Computes.MSTE import MSTE from pylammps.Computes.ECRA import ECRA from pylammps.Computes.RDF import RDF from pylammps.Computes.StructureFactor import StructureFactor from pylammps.Computes.Thermo import Thermo
""" proofchecker ~~~~~ :copyright: (c) 2014-2016 by Halfmoon Labs, Inc. :copyright: (c) 2016 blockstack.org :license: MIT, see LICENSE for more details. """ from proofs import profile_to_proofs, profile_v3_to_proofs from proofs import contains_valid_proof_statement from domain import get_proof_from_...
from django.shortcuts import render, Http404, HttpResponseRedirect from django.http import HttpResponse from django.template import loader from django.views.decorators.csrf import csrf_exempt, csrf_exempt, ensure_csrf_cookie import json from datetime import datetime,timedelta from .models import * from django.core.exce...
""" This example shows how to quiet flask logging down. References: - https://stackoverflow.com/questions/14888799/disable-console-messages-in-flask-server """ import flask import logging log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) app = flask.Flask(__name__) app.run()