code stringlengths 1 199k |
|---|
from __future__ import print_function, division
import time
import string
import random
import numpy as np
import pyopencl as cl
import subprocess
import os
from os.path import join
from gpuexperiments.callkernel import call_cl_kernel
from gpuexperiments.timecheck import inittime, timecheck
gpu_idx = 0
platforms = cl.g... |
import requests
class AsyncList(object):
def __init__(self, data, link, requester, headers):
self._backing = data
self._link = link
self._requester = requester
self._headers = headers
self._parser = None
def __iter__(self):
ind = 0
try:
while s... |
from collections import OrderedDict
import datetime
import math
from django.core.cache import cache
from django.db.models import Sum
from django.http import HttpResponseRedirect, HttpResponse
from django.template.loader import render_to_string
from django.views.decorators.csrf import csrf_exempt
from django.contrib.aut... |
import unittest
from troposphere import Parameter, Ref, NoValue
from troposphere.validators import boolean, integer, integer_range
from troposphere.validators import positive_integer, network_port
from troposphere.validators import tg_healthcheck_port
from troposphere.validators import s3_bucket_name, encoding, status
... |
"""
PEP 386-compliant version number for the survey django app.
"""
__version__ = '0.3.2' |
import os
import sys
import numpy as np
from string import Template
import re
import configparser
from pdb import set_trace
def write_ini_files(input_file='create_run.ini',problem='advection'):
config = configparser.SafeConfigParser(allow_no_value=True)
config.read(input_file)
scheduler = config.get('De... |
import pandas as pd
import asteval
from collections import OrderedDict
from cytoolz.curried import map, curry
from cytoolz.functoolz import pipe
from cytoolz.dicttoolz import valmap
from dask import delayed
from survey_stats import log
from survey_stats import pdutil
from survey_stats.etl import survey_df as sdf
from s... |
import sys
import re
import os
import operator
from warnings import warn
from datetime import datetime
from zipfile import ZipFile, ZIP_DEFLATED
from struct import unpack
from .compatibility import str_types, force_unicode
from . import xmlwriter
from xlsxwriter.worksheet import Worksheet
from xlsxwriter.chartsheet imp... |
import numpy as np
import pylab as plt
from vectorplot import lic_internal, kernels
dpi = 100
size = 700
video = False
vortex_spacing = 0.5
extra_factor = 2.
a = np.array([1,0])*vortex_spacing
b = np.array([np.cos(np.pi/3),np.sin(np.pi/3)])*vortex_spacing
rnv = int(2*extra_factor/vortex_spacing)
vortices = [n*a+m*b for... |
from copy import deepcopy
from itertools import product
import numpy as np
import pytest
from ruptures.costs import CostAR
from ruptures.datasets import pw_constant
from ruptures.detection import Binseg, BottomUp, Dynp, Pelt, Window, KernelCPD
from ruptures.exceptions import BadSegmentationParameters
@pytest.fixture(sc... |
"""
Created on Fri Dec 2 16:15:29 2016
@author: waynetliu
"""
from __future__ import division
users = [
{ "id": 0, "name": "Hero" },
{ "id": 1, "name": "Dunn" },
{ "id": 2, "name": "Sue" },
{ "id": 3, "name": "Chi" },
{ "id": 4, "name": "Thor" },
{ "id": 5, "name":... |
from stdproprocessors import * |
import datetime
import time
import botconfig
def logger(file, write=True, display=True):
if file is not None:
open(file, "a").close() # create the file if it doesn't exist
def log(*output, write=write, display=display):
output = " ".join([str(x) for x in output]).replace("\u0002", "").replace("\... |
"""
This file provides simple functions to calculate wavelength dependent effects.
The functions can also be used to estimate the Weak Lensing Channel ghosts as a function
of spectral type.
:requires: NumPy
:requires: matplotlib
:requires: pysynphot
:version: 0.1
:author: Sami-Matias Niemi
:contact: s.niemi@ucl.ac.uk
"... |
import logging
import os
import uuid
import json
import csv
import xmltodict
from django.core.files.storage import default_storage
logger = logging.getLogger('debug.{}'.format(__name__))
def generate_guid():
"""
Generate a random UUID. For example: 0afdb760-efb6-48da-bbaa-462c772e86c0.
"""
return str(uu... |
import unittest
from primer_designer import utils
class UtilsTest(unittest.TestCase):
def setUp(self):
pass
def test_check_if_is_fasta_file(self):
self.assertTrue(utils.is_fasta("Ca2.fas"))
self.assertTrue(utils.is_fasta("Ca2.FAS"))
self.assertTrue(utils.is_fasta("Ca2.fst"))
... |
'''
Function for insertion sort
Time Complexity : O(N)
Space Complexity : O(N)
Auxilary Space : O(1)
'''
def insertionSort(ar):
for i in range(1,len(ar)):
j = i - 1
elem = ar[i]
while(j >= 0 and ar[j] > elem):
ar[j + 1] = ar[j]
j -= 1
ar[j + 1]... |
import urllib
from flask import render_template, url_for, request, flash, redirect
from weblab.core.webclient.web.helpers import _get_loggedin_info, _get_experiment_info
from weblab.core.wl import weblab_api
from weblab.core.exc import SessionNotFoundError
@weblab_api.route_webclient("/labs.html")
def labs():
"""
... |
import vtk
import numpy as np
from vmtk import vmtkscripts
from scipy.stats import skew
import argparse
import copy
def Execute(args):
print("get average along line probes")
reader_lines = vmtkscripts.vmtkSurfaceReader()
reader_lines.InputFileName = args.lines_file
reader_lines.Execute()
lines_surfa... |
from uuid import uuid4
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import settings
from mezzanine.core.models import Orderable
class Html5Mixin(object):
"""... |
"""
Basic statistics module.
This module provides functions for calculating statistics of data, including
averages, variance, and standard deviation.
Calculating averages
--------------------
================== =============================================
Function Description
================== ==========... |
from ndlib.models.compartments.Compartment import Compartiment
import networkx as nx
import numpy as np
__author__ = 'Giulio Rossetti'
__license__ = "BSD-2-Clause"
__email__ = "giulio.rossetti@gmail.com"
class NodeCategoricalAttribute(Compartiment):
def __init__(self, attribute, value, probability=1, **kwargs):
... |
"""test all fields"""
import unittest
from functools import partial
from unittest.mock import MagicMock, patch
from tests.base import async_test, AsyncMock
from bs4 import BeautifulSoup
from data import data
from data.fetcher import Fetcher
from data.fetcher import PhatomJSFetcher
from untangle import Element
q = parti... |
import rethinkdb as r
DEFAULT_DATABASE_NAME = 'default'
_connections = {}
_active_alias = None
class ConnectionError(Exception):
pass
get_alias = lambda d: d or _active_alias or DEFAULT_DATABASE_NAME
def connect(db=None, alias=None, host='localhost', port=28015, auth_key=''):
global _connections
global _act... |
#!/usr/bin/env python3
"""Tests for sshed.sshed_client"""
import logging
import os
import socket
import stat
import tempfile
import timeit
import unittest
from unittest import mock
from sshed import sshed_client
class TestDuplicateFile(unittest.TestCase):
"""Tests for sshed.parse_arguments."""
# Patch stderr s... |
from __future__ import absolute_import
__author__ = 'Patrizio Tufarolo'
__email__ = 'patrizio.tufarolo@studenti.unimi.it'
'''
Project: testagent
Author: Patrizio Tufarolo <patrizio.tufarolo@studenti.unimi.it>
Date: 20/04/15
'''
import sys
from testagent.api import BaseWebSocketHandler
class EventsApiHandler(BaseWebSock... |
"""Tests the `pysat.utils.coords` functions."""
import datetime as dt
import logging
import numpy as np
import pytest
import pysat
from pysat.utils import coords
class TestCyclicData(object):
"""Unit tests for the `adjust_cyclic_data` function."""
def setup(self):
"""Run to set up a clean test environme... |
"""Ce package contient des classes et fonctions structurant l'architecture
réseau du projet.
Pour plus d'informations, consulter l'aide de chaque sous-package contenu
dans le fichier __init__.py.
""" |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 0); |
from myapp import utils
module_name = utils.getFinalName(__name__)
module = utils.getModule(__name__, static_path="/frontend/static")
import views
import views.morepages |
import os
import sys
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'Public Relations'
copyright = u"2015, Kelley Dagley"
version = '0.1'
release = '0.1'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
html_theme = 'default'
html_static_path = ['_static']
... |
import datetime
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from pytz import common_timezones
FEED_TYPE_CHOICES = (
(u'rss', u'RSS'),
(u'rss-0.90', u'RSS 0.90'),
(u'rss-0.91', u'RSS 0.91'),
(u'rss-1.0', u'RSS 1.... |
'''The 'grit build' tool along with integration for this tool with the
SCons build system.
'''
import filecmp
import getopt
import os
import shutil
import sys
import types
from grit import grd_reader
from grit import util
from grit.tool import interface
from grit import shortcuts
def ParseDefine(define):
'''Parses a ... |
from django.conf import settings
DEBUG_TOOLBAR_CONFIG = getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {})
AUTORELOAD_ENABLED = DEBUG_TOOLBAR_CONFIG.get('AUTORELOAD_ENABLED', True)
AUTORELOAD_FILETYPES = DEBUG_TOOLBAR_CONFIG.get(
'AUTORELOAD_FILETYPES',
('template', 'css', 'js'))
AUTORELOAD_TIMEOUT = DEBUG_TOOLBAR_C... |
"""
byceps.services.user_message.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Send an e-mail message from one user to another.
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from dataclasses import dataclass
from email.utils import formataddr
import os.path
from typing i... |
try:
import floppyforms
except ImportError:
import sys
print("\n \033[1;31mN'oubliez pas d'activer votre virtualenv\n\n"
" $ source apps/bin/activate \033[0m\n")
sys.exit(1)
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed... |
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.files import File as DjangoFile
from django.forms.models import modelform_factory
from django.test import TestCase
try:
from unittest import skipIf, skipUnless
except ImportError:
# Django<1.9
from django.uti... |
"""Creates a directory with with the unpacked contents of the remoting webapp.
The directory will contain a copy-of or a link-to to all remoting webapp
resources. This includes HTML/JS and any plugin binaries. The script also
massages resulting files appropriately with host plugin data. Finally,
a zip archive for all ... |
"""Package contenant la commande 'sorts editer'."""
from primaires.interpreteur.masque.parametre import Parametre
class PrmEditer(Parametre):
"""Commande 'sorts editer'.
"""
def __init__(self):
"""Constructeur de la commande"""
Parametre.__init__(self, "éditer", "edit")
self.schema =... |
import os
import re
import sys
import six
from six.moves.urllib.parse import quote, urljoin
from .command import Command, BadCommand
from paste.deploy import loadapp
from paste.wsgilib import raw_interactive
class RequestCommand(Command):
min_args = 2
usage = 'CONFIG_FILE URL [OPTIONS/ARGUMENTS]'
takes_conf... |
"""Transport Layer geometry
"""
__author__ = "Juan C. Duque, Alejandro Betancourt"
__credits__ = "Copyright (c) 2009-10 Juan C. Duque"
__license__ = "New BSD License"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
__all__ = ['getBbox']
def getBbox(layer):
"""
Finds the... |
import json
import os
from datetime import datetime
from mock import patch
from django.test import SimpleTestCase
from corehq.apps.app_manager.models import Application
from corehq.apps.userreports.app_manager import get_case_data_sources, get_form_data_sources
from corehq.apps.userreports.reports.builder import DEFAUL... |
"""
The Wyner common information.
"""
import numpy as np
from .base_markov_optimizer import MarkovVarOptimizer
__all__ = ['wyner_common_information']
class WynerCommonInformation(MarkovVarOptimizer):
"""
Compute the Wyner common information, min I[X:V], taken over all V which
render the X_i conditionally in... |
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django import forms
from django.conf import settings
import base64
try:
from Crypto.Cipher import Blowfish
except ImportError:
raise ImportError('Using an encrypted field requires the pycripto. You can install pycripto wit... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 5, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 0); |
import functools
from operator import attrgetter
from django import http
from django.conf import settings
from django.db.transaction import non_atomic_requests
from django.shortcuts import get_list_or_404, get_object_or_404, redirect
from django.utils.http import is_safe_url
from django.utils.translation import ugettex... |
import functools
import os
import pkgutil
import sys
from collections import OrderedDict, defaultdict
from importlib import import_module
import django
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import (
Base... |
import numpy as np
import scipy.ndimage
import tomviz.operators
class GenerateTiltSeriesOperator(tomviz.operators.CancelableOperator):
def transform(self, dataset, start_angle=-90.0, angle_increment=3.0,
num_tilts=60):
"""Generate Tilt Series from Volume"""
self.progress.maximum = ... |
import sys
from enthought.traits.api \
import *
from enthought.traits.ui.api \
import *
from enthought.traits.ui.menu \
import *
from enthought.pyface.image_resource \
import ImageResource
from enthought.developer.tools.ui_debugger import UIDebugger
image1 = ImageResource( 'folder' )
image2 = ImageResou... |
'''
This module performs the return type inference, according to symbolic types,
It then reorders function declarations according to the return type deps.
* type_all generates a node -> type binding
'''
from pythran.analyses import (LazynessAnalysis, StrictAliases, YieldPoints,
Loca... |
""" Test suit for escrapper package """
from escrapper import WebSVN, InvalidWebSVN
import pytest
URLS = {"elegant": ("http://websvn.meneame.net",
{'repname': "meneame",
'rev': 3138}),
"calm": ("http://demo.websvn.info",
{'repname': "WebSVN"})}
OBJS = {}... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 12, transform = "BoxCox", sigma = 0.0, exog_count = 0, ar_order = 12); |
def extractSicilltranslates(item):
'''
Parser for 'SicillTranslates'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return False
tagmap = [
('So What if It\'s an RPG World!?', 'So What if It\'s an RPG World!?', 'tr... |
import re
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
from zinnia.sitemaps import TagSitemap, AuthorSitemap, CategorySitemap, EntrySitemap
from simplecms.sitemap import PageSitemap
sitemaps = {
'tags': TagSitemap(),
'... |
import click
import yaml
class ConfigError(click.ClickException):
pass
def load(config):
with open(config, "r") as f:
config = yaml.load(f)
if not config:
raise ConfigError("You configuration is empty")
return config |
import os
from collections import defaultdict
from functools import wraps
from couchdbkit.exceptions import ResourceNotFound
from django.conf import settings
from django.contrib.auth.hashers import check_password, make_password
from django.http import HttpResponse
from corehq.apps.api.resources import DictObject
from c... |
import logging
from pbcore.io.FastaIO import FastaReader, FastaWriter
from pbhla.utils import get_base_sequence_name
log = logging.getLogger()
def separate_listed_sequences( fasta_file, good_values, good_output, bad_output ):
"""
Separate a fasta file into two based on a supplied value list
"""
with Fas... |
import sys, os
cwd = os.getcwd()
parent = os.path.dirname(cwd)
sys.path.append(parent)
import django_eulasees
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'django_eulasees'
copyright = u'2014, Johnny Gill'
version = dja... |
from Task import Task
from ShareableQueue import ShareableQueue
from GlobalManager import GlobalManager
import multiprocessing as mp
class Remote(object):
def __init__(self,inbox,outbox=None):
self.inbox = inbox
self.outbox = outbox
manager = mp.Manager()
self.local_queue... |
from __future__ import absolute_import
from mayavi.modules.ui.surface import * |
"""
profiling.__main__
~~~~~~~~~~~~~~~~~~
The command-line interface to profile a script or view profiling results.
.. sourcecode:: console
$ profiling --help
"""
from __future__ import absolute_import
from datetime import datetime
from functools import partial, wraps
import importlib
import os
try:
... |
from __future__ import division, absolute_import, print_function
import warnings
import itertools
import pytest
import numpy as np
import numpy.core._umath_tests as umt
import numpy.linalg._umath_linalg as uml
import numpy.core._operand_flag_tests as opflag_tests
import numpy.core._rational_tests as _rational_tests
fro... |
'''
Author: Jason.Parks
Created: Apr 12, 2012
Module: common.diagnostic.debug
Purpose: to import debug methods
'''
from common.diagnostic import wingdbstub
from common.diagnostic.pcsLogger import logger
class Debug(object):
'''
General class to hold methods to help debugging from any DCC app
'''
def __init__(self):... |
import csv
from landuse.models import LandUse
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Import HSE Health stats"
def add_arguments(self, parser):
parser.add_argument('--hse_bmi', nargs=1, required=False)
parser.add_argument('--hse_weight', nargs=1, r... |
import pytest
pytest.importorskip("asyncssh")
import dask
from dask.distributed import Client
from distributed.deploy.ssh import SSHCluster
from distributed.utils_test import loop # noqa: F401
@pytest.mark.asyncio
async def test_basic():
async with SSHCluster(
["127.0.0.1"] * 3,
connect_options=dic... |
from django.contrib import admin
from django.contrib.auth.models import User
from django.core import checks
from django.db import models
from django.test import TestCase
from django.test.utils import isolate_apps
from django.urls import reverse
from content_editor.admin import ContentEditor, ContentEditorInline
from co... |
"""engine.SCons.Variables
This file defines the Variables class that is used to add user-friendly
customizable variables to an SCons build.
"""
__revision__ = "src/engine/SCons/Variables/__init__.py 2009/09/04 16:33:07 david"
import os.path
import string
import sys
import SCons.Environment
import SCons.Errors
import S... |
from m5.params import *
from O3CPUInjectedFault import O3CPUInjectedFault
class IEWStageInjectedFault(O3CPUInjectedFault):
type = 'IEWStageInjectedFault'
tcontext = Param.Int(0, "Example Num") |
import m5
from m5.objects import *
class MyCache(BaseCache):
assoc = 2
block_size = 64
latency = '1ns'
mshrs = 10
tgts_per_mshr = 5
class MyL1Cache(MyCache):
is_top_level = True
cpu = TimingSimpleCPU(cpu_id=0)
cpu.addTwoLevelCacheHierarchy(MyL1Cache(size = '128kB'),
... |
from __future__ import unicode_literals
import copy
import sys
from functools import update_wrapper
from django.utils.six.moves import zip
import django.db.models.manager # NOQA: Imported to register signal handler.
from django.conf import settings
from django.core.exceptions import (ObjectDoesNotExist,
MultipleOb... |
from django import forms
from whistlepig.whistlepig.models import SourceEmailAddress, DestinationEmailAddress
from whistlepig.whistlepig.models import StatusUpdate, OutageNotificationTemplate
class OutageNotificationForm(forms.Form):
source_email_address = forms.ChoiceField(required=True)
destination_email_addr... |
from .fetchers import NUPermissionsFetcher
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUInfrastructureVscProfile(NURESTObject):
""" Represents a InfrastructureVscProfile in the VSD
Notes:
Infrastructure VSC Profil... |
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 'UserPreferences'
db.create_table('preferences_userpreferences', (
('id', self.gf('django.db.models.fields.A... |
from supybot.test import *
import time
import pickle
import supybot.utils as utils
from supybot.utils.structures import *
class UtilsTest(SupyTestCase):
def testReversed(self):
L = range(10)
revL = list(reversed(L))
L.reverse()
self.assertEqual(L, revL, 'reversed didn\'t return rever... |
import sys
import time
import pickle
import requests
from github import Github, GithubException
from common import get_credentials
step_size = 100
search_phrase = '"from astropy" import OR "import astropy"'
username, password = get_credentials()
gh = Github(username, password)
total_repo = gh.search_code(search_phrase)... |
"""
The package implements the persistence layer.
Modules:
Packages:
metadata - Provides implementations for meta data persistence.
"""
__version__ = "$Revision-Id:$" |
import re
from django.db import models
from django.core.urlresolvers import reverse_lazy
from django.utils.timezone import now
from django.contrib.auth import get_user_model
from django.contrib.gis.geos import Point
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import gener... |
import bpy
import bgl
import string
import bmesh
from bpy.props import *
from bpy.types import Operator, AddonPreferences
from bpy_extras import view3d_utils
import math
import mathutils as mathu
import random
from mathutils import Vector
from . import mi_utils_base as ut_base
from . import mi_color_manager as col_man
... |
from django import template
from articles.models import Article
register = template.Library()
@register.inclusion_tag('articles/homepage_list_articles.html')
def list_articles(number_to_return):
articles = (Article.objects.filter(status=Article.LIVE_STATUS)
.order_by('-date_created')[:number_to_return])
... |
from django import forms
from django.conf import settings
class AuthorizeRequestTokenForm(forms.Form):
oauth_token = forms.CharField(widget=forms.HiddenInput)
client_name = forms.CharField(max_length=50,
widget=forms.TextInput(attrs={"placeholder":getattr(settings, "OAUTH_PROVIDER_DEFAULT_CLIENT_NAME", ... |
from __future__ import absolute_import, print_function, division
import theano
from theano.compile.mode import Mode, AddFeatureOptimizer
from theano.gof.toolbox import NoOutputFromInplace
import theano.tensor as T
def test_no_output_from_implace():
x = T.matrix()
y = T.matrix()
a = T.dot(x, y)
b = T.tan... |
from django.core.management.base import BaseCommand
from django.db.models import Q
from django.utils import timezone
from wagtail.core.models import PageRevision
try:
from wagtail.core.models import WorkflowState
workflow_support = True
except ImportError:
workflow_support = False
class Command(BaseCommand)... |
"""
Misc tools for implementing data structures
Note: pandas.core.common is *not* part of the public API.
"""
import collections
from collections import OrderedDict, abc
from datetime import datetime, timedelta
from functools import partial
import inspect
from typing import Any, Iterable, Union
import numpy as np
from ... |
import markdown2
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import pyqtSignal as Signal
from pcloudpy.gui.components import customWidgets
def widget_generator(func, parms, text="", only_apply=False):
class TemplateWidget(QWidget):
def __init__(self,... |
def get_sort_field(request):
"""
Retrieve field used for sorting a queryset
:param request: HTTP request
:return: the sorted field name, prefixed with "-" if ordering is descending
"""
sort_direction = request.GET.get('dir')
field_name = (request.GET.get('sort') or '') if sort_direction else... |
"""
Display song/video and control MPRIS compatible players.
There are two ways to control the media player. Either by clicking with a mouse
button in the text information or by using buttons. For former you have
to define the button parameters in your config.
Configuration parameters:
button_next: mouse button to ... |
from nose.tools import *
import whetlab, whetlab.server
from time import time, sleep
from nose.tools import with_setup, assert_equals
import numpy as np
import numpy.random as npr
whetlab.RETRY_TIMES = [] # So that it doesn't wait forever for tests that raise errors
default_access_token = None
default_description = ''
... |
"""
Ctypes based wrapper to libtiff library.
See TIFF.__doc__ for usage information.
Homepage: http://pylibtiff.googlecode.com/
"""
__author__ = 'Pearu Peterson'
__date__ = 'April 2009'
__license__ = 'BSD'
__version__ = '0.3-svn'
__all__ = ['libtiff', 'TIFF']
import os
import sys
import numpy as np
from numpy import c... |
"""
NumPy
=====
Provides
1. An array object of arbitrary homogeneous items
2. Fast mathematical operations over arrays
3. Linear Algebra, Fourier Transforms, Random Number Generation
How to use the documentation
----------------------------
Documentation is available in two forms: docstrings provided
with the cod... |
r"""
FASTQ format (:mod:`skbio.io.fastq`)
====================================
.. currentmodule:: skbio.io.fastq
The FASTQ file format (``fastq``) stores biological (e.g., nucleotide)
sequences and their quality scores in a simple plain text format that is both
human-readable and easy to parse. The file format was inve... |
from __future__ import print_function
import copy,struct,sys
from rdkit.six.moves import cPickle
from rdkit.six import iterkeys
from rdkit import six
from rdkit import DataStructs
class VectCollection(object):
"""
>>> vc = VectCollection()
>>> bv1 = DataStructs.ExplicitBitVect(10)
>>> bv1.SetBitsFromList((1,3,5... |
class CTECThriftClientError(Exception):
pass |
import os
import subprocess
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
extensions = ['breathe']
breathe_projects = { 'xsimd': '../xml' }
templates_path = ['_templates']
html_static_path = ['_static']
source_suffix = '.rst'
master_doc = 'index'
proj... |
algorithm = "hagedorn"
propagator = "semiclassical"
splitting_method = "Y4"
T = 70
dt = 0.005
dimension = 1
ncomponents = 1
eps = 0.1530417681822
potential = "eckart"
sigma = 100 * 3.8008 * 10**(-4.0)
a = 1.0 / (2.0 * 0.52918)
Q = [[ 3.5355339059327 ]]
P = [[ 0.2828427124746j]]
q = [[-7.5589045088306 ]]
p = [[ 0.247885... |
"""
Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting).
"""
import numpy as np
import warnings
from sklearn import datasets
from sklearn.base import clone
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.ensemble.gradi... |
"""
Defines meta data specific constants.
"""
__version__ = "$Revision-Id:$"
CREATION_DATETIME = "____creationdatetime____" # as datetime
MODIFICATION_DATETIME = "____modificationdatetime____" # as datetime
SIZE = "____size____" # size in bytes
OWNER = "____owner____"
MIME_TYPE = "____mimetype____" |
import cv2
from PIL import Image
import numpy
from maskgen.image_wrap import ImageWrapper,openImageFile
def transform(img,source,target,**kwargs):
rgba = img.convert('RGBA')
donor_img_file = kwargs['donor']
inputmask = openImageFile(donor_img_file)
donor = inputmask.convert('RGBA')
if donor.size != ... |
"""
pyexcel.internal.sheets.matrix
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Matrix, a data model that accepts any types, spread sheet style
of lookup.
:copyright: (c) 2014-2019 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
"""
import copy
import types
from functools import... |
import django.dispatch
profiler_setup = django.dispatch.Signal(providing_args=['profiler', 'view_func', 'view_args', 'view_kwargs']) |
import os
import django
from django.conf import global_settings
WAGTAIL_ROOT = os.path.dirname(__file__)
STATIC_ROOT = os.path.join(WAGTAIL_ROOT, 'test-static')
MEDIA_ROOT = os.path.join(WAGTAIL_ROOT, 'test-media')
MEDIA_URL = '/media/'
DATABASES = {
'default': {
'ENGINE': os.environ.get('DATABASE_ENGINE', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.