content string |
|---|
# -*- 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):
# Changing field 'Picture.height'
db.alter_column(u'cmsplugin_picture', 'height', self.gf('django.db.models... |
"""Renren Authentication Views"""
from pyramid.httpexceptions import HTTPFound
from pyramid.security import NO_PERMISSION_REQUIRED
import requests
from ..api import (
AuthenticationComplete,
AuthenticationDenied,
register_provider,
)
from ..exceptions import ThirdPartyFailure
from ..settings import Provid... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
mocked
---------------------
Date : January 2016
Copyright : (C) 2016 by Matthias Kuhn
Email : <EMAIL>
**************************************************... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... |
"""Tests for tensorflow.ops.one_hot_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops
fro... |
"""
Classes representing uploaded files.
"""
import errno
import os
from io import BytesIO
from django.conf import settings
from django.core.files.base import File
from django.core.files import temp as tempfile
from django.utils.encoding import force_str
__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryU... |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - switch user form
@copyright: 2001-2004 Juergen Hermann <<EMAIL>>,
2003-2007 MoinMoin:ThomasWaldmann
2007 MoinMoin:JohannesBerg
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin import user, util, wikiuti... |
# -*- coding: utf-8 -*-
"""
Swedish specific Form helpers
"""
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.validators import EMPTY_VALUES
from django.contrib.localflavor.se.utils import (id_number_checksum,
validate_id_birthday, format_personal_id_numbe... |
import json
from qingcloud.cli.iaas_client.actions.base import BaseAction
class CreateS2AccountAction(BaseAction):
action = 'CreateS2Account'
command = 'create-s2-account'
usage = '%(prog)s -T <account_type> [-n <account_name> ...] [-f <conf_file>]'
@classmethod
def add_ext_arguments(cls, parser)... |
"""Course explorer module."""
__author__ = 'Rahul Singal (<EMAIL>)'
from common import safe_dom
from controllers import utils
from models import custom_modules
from models.config import ConfigProperty
from models.models import StudentProfileDAO
from modules.course_explorer import student
from google.appengine.api im... |
import sys
from struct import unpack
from timemachine import *
##
# Magic cookie that should appear in the first 8 bytes of the file.
SIGNATURE = "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
EOCSID = -2
FREESID = -1
SATSID = -3
MSATSID = -4
class CompDocError(Exception):
pass
class DirNode(object):
def __init__(self... |
import gym
import gym_sokoban
import time
from PIL import Image
import numpy as np
import argparse
import os
parser = argparse.ArgumentParser(description='Run environment with random selected actions.')
parser.add_argument('--rounds', '-r', metavar='rounds', type=int,
help='number of rounds to play... |
from Components.PerServiceDisplay import PerServiceBase
from Components.Element import cached
from enigma import iPlayableService, iServiceInformation, eServiceReference, eEPGCache
from Source import Source
class EventInfo(PerServiceBase, Source, object):
NOW = 0
NEXT = 1
def __init__(self, navcore, now_or_next):
... |
from openerp.osv import osv, fields
from openerp.tools.translate import _
class note_pad_note(osv.osv):
""" memo pad """
_name = 'note.note'
_inherit = ['pad.common','note.note']
_pad_fields = ['note_pad']
_columns = {
'note_pad_url': fields.char('Pad Url', pad_content_field='memo'),
... |
import _lightbluecommon
__all__ = ('OBEXResponse', 'OBEXError',
'CONTINUE', 'OK', 'CREATED', 'ACCEPTED', 'NON_AUTHORITATIVE_INFORMATION',
'NO_CONTENT', 'RESET_CONTENT', 'PARTIAL_CONTENT',
'MULTIPLE_CHOICES', 'MOVED_PERMANENTLY', 'MOVED_TEMPORARILY', 'SEE_OTHER',
'NOT_MODIFIED', 'USE_PROXY',
'B... |
import socket
import threading
from log import log
web_server_port = 53455
listen_port = 53456
reply_port = 53457
debug_timeout = 10 # seconds
d = None
def daemon():
# find local IP
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 0))
local_ip_address = s.getsockname()[0]
... |
"""Unit tests for SPINN data module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import tempfile
import numpy as np
import tensorflow as tf
from tensorflow.contrib.eager.python.examples.spinn import data
class DataTest(tf.... |
from virtualization.constants import StateType
###############################################################################
# Classes
###############################################################################
class State:
"""
This class represents the state of a virtual instance. It provides
abst... |
import os.path as op
import warnings
import numpy as np
from numpy.testing import (assert_allclose, assert_array_equal)
from nose.tools import assert_raises, assert_equal, assert_true
from mne import io, pick_types, pick_channels, read_events, Epochs
from mne.channels.interpolation import _make_interpolation_matrix
f... |
"""The TileDialog class is a dialog used to edit a list of tiles for
a server/network node. If the server node is an N-instance node the
dialog will display a spin control [1 .. N] to edit the tile list for
any of the N instances.
"""
from wxPython.wx import *
from wxPython.gizmos import *
import crutils
class Tile... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrays in the Ruby Koans
#
from runner.koan import *
class AboutLists(Koan):
def test_creating_lists(self):
empty_list = list()
self.assertEqual(list, type(empty_list))
self.assertEqual(__, len(empty_list))
def test_list... |
# -*- coding: utf-8 -*-
"""Readers for Sloka content."""
from __future__ import unicode_literals, print_function
import json
import logging
from pelican.readers import BaseReader
logger = logging.getLogger(__name__)
class SlokaReader(BaseReader):
"""A commonmarkdown based reader for sanskrit verses.
Uses... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import sys
import os
import threading
if sys.version_info[0] >= 3:
import queue
Queue = queue
else:
import Queue
import warnings
from thrift.T... |
from boto.dynamodb2.types import STRING
class BaseSchemaField(object):
"""
An abstract class for defining schema fields.
Contains most of the core functionality for the field. Subclasses must
define an ``attr_type`` to pass to DynamoDB.
"""
attr_type = None
def __init__(self, name, data_... |
"""functools.py - Tools for working with functions and callable objects
"""
# Python module wrapper for _functools C module
# to allow utilities written in Python to be added
# to the functools module.
# Written by Nick Coghlan <ncoghlan at gmail.com>
# Copyright (C) 2006 Python Software Foundation.
# See C source co... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 9 00:35:54 2016
@author: chuckgu
"""
import json,os
from nltk.tokenize import sent_tokenize,word_tokenize
from konlpy.tag import Twitter
import numpy as np
import sys
reload(sys)
sys.setdefaultencoding('utf8')
twitter=Twitter()
txt=[]
checklist=['Exclamation','A... |
import os
import sys
from mesonbuild.coredata import version
if sys.version_info[0] < 3:
print('Tried to install with Python 2, Meson only supports Python 3.')
sys.exit(1)
# We need to support Python installations that have nothing but the basic
# Python installation. Use setuptools when possible and fall ba... |
"""
Class for "reading" data from Neuroshare compatible files (check neuroshare.org)
It runs through the whole file and searches for: analog signals, spike cutouts,
and trigger events (without duration)
Depends on: Neuroshare API 0.9.1, numpy 1.6.1, quantities 0.10.1
Supported: Read
Author: Andre Maia Chagas
"""
# n... |
#!/usr/bin/env python
"""
Copyright 2014 The Trustees of Princeton University
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unl... |
"""Compare two images for equality, subject to a mask."""
from PIL import Image
from PIL import ImageChops
import os.path
def Compare(file1, file2, **kwargs):
"""Compares two images to see if they're identical subject to a mask.
An optional directory containing masks is supplied. If a mask exists
which match... |
#!/usr/bin/env python3
import leveldb
import msgpack
import csv
from util.misc import Benchmark, open_file
REQUIRED_KEYS = {'title', 'paper_id', 'date'}
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Creates a LevelDB of TSV metadata in infile")
parser.add_argumen... |
from .suggester import create_suggester
from .dummy import Any, Never
from .separate_context import SeparateContext
from .types_misc import Type, CheckType, Number
from .strings import *
from .lists import List
from .seq import Seq
from .tuple import Tuple
from .dicts import Dict
from .map import Map
from .sets import ... |
"""
Admin tool for the Program Enrollments models
"""
from django.contrib import admin
from django.urls import reverse
from django.utils.html import format_html
from lms.djangoapps.program_enrollments.models import (
CourseAccessRoleAssignment,
ProgramCourseEnrollment,
ProgramEnrollment
)
class ProgramEn... |
from pypov.pov import Vector, Texture, Pigment, POV, File, Camera, Cylinder
from pypov.pov import LightSource, Sphere, Finish, Settings, Plane, Box, Cone
from pypov.pov import Checker, SkySphere, Union, GlobalSettings, Radiosity
from pypov.pov import Polygon_4, Difference, Object, parse_args
dark_glass = Texture(
... |
import optparse
import m5
from m5.objects import *
from m5.util import addToPath
from m5.internal.stats import periodicStatDump
addToPath('../')
from common import MemConfig
# this script is helpful to sweep the efficiency of a specific memory
# controller configuration, by varying the number of banks accessed,
# a... |
#!/usr/bin/python -u
#
#
#
#################################################################################
# Start off by implementing a general purpose event loop for anyones use
#################################################################################
import sys
import getopt
import os
import libvirt
impor... |
from django.shortcuts import render, redirect
from django.http.response import HttpResponse
from users.decorators import user_is_anonymous, user_is_authenticated
from users.models import UserRegistrationForm, UserAuthenticationForm
from django.contrib.auth import logout
from django.contrib import messages
REQUEST_METH... |
"""Test processing of unrequested blocks.
Setup: two nodes, node0 + node1, not connected to each other. Node1 will have
nMinimumChainWork set to 0x10, so it won't process low-work unrequested blocks.
We have one P2PInterface connection to node0 called test_node, and one to node1
called min_work_node.
The test:
1. Ge... |
"""Confusion matrix related metrics."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import confusion_matrix as cm
def confusion_matrix(labels, predictions, num_classes=None, dty... |
"""DNA - Service example - Module to launch a local test."""
import os
import sys
# This is a workaround to import the relevant libraries for local testing
# purposes.
# The import will be handled through proper "vendor.add" in appengine_config.py
# for the AppEngine deployed version.
_BASEPATH = os.path.abspath(__fil... |
from openstack.compute import compute_service
from openstack import resource
class ServerInterface(resource.Resource):
id_attribute = 'mac_addr'
resource_key = 'interfaceAttachment'
resources_key = 'interfaceAttachments'
base_path = '/servers/%(server_id)s/os-interface'
service = compute_service.C... |
{
'name': 'Events Organisation',
'version': '0.1',
'website' : 'https://www.odoo.com/page/events',
'category': 'Tools',
'summary': 'Trainings, Conferences, Meetings, Exhibitions, Registrations',
'description': """
Organization and management of Events.
======================================
The... |
from pyface.tasks.action.task_action import TaskAction
from pychron.envisage.resources import icon
# ============= standard library imports ========================
# ============= local library imports ==========================
class SaveLoadingDBAction(TaskAction):
name = 'Save DB'
method = 'save_loadin... |
import logging
import os
from subprocess import Popen, PIPE
from ._compat import *
DEVNULL = open(os.devnull, 'w')
class Proc(Popen):
def communicate(self, **kwargs):
if kwargs.get('input') and isinstance(kwargs['input'], basestring):
kwargs['input'] = kwargs['input'].encode('utf-8')
... |
import unittest
import imath
import IECore
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
class ParentConstraintTest( GafferSceneTest.SceneTestCase ) :
def test( self ) :
plane1 = GafferScene.Plane()
plane1["transform"]["translate"].setValue( imath.V3f( 1, 2, 3 ) )
plane1["transfo... |
from fabric.api import settings, sudo
from cuisine import package_ensure, package_clean
def stop():
with settings(warn_only=True):
sudo("nohup service apirestd stop")
sudo("nohup service discovery-agent stop")
sudo("nohup service events-agent stop")
sudo("nohup service health-syste... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import pkgutil
from pants.backend.python.targets.python_binary import PythonBinary
from pants.backend.python.targets.python_library import PythonLibrary
fro... |
from scapy.fields import StrFixedLenField, FlagsField, ScalingField, BitField
from scapy.contrib.automotive.obd.packet import OBD_Packet
# See https://en.wikipedia.org/wiki/OBD-II_PIDs for further information
# PID = Parameter IDentification
class OBD_PID80(OBD_Packet):
name = "PID_80_PIDsSupported"
fields_d... |
# -----------------
# cursor position
# -----------------
#? 0 int
int()
#? 3 int
int()
#? 4 str
int(str)
# -----------------
# should not complete
# -----------------
#? []
.
#? []
str..
#? []
a(0):.
# -----------------
# if/else/elif
# -----------------
if 1:
1
elif(3):
a = 3
else:
a = ''
#? int() str... |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.... |
"""Tests for WAVE file labeling tool."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
from tensorflow.examples.speech_commands import label... |
import numpy as np
import time
from numpy.lib.arraysetops import *
def bench_unique1d( plot_results = False ):
exponents = np.linspace( 2, 7, 9 )
ratios = []
nItems = []
dt1s = []
dt2s = []
for ii in exponents:
nItem = 10 ** ii
print 'using %d items:' % nItem
a = np.fix... |
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
def deploy(revision=''):
if revision!='':
print "Deploying to server using revision: %s" % revision
updateSource(revision)
migrateDatabase()
restartApache()
def backupDatabas... |
#!/usr/bin/env python
'''Basic test that `from rethinkdb import *` works'''
import os, sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, "common"))
import driver, utils
dbName, tableName = utils.get_test_db_table()
# -- import rethikndb driver via star method
p... |
# This is an example of a service hosted by python.exe rather than
# pythonservice.exe.
# Note that it is very rare that using python.exe is a better option
# than the default pythonservice.exe - the latter has better error handling
# so that if Python itself can't be initialized or there are very early
# import erro... |
"""
USA-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_text
from django.u... |
from .lookups import LookupDoesNotExist, ExtraFieldLookup
from . import lookups as lookups_module
from .resolver import resolver
import inspect
# TODO: add possibility to add lookup modules
def create_lookup(lookup_def):
for _, cls in inspect.getmembers(lookups_module):
if inspect.isclass(cls) and issubcla... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import shade
from shade import meta
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
def _system_state_change(state, device):
"""Check if system s... |
from nupic.frameworks.opf.expdescriptionhelpers import importBaseDescription
# the sub-experiment configuration
config ={
'aggregationInfo' : {'seconds': 0, 'fields': [(u'c1', 'first'), (u'c0', 'first')], 'months': 0, 'days': 0, 'years': 0, 'hours': 1, 'microseconds': 0, 'weeks': 0, 'minutes': 0, 'milliseconds': 0},... |
import unittest
from api_categorizer import APICategorizer
from compiled_file_system import CompiledFileSystem
from extensions_paths import CHROME_EXTENSIONS
from object_store_creator import ObjectStoreCreator
from test_file_system import TestFileSystem
def _ToTestData(obj):
'''Transforms |obj| into test data by t... |
from unittest import TextTestResult
from twisted.trial import unittest
from scrapy.spiders import Spider
from scrapy.http import Request
from scrapy.item import Item, Field
from scrapy.contracts import ContractsManager
from scrapy.contracts.default import (
UrlContract,
ReturnsContract,
ScrapesContract,
)... |
from rekall import addrspace
from rekall import testlib
from rekall.plugins.windows.malware import apihooks
class TestHookHeuristics(testlib.RekallBaseUnitTestCase):
"""Test the hook detection heuristic.
The actual test cases are generated using the nasm assembler in:
rekall/src/hooks/amd64.asm and reka... |
"""
Protocol implementation.
"""
try:
import hashlib
except ImportError:
import md5
try:
import simplejson as json
except ImportError:
import json
from avro import schema
#
# Constants
#
# TODO(hammer): confirmed 'fixed' with Doug
VALID_TYPE_SCHEMA_TYPES = ('enum', 'record', 'error', 'fixed')
#
# Exceptions
... |
import sys
import types
import xmlrpclib
import urlparse
# Attempt to import rhn client tools
sys.path.insert(0, '/usr/share/rhn')
try:
import up2date_client
import up2date_client.config
except ImportError, e:
module.fail_json(msg="Unable to import up2date_client. Is 'rhn-client-tools' installed?\n%s" % e... |
from __future__ import unicode_literals, division
from flask import Flask, request, redirect
from flask.ext.sqlalchemy import SQLAlchemy
import os
from raven import Client
from raven.middleware import Sentry
from yoi.account.user import bp as account
from yoi.config import (secret,
database_ur... |
"""Execution Callbacks for Eager Mode."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import numpy as np
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.eager import context
from tensorflow.python.eager import c... |
from __future__ import unicode_literals
import re
import os.path
import subprocess
import shutil
import tempfile
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import cssmin as cssmin_mod
import slimit as slimit_mod
from django.conf import settings
from django.core.fi... |
from oslo.config import cfg
import testtools
import webob.exc as webexc
import quantum
from quantum.api import extensions
from quantum.api.v2 import attributes
from quantum.api.v2 import router
from quantum.common import config
from quantum import context as q_context
from quantum.db import api as db
from quantum.db i... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
import time
from ansible.module_utils.basic import AnsibleModule
from ansible.... |
"""
=========================
Kernel Density Estimation
=========================
This example shows how kernel density estimation (KDE), a powerful
non-parametric density estimation technique, can be used to learn
a generative model for a dataset. With this generative model in place,
new samples can be drawn. These... |
import unittest
from PySide.QtGui import QPainter, QLinearGradient
from PySide.QtCore import QLine, QLineF, QPoint, QPointF, QRect, QRectF, Qt
class QPainterDrawText(unittest.TestCase):
def setUp(self):
self.painter = QPainter()
self.text = 'teste!'
def tearDown(self):
del self.text
... |
class MeritFunctionError(Exception):
def __init__(self, message, error):
super(Exception, self).__init__(message)
self.errors = error
class MeritFunction():
'''
This class provides functionality to create a merit function
using Zemax's command DEFAULTMERIT.
To create a merit fnction, a bl... |
"""Functions to parse datetime objects."""
# We're using regular expressions rather than time.strptime because:
# - They provide both validation and parsing.
# - They're more flexible for datetimes.
# - The date/datetime/time constructors produce friendlier error messages.
import datetime
import re
from django.utils.... |
import copy
def merge_dict(base, update):
"""Update dict concatenating list values"""
res = copy.deepcopy(base)
for k, v in list(update.items()):
if k in list(res.keys()) and isinstance(v, list):
res[k].extend(v)
else:
res[k] = v
return res |
from . import AWSHelperFn, AWSObject, AWSProperty, Tags
from .validators import boolean, defer, double, integer, positive_integer
CHANGE_IN_CAPACITY = "CHANGE_IN_CAPACITY"
PERCENT_CHANGE_IN_CAPACITY = "PERCENT_CHANGE_IN_CAPACITY"
EXACT_CAPACITY = "EXACT_CAPACITY"
ACTIONS_ON_FAILURE = (
"TERMINATE_CLUSTER",
"CA... |
import os
import json
import re
from builder.ext_button import Button, get_image, ExtensionConfigError, bytes_string
from builder.locales import WebExtensionLocal, message_name
class WebExtensionButton(Button):
def __init__(self, folders, buttons, settings, applications):
super(WebExtensionButton, self)... |
import weakref
from fsbc.signal import Signal
from .contextaware import ContextAware
class SignalBehavior:
def __init__(self, context, parent, names):
parent.__signal_enable_behavior = self
self._context = context
self._parent = weakref.ref(parent)
self._names = set(names)
... |
# encoding: 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 'UserInfo'
db.create_table('project_userinfo', (
('id', self.gf('django.db.mode... |
import json
import os.path
import sys
BASE = os.path.dirname(__file__.replace('\\', '/'))
sys.path.insert(0, os.path.join(BASE, "Mako-0.9.1.zip"))
sys.path.insert(0, BASE) # For importing `data.py`
from mako import exceptions
from mako.lookup import TemplateLookup
from mako.template import Template
import data
de... |
from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
from django.db.backends.mysql import compiler
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
def resolve_columns(self, row, fields=()):
"""
Integrate the cases hand... |
from gnuradio import gr, gr_unittest
from gnuradio import blocks
import ieee802_15_4_swig as ieee802_15_4
from css_phy import physical_layer as phy
class qa_deinterleaver_ff (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_0... |
""" An image and text-based control that can be used as a normal, radio or
toolbar button.
"""
#-------------------------------------------------------------------------------
# Imports:
#-------------------------------------------------------------------------------
import wx
from numpy import array, fromstrin... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.errors import AnsibleError, AnsibleAction, _AnsibleActionDone, AnsibleActionFail
from ansible.module_utils._text import to_native
from ansible.module_utils.parsing.convert_bool import boolean
from ansible.pl... |
"""Tests for IdentityNOp."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.ops import array_ops
from tensorflow.python.platform import test
class IdentityNOpT... |
"""Setup.py for pymatgen."""
import sys
import platform
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
"""Extension builder that checks for numpy before install."""
def finalize_options(self):
"""Ov... |
"""Functions used to extract and analyze stacks. Faster than Python libs."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import linecache
import sys
# Names for indices into TF traceback tuples.
TB_FILENAME = 0
TB_LINENO = ... |
import scipy.sparse as sp
import numpy as np
from .fixes import sparse_min_max, bincount
from .sparsefuncs_fast import csr_mean_variance_axis0 as _csr_mean_var_axis0
from .sparsefuncs_fast import csc_mean_variance_axis0 as _csc_mean_var_axis0
def _raise_typeerror(X):
"""Raises a TypeError if X is not a CSR or CS... |
import os
import six
import logging
from collections import defaultdict
from scrapy.exceptions import NotConfigured
from scrapy.http import Response
from scrapy.http.cookies import CookieJar
from scrapy.utils.python import to_native_str
logger = logging.getLogger(__name__)
class CookiesMiddleware(object):
"""Th... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template.defaultfilters import slugify
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class SlugifyTests(SimpleTestCase):
"""
Running slugify on a pre-escaped string le... |
import tensorflow as tf
class AssignmentView:
def __init__(self):
self.variables = {}
self.variables["total_vertex_count"] = tf.placeholder(tf.int32)
self.variables["vertex_indices"] = tf.placeholder(tf.int32)
self.variables["from_range"] = tf.placeholder(tf.int32)
def get_al... |
{
'name': 'MRP Operations start without material',
'version': '8.0.1.0.1',
'author': 'OdooMRP team',
'contributors': ["Daniel Campos <<EMAIL>>",
"Pedro M. Baeza <<EMAIL>>",
"Ana Juaristi <<EMAIL>>"],
'website': 'http://www.odoomrp.com',
"depends": ['mrp_... |
"""Bayesian Data Analysis, 3rd ed
Chapter 5, demo 2
Hierarchical model for SAT-example data (BDA3, p. 102)
"""
from __future__ import division
import numpy as np
from scipy.stats import norm
import scipy.io # For importing a matlab file
import matplotlib.pyplot as plt
# Edit default plot settings (colours from colo... |
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from accounts.models import *
from album.models import *
from comment.models import *
from notification.models import *
from post.models import *
from tag.models import *
# accout
class UserSerializer(serializers.HyperlinkedMode... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.test import TestCase, override_settings
from django.test.client import RequestFactory
from django.views.generic.base import View
from django.views.gen... |
"""
Unit tests for stem.descriptor.export.
"""
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import stem.prereq
import test.runner
from stem.descriptor.export import export_csv, export_csv_file
from test.mocking import (
get_relay_server_descriptor,
get_brid... |
"""Rules for Reals."""
from extensions.rules import base
class Equals(base.RealRule):
description = 'is equal to {{x|Real}}'
class IsLessThan(base.RealRule):
description = 'is less than {{x|Real}}'
class IsGreaterThan(base.RealRule):
description = 'is greater than {{x|Real}}'
class IsLessThanOrEqua... |
# encoding: utf-8
"""
Utilities for version comparison
It is a bit ridiculous that we need these.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the f... |
"""Implements ThreadPoolExecutor."""
from __future__ import with_statement
import atexit
import threading
import weakref
import sys
from concurrent.futures import _base
try:
import queue
except ImportError:
import Queue as queue
__author__ = 'Brian Quinlan (<EMAIL>)'
# Workers are created as daemon threads... |
from __future__ import absolute_import, division, print_function
import sys
import re
import datetime
import types
import json
import six
from configman.datetime_util import (
datetime_from_ISO_string,
date_from_ISO_string,
datetime_to_ISO_string,
date_to_ISO_string,
)
# for backward compatibility th... |
"""Functions copypasted from newer versions of numpy.
"""
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy._lib._version import NumpyVersion
if NumpyVersion(np.__version__) > '1.7.0.dev':
_assert_warns = np.testing.assert_warns
else:
def _assert... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.