content string |
|---|
# -*- coding: utf-8 -*-
"""
celery.utils.threads
~~~~~~~~~~~~~~~~~~~~
Threading utilities.
"""
from __future__ import absolute_import, print_function
import os
import socket
import sys
import threading
import traceback
from contextlib import contextmanager
from celery.local import Proxy
from celery.fiv... |
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
import numpy as np
# To compile and install locally run "python setup.py build_ext --inplace"
# To install library to Python site-packages run "python setup.py build_ext install"
ext_modules = [
Extension... |
from __future__ import absolute_import
from ..model import Model
from ..core.properties import Any, Dict, Float, String, Int, Bool, Override
class TileSource(Model):
""" A base class for all tile source types. ``TileSource`` is
not generally useful to instantiate on its own. In general, tile sources are used ... |
#www.stuffaboutcode.com
#Raspberry Pi, Minecraft Analogue Clock
#import the minecraft.py module from the minecraft directory
import minecraft.minecraft as minecraft
#import minecraft block module
import minecraft.block as block
#import time, so delays can be used
import time
#import datetime, to get the time!
import d... |
"""
.. dialect:: mssql+adodbapi
:name: adodbapi
:dbapi: adodbapi
:connectstring: mssql+adodbapi://<username>:<password>@<dsnname>
:url: http://adodbapi.sourceforge.net/
.. note::
The adodbapi dialect is not implemented SQLAlchemy versions 0.6 and
above at this time.
"""
import datetime
from s... |
"""
SmartCameraConfig class : handles config for the smart_camera project
smart_camera.cnf file is created in the local directory
other classes or files wishing to use this class should add
import sc_config
"""
from os.path import expanduser
import ConfigParser
class SmartCameraConfig(object):
def __init_... |
"""
Specific overrides to the base prod settings to make development easier.
"""
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
# Don't use S3 in devstack, fall back to filesystem
del DEFAULT_FILE_STORAGE
MEDIA_ROOT = "/edx/var/edxapp/uploads"
DEBUG = True
USE_I18N = True
TEMPLATE_DEB... |
__all__ = ['imread', 'imread_collection']
import skimage.io as io
try:
from astropy.io import fits as pyfits
except ImportError:
try:
import pyfits
except ImportError:
raise ImportError(
"PyFITS could not be found. Please refer to\n"
"http://www.stsci.edu/resources/... |
"""
Creates permissions for all installed apps that need permissions.
"""
from django.contrib.auth import models as auth_app
from django.db.models import get_models, signals
def _get_permission_codename(action, opts):
return u'%s_%s' % (action, opts.object_name.lower())
def _get_all_permissions(opts):
"Retu... |
from webkitpy.tool.commands.commandtest import CommandsTest
from webkitpy.tool.commands.suggestnominations import SuggestNominations
from webkitpy.tool.mocktool import MockOptions, MockTool
class SuggestNominationsTest(CommandsTest):
mock_git_output = """commit 60831dde5beb22f35aef305a87fca7b5f284c698
Author: <E... |
"""
Tests for TypedPropertyCollection class.
"""
__version__='''$Id$'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
setOutDir(__name__)
import os, sys, copy
from os.path import join, basename, splitext
import unittest
from reportlab.graphics.widgetbase import PropHolder, TypedProper... |
import json
import logging
from time import time
from celery import current_task
from django.db import reset_queries
import dogstats_wrapper as dog_stats_api
from lms.djangoapps.instructor_task.models import PROGRESS, InstructorTask
from util.db import outer_atomic
TASK_LOG = logging.getLogger('edx.celery.task')
c... |
from django.db.models.expressions import RawSQL
def get_value(keys, dict_, default=None):
"""
Given a list of keys, search in a dict for the first matching keys (case insensitive) and return the value
Note: the search is case insensitive.
:param keys: list of possible keys
:param dict_:
:param... |
from setuptools import setup
setup(
name='flask_signedcookies',
version='1.0.0',
url='https://github.com/lovette/flask_signedcookies',
download_url = 'https://github.com/lovette/flask_signedcookies/archive/master.tar.gz',
license='BSD',
author='Lance Lovette',
author_email='<EMAIL>',
descr... |
"""
This tutorial introduces stacked denoising auto-encoders (SdA) using Theano.
Denoising autoencoders are the building blocks for SdA.
They are based on auto-encoders as the ones used in Bengio et al. 2007.
An autoencoder takes an input x and first maps it to a hidden representation
y = f_{\theta}(x) = s(Wx+b),... |
from __future__ import print_function, unicode_literals
import os
import os.path as path
import subprocess
import sys
from time import time
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
from servo.command_base import CommandBase, cd
def is_headless_build():
return int(... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
# =======================================
# twilio module support methods
#
import json
fr... |
"""The jewish_calendar component."""
import logging
import hdate
import voluptuous as vol
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import async_load_platform
_LOGGER = logging.getLogger(__name__)... |
import hashlib
import json
import logging
import os
import re
import shutil
import subprocess
import sys
import tempfile
from proc_maps import ProcMaps
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
REDUCE_DEBUGLINE_PATH = os.path.join(BASE_PATH, 'reduce_debugline.py')
LOGGER = logging.getLogger('prepare_sym... |
{
'name' : 'OHADA - Accounting',
'version' : '1.0',
'author' : 'Baamtu Senegal',
'category' : 'Localization/Account Charts',
'description': """
This module implements the accounting chart for OHADA area.
===========================================================
It allows any company or associ... |
"""
The Tornado Framework
By Ali Pesaranghader
University of Ottawa, Ontario, Canada
E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com
"""
import os
import zipfile
from os.path import basename
class Archiver:
"""
This class stores results of experiments in .zip files for fut... |
import os, unittest
from django.db import settings
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.utils import GeoIP, GeoIPException
# Note: Requires use of both the GeoIP country and city datasets.
# The GEOIP_DATA path should be the only setting set (the directory
# should contain links or ... |
class TestConfiguration(object):
def __init__(self, version, architecture, build_type):
self.version = version
self.architecture = architecture
self.build_type = build_type
@classmethod
def category_order(cls):
"""The most common human-readable order in which the configurati... |
"""
Fakes For Scheduler tests.
"""
import mox
from nova.compute import vm_states
from nova import db
from nova.openstack.common import jsonutils
from nova.scheduler import filter_scheduler
from nova.scheduler import host_manager
COMPUTE_NODES = [
dict(id=1, local_gb=1024, memory_mb=1024, vcpus=1,
... |
# $HeadURL$
__RCSID__ = "$Id$"
import urllib2, re, tarfile, os, types, sys, subprocess, urlparse, tempfile
from DIRAC import gLogger, S_OK, S_ERROR
from DIRAC.Core.Utilities import CFG, File, List
class Distribution:
cernAnonRoot = 'http://svn.cern.ch/guest/dirac'
googleAnonRoot = 'http://dirac-grid.googlecode.... |
from openerp.osv import orm, fields
class res_partner(orm.Model):
"""
Inherits partner and adds airport and iata_code fields in the partner
form
"""
_inherit = 'res.partner'
_columns = {
'railway_station': fields.boolean('Railway Station'),
}
_defaults = {
'railway_sta... |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=... |
import asn1
import hashlib
import os
# This file implements very minimal certificate and OCSP generation. It's
# designed to test revocation checking.
def RandomNumber(length_in_bytes):
'''RandomNumber returns a random number of length 8*|length_in_bytes| bits'''
rand = os.urandom(length_in_bytes)
n = 0
for ... |
import itertools
from hachoir_core.field import MissingField
class FakeArray:
"""
Simulate an array for GenericFieldSet.array(): fielset.array("item")[0] is
equivalent to fielset.array("item[0]").
It's possible to iterate over the items using::
for element in fieldset.array("item"):
... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""Ensure that rate limiting is enabled by default. """
orm['util.RateLimitConfiguration'].objects.create(enable... |
class FileProxyMixin(object):
"""
A mixin class used to forward file methods to an underlaying file
object. The internal file object has to be called "file"::
class FileProxy(FileProxyMixin):
def __init__(self, file):
self.file = file
"""
encoding = property(la... |
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.oneview import OneViewModuleBase
class EthernetNetworkFactsModu... |
'''
Mesh Manipulation Example
=========================
This demonstrates creating a mesh and using it to deform the texture (the
kivy log). You should see the kivy logo with a five sliders to right.
The sliders change the mesh points' x and y offsets, radius, and a
'wobble' deformation's magnitude and speed.
This ex... |
from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class City3D(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(dim=3)
objects = models.GeoManager()
def __str__(self):
return self.n... |
from google.appengine.ext import db
from google.appengine.api import users
from json import JSONDecoder
class DictModel(db.Model):
def to_dict(self):
decoder = JSONDecoder()
result = dict(
[
(p[:-len('_json')], decoder.decode(getattr(self, p))) if p.endswith('_json') el... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = r'''
---
module: win_user
version_added: "1.7"
short_description: Manages local Windows user accounts
description:
- Manages local Windows user accounts
... |
#!/usr/bin/env python3
"""
# OpenWrt download directory cleanup utility.
# Delete all but the very last version of the program tarballs.
#
# Copyright (C) 2010-2015 Michael Buesch <<EMAIL>>
# Copyright (C) 2013-2015 OpenWrt.org
"""
from __future__ import print_function
import sys
import os
import re
import getopt
# ... |
import os
import sys
from select import select
from subprocess import Popen, PIPE
import rpyc
err = ""
def handleInterpreter(conn, fd, data):
global err
if fd == p.stderr.fileno():
datastr = str(data, 'utf8')
if datastr == '>>> ':
return
if 'Type "help", "co... |
from sympy.utilities.pytest import raises, USE_PYTEST
if USE_PYTEST:
import py.test
pytestmark = py.test.mark.skipif(USE_PYTEST,
reason=("using py.test"))
# Test callables
def test_expected_exception_is_silent_callable():
def f():
raise ValueError()
raise... |
import eventlet
import json
from flask import request, json, Flask, Response # noqa
from st2reactor.sensor.base import Sensor
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=True,
time=True)
class SmartThingsSensor(Sensor):
def __init__(self, sensor_service, config=None):
... |
try:
import boto3
from botocore.exceptions import ClientError, ParamValidationError, MissingParametersError
HAS_BOTO3 = True
except ImportError:
HAS_BOTO3 = False
class AWSConnection:
"""
Create the connection object and client objects as required.
"""
def __init__(self, ansible_obj, ... |
DATE_FORMAT = 'j F Y' # '20 januari 2009'
TIME_FORMAT = 'H:i' # '15:23'
DATETIME_FORMAT = 'j F Y H:i' # '20 januari 2009 15:23'
YEAR_MONTH_FORMAT = 'F Y' # 'januari 2009'
MONTH_DAY_FORMAT = 'j F' # '20 januari'
SHORT_DATE_FORMAT = 'j-n-Y' ... |
#!/usr/bin/env python
from omics_pipe.parameters.default_parameters import default_parameters
from omics_pipe.utils import *
p = Bunch(default_parameters)
def bwa1(sample, bwa1_flag):
'''BWA aligner for read1 of paired_end reads.
input:
.fastq
output:
.sam
citation:
Li... |
#!/usr/bin/env python3
"""JACK client that creates minor triads from single MIDI notes.
All MIDI events are passed through.
Two additional events are created for each NoteOn and NoteOff event.
"""
import jack
import struct
# First 4 bits of status byte:
NOTEON = 0x9
NOTEOFF = 0x8
INTERVALS = 3, 7 # minor triad
c... |
import unittest2 as unittest
from webkitpy.common.net.buildbot import Builder
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.thirdparty.mock import Mock
from webkitpy.tool.bot.sheriff import Sheriff
from webkitpy.tool.mocktool import MockTool
class MockSheriffBot(object):
name = "mo... |
"""The 'mailman' command dispatcher."""
__all__ = [
'main',
]
import os
import argparse
from functools import cmp_to_key
from mailman.core.i18n import _
from mailman.core.initialize import initialize
from mailman.interfaces.command import ICLISubCommand
from mailman.utilities.modules import find_components
... |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
from threading import Lock
from copy import deepcopy
from time import sleep
from functools import wraps
from powerline.renderer import Renderer
from powerline.lib.config import ConfigLoader
fr... |
import os.path
import sys
from warnings import warn
try:
_console = sys._jy_console
_reader = _console.reader
except AttributeError:
raise ImportError("Cannot access JLine2 setup")
try:
# jarjar-ed version
from org.python.jline.console.history import MemoryHistory
except ImportError:
# dev ver... |
"""
Template file used by the OPF Experiment Generator to generate the actual
description.py file by replacing $XXXXXXXX tokens with desired values.
This description.py file was generated by:
'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupicengine/frameworks/opf/expGenerator/ExpGenerator.pyc'
"""
from... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 07 17:44:20 2016
A module to store operations related to matrix tranformations.
@author: Luke
"""
import Point as p
import Line as l
import constants as c
import numpy
import math
def translateMatrix(shiftX, shiftY, shiftZ=0):
transMatrix = numpy.identity(4)
t... |
import numpy as np
from numpy.testing import assert_array_equal
from nose import with_setup
from nose.tools import (assert_equal, assert_raises)
try:
from nose.tools import assert_is
except ImportError:
from landlab.testing.tools import assert_is
from landlab.grid import raster_funcs as rfuncs
from landlab imp... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
... |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import glob
import os
import shutil
import sys
import zlib
from distutils.core impo... |
import pkg_resources
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
class Core(object):
@classmethod
def js_package(cls):
return __package__
@classmethod
def css_package(cls):
return __package__
@classmethod
def image_... |
import os, sys
from gi.repository import Gtk
from autokey.configmanager import *
from autokey import iomediator, model, common
from dialogs import GlobalHotkeyDialog
import configwindow
DESKTOP_FILE = "/usr/share/applications/autokey-gtk.desktop"
AUTOSTART_DIR = os.path.expanduser("~/.config/autostart")
AUTOSTART_FIL... |
"""Contains test utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from tensorflow.core.example import example_pb2
from tensorflow.core.example import feature_pb2
from tensorflow.python.framework import constant_op... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import keyword as kw
import sympy
from .repr import ReprPrinter
from .str import StrPrinter
# A list of classes that should be printed using StrPrinter
STRPRINT = ("Add", "Infinity", "Integer", "Mul", "NegativeInfinity",
"Pow", "Zero... |
"""Tests for the compute extra resources framework."""
from oslo_config import cfg
from stevedore import extension
from stevedore import named
from nova.compute import resources
from nova.compute.resources import base
from nova.compute.resources import vcpu
from nova import context
from nova.objects import flavor as... |
from __future__ import print_function
from contextlib import closing
from PIL import ImageChops, ImageStat
from videosequence import VideoSequence
def assert_images_not_equal(im1, im2):
diff = ImageChops.difference(im1, im2)
for min_, max_ in ImageStat.Stat(diff).extrema:
if max_ > 0:
retu... |
"""Utility ops shared across tf.contrib.signal."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import fractions
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_util
from tensorflow.python.ops import array_ops
... |
import uuid
import mock
from neutron.extensions import securitygroup as ext_sg
from neutron import manager
from neutron.plugins.oneconvergence import plugin as nvsd_plugin
from neutron.tests import tools
from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc
from neutron.tests.unit.extensions imp... |
from __future__ import unicode_literals
from .common import InfoExtractor
class EbaumsWorldIE(InfoExtractor):
_VALID_URL = r'https?://www\.ebaumsworld\.com/video/watch/(?P<id>\d+)'
_TEST = {
'url': 'http://www.ebaumsworld.com/video/watch/83367677/',
'info_dict': {
'id': '83367677... |
def thrustDice(value):
if value <= 10:
return 1
if value < 40:
return (value - 11) // 8 + 1
if value < 60:
return (value - 5) // 10 + 1
return (value) // 10 + 1
def thrustModifier(value):
if value <= 10:
return (value - 11) // 2 - 1
if value < 40:
return... |
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2007 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/license... |
#!/usr/bin/env python
__all__ = ['Cube',
'Cylinder',
'Cone',
'Sphere',
'Circle',
'Plane',
'Tetrahedron',
'Octahedron',
'Icosahedron',
'Torus',
'TorusKnot',
'Tube']
import numpy as np
# This is a ... |
"""Runs findbugs, and returns an error code if there are new warnings.
This runs findbugs with an additional flag to exclude known bugs.
To update the list of known bugs, do this:
findbugs_diff.py --rebaseline
Note that this is separate from findbugs_exclude.xml. The "exclude" file has
false positives that we do n... |
"""
This module provies an interface to the Elastic MapReduce (EMR)
service from AWS.
"""
from connection import EmrConnection
from step import Step, StreamingStep, JarStep
from bootstrap_action import BootstrapAction
from boto.regioninfo import RegionInfo
def regions():
"""
Get all available regions for the ... |
from kivy.adapters.dictadapter import DictAdapter
from kivy.uix.selectableview import SelectableView
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.listview import ListView, ListItemButton
from kivy.lang import Builder
from kivy.factory import Factory
from fixtures im... |
#
# iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_1')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(m... |
import os
import os.path as osp
import xml.etree.ElementTree as ET
import numpy as np
import scipy.sparse
import scipy.io as sio
# from utils.cython_bbox import bbox_overlaps
years = {'2013': '2013',
'2014': ['0000', '0001', '0002', '0003', '0004', '0005', '0006']}
name = 'ILSVRC'
_MAX_TRAIN_NUM = 20000
... |
'''
Uses numerical integration to calculate accurate values to test against.
This should only be run after `python setup.py build_ext --inplace`.
'''
import os
import sys
import fdint
tests_dir = os.path.join(os.path.dirname(__file__), '../fdint/tests/')
import warnings
import numpy
from numpy import exp, sqrt
from ... |
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.urls import reverse
from django.views.generic import FormView, ListView
from osf.models import OSFGroup
from admin.osf_groups.forms import OSFGroupSearchForm
from admin.base.views import GuidView
from admin.osf_groups.serializers import seriali... |
"""Certificates API
This is a Python API for generating certificates asynchronously.
Other Django apps should use the API functions defined in this module
rather than importing Django models directly.
"""
import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from eventtracking ... |
""" Update all copyright notices to the current year.
Does a search for a specific copyright notice of last year and replaces
it with a version for this year. Other copyright mentionings are listed,
but left unmodified.
If an argument is given, use that as the name of the copyright holder,
otherwise use the name speci... |
"""Module with classes to integrate MM charges into
a QM calculation.
"""
from psi4.driver import *
class Diffuse(object):
def __init__(self, molecule, basisname, ribasisname):
self.molecule = molecule
self.basisname = basisname
self.ribasisname = ribasisname
self.basis = None
... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'j... |
# tested with python2.7 and 3.4
from spyre import server
import pandas as pd
import json
try:
import urllib2
except ImportError:
import urllib.request as urllib2
class StockExample(server.App):
def __init__(self):
# implements a simple caching mechanism to avoid multiple calls to the yahoo finance api
self.d... |
"""Pseudo terminal utilities."""
# Bugs: No signal handling. Doesn't set slave termios and window size.
# Only tested on Linux.
# See: W. Richard Stevens. 1992. Advanced Programming in the
# UNIX Environment. Chapter 19.
from select import select
import os
import tty
__all__ = ["openpty","fork","spaw... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class KeyPoolTest(BitcoinTestFramework):
def run_test(self):
nodes = self.nodes
addr_before_encrypting = nodes[0].getnewaddress()
addr_before_encrypting_data = nodes[0].validateaddress(addr_bef... |
import os
import re
from uuid import UUID
from ansible.module_utils.basic import BOOLEANS
from ansible.module_utils.six import text_type, binary_type
FINAL_STATUSES = ('ACTIVE', 'ERROR')
VOLUME_STATUS = ('available', 'attaching', 'creating', 'deleting', 'in-use',
'error', 'error_deleting')
CLB_ALGOR... |
from collections import OrderedDict
import glob
import os
try:
# Python 3
from urllib.parse import urlparse, parse_qs
except ImportError:
# Python 2
from urlparse import urlparse, parse_qs
import IPython.display
import cartopy.crs as ccrs
import ipywidgets
import iris
import iris.plot as iplt
import ma... |
"""Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
from __future__ import print_function
from collections import defaultdict
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model import lars_pat... |
"""High level API for learning with TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
# pylint: disable=wildcard-import
from tensorflow.contrib.learn.python.learn import datasets
from tensorflow.contrib.learn.python.learn im... |
from weboob.tools.test import BackendTest
import urllib
from random import choice
class AttilasubTest(BackendTest):
MODULE = 'attilasub'
def test_subtitle(self):
subtitles = list(self.backend.iter_subtitles('fr', 'spiderman'))
assert (len(subtitles) > 0)
for subtitle in subtitles:
... |
import time
import select
import socket
import struct
import threading
import errno
from .amspacket import AmsPacket
from .adsconnection import AdsConnection
from .adsexception import AdsException
from .commands import *
class InvalidPacket(AdsException):
pass
class AdsClient:
def __init__(self, adsConnecti... |
import sys
import os
import re
def print_environ(environ=os.environ):
"""Dump the shell environment as HTML."""
keys = environ.keys()
keys.sort()
i = 0
for key in keys:
if not re.search("^HTTP_|^REQUEST_", key):
continue
if i == 0:
print """<tr class="normal"><td>""",... |
# -*- coding: utf-8 -*-
import sys
import os
import math
#读写文件接口函数文件函数
def read_write_file(rfname,wfname,resource_files):
readf = open(rfname,'r')
writef = open(wfname,'w')
for line in readf:
#add other functions to deal with each line
result_line = location_extr(line.strip(),resource_files)
writef.write(re... |
from sqlalchemy import Unicode, Date, Integer
from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.orm import relationship
import sqlalchemy.types
from camelot.admin.entity_admin import EntityAdmin
from camelot.core.orm import Entity
import camelot.types
class Movie( Entity ):
__tablename__ =... |
"""
This is the play
"""
import numpy as np
import matplotlib.pyplot as plt
import math
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
from functions import selection_algorithm, scl
from csl import CSL
plot = True
verbose = False
tracking = True
selection = False
# Generate the data
n_sa... |
data = (
's', # 0x00
't', # 0x01
'u', # 0x02
'v', # 0x03
'w', # 0x04
'x', # 0x05
'y', # 0x06
'z', # 0x07
'A', # 0x08
'B', # 0x09
'C', # 0x0a
'D', # 0x0b
'E', # 0x0c
'F', # 0x0d
'G', # 0x0e
'H', # 0x0f
'I', # 0x10
'J', # 0x11
'K', # 0x12
'L', # 0x13
'M', # 0... |
import unittest
from api_list_data_source import APIListDataSource
from compiled_file_system import CompiledFileSystem
from copy import deepcopy
from object_store_creator import ObjectStoreCreator
from test_file_system import TestFileSystem
def _ToTestData(obj):
'''Transforms |obj| into test data by turning a list o... |
from keras.models import Graph
from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D
from keras.layers.advanced_activations import PReLU
import datetime
'''
Inception v3 paper
http://arxiv.org/pdf/1512.00567v1.pdf
Old inception paper
http://arxiv.org/pdf/1409.4842.pdf
'''
def activation_fu... |
from __future__ import absolute_import, unicode_literals
import os
import pytest
from case import Mock, mock, patch
from celery.bin.base import Command, Extensions, Option
from celery.five import bytes_if_py2
class MyApp(object):
user_options = {'preload': None}
APP = MyApp() # <-- Used by test_with_custom_... |
"""
Example of parallel implementation of betweenness centrality using the
multiprocessing module from Python Standard Library.
The function betweenness centrality accepts a bunch of nodes and computes
the contribution of those nodes to the betweenness centrality of the whole
network. Here we divide the network in chu... |
"""
##########
IDMapShift
##########
IDMapShift is a tool that properly sets the ownership of a filesystem for use
with linux user namespaces.
=====
Usage
=====
nova-idmapshift -i -u 0:10000:2000 -g 0:10000:2000 path
This command will idempotently shift `path` to proper ownership using
the provided uid and gid ... |
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'community',
'version': '1.0'}
# import cloudstack common
from ansible.module_utils.cloudstack import *
class AnsibleCloudStackConfiguration(AnsibleCloudStack):
def __init__(self, module):
super(Ans... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script will be used to create test data set. It is also called by:
- test_small_file_rule.py
- test_small_file_actions.py
"""
import sys
import ast
import os
import re
import argparse
from util import *
def create_test_set(file_set_nums, file_size, base_dir, deb... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.network.nxos.nxos import load_config, run_commands
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
from ansibl... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: bigip_gtm_datacenter
short_description: Manage Data... |
"""
Management class for migration / resize operations.
"""
import os
from nova import exception
from nova.openstack.common import excutils
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import units
from nova.virt import configdrive
from no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.