code
stringlengths
1
199k
from .twoRoundDeterministicRewardEnv import TwoRoundDeterministicRewardEnv
from django.contrib import admin from cms.models.Game import Game, GameAdmin from cms.models.GameSession import GameSession, GameSessionAdmin from cms.models.Player import Player, PlayerAdmin from cms.models.Role import Role, RoleAdmin from cms.models.Affiliation import Affiliation, AffiliationAdmin admin.site.register...
import io import os import re from setuptools import find_packages from setuptools import setup def read(filename): filename = os.path.join(os.path.dirname(__file__), filename) text_type = type(u"") with io.open(filename, mode="r", encoding='utf-8') as fd: return re.sub(text_type(r':[a-z]+:`~?(.*?)`...
from __future__ import unicode_literals from core.utils import error_page, is_mobile from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.hashers import check_password, make_password from django.core.exceptions import ObjectDoesNotExist from django.db.model...
import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import seaborn as sns import numpy as np from protoclass.data_management import DCEModality from protoclass.data_management import GTModality from protoclass.preprocessing import StandardTimeNormalization path_dce = '/data/prostate/experiments/Pati...
"""ECLAIR is a package for the robust and scalable inference of cell lineages from gene expression data. ECLAIR achieves a higher level of confidence in the estimated lineages through the use of approximation algorithms for consensus clustering and by combining the information from an ensemble of minimum spanning trees...
from flask import request, jsonify, render_template, redirect, url_for from app import app from ga import GA @app.route('/') def index(): gen = request.args.get('gen', 10) return render_template('index.html', gen=gen) @app.route('/ga') def computeGA(): gen_algo = GA() # min = -2.24 # max = -0.76 ...
from distutils.core import setup setup(name='lamborghini', version='0.0', py_modules=['lamborghini'], )
import sys import logging import click from cargoport.utils import yield_packages, HEADER_KEYS logging.basicConfig(level=logging.DEBUG) log = logging.getLogger() @click.command() @click.argument('galaxy_package_file') def main(galaxy_package_file): with open(galaxy_package_file, 'r') as handle: retcode = 0 ...
import numpy as np from params import * from functions import * import scipy.ndimage import math import sys import scipy.misc fire_palette = scipy.misc.imread('palettes/fire_palette.png')[0][:, 0:3] confidence_palette = scipy.misc.imread('palettes/confidence_palette.png')[0][:, 0:3] def getImageMinMax(im_np): retur...
from django.core.urlresolvers import resolve from django.test import TestCase from django.http import HttpRequest from django.template.loader import render_to_string from .views import home class HomePageRest(TestCase): def test_portada(self): found = resolve('/') self.assertEqual(found.func, home) ...
import turtle ball = turtle.Turtle() wn = turtle.Screen() ball.hideturtle() vx=10 vy=40 x=0 y=0 dt=0.1 ax=0 ay=-9.81 while(1): vx += ax * dt vy += ay * dt x += vx * dt y += vy * dt ball.goto(x, y) ball.dot(3) if(y<0): vy = -0.8*vy wn.mainloop() # Wait for user to close wi...
from flask_oauthlib.provider import OAuth2Provider oauth2 = OAuth2Provider()
"""d3d8types.h""" from .winapi import * D3DCOLOR = Alias("D3DCOLOR", DWORD) D3DVECTOR = Struct("D3DVECTOR", [ (Float, "x"), (Float, "y"), (Float, "z"), ]) D3DCOLORVALUE = Struct("D3DCOLORVALUE", [ (Float, "r"), (Float, "g"), (Float, "b"), (Float, "a"), ]) D3DRECT = Struct("D3DRECT", [ (L...
from contextlib import contextmanager import numpy as np try: from contextlib import ExitStack except ImportError: from contextlib2 import ExitStack from .regulargrid import RegularGrid from . import axis from . import nxresult from ..utils import indexing from ..io import nxfs class NXSignalRegularGrid(Regular...
def try_to_parse_int(value, defaultValue=0): try: return int(value) except ValueError: return defaultValue def try_to_parse_bool(value): value = value.lower() if value == "false" or value == "0": return False else: return True def try_to_parse_int_list(value, delimite...
from django.contrib import admin from .models import Product, Tag, ColorTag class ProductAdmin(admin.ModelAdmin): list_display = ("title", "description_short") admin.site.register(Product, ProductAdmin) admin.site.register(Tag) admin.site.register(ColorTag)
import os, sys import datetime import multiprocessing import Queue import numpy as np import Op, Interface import IO class Export(Op.Op): def __init__(self, name='/Export_Data', locations='', saveTo='', exactMatch=True, enable=True, attrsWhiteList='', attrsBlackList='', frameRange='', allowOverride=True): fields...
from __future__ import division import os import subprocess from tempfile import TemporaryFile, NamedTemporaryFile import wave import sys try: from StringIO import StringIO except: from io import StringIO, BytesIO from .utils import ( _fd_or_path_or_tempfile, db_to_float, ratio_to_db, get_encode...
from anki.hooks import wrap from aqt.editor import Editor, EditorWebView import os import sys from BeautifulSoup import BeautifulSoup from PyQt4.QtGui import * from PyQt4.QtCore import * REMOVE_ATTRIBUTES = [ 'color', 'background-color', ] def purgeAttributes(self, mime, _old): html = mime.html() ...
import json import base64 import os from django.core.urlresolvers import reverse from django.test import TestCase, LiveServerTestCase import requests from selenium import webdriver from selenium.webdriver.common.keys import Keys from easter_egg.models import split_image class _HelperTestCase(TestCase): path_to_imag...
import hashlib import struct import unittest from pycoin.coins.exceptions import BadSpendableError from pycoin.symbols.btc import network Spendable = network.tx.Spendable BITCOIN_ADDRESSES = [network.keys.private(i).address() for i in range(1, 21)] WIFS = [network.keys.private(i).wif() for i in range(1, 21)] FAKE_HASH ...
import pytest import logging from spinalcordtoolbox.scripts import sct_denoising_onlm logger = logging.getLogger(__name__) @pytest.mark.sct_testing @pytest.mark.usefixtures("run_in_sct_testing_data_dir") def test_sct_denoising_onlm_no_checks(): """Run the CLI script without checking results. TODO: Check the res...
import unittest from django.conf import settings from django.db.models import get_app, get_apps from django.test import _doctest as doctest from django.test.utils import setup_test_environment, teardown_test_environment from django.test.testcases import OutputChecker, DocTestRunner, TestCase from django.test.simple imp...
from os import system, walk, path, mkdir from shutil import copy import sys, re from tests import tests_model from serve import render from build import Build YC = 'yuicompressor-2.4.2.jar' EXCLUDES = ['Source/Extras', 'Source/Layouts', 'Source/Options/Options.js' 'Source/Core/Fx.js'...
""" A collection of fake versions of various objects used in tests. There are a lot of classes here because many of them have model/view interactions that are expressed through adapter registrations, so having additional types is helpful. """ from zope.interface import implements from twisted.python.components import r...
import json from tornado import web from ...base.handlers import APIHandler class NbconvertRootHandler(APIHandler): @web.authenticated def get(self): self.check_xsrf_cookie() try: from nbconvert.exporters import base except ImportError as e: raise web.HTTPError(50...
"""======================== Transfac match pipeline ======================== The transfac match pipeline takes a several set of :term:`bed` or :term:`gtf` formatted files and scans intervals for transcription factor binding motifs. It performs the following analyses: * transfac match motif analysis * If bed fi...
"""Tools for connecting to a Veritable API server. See also: https://dev.priorknowledge.com/docs/client/python """ import logging import requests import json import sys from gzip import GzipFile from io import BytesIO from requests.auth import HTTPBasicAuth from .exceptions import VeritableError from .utils import _url...
import logging import datetime import warnings from typing import TYPE_CHECKING, Any, Union, Optional import six from ._common.utils import utc_from_timestamp, utc_now from ._common.constants import ( REQUEST_RESPONSE_GET_SESSION_STATE_OPERATION, REQUEST_RESPONSE_SET_SESSION_STATE_OPERATION, REQUEST_RESPONS...
import sys, os import subprocess from Overc.package import Package from Overc.container import Container from Overc.utils import Utils from Overc.utils import ROOTMOUNT from Overc.utils import HOSTPID from Overc.utils import SYSROOT def Is_btrfs(): return not os.system('btrfs subvolume show %s >/dev/null 2>&1' % R...
from cloudinary.models import CloudinaryField from django.contrib.auth.models import User from django.db import models from multiselectfield import MultiSelectField group_permissions = ( ('INVITE_MEMBER', 'Send invites'), ('DELETE_MEMBER', 'Remove members'), ('BLOCK_MEMBER', 'Block members'), ('SUSPEND_...
"""File System Utilities. @see: Cake Build System (http://sourceforge.net/projects/cake-build) @copyright: Copyright (c) 2010 Lewis Baker, Stuart McMahon. @license: Licensed under the MIT license. """ import shutil import os import os.path import time import cake.path def toUtc(timestamp): """Convert a timestamp from...
from django.contrib import messages from django.shortcuts import render, get_object_or_404, redirect from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.utils import timezone from .forms import AddEventForm from .models import Event def index(request...
from webapp2_extras import jinja2 import webapp2 def nl2br(value): return value.replace('\n', '<br>\n') class BaseHandler(webapp2.RequestHandler): @webapp2.cached_property def jinja2(self): j2 = jinja2.get_jinja2(app=self.app) j2.environment.filters['nl2br'] = nl2br return j2 def...
import uuid
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dev_times', '0001_initial'), ] operations = [ migrations.AddField( model_name='dailyspenttime', name='rate_amount', f...
from functools import partial import sqlite3 import os import os.path import sys import unittest from click.testing import CliRunner import fixturegen import fixturegen.cli import fixturegen.exc import fixturegen.generator PATH = os.path.dirname(os.path.abspath(__file__)) _TEST_DB = '{0}/test.db'.format(PATH) _SQLITE_D...
import pytest from atom.api import Atom, Value from psi.util import get_tagged_values class PreferencesContainer(Atom): a = Value(1) b = Value(2).tag(preference=True) c = Value(3).tag(not_preference=True) d = Value(4).tag(preference=True) @pytest.fixture def preferences(): return PreferencesContaine...
""" ERP+ """ __author__ = 'António Anacleto' __credits__ = [] __version__ = "1.0" __maintainer__ = "António Anacleto" __status__ = "Development" __model_name__='linha_lista_precos.LinhaListaPrecos' import auth, base_models from orm import * from form import * try: from my_produto import Produto except: from pro...
"""Julia set generator without optional PIL-based image drawing""" import time x1, x2, y1, y2 = -1.8, 1.8, -1.8, 1.8 c_real, c_imag = -0.62772, -.42193 def calculate_z_serial_purepython(maxiter, zs, cs): """Calculate output list using Julia update rule""" output = [0] * len(zs) for i in range(len(zs)): ...
from django.test import TestCase from django.contrib.auth.models import User from mock import patch, mock from datetime import datetime, timedelta from channel_rss.tasks import fetch_rss_feeds from channel_rss.models import RssFeed from channel_rss.config import CHANNEL_NAME from channel_rss.tests.test_base import Base...
import base64 import requests try: requests.packages.urllib3.disable_warnings() except AttributeError: pass DRY_RUN = False class Rest: def __init__(self, base_url, username, secret, debug): self.base_url = base_url self.username = username self.password = secret self.debug =...
""" ================= Lorentzian Fitter ================= """ import numpy from numpy.ma import median from numpy import pi from pyspeckit.mpfit import mpfit from . import fitter class LorentzianFitter(fitter.SimpleFitter): def __init__(self,multisingle='multi'): self.npars = 3 self.npeaks = 1 ...
class BadContext(object): """ A simple context manager that throws an exception in enter """ def __init__(self): self.array = [] def __enter__(self): raise Exception("Like whatever") def __exit__(self, type, value, traceback): print "The __exit__ gets called" if t...
"""Examine callable regions following genome mapping of short reads. Identifies callable analysis regions surrounded by larger regions lacking aligned bases. This allows parallelization of smaller chromosome chunks through post-processing and variant calling, with each sub-section mapping handled separately. Regions ar...
h5filename = "./Farben.h5" tvals_in = "CMYK_M" import locale locale.setlocale(locale.LC_ALL, 'de_DE') from tables import * from colormath.color_objects import LabColor from mpl_toolkits.mplot3d import * import matplotlib.pyplot as plt import numpy as np from scipy import interpolate def abL_2_sRGB(a_val,b_val,L_val): ...
from .base import BaseType class SystemSetting(BaseType): _soap_tag = 'system_setting' def __init__(self): BaseType.__init__( self, simple_properties={'id': int, 'name': str, 'value': str, 'default_value': st...
"""Directory for all test files."""
from ..osid import markers as osid_markers class OsidCondition(osid_markers.Extensible, osid_markers.Suppliable): """The ``OsidCondition`` is used to input conditions into a rule for evaluation.""" class OsidInput(osid_markers.Extensible, osid_markers.Suppliable): """The ``OsidInput`` is used to input condition...
import sublime, sublime_plugin, subprocess, os, sys class NotebookviewCommand(sublime_plugin.TextCommand): def run(self, edit): #Import Current Filepath as Plaintext path = str(self.view.file_name()); if(path == "None"): sublime.error_message("File Not Saved") return settings = sublime.load_settings('Wol...
from pydotmailer import * __author__ = 'Mike Austin' __copyright__ = 'Copyright 2012, Mike Austin' __credits__ = ['Mike Austin',] __version__ = '0.1.1'
from tests import BaseTestCase class TestDrawing(BaseTestCase): """ Test container of plan """ @classmethod def setUpClass(cls): from planner.drawing import Drawing cls.Drawing = Drawing def setUp(self): self.drawing = self.Drawing() def test_format_sizes(self): ...
"two factor auth using twilio"
import re, os from selenium import webdriver from selenium.webdriver.chrome.options import Options import imageio try: import urllib.request as rq from urllib.parse import urlparse except ImportError: import urllib2 as rq from urlparse import urlparse class Archive(object): def __init__(self, url, d...
from odoo import http from odoo.http import request from odoo.addons.website_sale.controllers.main import WebsiteSale as controller class WebsiteSale(controller): @http.route() def shop(self, page=0, category=None, search="", ppg=False, **post): request.context = dict(request.context, search_tags=search...
''' cgat_check_deps.py - check whether the software dependencies are on your PATH ============================================================================= Purpose ------- .. The goal of this script is to provide a list of third-party command-line programs used in a Python script given as input, and check whether t...
import math as m import time from typing import List, Union import numpy as np from Debug.debug_command_factory import DebugCommandFactory, MAGENTA, CYAN from Util.constant import ROBOT_CENTER_TO_KICKER, BALL_RADIUS, KickForce, ROBOT_RADIUS from Util import Pose, Position from Util.ai_command import CmdBuilder, Idle, M...
from mako import exceptions from mako import lookup from mako.template import Template from mako.testing.assertions import assert_raises from mako.testing.assertions import assert_raises_message_with_given_cause from mako.testing.assertions import eq_ from mako.testing.fixtures import TemplateTest from mako.testing.hel...
print() print() print("SAGA") print() first_name = input("What is your name? \n") print() print("Welcome to my SAGA," , first_name) print() my_list = ["Keegan", "Bananas", "CTC"] my_list.append(first_name) print("This is a" + "story" + "about Keegan and", first_name) print() print(""" Once upon a time Keegan and {0} we...
import _plotly_utils.basevalidators class HoverinfoValidator(_plotly_utils.basevalidators.FlaglistValidator): def __init__( self, plotly_name="hoverinfo", parent_name="choroplethmapbox", **kwargs ): super(HoverinfoValidator, self).__init__( plotly_name=plotly_name, parent...
import pandas as pd from bokeh.models import HoverTool from bokeh.models.formatters import DatetimeTickFormatter from bokeh.palettes import Plasma256 from bokeh.plotting import figure, ColumnDataSource from app import db from app.decorators import data_quality date_formatter = DatetimeTickFormatter(microseconds=['%f'],...
from __future__ import unicode_literals import logging from django import template from django.utils.safestring import mark_safe from djblets.util.compat.django.template.loader import render_to_string from reviewboard.extensions.hooks import (CommentDetailDisplayHook, HeaderAct...
from unittest import TestCase try: from unittest import mock from unittest.mock import Mock except ImportError: import mock from mock import Mock from pycomb import combinators as c, exceptions, context from pycomb.combinators import generic_object, Int from pycomb.predicates import StructType class _An...
""" Special Pythagorean triplet A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ import time start_time = time.time() triplet_sum =...
from diamond.collector import Collector from diamond import convertor import os class UptimeCollector(Collector): PROC = '/proc/uptime' def get_default_config(self): config = super(UptimeCollector, self).get_default_config() config.update({ 'path': 'uptime', 'metric_name'...
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "event_recorder.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
""" MIT License Copyright (c) 2017 Christian Pfarr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,...
from setuptools import setup, find_packages setup( name='phscrap', version='0.1', author='Juan Schandin', author_email='jschandin@gmail.com', packages=find_packages(), install_requires=open('requirements.txt').read().splitlines(), entry_points=""" [console_scripts] phscrap = scrap.ph...
import logging from pyvisdk.exceptions import InvalidArgumentError log = logging.getLogger(__name__) def ExitedStandbyModeEvent(vim, *args, **kwargs): '''This event records that the host is no longer in standby mode.''' obj = vim.client.factory.create('ns0:ExitedStandbyModeEvent') # do some validation check...
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 'Repository.description_format' db.add_column('common_repository', 'description_format', self.gf('...
import os import sys import django from django.conf import settings DEFAULT_SETTINGS = dict( INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sites", "pinax.lms.activities", "pinax.lms.activities.tests" ], DATABASES={ "def...
from crispy_forms.helper import FormHelper from crispy_forms.layout import Hidden, Submit, Layout from django.conf import settings from django.contrib.auth.models import User from django import forms from django.utils.translation import get_language, gettext as _ class EdsSearchForm(forms.Form): """ """ lang = ...
''' Numerical example for the Continuous No-Regret Algorithm with quadratic loss functions @author: Maximilian Balandat, Walid Krichene @date: Dec 20, 2014 ''' from ContNoRegret.Domains import S from ContNoRegret.Distributions import Uniform from ContNoRegret.LossFunctions import GaussianLossFunction from ContNoRegret....
from abstract_action import AbstractAction from jarvis.api.places import PlacesApi from jarvis import logger class Places(AbstractAction): MAX_RADIUS = 50000 def __init__(self, **kwargs): AbstractAction.__init__(self, **kwargs) self.api = PlacesApi(self.user) def first_detailed_nearby(self, **kwargs): kw = kwa...
from wq.io import BaseIO, TimeSeriesMapper, XmlParser from climata.base import ZipWebserviceLoader, FilterOpt, DateOpt, ChoiceOpt from .constants import DOMAINS class WqxDomainIO(ZipWebserviceLoader, XmlParser, TimeSeriesMapper, BaseIO): """ Load WQX / STORET domain values from EPA web services. Usage: ...
company_info = { 'name': 'My super company', 'address': '45, beautiful avenue, blabla, France', 'number of employees': 3, 'employees': [ "Pierre", "Cedric", "Manu" ], 'contact': { 'email': 'contact@my-super-company.com', 'phone': '+33 567874332' } } print "raw display" print company_info print import p...
def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return words def sort_words(words): """Sorts the words.""" return sorted(words) def print_first_word(words): """Prints the first word after popping it off.""" word = words.pop(0) print word d...
import os import re controlPath = '../src/controls/basic' controlsDir = os.listdir(controlPath) controlFiles = [] def removeStarsAtBeginningsOfLines(text): lines = text.split("\n") out = "" for line in lines: if re.match("^[\s]*\*", line): line = line[line.find("*")+1:] out += line + "<br />" return out def ...
''' WN Lemma to ERG predicates Latest version can be found at https://github.com/letuananh/omwtk @author: Le Tuan Anh <tuananh.ke@gmail.com> @license: MIT ''' __author__ = "Le Tuan Anh" __email__ = "<tuananh.ke@gmail.com>" __copyright__ = "Copyright 2017, omwtk" __license__ = "MIT" __maintainer__ = "Le Tuan Anh" __vers...
from email import utils import math import re import time import urllib from helpers.youtube_video_helper import YouTubeVideoHelper from models.match import Match defense_render_names_2016 = { 'A_ChevalDeFrise': 'Cheval De Frise', 'A_Portcullis': 'Portcullis', 'B_Ramparts': 'Ramparts', 'B_Moat': 'Moat',...
import boto.ec2 import boto.ec2.elb import sethji.util as util def get_region_list(): regions = boto.ec2.get_regions('ec2') return [r.name for r in regions] class Ec2Handler(object): def __init__(self, apikey, apisecret, region): self.region = region self.connection = boto.ec2.connect_to_reg...
import re from grab.util.py3k_support import * RE_SPECIAL_ENTITY = re.compile(b'&#(1[2-6][0-9]);') def make_str(value, encoding='utf-8'): """ Normalize unicode/byte string to byte string. """ if isinstance(value, unicode): # Convert to string (py2.x) or bytes (py3.x) value = value.encode...
import os import requests import urllib.parse from xml.etree import ElementTree from Module import Command save_subdir = 'define' module_name = 'define' api_key = "" def command_define(cmd, bot, args, msg, event): if len(args) != 1: return "1 argument expected" if api_key is None or api_key == "": ...
import sys _64bit = sys.maxint == 0x7fffffffffffffff if 0x2070000 <= sys.hexversion < 0x2080000: if sys.platform == "linux2" and _64bit: from linux.py27_64.cpp import * elif sys.platform == "linux2" and not _64bit: from linux.py27_32.cpp import * elif sys.platform == "darwin": from...
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): # Adding model 'League' db.create_table(u'game_league', ( (u'id', self.gf('django.db.mod...
''' API for Gui v3 guiAPP guiWIN guiWID ''' from buildingblocks import guiRectangle,guiLines import random as r class Widget(): def __init__(self,_x,_y,_w,_h): self.x = _x self.y = _y self.w = _w self.h = _h self.children = [] self.parent = None self.toplevel ...
"""CSV Core serializer tests.""" from __future__ import absolute_import, print_function from invenio_pidstore.models import PersistentIdentifier from invenio_records import Record from invenio_rest.serializer import BaseSchema as Schema from marshmallow import fields from invenio_records_rest.serializers.csv import CSV...
from __future__ import absolute_import, unicode_literals from config.template_middleware import TemplateResponse from gaecookie.decorator import no_csrf from gaepermission.decorator import login_not_required @login_not_required @no_csrf def index(): return TemplateResponse(template_path='/professor/home.html')
from setuptools import setup setup( name='blender-chemicals', version='0.3.0', description="Imports chemicals into blender with open babel.", url='http://github.com/patrickfuller/blender-chemicals/', author="Patrick Fuller", author_email='patrickfuller@gmail.com', entry_points={ 'con...
from django.core.urlresolvers import reverse def get_admin_url(inst): return reverse('admin:%s_%s_change' % (inst._meta.app_label, inst._meta.model_name), args=[inst.pk])
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): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ ...
from pyramid.httpexceptions import HTTPFound from pyramid.view import notfound_view_config, view_config def includeme(config): config.add_static_view('static', 'static', cache_max_age=3600) config.add_static_view('deform', 'deform:static') config.add_route('root', '/') @view_config(route_name='root') def ro...
from __future__ import division import re import collectd try: from cs import CloudStack except ImportError: print "Oupss, it looks like CS client isn't installed. Please install it using pip install cs" raise RUN = 0 NAME = 'cloudstack' DEFAULT_API = 'http://localhost:8096/client/api' DEFAULT_AUTH = False ...
import os import shutil from distutils.core import setup, Command from distutils.archive_util import make_tarball from setuptools import find_packages class SrcCmd(Command): description = "custom command to build archive of only py sources" user_options = [] def initialize_options(self): pass de...
from flask import Flask, render_template from flask.ext.script import Manager from flask.ext.bootstrap import Bootstrap app = Flask(__name__) manager = Manager(app) bootstrap = Bootstrap(app) @app.route('/') def index(): return render_template('index.html') if __name__ == '__main__': manager.run()
from rest_framework import serializers from core.models.chip import * class ChipSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Chip fields = ('id', 'url', 'number', 'address', 'creation_date', 'last_update_date') class CatSerializer(serializers.HyperlinkedModelSerializer): ...
from django import forms from django.conf import settings from django.contrib.sites.models import Site from django.template.loader import render_to_string from crispy_forms.helper import FormHelper from crispy_forms.layout import ( Layout, Field, Fieldset, ButtonHolder, Submit, Div ) from utils....
import argparse import copy import json import os import traceback from datetime import datetime import pandas as pd import requests from tqdm import tqdm from scheduled_bots import PROPS, ITEMS, get_default_core_props from scheduled_bots.civic import CHROMOSOME, IGNORE_SYNONYMS, DrugCombo, EVIDENCE_LEVEL, TRUST_RATING...
import struct from exception import UnknownMagic from macho import MACH_O_CPU_TYPE ''' struct fat_header { unsigned long magic; /* FAT_MAGIC */ unsigned long nfat_arch; /* number of structs that follow */ }; struct fat_arch { cpu_type_t cputype; /* cpu specifier (int) */ cpu_subtype_t cp...