content stringlengths 4 20k |
|---|
from test.support import run_unittest
from test.script_helper import assert_python_failure, temp_dir
import unittest
import sys
import cgitb
class TestCgitb(unittest.TestCase):
def test_fonts(self):
text = "Hello Robbie!"
self.assertEqual(cgitb.small(text), "<small>{}</small>".format(tex... |
from __future__ import absolute_import, unicode_literals
import warnings
from functools import wraps
from itertools import count
from django.db import connection
try:
from django.db import connections, router
except ImportError: # pre-Django 1.2
connections = router = None # noqa
from django.db import mod... |
import os
import six
from datetime import date, datetime, time
import django
from django.db import models
from django.db.models.query import QuerySet
from django.db.models import sql
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
# Deprecated this thing in Django... |
import numpy as np
import vorpy
def test__is_subsequence_of_nondecreasing_sequence ():
# Positive tests
assert vorpy.index_map.is_subsequence_of_nondecreasing_sequence([], [])
assert vorpy.index_map.is_subsequence_of_nondecreasing_sequence([], [0])
assert vorpy.index_map.is_subsequence_of_nondecreasin... |
import os
import redis
import json
from durable import engine
from durable import interface
from werkzeug.routing import Rule
from werkzeug.wsgi import SharedDataMiddleware
class Host(engine.Host):
def __init__(self):
super(Host, self).__init__()
self._redis_server = redis.Redis(unix_socket_path=... |
"""
Insert nice comments
This document was created using:
pandoc -f latex qg_1layer_wave.tex -t rst > qg_1layer_wave.rst
Can make an html version to view locally using:
pandoc qg_1layer_wave.tex -s --mathjax -o qg_1layer_wave.html
"""
from firedrake import *
import numpy as np
import sys
Lx = 20. ... |
from django.contrib import admin
from django.contrib.admin.options import ModelAdmin
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core import mail
from django.test.client import RequestFactory
import mock
from nose.tools import eq_
from kitsune.forums.events imp... |
#!/usr/bin/env python
#by <EMAIL>
import socket
import re
import time
import cStringIO
import sys,os
from config_note import Config
from subprocess import call
from config_note import Config
import base64
import binascii
from picture import Image
from base import RawCode
import sqlite3
from datetime import datetime
c... |
INDEX_LIST = {
"Miscellaneous indices (works on CD)": {
"AWNAMSCD.BIN": "Names of authors and works",
"BIBINDCD.BIN": "Index to author/work entries in bibliographical form of Canon",
"AUTHWKCD.BIN": "Comprehensive list of authors and works on CD",
"DATINDCD.BIN": "Index to author/wor... |
"""Tests running the delete_orphan command"""
import ddt
from django.core.management import call_command
from contentstore.tests.test_orphan import TestOrphanBase
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore import ModuleStoreEnum
@ddt.ddt
class TestDeleteOrphan(TestOrphanB... |
#!/usr/bin/python
###########################################################################
# PrepareTrainingData.py :
#
# Prepares training data for CNN
#
###########################################################################
import glob
import json
import math
import os
import random
import subprocess
import... |
# coding: utf-8
from mako.lookup import TemplateLookup
from datetime import datetime
strict_undefined = True
class TemplateEngine:
def __init__(self, folder, global_fields, global_functions):
self.folder = folder
self.global_fields = global_fields
global_functions["format_time"] = Template... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
las2txtPro.py
---------------------
Date : October 2014
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
****************... |
# -*- encoding:utf-8 -*-
"""
委托工具模块
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
from functools import update_wrapper
from operator import attrgetter
from ..CoreBu.ABuFixes import signature
__author__ = '阿布'
__weixin__ = 'abu_q... |
'''
Identifiers:
\d = any number
\D = anything but a number
\s = space
\S = anything but a space
\w = any letter
\W = anything but a letter
. = any character, except for a new line
\b = space around whole words
\. = period. must use backslash, because . normally means any character.
Modifiers:
{1,3} = for digits, u exp... |
import numpy as np
class PauliBasis:
"""Defines a Pauli basis.
A good introduction to the topic is [1]_.
TODO
References
----------
.. [1] A "Pauli basis" is an orthonormal basis (w.r.t
:math:`\\langle A, B \\rangle = \\text{Tr}(A \\cdot B^\\dagger)`)
for a space of Hermitian... |
from setuptools import setup, find_packages
from codecs import open
from os import path
VERSION = '0.0.3'
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
# get the dependencies... |
import sys
if sys.version_info < (3,):
__all__ = ['u']
class U(object):
def __add__(self, other):
return eval('u'+repr(other).replace(r'\\u', r'\u')
.replace(r'\\U', r'\U'))
u = U()
long = long # for further "from testing.support... |
from typing import Dict, Tuple, Any, Optional, MutableMapping, Mapping, Text
from datetime import datetime
from .exceptions import UnknownUpdateCardAction
from .templates import TRELLO_SUBJECT_TEMPLATE, TRELLO_MESSAGE_TEMPLATE
SUPPORTED_CARD_ACTIONS = [
u'updateCard',
u'createCard',
u'addLabelToCard',
... |
"""Tests for utils."""
from absl.testing import absltest
from acme.jax import utils
import jax
import jax.numpy as jnp
class JaxUtilsTest(absltest.TestCase):
def test_batch_concat(self):
batch_size = 32
inputs = [
jnp.zeros(shape=(batch_size, 2)),
{
'foo': jnp.zeros(shape=(bat... |
import sys
import in_generator
import template_expander
import name_utilities
from make_settings import to_passing_type, to_idl_type
class MakeInternalSettingsWriter(in_generator.Writer):
defaults = {
'type': 'bool',
'initial': None,
'invalidate': None,
}
default_parameters = {}
... |
"""
Set operations for 1D numeric arrays based on sorting.
:Contains:
ediff1d,
unique,
intersect1d,
setxor1d,
in1d,
union1d,
setdiff1d
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in some operations ... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
# fixes a changed syntax in the locks.
def forwards(self, orm):
"Write your forwards methods here."
for channel in orm.Channel.objects.all(... |
""" A package containing Interpolation related classes. """
# Package imports
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
# Version
__major__ = 0 # for major interface/format changes
__minor__ = 1 # f... |
from Queue import Queue, Empty
from threading import Thread
from time import sleep
from connection import Connection
__all__ = ['ConnectionPool']
class ConnectionPool(object):
"""
Simple connection-caching pool implementation.
ConnectionPool provides the simplest possible connection pooling,
lazily c... |
import os
import tempfile
import string as printstring # string is being used as a var - easier to replace here
from viper.common.abstracts import Module
from viper.core.database import Database
from viper.core.session import __sessions__
from viper.core.storage import get_sample_path
from viper.common.constants impo... |
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'
}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.couchbase_common import *
from time import sleep
import socket
import requests
import json
import os
class Couchbase(o... |
"""Tests for tensorflow.python.ops.special_math_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorflow.python.framework imp... |
#!/usr/bin/env python
"""Compare new propagate counts function with original function. Test assc results is same."""
__copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
import os
from os.path import join
from sys import stdout
import timeit
from goat... |
from dasbus.server.interface import dbus_interface
from dasbus.server.property import emits_properties_changed
from dasbus.typing import * # pylint: disable=wildcard-import
from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate
from pyanaconda.modules.common.constants.objects import DISK_INITIALIZ... |
from random import *
import numpy
import pylab
import nupic.bindings.algorithms as algo
from nupic.bindings.math import GetNumpyDataType
type = GetNumpyDataType('NTA_Real')
type = 'float32'
def simple():
print "Simple"
numpy.random.seed(42)
n_dims = 2
n_class = 4
size = 200
labels = num... |
from django.utils.html import linebreaks, urlize
from django.utils.functional import curry
from django.conf import settings
# build DEFAULT_MARKUP_TYPES
DEFAULT_MARKUP_TYPES = [
('html', lambda markup: markup),
('plain', lambda markup: urlize(linebreaks(markup))),
]
try:
import pygments
PYGMENTS_INSTA... |
from database import get_session, User, Day, Activity, Event
from database import clear_db
from fitbit import DEFAULT_GOAL as goal, get_dashboard_state, clear_user_log, log_step_activity
from weconnect import get_events_for_user
import sys
def change_steps(user, target_steps, session):
day = user.thisday()
#chang... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.ansible_tower import TowerModule, tower_auth_config, tower_check_... |
""" Example pylib functions"""
def row_generator(resource, doc, env, *args, **kwargs):
""" An example row generator function.
Reference this function in a Metatab file as the value of a Datafile:
Datafile: python:pylib#row_generator
The function must yield rows, with the first being headers... |
'''
Bulk spectral line fitting with SDSS galaxy spectra
'''
import os
import shutil
from astropy.io import fits
from pandas import DataFrame, Series
import numpy as np
from datetime import datetime
try:
from interruptible_pool import InterruptiblePool as Pool
except ImportError:
from multiprocessing import Po... |
'''
Madsonic XBMC Plugin
Copyright (C) 2013 t0mm0, Madevil
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 versi... |
"""Test the aiohttp client helper."""
import asyncio
import unittest
import aiohttp
from homeassistant.bootstrap import setup_component
import homeassistant.helpers.aiohttp_client as client
from homeassistant.util.async import (
run_callback_threadsafe, run_coroutine_threadsafe)
from tests.common import get_test... |
"""Module with utility classes and functions related
to data tables and text.
"""
import sys
import warnings
from psi4.driver import constants
from psi4 import core
class Table(object):
"""Class defining a flexible Table object for storing data."""
def __init__(self, rows=(), row_label_width=10, row_label... |
import FreeCAD,FreeCADGui
from FreeCAD import Base
from FreeCAD import Part
# FreeCADShip modules
from surfUtils import Paths
from surfUtils import Geometry
from surfUtils import Math
class Preview(object):
def __init__(self):
""" Constructor.
@param self Auto call object.
@note Start it as... |
import numpy as np
import matplotlib as mpl
mpl.use('agg')
import pylab as pl
import h5py
# Optimized plot parameters to make beautiful plots:
pl.rcParams['figure.figsize'] = 12, 7.5
pl.rcParams['figure.dpi'] = 100
pl.rcParams['image.cmap'] = 'jet'
pl.rcParams['lines.linewidth'] = 1.5
pl.rcParams['font.fami... |
"""
IBM NAS Volume Driver.
Currently, it supports the following IBM Storage Systems:
1. IBM Scale Out NAS (SONAS)
2. IBM Storwize V7000 Unified
Notes:
1. If you specify both a password and a key file, this driver will use the
key file only.
2. When using a key file for authentication, it is up to the user or
sys... |
"""
A module to perform experimental thermochemical data analysis.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "<EMAIL>"
__date__ = "Jun 10, 2012"
from pymatgen.core.composition import Composition
STAND... |
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from telemetry import story
class BigJsPageSet(story.StorySet):
""" Sites which load and run big JavaScript files."""
def __init__(self):
super(BigJsPageSet, self).__init__(
archive_data_file='data/big_js.json',... |
"""ADMM algorithm for the CMOD problem"""
from __future__ import division, absolute_import
import copy
import numpy as np
from sporco.admm import admm
import sporco.linalg as sl
__author__ = """Brendt Wohlberg <<EMAIL>>"""
class CnstrMOD(admm.ADMMEqual):
r"""
ADMM algorithm for a constrained variant of th... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
store_version = 1 # Needed for dynamic plugin loading
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at ... |
import logging
from django.forms import TextInput
from django.forms.widgets import RadioInput, MultiWidget
from django.utils.encoding import StrAndUnicode, force_unicode
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
import models
class RadioFieldRende... |
"""
Implements image tile identification and fetching from various sources.
The Matplotlib interface can make use of tile objects (defined below) via the
:meth:`cartopy.mpl.geoaxes.GeoAxes.add_image` method. For example, to add a
:class:`MapQuest Open Aerial tileset <MapQuestOpenAerial>` to an existing axes
at zoom l... |
from RMPY.rig.biped.rig_parts import reverseFeet
import pymel.core as pm
from RMPY.rig import rigFK
from RMPY.rig import constraintSwitch
class IkFkFeetModel(constraintSwitch.ConstraintSwitchModel):
def __init__(self):
super(IkFkFeetModel, self).__init__()
self.ik_feet = None
self.fk_feet ... |
# Tai Sakuma <<EMAIL>>
from .splitfuncs import create_file_start_length_list
##__________________________________________________________________||
class DatasetIntoEventBuildersSplitter(object):
def __init__(self, EventBuilder, eventBuilderConfigMaker,
maxEvents = -1, maxEventsPerRun = -1,
... |
import os
import sys
## Modify this path
sys.path.append("##TRAFCI_PYTHON_LIB_CLASSPATH##")
import Session
import re
# removes whitespace and \r\n
def trim( tmpstr ):
return tmpstr.strip(' \r\n')
##################################
########################################################################
# create... |
import numpy, h5py, pylab, copy
from PnSC_h5io import *
import scipy.optimize
from matplotlib.ticker import FuncFormatter
class fitfcns: #datatuples are x1,x2,...,y
#.finalparams .sigmas .parnames useful, returns fitfcn(x)
def genfit(self, fcn, initparams, datatuple, markstr='unspecified', parnames=[], interac... |
from django.db import models
from django.dispatch import receiver
from django.contrib.auth.models import User
from taggit.models import Tag
from .models import TagUid
from .model_utils import grant_default_model_level_perms
@receiver(models.signals.post_save, sender=User)
def default_permissions_post_save(sender, ins... |
from osv import osv, fields
import decimal_precision as dp
class mrp_indicators(osv.osv):
_name = 'mrp.indicators'
_columns = {
'name': fields.char('Name', size=255, required=True),
'line_ids': fields.one2many('mrp.indicators.line', 'indicator_id', 'Lines'),
'line_average_ids': fields.o... |
from matplotlib.transforms import Bbox
from matplotlib.transforms import TransformedBbox
from matplotlib.transforms import blended_transform_factory
from mpl_toolkits.axes_grid1.inset_locator import BboxPatch
from mpl_toolkits.axes_grid1.inset_locator import BboxConnector
from mpl_toolkits.axes_grid1.inset_locator impo... |
"""
docker_registry.drivers.dumb
~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a very dumb driver, which uses memory to store data.
It obviously won't work out of very simple tests.
Should only be used for inspiration and tests.
"""
from ..core import compat
from ..core import driver
from ..core import exceptions
class Stora... |
"""
This module implements a class which returns the appropiate Response class
based on different criterias.
"""
from mimetypes import MimeTypes
from pkgutil import get_data
from cStringIO import StringIO
from scrapy.http import Response
from scrapy.utils.misc import load_object
from scrapy.utils.python import isbin... |
"""
Address device / device descriptor class
http://libvirt.org/formatdomain.html#elementsAddress
"""
from virttest.libvirt_xml import accessors, xcepts
from virttest.libvirt_xml.devices import base
class Address(base.TypedDeviceBase):
__slots__ = base.TypedDeviceBase.__slots__ + ('attributes',)
def __ini... |
"""Utility functions specifically for NMT."""
from __future__ import print_function
from REDACTED.nmt.utils import misc_utils as utils
__all__ = ["get_translation"]
def get_translation(nmt_outputs, tgt_eos, subword_option):
"""Given batch decoding outputs, select a sentence and turn to text."""
if tgt_eos: tgt_... |
# -*- coding: utf-8 -*-
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 'Forum.moderator_only'
db.add_column('djangobb_forum_forum', 'moderator_only',
... |
from django.core.management.base import BaseCommand
# from django.contrib.gis.geos import Point
from pollingstations.models import PollingStation, PollingDistrict
from councils.models import Council
from addressbase.models import Address, UprnToCouncil
def update_station_point(council_id, station_id, point):
"""... |
"""
This a small python program to collect, save and visualise data from the serial port in real time.
Each data point is a scalar number.
Consecutive data points result in a time series that is assumed to be irregular (i.e. heterogeneous).
"""
__author__ = "Quentin Geissmann, [http://github.com/qgeissmann]"
import ... |
# -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**metadata module.**
Contact : <EMAIL>
.. note:: 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; eit... |
'''
Python classes for interacting with the Brookstone Rover 2.0
and Rover Revolution
Copyright (C) 2015 Simon D. Levy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of t... |
import os
import sys
import eventlet
from oslo_config import cfg
from st2common import log as logging
from st2common.constants.timer import TIMER_ENABLED_LOG_LINE, TIMER_DISABLED_LOG_LINE
from st2common.logging.misc import get_logger_name_for_module
from st2common.service_setup import setup as common_setup
from st2co... |
#!/usr/bin/env python
# coding=utf8
"""
Import known_changes files
@contact: Debian FTP Master <<EMAIL>>
@copyright: 2009 Mike O'Connor <<EMAIL>>
@license: GNU General Public License version 2 or later
"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General... |
from . import Image, ImageFile
from ._binary import i8, o8, i16be as i16
import struct
import os
__version__ = "0.3"
def _accept(prefix):
return len(prefix) >= 2 and i16(prefix) == 474
##
# Image plugin for SGI images.
class SgiImageFile(ImageFile.ImageFile):
format = "SGI"
format_description = "SGI ... |
import os
import random
import time
from django.db import models
from aesfield.field import AESField
import amo.models
from users.models import UserProfile
KEY_SIZE = 18
SECRET_SIZE = 32
VERIFIER_SIZE = 10
CONSUMER_STATES = (
('pending', 'Pending'),
('accepted', 'Accepted'),
('canceled', 'Canceled'),
... |
import unittest
import numpy as np
from chainer import testing
from chainer.testing import attr
from chainercv.datasets import coco_instance_segmentation_label_names
from chainercv.datasets import COCOInstanceSegmentationDataset
from chainercv.utils import assert_is_bbox
from chainercv.utils import assert_is_instanc... |
"""
WSGI config for musicrec project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... |
class SickBeardException(Exception):
"Generic SickBeard Exception - should never be thrown, only subclassed"
class ConfigErrorException(SickBeardException):
"Error in the config file"
class LaterException(SickBeardException):
"Something bad happened that I'll make a real exception for later"
class NoNFOE... |
#!/usr/bin/python
import os
import sys
import logging
import shutil
from avocado.utils import process
# simple magic for using scripts within a source tree
basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.join(basedir, 'virttest')):
sys.path.append(basedir)
from vir... |
"""
Allow other packages to extend this namespace, zip safe setuptools style
"""
import pkg_resources
pkg_resources.declare_namespace(__name__) |
from djng.services.base import Service, ServiceConfigurationError
class CacheConfigure(object):
def __init__(self, next, impl=None, in_memory=False):
self.next = next
if impl and in_memory:
raise ServiceConfigurationError, 'Only one of impl or in_memory'
if not (impl or in_memor... |
""" Helpers for parsing various outputs jit produces.
Notably:
1. Statistics of log.ops
2. Parsing what jitprof produces
"""
import re
REGEXES = [
(('tracing_no', 'tracing_time'), '^Tracing:\s+([\d.]+)\s+([\d.]+)$'),
(('backend_no', 'backend_time'), '^Backend:\s+([\d.]+)\s+([\d.]+)$'),
(None, '^TOTAL.*$')... |
from __future__ import absolute_import, print_function
import os
import uuid
import json
import logging
import functools
from . import uhf
uhf(__name__)
from .qt import QtCore, QtNetwork, QtWidgets
from .runner import run_mod
from .repo import ModNotFound
from .windows import ModInstallWindow
from . import center
t... |
from __future__ import division
__author__ = 'Maximilian Bisani'
__version__ = '$LastChangedRevision: 1691 $'
__date__ = '$LastChangedDate: 2011-08-03 15:38:08 +0200 (Wed, 03 Aug 2011) $'
__copyright__ = 'Copyright (c) 2004-2005 RWTH Aachen University'
__license__ = """
This program is free software; you ... |
import httplib
from flask import Blueprint, json, current_app, redirect, request
from .. import app_util
from .. import config
from .. import exceptions
from ..api import repository, images
from .. import search as search_package
section = Blueprint('v1', __name__, url_prefix='/v1')
@section.after_request
def add... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from . import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'blog.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^login/$', views.LoginView.as_view(), name='login'),... |
"""Support for TPLink lights."""
import asyncio
from datetime import timedelta
import logging
import time
from typing import Any, Dict, NamedTuple, Tuple, cast
from pyHS100 import SmartBulb, SmartDeviceException
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
# ExtractorError,
# HEADRequest,
int_or_none,
qualities,
unified_strdate,
)
class CanalplusIE(InfoExtractor):
IE_DESC = 'mycanal.fr and piwiplus.fr'
_VALID_URL = r'ht... |
import sys
import shutil
import os
def copy_libs(path, libList):
for lib in libList:
shutil.copy2(os.path.join(path, lib),
os.path.join(os.getcwd(),
"resources",
"packaging",
... |
from django.conf.urls import url, include
from django.views.i18n import javascript_catalog
from hub.views import ExtraDetailRegistrationView
from rest_framework.routers import DefaultRouter
from kpi.views import (
AssetViewSet,
AssetSnapshotViewSet,
UserViewSet,
CurrentUserViewSet,
CollectionViewSe... |
"""Extension to python-markdown to support LaTeX (rather than html) output.
Authored by Rufus Pollock: <http://www.rufuspollock.org/>
Reworked by Julian Wulfheide (<EMAIL>) and
Indico Project (<EMAIL>)
Usage:
======
1. Command Line. A script entitled markdown2latex.py is automatically
installed. For details of usage... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Size.status'
db.delete_column('carts_size', 'status')
# Adding field 'Size.enable... |
import numpy as np
import matplotlib.pyplot as plt
import sys, os, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
import stft as STFT
import sineModel as SM
import utilFunctions as UF
(fs, x) = UF.wavread(os.path.join(os.path.dirname(os.path.realpath(__fi... |
"""Hello Manager App."""
from empower.core.app import EmpowerApp
class HelloWorld(EmpowerApp):
"""HelloWorld App.
Command Line Parameters:
tenant_id: tenant id
every: loop period in ms (optional, default 5000ms)
Example:
./empower-runtime.py apps.helloworld.helloworld \
... |
from itertools import combinations
import pytest
import networkx as nx
from networkx.algorithms.community import k_clique_communities
def test_overlapping_K5():
G = nx.Graph()
G.add_edges_from(combinations(range(5), 2)) # Add a five clique
G.add_edges_from(combinations(range(2, 7), 2)) # Add another f... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'textbox05.xlsx'
... |
from django import http
from django.conf import settings
from django.contrib import auth
from django.utils.http import is_safe_url
import commonware.log
from django_browserid import BrowserIDBackend, get_audience
from django.utils.translation import ugettext as _
import mkt
from lib.metrics import record_action
from ... |
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0)
t.write("Jamroot.jam", """\
import param ;
import assert ;
import errors : try catch ;
rule test1 ( )
{
param.handle-named-params ;
}
test1 ;
rule test2 ( sources * )
{
param.handle-named-params sources ;
return $(sources) ;
}
assert.result : test2 ;... |
#!/usr/bin/env python2
# -*- coding: utf-8; -*-
"""
Copyright (C) 2007-2012 Lincoln de Sousa <<EMAIL>>
Copyright (C) 2007 Gabriel Falcão <<EMAIL>>
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; eith... |
import pickle, codecs, os.path, copy, logging
from decimal import Decimal
from gi.repository import Gtk, Gdk, GLib, Pango
# local files import
from . import analysis
from .. import misc, data, undo
# Setup logger object
log = logging.getLogger(__name__)
def get_analysis_settings(parent):
builder = Gtk.Builder(... |
import os
import sys
import yaml
class LeelaConfig(object):
def __init__(self, project_path):
self.__project_path = project_path
self.__config = {}
def parse(self, config):
self.__check_param(config, 'leela')
self.__check_param(config, 'services')
services_cfg = config... |
"""
Instructor Dashboard Views
"""
from django.utils.translation import ugettext as _
from django_future.csrf import ensure_csrf_cookie
from django.views.decorators.cache import cache_control
from mitxmako.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from django.utils.html import es... |
import collections
import copy
import json
import os
import pipes
import re
import subprocess
import sys
import bb_utils
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from pylib import constants
CHROMIUM_COVERAGE_BUCKET = 'chromium-code-coverage'
_BotConfig = collections.namedtuple(
'BotConfig... |
# coding=utf-8
"""
InaSAFE Disaster risk tool by AusAid - **Volcano polygon evacuation.**
Contact : <EMAIL>
.. note:: 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 2 of th... |
import os
import string
import subprocess as sp
import argparse
import re
EMACS = os.path.join('..', 'src', 'emacs')
def find_modules():
modpaths = []
for (dirname, dirs, files) in os.walk('.'):
if 'Makefile' in files:
modpaths.append(dirname)
return modpaths
def cmd_test(args):
m... |
"""
=============================
OOB Errors for Random Forests
=============================
The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where
each new tree is fit from a bootstrap sample of the training observations
:math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er... |
from spack import *
class RSurvival(RPackage):
"""Contains the core survival analysis routines, including definition of
Surv objects, Kaplan-Meier and Aalen-Johansen (multi-state) curves, Cox
models, and parametric accelerated failure time models."""
homepage = "https://cran.r-project.org/package=sur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.