code stringlengths 1 199k |
|---|
import os
import shelve
from .common import cache_uri_build, sprite_filepath_build
CACHE_DIR = None
API_CACHE = None
SPRITE_CACHE = None
def save(data, endpoint, resource_id=None, subresource=None):
if data == dict(): # No point in saving empty data.
return None
if not isinstance(data, (dict, list)):
... |
from __future__ import unicode_literals
from functools import update_wrapper
from hashlib import md5
from django.conf.urls import url
from django.contrib.admin import ModelAdmin as DjangoModelAdmin
from django.contrib.admin.utils import flatten_fieldsets, model_format_dict
from django.contrib.auth import get_permission... |
from core import kde
class DefaultProfile4(kde.KDE4Action):
"""Set Konsole's default profile."""
def arguments(self):
return [
('path', 'The relative path to a Konsole .profile file.')
]
def binary_dependencies(self):
return ['konsole']
def execute(self, path, binary ... |
from . import access_token
from . import errors
from . import utils
from .connection import connection
from .logger import setup_logger
from .batch import Batch
from .request import Broker
from .malware import Malware
from .malware_family import MalwareFamily
from .threat_exchange_member import ThreatExchangeMember
fro... |
"""
Consumer process management. Imports consumer code, manages RabbitMQ
connection state and collects stats about the consuming process.
"""
import collections
import logging
import math
import multiprocessing
import os
from os import path
import profile
import signal
import time
import warnings
from helper import con... |
import os
from datetime import datetime, timedelta
from django.db import models
from django.core.exceptions import PermissionDenied, ValidationError
from mezzanine.conf import settings
from hs_core.signals import pre_check_bag_flag
class ResourceIRODSMixin(models.Model):
""" This contains iRODS methods to be includ... |
"""Defines a Jupyter Notebook interface to Klampt."""
from ._version import version_info, __version__
from .widgets import * |
import os
import simplejson as json
from tests.checks.common import AgentCheckTest, Fixtures
from checks import AgentCheck
class TestCeph(AgentCheckTest):
"""Basic Test for ceph integration."""
CHECK_NAME = 'ceph'
FIXTURE_DIR = os.path.join(os.path.dirname(__file__), 'ci')
def test_simple_metrics(self):... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0004_auto_20150726_1315'),
]
operations = [
migrations.CreateModel(
name='JobType',
fields=[
('id', ... |
from __future__ import absolute_import
import six
import hashlib
import logging
import os
from nose.plugins import Plugin
def hash_filename(filename):
'''Design goal:
* Take a filename and output a number.
* Return the same number even if the filename
is now in a different path.
To achieve that, i... |
"""--------------------------------------------------------------------
COPYRIGHT 2016 Stanley Innovation Inc.
Software License Agreement:
The software supplied herewith by Stanley Innovation Inc. (the "Company")
for its licensed SI Vector Platform is intended and supplied to you,
the Company's customer, for use solely... |
import chemkit
import unittest
class AtomTest(unittest.TestCase):
def test_symbol(self):
molecule = chemkit.Molecule()
atom = molecule.addAtom("C")
self.assertEqual(atom.symbol(), "C")
atom.setAtomicNumber(2)
self.assertEqual(atom.symbol(), "He")
def test_name(self):
... |
from unittest import TestCase
from ..model_conversion import *
from ..statespace import ss
from ..transferfunction import tf
from .tools.test_utility import assert_tf_equal, assert_ss_equal
class TestModelConversion(TestCase):
def setUp(self):
self.ss = ss([[1, 1], [-2, -5]], [[1], [1]], [[0, 3]], 0)
... |
import traceback
from core import debug
debug.warning("The use of core.modules.port_configure is deprecated. "
"Please use gui.modules.port_configure.",
''.join(traceback.format_stack()))
from gui.modules.port_configure import * |
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
import setup as _setup
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'i... |
from Queue import Empty
from anyjson import serialize, deserialize
from sqlalchemy import create_engine
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import sessionmaker
from kombu.transport import virtual
from sqlakombu.models import Queue, Message, metadata
class Channel(virtual.Channel):
_sessi... |
CUSTOM_DAY_FORMAT = 'd/m/Y CUSTOM' |
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
... |
"""
Some standard discrete distribution.
"""
from .. import ScalarDistribution
from ..math.misc import combinations as C, is_integer, is_number
__all__ = (
'bernoulli',
'binomial',
'hypergeometric',
'uniform',
)
def bernoulli(p):
"""
The Bernoulli distribution:
x P(x)
0 1-p
1... |
import os
import sys
import re
import string
import types
import codecs
from xml.etree import cElementTree
from itertools import chain, imap
try:
MODULE = os.path.dirname(os.path.abspath(__file__))
except:
MODULE = ""
from tree import Tree, Text, Sentence, Slice, Chunk, PNPChunk, Chink, Word, table
from tree im... |
import unittest
from autoprotocol.protocol import Protocol, Ref
from autoprotocol.instruction import Instruction, Thermocycle, Incubate, Pipette, Spin
from autoprotocol.container_type import ContainerType
from autoprotocol.container import Container, WellGroup, Well
from autoprotocol.unit import Unit
from autoprotocol.... |
"""
Calculate BOLD confounds
^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: init_bold_confs_wf
.. autofunction:: init_ica_aroma_wf
"""
from os import getenv
from nipype.algorithms import confounds as nac
from nipype.interfaces import utility as niu, fsl
from nipype.pipeline import engine as pe
from templateflow.api import ... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("LogisticRegression" , "iris" , "sqlite") |
"""
Django admin models for a campaign application.
"""
from django.contrib import admin
from campaign.models import Supporter, Entry, Issue
class EntryAdmin(admin.ModelAdmin):
date_hierarchy = 'pub_date'
fieldsets = (
(u'Metadata', {'fields': (('title', 'slug'), 'subtitle', 'author', 'pub_date',)}),
... |
import logging
from pathlib import Path
from flask import Blueprint, current_app, render_template, send_from_directory
from scout import __version__
from scout.server.utils import public_endpoint
LOG = logging.getLogger(__name__)
public_bp = Blueprint(
"public",
__name__,
template_folder="templates",
st... |
"""#R1 : threshold of the ndPAC.
This script provide an insight of the ndPAC's threshold.
"""
import json
with open("../../paper.json", 'r') as f: cfg = json.load(f) # noqa
import numpy as np
from scipy.special import erfinv
from tensorpac.signals import pac_signals_wavelet
from tensorpac import Pac
import seaborn as ... |
from datetime import date, datetime, timedelta
import django # noqa
from django import forms
from django.db import models
from django.contrib.auth import get_user
from django.contrib.auth.models import AnonymousUser
from django.core import mail
from django.core.files.storage import default_storage as storage
from djan... |
from django.conf import settings
from django.conf.urls import url, include
from django.contrib.auth.views import login, logout
from social.backends.google import GooglePlusAuth
from .views import *
context = dict(
plus_id=getattr(settings, 'SOCIAL_AUTH_GOOGLE_PLUS_KEY', None),
plus_scope=' '.join(GooglePlusAuth... |
from __future__ import division
try:
import torchTool
except ImportError:
print('pytorch not installed, related components are not available')
import math
import random
from PIL import Image, ImageOps
import PIL
try:
import accimage
except ImportError:
accimage = None
import numpyTool as np
import numbe... |
import time
from datetime import datetime, timedelta
from django.db import connections
from django.db.models import Avg, F, Q, Sum
import multidb
import waffle
from celery import group
import olympia.core.logger
from olympia import amo
from olympia.addons.models import Addon, FrozenAddon
from olympia.addons.tasks impor... |
"""
.. module:: burp1
:platform: Unix
:synopsis: Burp-UI burp1 backend module.
.. moduleauthor:: Ziirish <ziirish@ziirish.info>
"""
import re
import os
import socket
import time
import json
import datetime
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
import shutil
imp... |
from __future__ import absolute_import
from __future__ import unicode_literals
from django.http import HttpResponse, Http404
from django.conf import settings
from django.core import serializers
from django.db.models import Model
from django.apps import apps as django_apps
from django.db.models.query import QuerySet
fro... |
class Instrument(object):
"""Librato Instrument Base class"""
def __init__(self, connection, name, id=None, streams=[], attributes={}, description=None):
self.connection = connection
self.name = name
self.streams = []
for i in streams:
if isinstance(i, Stream):
... |
from copy import deepcopy
import os.path as op
import pytest
import numpy as np
from scipy import linalg
from scipy.spatial.distance import cdist
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_almost_equal, assert_allclose,
assert_a... |
from django import forms
from django.template.defaultfilters import slugify
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext, get_language
import django_select2
from hvad.forms import TranslatableModelForm
import taggit
from unidecode import unidecode
from .models import Tag, ... |
from django.test import TestCase
from django.urls import reverse
from corehq.apps.domain.models import Domain
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.domain.tests.test_views import BaseAutocompleteTest
from corehq.apps.users.dbaccessors import delete_all_users
from corehq.apps.users.mode... |
"""
Doc string here.
@author mje
@email: mads [] cnru.dk
"""
import sys
import subprocess
if len(sys.argv) == 4:
cpu_number = sys.argv[3]
else:
cpu_number = 1
submit_cmd = 'submit_to_cluster \"python %s %s\"' % (sys.argv[1], cpu_number)
print(submit_cmd) |
from django.conf import settings
def get_profile_model():
"""
Returns configured user profile model or None if not found
"""
auth_profile_module = getattr(settings, 'AUTH_PROFILE_MODULE', None)
profile_model = None
if auth_profile_module:
# get the profile model. TODO: super flacky, refa... |
from django.test import TestCase
from django.utils.timezone import now
from ..models import Promise, VerificationDocument
from popolo.models import Person
nownow = now()
class VerificationDocumentTestCase(TestCase):
def setUp(self):
self.person = Person.objects.create(name=u"A person")
self.promise ... |
"""Univariate polynomials with galois field coefficients."""
import random
import modint
import sparse_poly
def GFPolyFactory(p):
"""Create custom class for specific coefficient type."""
coefficient_type = modint.ModularIntegerFactory(p)
class newClass(sparse_poly.SparsePolynomial):
coeff_type = coe... |
""" test with the .transform """
from io import StringIO
import numpy as np
import pytest
from pandas._libs import groupby
from pandas.core.dtypes.common import ensure_platform_int, is_timedelta64_dtype
import pandas as pd
from pandas import (
Categorical, DataFrame, MultiIndex, Series, Timestamp, concat, date_rang... |
from django.conf.urls import *
from dbe.cal.models import *
from dbe.cal.views import *
from django.contrib.auth.decorators import login_required
urlpatterns = patterns("dbe.cal.views",
(r"^month/(\d+)/(\d+)/(-?1)/$" , login_required(MonthView.as_view()), {}, "month"),
(r"^month/(\d+)/(\d+)/$" , login_req... |
from itertools import product
import numpy as np
import pytest
from pandas import DataFrame, NaT, date_range
import pandas._testing as tm
@pytest.fixture(params=product([True, False], [True, False]))
def close_open_fixture(request):
return request.param
@pytest.fixture
def float_frame_with_na():
"""
Fixture... |
import numpy as np
from .addon import AddonModel
class EffectiveStressModel(AddonModel):
"""Effective stress model"""
name = '__effstress__'
def __init__(self, porepres):
self.num_sdv = 1
self.sdv_names = ['POREPRES']
self.porepres = np.asarray(porepres)
if len(self.porepres.... |
from __future__ import division, unicode_literals, print_function
from django.core.management import BaseCommand
from applications.posts.models import Post, Category
def smart_print(text):
print(text.encode("utf-8"))
class Command(BaseCommand):
def handle(self, *args, **options):
posts = Post.objects.al... |
"""Module Description
Copyright (c) 2008 H. Gene Shin <shin@jimmy.harvard.edu>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included with
the distribution).
@status: experimental
@version: $Revision$
@author: H. Gene Shin
@contact: shin@... |
from datetime import datetime
import time
from optparse import make_option
import sys
from django.core.management.base import NoArgsCommand
import simplejson
from pillowtop.couchdb import CachedCouchDB
CHUNK_SIZE = 500
POOL_SIZE = 15
MAX_TRIES = 10
RETRY_DELAY = 60
RETRY_TIME_DELAY_FACTOR = 15
class PtopReindexer(NoArg... |
import sys
import os
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.db import connections, DEFAULT_DB_ALIAS, migrations
from django.db.migrations.loader import MigrationLo... |
from argparse import ArgumentParser
from sys import version_info
_NO_FUNC = object()
__all__ = ['App']
if version_info[0] >= 32:
text_type = basestring
else:
text_type = str
class App(object):
"""
Simple command line application.
Constructor arguments are propagated to :py:class:`ArgumentParser`.
... |
from .a import App, Other
@App.foo(name="alpha")
def f():
pass
@App.foo(name="beta")
def g():
pass
@App.foo(name="gamma")
def h():
pass
@Other.foo(name="alpha")
def i():
pass |
import re
import numpy as np
import datetime
from ..base import BaseRaw
from ..meas_info import create_info, _format_dig_points
from ..utils import _mult_cal_one
from ...annotations import Annotations
from ...utils import logger, verbose, fill_doc, warn, _check_fname
from ...utils.check import _require_version
from ..c... |
import os, sys
import math
import urllib
import urllib2
import tempfile
import StringIO
import operator
import base64
import posixpath
import os.path as systempath
import zipfile
import shutil
from hashlib import md5
from datetime import datetime
from time import strftime, localtime
from re import sub, compile, MULTILI... |
from distutils.core import setup
setup(
name='SocksiPy',
version='1.00',
py_modules=["socks", ],
) |
from . import domainresource
class StructureMap(domainresource.DomainResource):
""" A Map of relationships between 2 structures that can be used to transform
data.
"""
resource_type = "StructureMap"
def __init__(self, jsondict=None, strict=True):
""" Initialize all valid properties.
... |
""" Generator for C++ style thunks """
import glob
import os
import re
import sys
from idl_log import ErrOut, InfoOut, WarnOut
from idl_node import IDLAttribute, IDLNode
from idl_ast import IDLAst
from idl_option import GetOption, Option, ParseOptions
from idl_outfile import IDLOutFile
from idl_parser import ParseFiles... |
from __future__ import annotations
from dials.array_family import flex
class ValidatedMultiExpProfileModeller:
"""
A class to wrap profile modeller for validation
"""
def __init__(self, modellers):
"""
Init the list of MultiExpProfileModeller modellers
"""
self.modellers ... |
def extractEnlnGenerasiNet(item):
'''
Parser for 'enLN.generasi.net'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
chp_prefixes = [
('imouto sae ireba ii', 'Imouto sae Ireba ii.', ... |
"""Semi-automated code-level dependency tracking for python."""
from codedep.decorators import codeHash, codeDeps, ForwardRef, codedepEvalThunk
from codedep.compute import getHash
__version__ = '0.4.dev1' |
from kapteyn import maputils
import numpy
from service import *
fignum = 34
fig = plt.figure(figsize=figsize)
frame = fig.add_axes(plotbox)
title = r"""Hammer Aitoff projection (AIT) oblique with:
$(\alpha_p,\delta_p) = (0^\circ,30^\circ)$, $\phi_p = 75^\circ$ also:
$(\phi_0,\theta_0) = (0^\circ,90^\circ)$. (Cal. fig.3... |
from __future__ import division
import numpy as np
from ..gloo import set_state, Texture2D
from ..color import get_colormap
from .shaders import ModularProgram, Function, FunctionChain
from .transforms import NullTransform
from .visual import Visual
from ..ext.six import string_types
VERT_SHADER = """
attribute vec2 a_... |
import socket
addr = '169.254.38.91'
port = 7890
sock = socket.socket()
def r():
print "recv'd: " + sock.recv(1024)
def s(m):
sock.sendall(msg + "\r\n")
def g(m):
s(m)
r()
r()
if __name__ == '__main__':
sock.connect( (addr,port))
r()
r()
print "setup done"
#msg = "dll?lib=msvcr... |
import csv
from cStringIO import StringIO
from django.conf import settings
from django.core import mail
from django.core.cache import cache
from django.core.urlresolvers import reverse
from nose.tools import eq_
import mkt
import mkt.site.tests
from mkt.access.models import Group, GroupUser
from mkt.reviewers.models im... |
"""
amnonscript
heatsequer
supercooldb.py
the sql cooldb implementation
"""
__version__ = "0.1"
from ..utils.amnonutils import Debug,dictupper,listupper,delete
from ..utils.oboparse import Parser
from ..utils.ontologygraph import ontologysubtreeids,ontologytotree,getnodeparents,ontotreetonames
from ..experiment.expclas... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^geoprisma/', include("geoprisma.urls", namespace="geoprisma")),
url(r'^map/(?P<wsName>[\w-]+)/(?P<viewId>[\w-]+)$', 'example_project.views.maprend... |
import datetime
from django.contrib.auth.models import User
from django.contrib.comments.managers import CommentManager
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.core im... |
try:
from tn.plonehtmlpage import html_page
HAS_HTML_PAGE = True
except ImportError:
HAS_HTML_PAGE = False
if HAS_HTML_PAGE:
from five import grok
from plone import api
from Products.statusmessages.interfaces import IStatusMessage
from tn.plonebehavior.template import _
from tn.plonebeha... |
from __future__ import absolute_import
import re
import six
import uuid
from datetime import datetime
from pytz import utc
from sentry.models import ProjectKey, OrganizationOption
def _generate_pii_config(project, org_options):
scrub_ip_address = (org_options.get('sentry:require_scrub_ip_address', False) or
... |
"""
tests for magic_gui
"""
import wx
import unittest
import os
from pmagpy import pmag
from pmagpy import new_builder as nb
from pmagpy import data_model3 as data_model
from pmagpy import controlled_vocabularies3 as cv3
DMODEL = data_model.DataModel()
WD = pmag.get_test_WD()
PROJECT_WD = os.path.join(WD, "data_files",... |
import os
import re
from setuptools import setup, find_packages
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
r... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.views import View
from django.utils.decorators import method_decorator
@method_decorator(login_required, name='dispatch')
class DashboardView(View):
template_name = "index.html"
def get(self, request):
... |
import os
from flask import Blueprint, request, render_template, g
from flask.ext.login import login_required
from config import config
from werkzeug import secure_filename
from admin import perimeter_check
cms_page = Blueprint('cms_page', __name__, template_folder='templates')
@cms_page.route("/cms/")
@login_required
... |
import m5
from m5.objects import *
system = System(cpu = AtomicSimpleCPU(cpu_id=0),
physmem = PhysicalMemory(),
membus = Bus())
system.physmem.port = system.membus.port
system.cpu.connectMemPorts(system.membus)
system.cpu.clock = '2GHz'
root = Root(system = system) |
from __future__ import unicode_literals
from ..denoising import GaussianBlurImageFilter
def test_GaussianBlurImageFilter_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
inputVolu... |
from __future__ import absolute_import, division, print_function
from cryptography import utils
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.backends.openssl.utils import _truncate_digest
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitive... |
"""
Copyright (c) 2013, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of ... |
import os
from .lib import StringIO
from .processors import ProcessorPipeline
from .utils import (img_to_fobj, open_image, IKContentFile, extension_to_format,
UnknownExtensionError)
class SpecFileGenerator(object):
def __init__(self, processors=None, format=None, options=None,
autoconvert=True, ... |
"""Function for generating the SkUserConfig file, customized for Android."""
import os
AUTOGEN_WARNING = (
"""
///////////////////////////////////////////////////////////////////////////////
//
// THIS FILE IS AUTOGENERATED BY GYP_TO_ANDROID.PY. DO NOT EDIT.
//
// This file contains Skia's upstream include/config/SkUse... |
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 'Assignment'
db.create_table(u'assignment_assignment', (
(u'id', self.gf('django.db.models.fields.AutoField'... |
from __future__ import unicode_literals
from django.db import models, migrations
import django_mobile_app_distribution.models
import django.core.files.storage
class Migration(migrations.Migration):
dependencies = [
('django_mobile_app_distribution', '0001_initial'),
]
operations = [
migratio... |
import numpy as np
import pylab as pl
from matplotlib.colors import ListedColormap
from sklearn import svm
from sklearn.metrics import classification_report
N = 100
data = np.genfromtxt("classification.txt")
X = data[:, 0:2]
t = data[:, 2]
pl.figure(figsize=(18, 5))
no = 1
for kernel in ('linear', 'poly', 'rbf'):
#... |
'''It provides common statements.'''
from .util import Statement
from .clause import returning, where
from .clause import insert, columns, values, on_duplicate_key_update, replace
from .clause import select, from_, joins, group_by, having, order_by, limit, offset
from .clause import for_, of, nowait
from .clause import... |
import gtk
import gtk.glade
import gtksourceview
import gtkmozembed
PLUGIN_NAME='Browser'
PLUGIN_VERSION='0.1'
PLUGIN_EVOEDITOR_VERSION='0.1'
PLUGIN_DESCRIPTION='Plugin navegación'
PLUGIN_CONFIGURABLE=True
PLUGIN_IMAGE_PATH='plugins/browser/pixmaps/'
PLUGIN_ICON=PLUGIN_IMAGE_PATH + 'browser.png'
PLUGIN_GLADE_FILE='plug... |
"""The tests for the manual Alarm Control Panel component."""
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.setup import setup_component
from homeassistant.const import (
STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_N... |
import datetime
import hashlib
import json
from bson.objectid import ObjectId
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from mongoengine.base import ValidationError
from crits.core.class_ma... |
import numpy as np
import random
import milk.supervised.svm
import milk.supervised.multi
from milk.supervised.classifier import ctransforms
from .fast_classifier import fast_classifier
import milksets.wine
features,labels = milksets.wine.load()
A = np.arange(len(features))
random.seed(9876543210)
random.shuffle(A)
feat... |
from nose.tools import assert_true, nottest
CUSHION_PERCENT = 0.01
LOG_ALL_RESULTS = False
BENCHMARK_TO_DESIRED_KEY_MAP = {
"index": "Index splitting",
"random": "Random splitting",
"scaffold": "Scaffold splitting",
"logreg": "logistic regression",
"tf": "Multitask network",
"tf_robust": "robust... |
from collections import OrderedDict
from typing import Optional
from qrl.core import config
from qrl.core.Message import Message
from qrl.core.MessageRequest import MessageRequest
from qrl.core.txs.CoinBase import CoinBase
from qrl.generated import qrllegacy_pb2
from qrl.generated.qrllegacy_pb2 import LegacyMessage
cla... |
import os
import tornado.autoreload
import tornado.ioloop
import tornado.web
from tornado_project_skeleton.tools import config
pwd = os.path.dirname(os.path.abspath(__file__))
config.add_config_ini('%s/main.ini' % pwd)
class MainHandler(tornado.web.RequestHandler):
def get(self):
name = config.NAME
... |
from __future__ import with_statement
import warnings
from unittest import TestCase
class DeprecationTest(TestCase):
# python >= 2.6 is required to make deprecation warning tests useful
# this DeprecationTest is always successful for python < 2.6
def assertDeprecated(self, cls, *args, **kwargs):
if ... |
"""
A component which allows you to send data to StatsD.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/statsd/
"""
import logging
import homeassistant.util as util
from homeassistant.const import EVENT_STATE_CHANGED
from homeassistant.helpers import sta... |
"""
WSGI config for superlists project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... |
from MOAIRuntime import MOAIRuntime
from LuaPrint import tracebackFunc, luaBeforePrint, luaAfterPrint, printSeparator |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/intangible/pet/shared_bordok_hue.iff"
result.attribute_template_id = -1
result.stfName("","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result |
from remote_helper.job import Job, NullJob
class JobContainer:
"""
A container for a single Job instance.
"""
def __init__(self):
self._job = NullJob()
def create_new_job(self, events_url):
self._job = Job(events_url)
def get(self):
return self._job |
import time
import datetime
import logging
import urllib2
from shapely.wkt import loads
from owslib.util import http_post
from pycsw.core.etree import etree
LOGGER = logging.getLogger(__name__)
ranking_enabled = False
ranking_pass = False
ranking_query_geometry = ''
def get_today_and_now():
"""Get the date, right n... |
from django.apps import AppConfig
class WwwConfig(AppConfig):
name = "www" |
from __future__ import division
import os
import numpy as np
import tensorflow as tf
def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def _float32_feature(value):
... |
from __future__ import print_function, absolute_import, division
import pytest
import numpy as np
import numpy.testing as npt
import astropy.units as u
from ..io.sim_tools import create_cube_header, create_image_header, create_fits_hdu
def test_create_cube_header():
pixel_scale = 0.001 * u.deg
spec_pixel_scale ... |
'''cgat_logfiles2tsv.py - create summary from logfiles
===================================================
Purpose
-------
This script takes a list of logfiles and collates summary information
about execution times. This can be useful for post-mortem
benchmark analysis.
This script uses the ``# job finished`` tag that ... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/droid/shared_droid_damage_repair_kit_c.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.