content
string
"""This module implements a loader and dumper for the svmlight format This format is a text-based format, with one sample per line. It does not store zero valued features hence is suitable for sparse dataset. The first element of each line can be used to store a target variable to predict. This format is used as the...
from __future__ import unicode_literals import warnings import dnf.exceptions import dnf.pycomp warnings.filterwarnings('once', category=dnf.exceptions.DeprecationWarning) import dnf.const __version__ = dnf.const.VERSION import dnf.base Base = dnf.base.Base # :api import dnf.plugin Plugin = dnf.plugin.Plugin # :api...
# source: http://stackoverflow.com/questions/2758159/how-to-embed-a-python-interpreter-in-a-pyqt-widget import sys, os, re import traceback, platform from PyQt4 import QtCore from PyQt4 import QtGui from chainkey import util if platform.system() == 'Windows': MONOSPACE_FONT = 'Lucida Console' elif platform.syste...
# WSGI Handler sample configuration file. # # Change the appropriate settings below, in order to provide the parameters # that would normally be passed in the command-line. # (at least conf['addons_path']) # # For generic wsgi handlers a global application is defined. # For uwsgi this should work: # $ uwsgi_python --...
import sys import database.clblast as clblast def get_best_results(database): """Retrieves the results with the lowest execution times""" sections_best = [] for section in database["sections"]: section_best = {} # Stores all the section's meta data for attribute in section.keys()...
from slicc.ast.StatementAST import StatementAST from slicc.symbols import Type class IfStatementAST(StatementAST): def __init__(self, slicc, cond, then, else_): super(IfStatementAST, self).__init__(slicc) assert cond is not None assert then is not None self.cond = cond sel...
from quantumclient.quantum import client from quantumclient.client import HTTPClient from quantumclient.common import exceptions class CommonQuantumClient(object): def __init__(self, project, user, passwd, api_server_ip): AUTH_URL = 'http://%s:5000/v2.0' % (api_server_ip) httpclient = HTTPClient(...
import bottle import json import platform import sys import time import traceback from bottle import request from ycmd import extra_conf_store, hmac_plugin, server_state, user_options_store from ycmd.responses import ( BuildExceptionResponse, BuildCompletionResponse, ...
# -*- coding: utf-8 -*- import re import time from pyload.plugin.Account import Account class FilerNet(Account): __name = "FilerNet" __type = "account" __version = "0.04" __description = """Filer.net account plugin""" __license = "GPLv3" __authors = [("stickell", "<EMAIL>")] ...
import unittest from io import BytesIO from scrapy.mail import MailSender class MailSenderTest(unittest.TestCase): def test_send(self): mailsender = MailSender(debug=True) mailsender.send(to=['<EMAIL>'], subject='subject', body='body', _callback=self._catch_mail_sent) assert self.catched...
# -*- coding: utf-8 -*- from scrapy.spiders import Spider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request from scrapy.conf import settings from beerindex.items import WineIndexItem import logging import lxml.html from urlparse import urlparse import re class WineSpider(Spider): name =...
from datetime import datetime, timedelta import unittest from airflow.macros import hive class Hive(unittest.TestCase): def test_closest_ds_partition(self): d1 = datetime.strptime('2017-04-24', '%Y-%m-%d') d2 = datetime.strptime('2017-04-25', '%Y-%m-%d') d3 = datetime.strptime('2017-04-26...
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.basic import AnsibleModule from ansible.module_utils.openstack im...
from fvh import MyTurtle masterHexSet=[] masterHexList=[] distanceBetweenLayers=None points=["sw","se","e","ne","nw","w"] def drawit(circleXfromCenter,rootHex): heading=90 rootHex.turt.pu() rootHex.turt.seth(heading) rootHex.setDistanceBetweenLayers() rootHex.turt.fd(distanceBetweenLayers) newt...
""".""" from dhcpcanon.dhcpcaplease import DHCPCAPLease LEASE_INIT = DHCPCAPLease(interface='enp0s25', address='', server_id='', next_server='', router='', subnet_mask='', broadcast_address='', domain='', name_server='', lease_time='', renew...
import pytest, py def exvalue(): return py.std.sys.exc_info()[1] def f(): return 2 def test_assert(): try: assert f() == 3 except AssertionError: e = exvalue() s = str(e) assert s.startswith('assert 2 == 3\n') def test_assert_within_finally(): excinfo = py.test.r...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} try: import shade HAS_SHADE = True except ImportError: HAS_SHADE = False from distutils.version import StrictVersion def _choose_id_value(module): if module.par...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Hit.added' db.alter_column(u'cached_hitcount_hit', 'ad...
# -*- coding: utf-8 -*- """Test cases for the WikidataQuery query syntax and API.""" # # (C) Pywikibot team, 2014 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, unicode_literals import os import time import pywikibot import pywikibot.data.wikidataquery as query from py...
"""Ops to manipulate lists of tensors.""" # pylint: disable=g-bad-name from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_...
import optparse, os, sys, tempfile, shutil, stat class PassThroughParser(optparse.OptionParser): def _process_args(self, largs, rargs, values): while rargs: try: optparse.OptionParser._process_args(self,largs,rargs,values) except (optparse.BadOptionError,optparse.Amb...
"""Tests for distutils.command.build_py.""" import os import sys import StringIO import unittest from distutils.command.build_py import build_py from distutils.core import Distribution from distutils.errors import DistutilsFileError from distutils.tests import support from test.test_support import run_unittest cla...
import math import IECore import Gaffer import GafferDispatch class Wedge( GafferDispatch.TaskContextProcessor ) : Mode = IECore.Enum.create( "FloatRange", "IntRange", "ColorRange", "FloatList", "IntList", "StringList" ) def __init__( self, name = "Wedge" ) : GafferDispatch.TaskContextProcessor.__init__( self...
import os, sys SKIP = ['deprecated.c', 'entries.c', 'entries.h', 'old-and-busted.c'] TERMS = ['svn_wc_adm_access_t', 'svn_wc_entry_t', 'svn_wc__node_', 'svn_wc__db_temp_', 'svn_wc__db_node_hidden', 'svn_wc__loggy', 'svn_wc__db_wq_add', ...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from collections import namedtuple from pants.reporting.report import Report class Reporter(object): """Formats and emits reports. Subclasses implement the cal...
import time from openerp.osv import osv from openerp.tools.misc import formatLang from openerp.tools.translate import _ from openerp.report import report_sxw from openerp.exceptions import UserError class report_expense(report_sxw.rml_parse): def set_context(self, objects, data, ids, report_type=None): r...
"""Handler for benchmark.html.""" def web_socket_do_extra_handshake(request): # Turn off compression. request.ws_extension_processors = [] def web_socket_transfer_data(request): data = '' while True: command = request.ws_stream.receive_message() if command is None: retur...
import unittest from betfairlightweight import resources from tests.tools import create_mock_json class ScoreResourcesTest(unittest.TestCase): def test_racedetails(self): mock_response = create_mock_json("tests/resources/racedetails.json") resource = resources.RaceDetails(**mock_response.json()) ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unicodedata class Word(object): """ """ def __init__(self, input): self.original = input if isinstance(input, bytes): self.decoded = input.decode('utf-8', 'ignore') else: self.decoded = i...
"""Tests for baremetal utils.""" import errno import os from nova import test from nova.virt.baremetal import utils class BareMetalUtilsTestCase(test.TestCase): def test_random_alnum(self): s = utils.random_alnum(10) self.assertEqual(len(s), 10) s = utils.random_alnum(100) self....
"""For more tests on satisfiability, see test_dimacs""" from sympy import symbols, Q from sympy.logic.boolalg import And, Implies, Equivalent, true, false from sympy.logic.inference import literal_symbol, \ pl_true, satisfiable, valid, entails, PropKB from sympy.logic.algorithms.dpll import dpll, dpll_satisfiable...
from __future__ import unicode_literals template = { "Resources": { "HostedZone": { "Type": "AWS::Route53::HostedZone", "Properties": { "Name": "my_zone" } }, "my_health_check": { "Type": "AWS::Route53::HealthCheck", ...
from openerp import models, api from openerp.models import BaseModel class BaseModelExtend(models.BaseModel): _name = 'basemodel.extend' def _register_hook(self, cr): @api.multi def new_export_rows(self, fields): """ Export fields of the records in ``self``. ...
# -*- coding: utf-8 -*- """ pygments.formatters.other ~~~~~~~~~~~~~~~~~~~~~~~~~ Other formatters: NullFormatter, RawTokenFormatter. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.formatter import Formatter from pygments...
# coding: utf-8 from msgpack._version import version from msgpack.exceptions import * from collections import namedtuple class ExtType(namedtuple('ExtType', 'code data')): """ExtType represents ext type in msgpack.""" def __new__(cls, code, data): if not isinstance(code, int): raise TypeE...
""" Copyright (c) 2003-2007 LOGILAB S.A. (Paris, FRANCE). http://www.logilab.fr/ -- mailto:<EMAIL> manipulate pdf and fdf files. pdftk recommended. Notes regarding pdftk, pdf forms and fdf files (form definition file) fields names can be extracted with: pdftk orig.pdf generate_fdf output truc.fdf to merge fdf an...
"""C++ keywords and helper utilities for determining keywords.""" __author__ = '<EMAIL> (Neal Norwitz)' try: # Python 3.x import builtins except ImportError: # Python 2.x import __builtin__ as builtins if not hasattr(builtins, 'set'): # Nominal support for Python 2.3. from sets import Set a...
from __future__ import with_statement import re import os import random import copy import time from BaseHTTPServer import BaseHTTPRequestHandler from datetime import datetime, date from urllib2 import urlopen, URLError from cPickle import dump, load, HIGHEST_PROTOCOL from xml.sax import make_parser, SAXExc...
import os import sys from pbr import find_package from pbr.hooks import base def get_manpath(): manpath = 'share/man' if os.path.exists(os.path.join(sys.prefix, 'man')): # This works around a bug with install where it expects every node # in the relative data directory to be an actual directo...
# -*- 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 model 'XBlockAsidesConfig' db.create_table('lms_xblock_xblockasidesconfig', ( ('id', se...
import os import traceback from distutils import version import yaml from cloudlib import arguments from cloudlib import indicator from cloudlib import shell VERSION_DESCRIPTORS = ['>=', '<=', '==', '!=', '<', '>'] REQUIREMENTS_FILE_TYPES = [ 'requirements.txt', 'global-requirements.txt', 'test-requi...
from doit import exceptions class TestInvalidCommand(object): def test_just_string(self): exception = exceptions.InvalidCommand('whatever string') assert 'whatever string' == str(exception) def test_task_not_found(self): exception = exceptions.InvalidCommand(not_found='my_task') ...
#!/usr/bin/env python3 import subprocess import os import sys import glob import json import anymarkup REPO_PATH = 'git-repo' def git_clone(url): r = subprocess.run(['git', 'clone', url, REPO_PATH]) if r.returncode == 0: return True else: print("[COUT] Git clone error: Invalid argument ...
#!/usr/bin/python # encoding=utf-8 #!coding:utf-8 import re import sys import urllib2 import argparse import commands import os import subprocess if __name__ == "__main__" : # 测试正则表达式 reload(sys) sys.setdefaultencoding("utf-8") if len(sys.argv) > 1: # 如果在程序运行时,传递了命令行参数 # 打...
"""Wrapper for using the Scikit-Learn API with Keras models. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import types import numpy as np from tensorflow.python.keras.models import Sequential from tensorflow.python.keras.utils.generic_ut...
try: import json except ImportError: import simplejson as json import shlex import os import subprocess import sys import datetime import traceback import signal import time import syslog def daemonize_self(): # daemonizing code: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012 # logger.in...
import time from openerp.osv import fields, osv class account_budget_analytic(osv.osv_memory): _name = 'account.budget.analytic' _description = 'Account Budget report for analytic account' _columns = { 'date_from': fields.date('Start of period', required=True), 'date_to': fields.date('End...
""" The adodbapi dialect is not implemented for 0.6 at this time. """ import datetime from sqlalchemy import types as sqltypes, util from sqlalchemy.dialects.mssql.base import MSDateTime, MSDialect import sys class MSDateTime_adodbapi(MSDateTime): def result_processor(self, dialect, coltype): def process(...
import time import openerp.netsvc from openerp.osv import fields, orm, osv from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as OE_DFORMAT from openerp.tools.translate import _ class infraction_batch(orm.TransientModel): _name ='hr.infraction.batch' _description = 'Generate mass infraction incidents' ...
''' This script breaks a given GCE MIG to simulate zone failure or similar disaster scenario for testing purposes. It works by polling `gcloud compute instances list` and adding iptables rules on master to block ip addresses of instances, whose name matches pattern. The script runs in endless until you kill it with si...
from django.conf import settings from django.contrib.messages import constants, utils from django.utils.encoding import force_text LEVEL_TAGS = utils.get_level_tags() class Message: """ Represent an actual message that can be stored in any of the supported storage classes (typically session- or cookie-ba...
# -*- coding: utf-8 -*- r""" werkzeug.contrib.securecookie ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module implements a cookie that is not alterable from the client because it adds a checksum the server checks for. You can use it as session replacement if all you have is a user id or something to mark ...
import proto # type: ignore __protobuf__ = proto.module( package="google.ads.googleads.v8.enums", marshal="google.ads.googleads.v8", manifest={"PricePlaceholderFieldEnum",}, ) class PricePlaceholderFieldEnum(proto.Message): r"""Values for Price placeholder fields. """ class PricePlaceholder...
"""Unit tests for idlelib.configSectionNameDialog""" import unittest from idlelib.idle_test.mock_tk import Var, Mbox from idlelib import configSectionNameDialog as name_dialog_module name_dialog = name_dialog_module.GetCfgSectionNameDialog class Dummy_name_dialog(object): # Mock for testing the following methods ...
"""SCons.Tool.masm Tool-specific initialization for the Microsoft Assembler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The S...
#!/usr/bin/env python # encoding: utf-8 # (c) Siddharth Bharat Purohit, 3DRobotics Inc. """ The **mavgen.py** program is a code generator which creates mavlink header files. """ from waflib import Logs, Task, Utils, Node from waflib.TaskGen import feature, before_method, extension import os import os.path from xml.et...
""" Safe fallback for defaultdict, in order to support 2.4. """ ## From http://code.activestate.com/recipes/523034/ try: from collections import defaultdict except: class defaultdict(dict): def __init__(self, default_factory=None, *a, **kw): if (default_factory is not None and ...
""" Unit-tests and examples of syntax and behavior desired for AST-nodes. """ import unittest import operator import pdb from .node import denode, FASTNode, NodeInterface a, b, c = 5, 4, 2 inner = FASTNode(operator.__mul__, b, c) outer = FASTNode(operator.__add__, a, inner) # tree = FASTNode( # operator.__add__,...
import time import loadmaker from dtest import Tester class TestLoadmaker(Tester): def loadmaker_test(self): cluster = self.cluster cluster.populate(1).start() node1 = cluster.nodelist()[0] time.sleep(.2) host, port = node1.network_interfaces['thrift'] lm = loadm...
import logging from argparse import ArgumentParser import os import re import shutil import subprocess import sys import tempfile from threading import Thread, Lock import time import uuid import queue as Queue from multiprocessing import Manager # Append `SPARK_HOME/dev` to the Python path so that we can import the ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ It generates the list of candidate fusion genes. This list is hard coded in here and it is manually curated from: Greger et al. Tandem RNA Chimeras Contribute to Transcriptome Diversity in Human Population and Are Associated with Intronic Genetic Variants, Plos One,...
"""File transfers. """ __docformat__ = 'restructuredtext en' import os from utils import * class FileTransfer(Cached): """Represents a file transfer. """ _ValidateHandle = int def __repr__(self): return Cached.__repr__(self, 'Id') def _Alter(self, AlterName, Args=None): return...
# $Id: tns.py 23 2006-11-08 15:45:33Z dugsong $ # -*- coding: utf-8 -*- """Transparent Network Substrate.""" import dpkt class TNS(dpkt.Packet): __hdr__ = ( ('length', 'H', 0), ('pktsum', 'H', 0), ('type', 'B', 0), ('rsvd', 'B', 0), ('hdrsum', 'H', 0), ('msg', '0s'...
from .charsetprober import CharSetProber from .constants import eNotMe, eDetecting from .compat import wrap_ord # This prober doesn't actually recognize a language or a charset. # It is a helper prober for the use of the Hebrew model probers ### General ideas of the Hebrew charset recognition ### # # Four ma...
from slicc.ast.AST import AST class StatementListAST(AST): def __init__(self, slicc, statements): super(StatementListAST, self).__init__(slicc) if not isinstance(statements, (list, tuple)): statements = [ statements ] self.statements = statements def __repr__(self): ...
""" Memoization decorator that caches a function's return value. If later called with the same arguments then the cached value is returned rather than reevaluated. This is a a python 2.x port of `functools.lru_cache <http://docs.python.org/3/library/functools.html#functools.lru_cache>`_. If using python 3.2 or later y...
from __future__ import absolute_import import json import logging from pipes import quote as pquote import requests LOG = logging.getLogger(__name__) def add_ssl_verify_to_kwargs(func): def decorate(*args, **kwargs): if isinstance(args[0], HTTPClient) and 'https' in getattr(args[0], 'root', ''): ...
import json from ansible.module_utils._text import to_text from ansible.module_utils.basic import env_fallback from ansible.module_utils.network.common.utils import to_list, ComplexList from ansible.module_utils.common._collections_compat import Mapping from ansible.module_utils.connection import Connection, Connection...
from __future__ import with_statement import py, pytest # test for _argcomplete but not specific for any application def equal_with_bash(prefix, ffc, fc, out=None): res = ffc(prefix) res_bash = set(fc(prefix)) retval = set(res) == res_bash if out: out.write('equal_with_bash %s %s\n' % (retval,...
"""The Aggregate admin API extension.""" from webob import exc from nova.api.openstack import extensions from nova.compute import api as compute_api from nova import exception from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('compute', 'ag...
#! /bin/bash # -*- coding: utf-8 -* import urlparse import os import comm_log import tornado.ioloop import tornado.web import tornado.options from tornado.options import define, options # 监听端口 define("port", default=8978, help="run on the given port", type=int) # 日志输出 define("log", default=comm_log.get_logging('gohook...
"""Utilities for writing code that runs on Python 2 and 3""" #Copyright (c) 2010-2011 Benjamin Peterson #Permission is hereby granted, free of charge, to any person obtaining a copy of #this software and associated documentation files (the "Software"), to deal in #the Software without restriction, including without l...
"""Tests for db.deploy layer.""" import mock from rally.common import objects from rally import consts from tests.unit import test class DeploymentTestCase(test.TestCase): def setUp(self): super(DeploymentTestCase, self).setUp() self.deployment = { "uuid": "baa1bfb6-0c38-4f6c-9bd0-4...
from couchpotato import fireEvent from couchpotato.core.logger import CPLog from couchpotato.core.media.movie.providers.automation.base import Automation log = CPLog(__name__) autoload = 'PopularMovies' class PopularMovies(Automation): interval = 1800 url = 'https://s3.amazonaws.com/popular-movies/movies.j...
"""Demo platform that offers fake air quality data.""" from homeassistant.components.air_quality import AirQualityEntity async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Air Quality.""" async_add_entities( [DemoAirQuality("Home", 14, 23, 100), DemoAi...
"""Base implementation of 0MQ authentication.""" # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. import logging import zmq from zmq.utils import z85 from zmq.utils.strtypes import bytes, unicode, b, u from zmq.error import _check_version from .certs import load_certificat...
from telemetry.page import page as page_module from telemetry.page import shared_page_state from telemetry import story class PolymerPage(page_module.Page): def __init__(self, url, page_set, run_no_page_interactions): """ Base class for all polymer pages. Args: run_no_page_interactions: whether the ...
"""Root wrapper for OpenStack services Filters which commands a service is allowed to run as another user. To use this with nova, you should set the following in nova.conf: rootwrap_config=/etc/nova/rootwrap.conf You also need to let the nova user run nova-rootwrap as root in sudoers: nova ALL =...
import uuid class OriginAccessIdentity: def __init__(self, connection=None, config=None, id='', s3_user_id='', comment=''): self.connection = connection self.config = config self.id = id self.s3_user_id = s3_user_id self.comment = comment self.etag ...
# -*- coding: utf-8 -*- """ *************************************************************************** BatchPanel.py --------------------- Date : November 2014 Copyright : (C) 2014 by Alexander Bruy Email : alexander dot bruy at gmail dot com *************...
from . import test_note checks = [ test_note, ] # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from test import test_support import unittest from cStringIO import StringIO from quopri import * ENCSAMPLE = """\ Here's a bunch of special=20 =A1=A2=A3=A4=A5=A6=A7=A8=A9 =AA=AB=AC=AD=AE=AF=B0=B1=B2=B3 =B4=B5=B6=B7=B8=B9=BA=BB=BC=BD=BE =BF=C0=C1=C2=C3=C4=C5=C6 =C7=C8=C9=CA=CB=CC=CD=CE=CF =D0=D1=D2=D3=D4=D5=D6=D7 ...
import github.GithubObject import github.Issue import github.NamedUser class IssueEvent(github.GithubObject.CompletableGithubObject): """ This class represents IssueEvents as returned for example by http://developer.github.com/v3/todo """ @property def actor(self): """ :type: :cl...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, assert_raises_rpc_error, ) import json import os TESTSDIR = os.path.dirname(os.path.realpath(__file__)) class GetblockstatsTest(BitcoinTestFramework): start_height = 101 max_stat_pos = 2 ...
from pyparsing import Word, alphas, alphanums, Literal, restOfLine, OneOrMore, \ empty, Suppress, replaceWith # simulate some C++ code testData = """ #define MAX_LOCS=100 #define USERNAME = "floyd" #define PASSWORD = "swordfish" a = MAX_LOCS; CORBA::initORB("xyzzy", USERNAME, PASSWORD ); """ #####...
import array import tempfile from portage import _unicode_decode from portage import _unicode_encode from portage.tests import TestCase class ArrayFromfileEofTestCase(TestCase): def testArrayFromfileEof(self): # This tests if the following python issue is fixed # in the currently running version of python: # ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible.module_utils.facts.network.base import Network, NetworkCollector class HurdPfinetNetwork(Network): """ This is a GNU Hurd specific subclass of Network. It use fsysopts to get the ip address and...
#!/usr/bin/python3 # -*- coding:utf-8 -*- import socket from urllib.request import urlopen, Request from urllib.error import URLError, HTTPError import threading from gymkhana.aux.printing_format import green_nd_bold, yellow_nd_bold, colorfill, end_format from gymkhana.aux.my_variables import uclm_url, uclm_port3, my...
import os import sys import itertools import imp from distutils.command.build_ext import build_ext as _du_build_ext from distutils.file_util import copy_file from distutils.ccompiler import new_compiler from distutils.sysconfig import customize_compiler, get_config_var from distutils.errors import DistutilsError from d...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible.errors import AnsibleError, AnsibleParserError from ansible.parsing import DataLoader from ansible.playbook.attribute import Attribute, FieldAttribute from ansible.playbook.play import Play from ansible.play...
"""Gradients for operators defined in linalg_ops.py. Useful reference for derivative formulas is An extended collection of matrix derivative results for forward and reverse mode algorithmic differentiation by Mike Giles: http://eprints.maths.ox.ac.uk/1079/1/NA-08-01.pdf A detailed derivation of formulas for backpropa...
""" This module houses the Geometry Collection objects: GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon """ import json from ctypes import byref, c_int, c_uint from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.geometry import ( GEOSGeometry, ProjectInterpolateM...
data = ( 'Ruo ', # 0x00 'Bei ', # 0x01 'E ', # 0x02 'Yu ', # 0x03 'Juan ', # 0x04 'Yu ', # 0x05 'Yun ', # 0x06 'Hou ', # 0x07 'Kui ', # 0x08 'Xiang ', # 0x09 'Xiang ', # 0x0a 'Sou ', # 0x0b 'Tang ', # 0x0c 'Ming ', # 0x0d 'Xi ', # 0x0e 'Ru ', # 0x0f 'Chu ', # 0x10 'Zi ...
from __future__ import unicode_literals import os.path from django.utils._os import upath TEST_ROOT = os.path.dirname(upath(__file__)) TESTFILES_PATH = os.path.join(TEST_ROOT, 'apps', 'test', 'static', 'test') TEST_SETTINGS = { 'DEBUG': True, 'MEDIA_URL': '/media/', 'STATIC_URL': '/static/', 'MEDIA...
""" This file implements unit test cases for luigi/contrib/sqla.py Author: Gouthaman Balaraman Date: 01/02/2015 """ import os import shutil import tempfile import unittest from luigi import six import luigi import sqlalchemy from luigi.contrib import sqla from luigi.mock import MockFile from nose.plugins.attrib impor...
""" Inception + BN, suitable for images with around 224 x 224 Reference: Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. """ import mxnet as mx eps = 1e-10 + 1e-5 bn_mom = 0.9 fix_gamma = False ...
import logging import random from xmodule.x_module import XModule, STUDENT_VIEW from xmodule.seq_module import SequenceDescriptor from lxml import etree from xblock.fields import Scope, Integer from xblock.fragment import Fragment log = logging.getLogger('edx.' + __name__) class RandomizeFields(object): choic...
from invenio.htmlutils import HTMLWasher import htmlentitydefs import cgi import re RE_HTML_FIRST_NON_QUOTATION_CHAR_ON_LINE = re.compile('[^>]') class EmailWasher(HTMLWasher): """ Wash comments before being sent by email """ line_quotation = '' def handle_starttag(self, tag, attrs): """...
import numpy as np import turicreate as tc from polara import RecommenderModel class TuriFactorizationRecommender(RecommenderModel): def __init__(self, *args, **kwargs): self.item_side_info = kwargs.pop('item_side_info', None) self.user_side_info = kwargs.pop('user_side_info', None) super(...
from django.conf.urls import patterns from django.conf.urls import url from openstack_dashboard.dashboards.identity.groups import views urlpatterns = patterns( '', url(r'^$', views.IndexView.as_view(), name='index'), url(r'^create$', views.CreateView.as_view(), name='create'), url(r'^(?P<group_id>[^/...