code
stringlengths
1
199k
from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('customers', '0001_initial'), ] operations = [ migrations.CreateModel( name='Visit', fields=[ ...
from django.contrib.sites.models import Site from django.core.urlresolvers import reverse import docker import sh from tempfile import mkdtemp from celery import shared_task from urllib import urlencode from django_docker_processes import models import contextlib import os DOCKER_URL=os.environ.get('DOCKER_URL', 'unix:...
import os,sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Justin Quick', 'justquick@gmail.com'), ) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql'...
from __future__ import absolute_import, division, print_function import operator import logging import numpy as np import pandas as pd from .contracts import contract from .coordinates import Coordinates from .visual import VisualAttributes from .visual import COLORS from .exceptions import IncompatibleAttribute from ....
from sklearn2sql_heroku.tests.regression import generic as reg_gen reg_gen.test_model("XGBRegressor" , "diabetes" , "sqlite")
import tests.periodicities.period_test as per per.buildModel((360 , 'SM' , 50));
from django.contrib import messages from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from ccpages.models import Page from ccpages.forms import Pag...
from bitstring import ConstBitStream from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network from pylisp.utils import afi import doctest import unittest if __name__ == '__main__': import sys sys.path.insert(0, '.') sys.path.insert(0, '..') def load_tests(loader, tests, ignore): ''' ...
''' Production Configurations - Use djangosecure - Use Amazon's S3 for storing static files and uploaded media - Use sendgrid to send emails - Use MEMCACHIER on Heroku ''' from __future__ import absolute_import, unicode_literals from boto.s3.connection import OrdinaryCallingFormat from django.utils import six from .com...
__author__ = 'sclincha' import sys,os sys.path.append('../..') import numpy as np import unittest try: #to ease the use without proper Python installation import TranskribusDU_version except ImportError: sys.path.append( os.path.dirname(os.path.dirname( os.path.abspath(sys.argv[0]) )) ) import TranskribusDU...
from __future__ import print_function from sympy import symbols from galgebra.ga import Ga from galgebra.printer import Format,xpdf def main(): Format() coords = (x,y,z) = symbols('x y z',real=True) (o3d,ex,ey,ez) = Ga.build('e*x|y|z',g=[1,1,1],coords=coords) s = o3d.mv('s','scalar') v = o3d.mv('v',...
import tests.perf.test_ozone_ar_speed_many as gen gen.run_test(600)
import datetime import json import logging from django.test import TestCase from huxley.logging.handlers import DatabaseHandler from huxley.logging.models import LogEntry class LogEntryTestCase(TestCase): '''Should successfully create a LogEntry object and save it.''' def test_valid(self): log_entry = L...
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 model 'Project' db.create_table('projects_project', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_...
""" Simple example of the layout options. """ from __future__ import unicode_literals from prompt_toolkit import CommandLineInterface from prompt_toolkit.layout import Layout from prompt_toolkit.layout.prompt import DefaultPrompt, Prompt from prompt_toolkit.layout.margins import LeftMarginWithLineNumbers from prompt_to...
__author__ = 'Iacopo Spalletti' __email__ = 'i.spalletti@nephila.it' __version__ = '0.1.0'
import ZSI import ZSI.TCcompound from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED class ns0: targetNamespace = "http://s.mappoint.net/mappoint-30/" class ArrayOfVersionInfo_Def(ZSI.TCcompound.ComplexType, TypeDefinition): schema = "http://s.mappoint.net/mappoi...
from __future__ import unicode_literals names = [ 'Abassi', 'Abiku', 'Abuk', 'Achimi', 'Adriambahomanana', 'Adro', 'Adroa', 'Adroanzi', 'Age', 'Aha', 'Njoku', 'Aho', 'Aigamuxa', 'Aje', 'Shaluga', 'Ajok', 'Akongo', 'Ala', 'Ale', 'Alla', 'Alouroua', 'Amma', 'Ananse', 'Anansi', 'Andriamahilala', 'Andriambahoma...
from __future__ import absolute_import from itertools import izip import six from sentry.api.serializers import Serializer, register, serialize from sentry.constants import LOG_LEVELS from sentry.models import (GroupTombstone, User) @register(GroupTombstone) class GroupTombstoneSerializer(Serializer): def get_attrs...
import numpy as np import gzip import cPickle import theano import os import theano.tensor as T from theano.tensor.nnet import softmax from theano.tensor.nnet import sigmoid class SoftMax: def __init__(self,MAXT=10000,step=0.15,landa=0): self.MAXT = MAXT self.step = step self.landa = landa ...
from __future__ import unicode_literals from ..specialized import BRAINSABC def test_BRAINSABC_inputs(): input_map = dict(args=dict(argstr='%s', ), atlasDefinition=dict(argstr='--atlasDefinition %s', ), atlasToSubjectInitialTransform=dict(argstr='--atlasToSubjectInitialTransform %s', hash_files=...
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('preferences', '0002_auto_20181220_0803'), ] operations = [ migrations.CreateModel( name='...
from distutils.core import Extension, setup MODULE_NAME = "_greet" DYNLIB = MODULE_NAME + ".so" SRC_FILE = MODULE_NAME + ".c" if __name__ == "__main__": setup(ext_modules=[Extension(MODULE_NAME, [SRC_FILE])])
"""Create tests for each fuzzer""" import copy import glob def mako_plugin(dictionary): targets = dictionary['targets'] tests = dictionary['tests'] for tgt in targets: if tgt['build'] == 'fuzzer': new_target = copy.deepcopy(tgt) new_target['build'] = 'test' new_target['name'] += '_one_entry'...
from decimal import Decimal import random from django.contrib.auth.hashers import make_password, check_password from django.core.urlresolvers import reverse from django.core.validators import RegexValidator from django.db import models from django.utils.encoding import smart_text from django.utils.timezone import now f...
from functools import partial from collections import Sequence from flask import Blueprint, g, abort, Response, jsonify, request, \ render_template, escape from werkzeug.utils import cached_property from flask.ext.introspect import Tree, TreeRootView, NOTEXIST def setup_tree( objects, root_class, roots=...
from __future__ import absolute_import from etsdevtools.developer.tools.view_tester import *
from __future__ import absolute_import import logging import hashlib from collections import namedtuple from sentry.models import Project from sentry.utils.safe import safe_execute from sentry.utils.cache import cache import six from six import integer_types, text_type logger = logging.getLogger(__name__) StacktraceInf...
from . import element class ContactDetail(element.Element): """ Contact information. Specifies contact information for a person or organization. """ resource_type = "ContactDetail" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValid...
import os import sys import tidyenum try: from setuptools import setup except ImportError: from distutils.core import setup version = tidyenum.__version__ requires = [] if sys.version_info[:2] < (3, 4): requires.append('enum34') if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') ...
from django.conf import settings def reformat_settings(): """Makes sure request object is in the context processor""" if not 'django.core.context_processors.request' in settings.TEMPLATE_CONTEXT_PROCESSORS: settings.TEMPLATE_CONTEXT_PROCESSORS = \ settings.TEMPLATE_CONTEXT_PROCESSORS + ('dja...
import optparse import sys from django.conf import settings if not settings.configured: settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, HEALTHCARE_STORAGE_BACKEND='healthcare...
Name = 'AnimatePartialTBM' Label = 'Animate Partial Tunnel Boring Machine' Help = 'This filter analyzes a vtkTable containing position information about a Tunnel Boring Machine (TBM). This Filter iterates over each row of the table as a timestep and uses the XYZ coordinates of a single parts of the TBM to generate a tu...
from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _, ungettext_lazy from django_tables2 import Column, LinkColumn, TemplateColumn, A from oscar.core.loading import get_class, get_model DashboardTable = get_class('dashboard.tables', 'DashboardTable') PersonGroup = get_mo...
import numpy as np import numpy.random as nr from nipy.neurospin.clustering.gmm import GMM import nipy.neurospin.clustering.gmm as gmm from nipy.testing import assert_true def test_em_loglike0(): dim = 1 k = 1 n = 1000 x = nr.randn(n,dim) lgmm = GMM(k,dim) lgmm.initialize(x) lgmm.estimate(x)...
import datetime from django.db import models from django.template import RequestContext, loader from django.contrib.auth import authenticate, login, logout from django.shortcuts import render_to_response, get_object_or_404, redirect from django.utils.translation import ugettext as _ from django.http import HttpResponse...
""" Support for groups of elements """ from typing import Any, Dict, Generic, Iterable, List, Optional, Set, TypeVar # noqa import tsrc T = TypeVar("T") class GroupError(tsrc.Error): pass class Group(Generic[T]): def __init__( self, name: str, elements: Iterable[T], includes: Optional[List[str]] = None...
from django.conf.urls import * urlpatterns = patterns('django_pubsub_couch.views', (r'^([-0-9a-f]+)/$', 'callback', {}, 'pubsubhubbub_callback'))
from django.conf import settings from django.test.testcases import TestCase from django.http import HttpRequest, HttpResponse from sugar.middleware.cors import CORSMiddleware class CORSTests(TestCase): def test_middleware(self): cors = CORSMiddleware() request = HttpRequest() request.path = ...
from . import api
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 'Entry.answer' db.add_column('businesstest_entry', 'answer', self.gf('django.db.models.fields.CharField')(default='', ma...
from shutil import copy from django import forms from django.utils.translation import ugettext_lazy as _ from templatesadmin.edithooks import TemplatesAdminHook from templatesadmin import TemplatesAdminException class DotBackupFilesHook(TemplatesAdminHook): ''' Backup File before saving ''' @classmethod...
from django.contrib import admin from django.utils.html import format_html from .models import FileUpload class FileUploadAdmin(admin.ModelAdmin): list_display = ('title', 'file_url', 'linked_blogs',) def file_url(self, obj): return format_html('<a href="{0}" target="_blank">{0}</a>', obj.file.url) def linked...
""" FASTMODE -- Provide real time response for each program. First, this checks to see if the proposal asks for fasttime response. If so, the task then copies the data to the fast directory for that proposal on saltpipe. If it is the first object data for that proposal, then it will also send an email to the contac...
import math pi = math.pi known_element = raw_input('What do you know about the circle? ').lower() known_value = raw_input('How much is %s? ' % (known_element)) known_value = float(known_value) if known_element == 'diameter' or known_element == 'd': diameter = known_value radius = diameter/2 circumference = pi * diam...
import zlib from decimal import Decimal as D from django.conf import settings from django.core.exceptions import ObjectDoesNotExist, PermissionDenied from django.db import models from django.db.models import Sum from django.utils.encoding import python_2_unicode_compatible, smart_text from django.utils.timezone import ...
from scipy import interpolate import numpy as np import logging import os import h5py import cPickle as pickle from astropy import table, units from collections import OrderedDict from pandas import DataFrame import pandas as pd logger = logging.getLogger(__name__) default_atom_h5_path = os.path.join(os.path.dirname(__...
from nose.tools import eq_ from olympia import amo from olympia.amo.tests import TestCase from olympia.addons.models import Addon, Review from olympia.landfill.ratings import generate_ratings class RatingsTests(TestCase): def setUp(self): super(RatingsTests, self).setUp() self.addon = Addon.objects....
'''Functions and variables for working with Mongo DB''' from amber import settings import pymongo MDB = pymongo.Connection( settings.MONGO_DB['connection'])[settings.MONGO_DB['database_name']] MAIN_COLLECTION = MDB['main'] SERVERS_COLLECTION = MDB['servers'] def split_words(name): '''Splitting words in the give...
""" Lighting 3 ========== """ from rfxcom.protocol.base import BasePacketHandler from rfxcom.protocol.rfxpacketutils import RfxPacketUtils COMMANDS = { 0x00: 'Bright', 0x08: 'Dim', 0x10: 'On', 0x11: 'Level 1', 0x12: 'Level 2', 0x13: 'Level 3', 0x14: 'Level 4', 0x15: 'Level 5', 0x16: ...
"""Tests pleaseTurnOver, pageBreakBefore, frameBreakBefore, keepWithNext... """ __version__='''$Id$''' from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation setOutDir(__name__) import sys import unittest from reportlab.platypus.flowables import Flowable, PTOContainer, KeepInFrame ...
""" MongoDB handler for Python Logging inspired by https://github.com/andreisavu/mongodb-log """ import logging import datetime import socket import pymongo class MongoFormatter(logging.Formatter): def format(self, record): """ turn a LogRecord into something mongo can store """ data = recor...
import tests.model_control.test_ozone_custom_models_enabled as testmod testmod.build_model( ['Anscombe'] , ['LinearTrend'] , ['Seasonal_DayOfMonth'] , ['LSTM'] );
from PyQt5.QtGui import QBrush, QPainter, QPen from PyQt5.QtWidgets import QSizePolicy, QTabBar, QTabWidget class Ribbon(QTabWidget): """A QTabWidget with a defined background colour and bottom margin colour. I found it impossible to alter the background of a QTabWidget using stylesheets, even when using QT...
import sys import os.path import random import string import subprocess import plistlib import httplib import socket import ssl import urllib2 import base64 import xml.etree.cElementTree as ET jss_url = "" jss_username = "" jss_password = "" jds_dns_address = "" #<-This must be reachable by clients readUserPasswd = "" ...
from django.db.models import signals from haystack.signals import BaseSignalProcessor from mozillians.users.models import UserProfile from mozillians.groups.models import Group class SearchSignalProcessor(BaseSignalProcessor): def setup(self): signals.post_save.connect(self.handle_save, sender=UserProfile) ...
''' Production Configurations - Use djangosecure - Use Amazon's S3 for storing static files and uploaded media - Use sendgrid to send emails - Use MEMCACHIER on Heroku ''' from __future__ import absolute_import, unicode_literals from boto.s3.connection import OrdinaryCallingFormat from django.utils import six from .com...
from collections import defaultdict import numpy from repoze.lru import lru_cache """Naive implementations of subsequence kernels""" @lru_cache(500) def all_subsequences_kernel_recursive(s, t): """ counts the number of contiguous and non-contiguous subsequences that the input strings have in common (incl. t...
from pupa.utils import fix_bill_id from opencivicdata.legislative.models import (Bill, RelatedBill, BillAbstract, BillTitle, BillIdentifier, BillAction, BillActionRelatedEntity, BillSponsorship, BillSource, BillDocument, ...
from .roots import HUXLEY_ROOT DEBUG = True TEMPLATE_DEBUG = DEBUG SECRET_KEY = '+42lz(cp=6t#dzpkah^chn760l)rmu$p&f-#7ggsde2l3%fm-i' ADMINS = (('BMUN Tech Officer', 'tech@bmun.org')) ADMIN_SECRET = 'OVERRIDE THIS IN PRODUCTION' MANAGERS = ADMINS SITE_ID = 1 DATABASES = { 'default': { 'ENGINE': 'django.db.ba...
import time from django.utils.translation import ugettext, ungettext from jinja2 import Markup from canvas.templatetags.jinja_base import (global_tag, filter_tag, render_jinja_to_string, jinja_context_tag, update_context) from drawquest.apps.quest_comments.details_models impo...
"""This module contains the social functions for the coupled social and climate model SoCCo""" import numpy as np import pandas as pd from scipy import stats from . import climate as cl def popIntoNgroups(popTotal,nGroups,beta_a=1,beta_b=1): """Distributes total population popTotal into n groups that may be equ...
""" Module interface to pyalpm """ import sys import math import logging import os import queue try: import pacman.alpm_events as alpm import pacman.pkginfo as pkginfo import pacman.pacman_conf as config except ImportError as err: try: import DSGos_Installer.pacman.alpm_events as alpm im...
import numpy as np import numpy.linalg import scipy as sp import scipy.sparse import scipy.sparse.linalg from itertools import product def tls(A, b): ATA = np.dot(A.T, A) ATb = np.dot(A.T, b) return sp.sparse.linalg.bicgstab(ATA, ATb)[0] def gsolve(Z, B, l, w): n = 256 A = np.zeros((Z.shape[0] * Z.s...
from msrest.serialization import Model class ResourceGroupExportResult(Model): """Resource group export result. :param template: The template content. :type template: object :param error: The error. :type error: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceManagementErrorWithDetail...
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Tickformatstop(_BaseLayoutHierarchyType): # class properties # -------------------- _parent_path_str = "layout.ternary.baxis" _path_str = "layout.ternary.baxis.tickformatstop" _valid_props...
""" Tool to access the values along an edge. """ import numpy def lerp(t, x0, x1): """ Linearly interpolate between x0 and x1. """ return x0 + t * (x1 - x0) def UV_to_XY(uv, width, height, is_clamped = False): """ Converts the given UV to XY coordinates uv is defined in terms of GPU UV space. ""...
import logging from logging.config import dictConfig def setup_loghandlers(level=None): # Setup logging for post_office if not already configured logger = logging.getLogger('post_office') if not logger.handlers: dictConfig({ "version": 1, "disable_existing_loggers": False, ...
class RequestExists(Exception): pass class RequestDoesNotExist(Exception): pass class FatalError(Exception): """ Exception to be raised when user intervention is required """ pass class DuplicateCommonNameError(FatalError): pass
""" Decides if vendor bundles are used or not. Setup python path accordingly. """ from __future__ import absolute_import, print_function import os.path import sys HERE = os.path.dirname(__file__) TASKS_VENDOR_DIR = os.path.join(HERE, "_vendor") INVOKE_BUNDLE = os.path.join(TASKS_VENDOR_DIR, "invoke.zip") INVOKE_BUNDLE_...
from proteus.default_n import * from proteus import (StepControl, TimeIntegration, NonlinearSolvers, LinearSolvers, LinearAlgebraTools, Context) import ls_p as physics from proteus.mprans import NCLS ct = Context.ge...
from .pool_usage_metrics import PoolUsageMetrics from .image_reference import ImageReference from .node_agent_sku import NodeAgentSku from .authentication_token_settings import AuthenticationTokenSettings from .usage_statistics import UsageStatistics from .resource_statistics import ResourceStatistics from .pool_statis...
import ybrowserauth from django.conf import settings from django.http import HttpResponseRedirect def login(request, redirect_to="/invitations/contacts"): # @@@ redirect_to should not be hard-coded here ybbauth = ybrowserauth.YBrowserAuth(settings.BBAUTH_APP_ID, settings.BBAUTH_SHARED_SECRET) yahoo_login = ybba...
from gen_function import * import string def gen_singleton(args): return ( """// (C) Copyright David Abrahams 2000. Permission to copy, use, modify, sell and // distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implie...
from hashlib import sha256 as _sha256 def sha256_file(filename, chunk_size=1024*1024*16): ''' Helper function for hashing a single file ''' hasher = _sha256() chunk = 1024*1024*16 with open(filename, 'rb') as fid: data = fid.read(chunk) while data: hasher.update(data) data = fid.read(chunk) ...
from plyer.facades import Notification from pyobjus import autoclass, protocol, objc_str, ObjcBOOL from pyobjus.dylib_manager import load_framework, INCLUDE load_framework(INCLUDE.AppKit) load_framework(INCLUDE.Foundation) NSUserNotification = autoclass('NSUserNotification') NSUserNotificationCenter = autoclass('NSUser...
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Tickformatstop(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "streamtube.colorbar" _path_str = "streamtube.colorbar.tickformatstop" _valid_props = {"...
from ctypes import WinDLL, get_last_error, byref from ctypes.wintypes import HANDLE, LPDWORD, DWORD from msvcrt import get_osfhandle # pylint: disable=import-error from knack.log import get_logger logger = get_logger(__name__) ERROR_INVALID_PARAMETER = 0x0057 ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 def _check_zero...
from swgpy.object import * def create(kernel): result = Intangible() result.template = "object/intangible/pet/shared_21b_surgical_droid.iff" result.attribute_template_id = -1 result.stfName("","") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
import sys, re, operator, string, time def extract_words(path_to_file): with open(path_to_file) as f: str_data = f.read() pattern = re.compile('[\W_]+') word_list = pattern.sub(' ', str_data).lower().split() with open('../stop_words.txt') as f: stop_words = f.read().split(',') stop_w...
import pymongo import sys connection = pymongo.MongoClient("mongodb://localhost") def insert_many(): # get a handle to the school database db=connection.school people = db.people print "insert_many, reporting for duty" andrew = {"_id":"erlichson", "name":"Andrew Erlichson", "company":"MongoDB", ...
import bson import datetime from .. import config, util from ..web.errors import APIAuthProviderException log = config.log class APIKey(object): """ Abstract API key class """ @staticmethod def _preprocess_key(key): """ Convention for API keys is that they can have arbitrary informat...
from openflow import discovery def launch(): discovery.launch()
from IPython.core.magic import (magics_class, line_magic) from IPython.core.magics.basic import BasicMagics #Where _magic_docs is defined, also BasicMagics inherits the Magics already @magics_class class MyMagics(BasicMagics): @line_magic def quickref_text(self, line): """ Return the quickref text to be...
import unittest import pickle from ctypes import * import _ctypes_test dll = CDLL(_ctypes_test.__file__) from ctypes.test import xfail class X(Structure): _fields_ = [("a", c_int), ("b", c_double)] init_called = 0 def __init__(self, *args, **kw): X.init_called += 1 self.x = 42 class Y(X): ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import pwndbg.chain import pwndbg.commands import pwndbg.enhance import pwndbg.file import pwndbg.which import pwndbg.wrappers.checksec import pwndbg.wrapp...
"""Ftrl-proximal for TensorFlow.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import constant_op from tensorflow.python.framework import ops from tensorflow.python.ops import math_ops from tensorflow.python.training impo...
PRIORITIES = { 'blocker': 1, 'blocker a': 1, 'highest': 1, 'very high': 1, 'critical': 1, 'major': 2, 'major b': 2, 'high': 2, 'normal': 3, 'task': 3, 'minor': 3, 'minor c': 3, 'defect': 3, 'trivial': 3, 'low': 3, 'lowest': 3, 'very low': 3, 'enhan...
from ingenico.connect.sdk.data_object import DataObject from ingenico.connect.sdk.domain.payment.definitions.amount_breakdown import AmountBreakdown from ingenico.connect.sdk.domain.payment.definitions.gift_card_purchase import GiftCardPurchase from ingenico.connect.sdk.domain.payment.definitions.line_item import LineI...
from netforce.model import Model, fields, get_model from datetime import * from dateutil.relativedelta import * from pprint import pprint from netforce.access import get_active_company from netforce.database import get_connection def get_totals(date_from=None, date_to=None, excl_date_to=False, track_id=None, track2_id=...
import json import os import re from docutils import nodes from docutils.parsers.rst import directives from sphinx import __version__ as sphinx_ver, addnodes from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.util.compat import Directive from sphinx.util.console import bold from sphinx.util.nodes import...
from django.test import TestCase from django.core.urlresolvers import resolve, reverse class UrlsTest(TestCase): def setUp(self): # app URLs self.home_url = reverse('sift_home') def test_homepage_returns_correct_html(self): response = self.client.get(self.home_url) html = respons...
from swgpy.object import * def create(kernel): result = Intangible() result.template = "object/draft_schematic/space/booster/shared_booster_overdriver_mk1.iff" result.attribute_template_id = -1 result.stfName("string_id_table","") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
import machine Pin = machine.Pin io14 = Pin(14) clk = io14 io12 = Pin(12) miso = io12 io13 = Pin(13) mosi = io13 io15 = Pin(15) cs = io15 io2 = Pin(2) onboardled = io2 io0 = Pin(0) flashbutton = io0 io4 = Pin(4) sda = io4 rx = Pin(3) tx = Pin(1) io5 = Pin(5) scl = io5 a0 = machine.ADC(0) io16 = Pin(16) button_up = io0 ...
from datetime import datetime from .. import db from .hascategory import has_category class FlashcardCollection(db.Model): __tablename__ = 'flashcardcollection' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), index=True) timestamp = db.Column(db.DateTime, index=True, default...
from __future__ import print_function from pyhdf.HDF import * from pyhdf.VS import * f = HDF('inventory.hdf') # open 'inventory.hdf' in read mode vs = f.vstart() # init vdata interface vd = vs.attach('INVENTORY') # attach vdata 'INVENTORY' in read mode print("status:", vd.status) print("vd...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('clubdata', '0005_club_site'), ] operations = [ migrations.AlterField( model_name='club', name='site', field=models.On...
html = ''' <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>{0[title]}</title> {0[includes]} </head> <body> {0[content]} </body> </html> ''' favicon = '<link type="image/x-icon" rel="shortcut icon" href="{}" />' css = '<link type="text/css" rel="stylesheet" href="{}" />' javascript ...
from enum import Enum from uamqp import MessageBodyType class AmqpMessageBodyType(str, Enum): DATA = "data" SEQUENCE = "sequence" VALUE = "value" AMQP_MESSAGE_BODY_TYPE_MAP = { MessageBodyType.Data.value: AmqpMessageBodyType.DATA, MessageBodyType.Sequence.value: AmqpMessageBodyType.SEQUENCE, Mes...
""" Conversion functions for fossils """ from collections import defaultdict import pytz from indico.modules.rb.models.reservation_occurrences import ReservationOccurrence class Conversion(object): @classmethod def datetime(cls, dt, tz=None, convert=False): if dt: if tz: if i...