content stringlengths 4 20k |
|---|
"""Exports Sample CDN controllers.
Field Mappings:
In order to reduce the disk / memory space used,
fields name will be, most of the time, the first
letter of their long name. Fields mapping will be
updated and documented in each controller class.
"""
from poppy.provider.mock import certificates
from ... |
from test.support import run_unittest
import unittest
class ExceptionTestCase(unittest.TestCase):
def test_try_except_else_finally(self):
hit_except = False
hit_else = False
hit_finally = False
try:
raise Exception('nyaa!')
except:
hit_except = True
... |
'''
Directory output OEBBook writer.
'''
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <<EMAIL>>'
import os
from calibre.ebooks.oeb.base import OPF_MIME, xml2str
from calibre.ebooks.oeb.base import DirContainer, OEBError
__all__ = ['OEBWriter']
class OE... |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView, DetailView, ListView, FormView, CreateView, UpdateView, DeleteView
from django.contrib.auth.views import logout
from django.contrib.auth.decorators import login_required
from web.models import Venue
from web.views import ... |
class Signals(object):
def __init__(self):
self._signals = {}
def _connect(self, obj, name, handler, connector):
ret = self._signals.setdefault(obj, {})
hid = connector(name, handler)
ret.setdefault(name, []).append(hid)
return hid
def connect_signal(self, obj, na... |
import account
import account_voucher
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... |
"""Tests for distutils.command.build_clib."""
import unittest
import os
import sys
from test.support import run_unittest
from distutils.command.build_clib import build_clib
from distutils.errors import DistutilsSetupError
from distutils.tests import support
from distutils.spawn import find_executable
cla... |
"""
Online learning of a dictionary of parts of faces
==================================================
This example uses a large dataset of faces to learn a set of 20 x 20
images patches that constitute faces.
From the programming standpoint, it is interesting because it shows how
to use the online API of the sciki... |
from __future__ import absolute_import
# Config
from . import config
from .config import is_training, get_training_mode, init_graph
# Import models
from . import models
from .models.dnn import DNN
from .models.generator import SequenceGenerator
# Helpers
from . import helpers
from .helpers.evaluator import Evaluator... |
from .composition_parts import WithIdentifier
from .composition_parts import WithOwner
from .idl_type import IdlType
from .literal_constant import LiteralConstant
from .make_copy import make_copy
class Argument(WithIdentifier, WithOwner):
class IR(WithIdentifier):
def __init__(self, identifier, index, idl... |
from django.db import models
from django.core.validators import MinValueValidator
class Company(models.Model):
"""Describes a company/organization participating or interested in D-Dagen"""
def __str__(self):
return self.name + ": " + self.area_of_business
# filled in by company
AREA_OF_BUSINE... |
from __future__ import absolute_import, division, unicode_literals
import re
from . import base
from ..constants import rcdataElements, spaceCharacters
spaceCharacters = "".join(spaceCharacters)
SPACES_REGEX = re.compile("[%s]+" % spaceCharacters)
class Filter(base.Filter):
spacePreserveElements = frozenset([... |
"""
Israeli-specific form helpers
"""
import re
from django.core.exceptions import ValidationError
from django.core.validators import EMPTY_VALUES
from django.forms.fields import RegexField, Field, EMPTY_VALUES
from django.utils.checksums import luhn
from django.utils.translation import ugettext_lazy as _
# Israeli I... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: cobbler_sync
version_added: '2.7'
short_description: Sync Co... |
from __future__ import print_function
import cx_Oracle
import datetime
import SampleEnv
# truncate table first so that script can be rerun
connection = cx_Oracle.Connection(SampleEnv.MAIN_CONNECT_STRING)
cursor = connection.cursor()
print("Truncating table...")
cursor.execute("truncate table TestTempTable")
# popula... |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
self._loc... |
"""Fix Chrome App manifest.json files for use with multi-platform zip files.
See info about multi-platform zip files here:
https://developer.chrome.com/native-client/devguide/distributing#packaged-application
The manifest.json file needs to point to the correct platform-specific paths,
but we build all toolchains and... |
"""
SQLite3 backend for django.
Works with either the pysqlite2 module or the sqlite3 module in the
standard library.
"""
from __future__ import unicode_literals
import datetime
import decimal
import re
import warnings
from django.conf import settings
from django.db import utils
from django.db.backends import utils ... |
from spack import *
class XorgCfFiles(AutotoolsPackage):
"""The xorg-cf-files package contains the data files for the imake utility,
defining the known settings for a wide variety of platforms (many of which
have not been verified or tested in over a decade), and for many of the
libraries formerly del... |
from whoosh.qparser.default import *
from whoosh.qparser.plugins import *
from whoosh.qparser.syntax import * |
# -*- 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):
"Write your forwards methods here."
# Note: Don't use "from appname.models import ModelName".
# Use orm.... |
"""Routines for subsetting fonts."""
__author__ = '<EMAIL> (Roozbeh Pournader)'
import sys
from fontTools import subset
import coverage
def subset_font(source_file, target_file,
include=None, exclude=None, options=None):
"""Subsets a font file.
Subsets a font file based on a specified cha... |
# Ridiculously simple test of the winsound module for Windows.
import unittest
from test import support
support.requires('audio')
import time
import os
import subprocess
winsound = support.import_module('winsound')
ctypes = support.import_module('ctypes')
import winreg
def has_sound(sound):
"""Find out if a part... |
import datetime, re
from django.conf import settings
from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
from django.utils.feedgenerator import Atom1Feed
from django.core.urlresolvers import reverse as urlreverse
from django.template.defaultfilters import truncatewords_html, date as datefilter, linebre... |
"""Implementation of k-means clustering on top of `Estimator` API (deprecated).
This module is deprecated. Please use
@{tf.contrib.factorization.KMeansClustering} instead of
@{tf.contrib.learn.KMeansClustering}. It has a similar interface, but uses the
@{tf.estimator.Estimator} API instead of @{tf.contrib.learn.Estima... |
"""
Automates the running the the Hyperion crypter on an existing .exe
More information (Nullsecurity) - http://www.nullsecurity.net/papers/nullsec-bsides-slides.pdf
"""
import sys, time, subprocess
from modules.common import helpers
# the main config file
import settings
class Payload:
def __init__(self):
... |
# -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import os
import platform
import re
import sys
import zlib
from netrc import netrc, NetrcParseError
from . impor... |
# coding=utf-8
import pytest
@pytest.fixture # 创建测试环境, 可以做setUp和tearDown的工作
def setup_math():
import math
return math
@pytest.fixture(scope='function')
def setup_function(request):
def teardown_function():
print("teardown_function called.")
request.addfinalizer(teardown_function) # 这个内嵌的函数... |
import unittest
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
class TestSeleniumUsingPhantomJS(unittest.Test... |
import logging
import numpy as np
import pandas as pd
from astropy import units as u
from tardis import constants as const
from tardis.plasma.properties.base import ProcessingPlasmaProperty
logger = logging.getLogger(__name__)
__all__ = [
"BetaRadiation",
"GElectron",
"NumberDensity",
"SelectedAtoms... |
"""Test influxdb.py."""
import BaseHTTPServer
import threading
import re
import unittest
import influxdb
class TestInfluxPoint(unittest.TestCase):
def test_from_dict(self):
def check(sample, measurement, tags, fields, time):
point = influxdb.Point.from_dict(sample)
self.assertEqua... |
"""Verifies that test shuffling works."""
__author__ = '<EMAIL> (Zhanyong Wan)'
import os
import gtest_test_utils
# Command to run the gtest_shuffle_test_ program.
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_shuffle_test_')
# The environment variables for test sharding.
TOTAL_SHARDS_ENV_VAR = 'GTEST_TOT... |
from sqlalchemy.testing import assert_raises, assert_raises_message
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy.orm import scoped_session
from sqlalchemy import Integer, String, ForeignKey
from sqlalchemy.testing.schema import Table, Column
from sqlalchemy.orm import mapper, relationship, que... |
# Wrapper for loading templates from eggs via pkg_resources.resource_string.
from __future__ import unicode_literals
try:
from pkg_resources import resource_string
except ImportError:
resource_string = None
from django.conf import settings
from django.template.base import TemplateDoesNotExist
from django.temp... |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from jingo.helpers import urlparams
from .exceptions import ReadOnlyException
from .jobs import DocumentZoneURLRemapsJob
class ReadOnlyMiddleware(object):
"""
Renders a 403.html page with a flag for a specific message.
"""
... |
"""
Copyright (c) 2014 Brian Muller
Copyright (c) 2015 OpenBazaar
"""
import random
from twisted.internet import defer
from zope.interface import implements
import nacl.signing
from dht.node import Node
from dht.routing import RoutingTable
from dht.utils import digest
from log import Logger
from rpcudp import RPCProto... |
"""Functions relating to the moist static energy budget."""
from aospy.utils.vertcoord import int_dp_g
from indiff.advec import Upwind
from indiff.deriv import LatCenDeriv, LonCenDeriv
from .. import LAT_STR, LON_STR, PLEVEL_STR
from .advection import (horiz_advec, vert_advec, horiz_advec_upwind,
... |
import os
from secret_info import POSTGRES_CONNECTION, SECRET_KEY
basedir = os.path.abspath(os.path.dirname(__file__))
date_style = {'format': '%d-%b-%Y',
'help': 'DD-MMM-YYYY'}
class Config:
WTF_CSRF_ENABLED = True
SECRET_KEY = os.environ.get('SECRET_KEY') or SECRET_KEY
SQLALCHEMY_TRACK_M... |
"""
This command exports a course from CMS to a git repository.
It takes as arguments the course id to export (i.e MITx/999/2020 ) and
the repository to commit too. It takes username as an option for identifying
the commit, as well as a directory path to place the git repository.
By default it will use settings.GIT_R... |
"""
Verifies building a target when the --generator-output= option is used to put
the build configuration files in a separate directory tree referenced by a
symlink.
"""
import TestGyp
import os
# Android doesn't support --generator-output.
test = TestGyp.TestGyp(formats=['!android'])
if not hasattr(os, 'symlink'):
... |
# XXX TO DO:
# - popup menu
# - support partial or total redisplay
# - key bindings (instead of quick-n-dirty bindings on Canvas):
# - up/down arrow keys to move focus around
# - ditto for page up/down, home/end
# - left/right arrows to expand/collapse & move out/in
# - more doc strings
# - add icons for "file", ... |
from distutils.core import setup, Extension
nmap = Extension('nmap',
sources = ['nmap/nmap.py', 'nmap/__init__.py', 'nmap/example.py'])
from nmap import *
# Install : python setup.py install
# Register : python setup.py register
# platform = 'Unix',
# download_url = 'https://github.com/sleach/pyth... |
from django.conf.urls import patterns, url, include
from django.views.generic.base import TemplateView, RedirectView
from main.views import cached_javascript_catalog
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
js_info_dict = {
'packages': ('main',),
}
... |
import sys
import threading
import unittest
import pydevconsole
from _pydev_comm.pydev_rpc import make_rpc_client, start_rpc_server_and_make_client, start_rpc_server
from _pydevd_bundle import pydevd_io
from pydev_console.pydev_protocol import PythonConsoleFrontendService, PythonConsoleBackendService
from pydevconsole... |
"""Public API for the Trace plugin."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.contrib.tensorboard.plugins.trace.trace import *
from tensorflow.contrib.tensorboard.plugins.trace.trace_info_pb2 import... |
from datetime import datetime, timedelta
from twitter.common.lang import total_ordering
# TODO(wickman) Do something that won't break if this is running over NYE?
_CURRENT_YEAR = str(datetime.now().year)
class Level(object):
DEBUG = 0
INFO = 10
WARNING = 20
ERROR = 30
FATAL = 40
@total_ordering... |
from __future__ import absolute_import
from __future__ import print_function
from twisted.trial import unittest
from buildbot.process.results import SUCCESS
from buildbot.steps.package.rpm import rpmlint
from buildbot.test.fake.remotecommand import ExpectShell
from buildbot.test.util import steps
class TestRpmLint(... |
"""
=============================================================
Receiver Operating Characteristic (ROC) with cross validation
=============================================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality using cross-validation.
ROC curv... |
"""
=============================
Discrete versus Real AdaBoost
=============================
This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates
the difference in performance between the discrete SAMME [2] boosting
algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate... |
"""CUDA specific declaration and schedules."""
from __future__ import absolute_import as _abs
from .conv1d import *
from .conv1d_transpose_ncw import *
from .conv2d import *
from .conv2d_hwcn import *
from .conv2d_int8 import *
from .conv2d_winograd import *
from .conv2d_nhwc_winograd import *
from .depthwise_conv2d i... |
import cq_common # modules parameters
from cq_common import *
import sys
import math
class cq_kyocera():
def __init__(self):
self.body_top_color_key = 'brown body' # Top color
self.body_color_key = 'black body' # Body color
self.pin_color_key = 'metal grey pi... |
from bok_choy.page_object import PageObject
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from common.test.acceptance.pages.common.utils import click_css
from common.test.acceptance.tests.helpers import get_selected_option_text, select_option_by_text
class BaseCompo... |
from __future__ import unicode_literals
from six.moves.builtins import range
from six.moves.builtins import object
import pytz
import datetime
import calendar as standardlib_calendar
from django.conf import settings
from django.utils.translation import ugettext
from django.utils.encoding import python_2_unicode_compat... |
from grid.models import Grid
from django.contrib.auth.models import Group, User, Permission
from package.models import Category, PackageExample, Package
from grid.models import Element, Feature, GridPackage
from core.tests import datautil
def load():
category, created = Category.objects.get_or_create(
pk=1... |
# -*- coding: utf-8 -*-
"""
werkzeug.local
~~~~~~~~~~~~~~
This module implements context-local objects.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import copy
from functools import update_wrapper
from werkzeug.wsgi impo... |
import unittest
from autothreadharness.harness_case import HarnessCase
class ED_6_4_1(HarnessCase):
role = HarnessCase.ROLE_ED
case = '6 4 1'
golden_devices_required = 1
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main() |
# -*- coding: utf-8 -*-
import inject
from connection.connection import Connection
class SilegData:
conn = inject.attr(Connection)
def _fetchall(self, sql):
con = self.conn.get()
try:
cur = con.cursor()
try:
cur.execute(sql)
rows = cur.f... |
"""Constants for the Toon integration."""
from datetime import datetime, timedelta
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_PROBLEM,
)
from homeassistant.components.sensor import (
ATTR_LAST_RESET,
ATTR_STATE_CLASS,
DEVICE_CLASS_ENERGY,
DEVICE... |
"""
Utilities for retrieving revision information from a project's git repository.
"""
# Do not remove the following comment; it is used by
# astropy_helpers.version_helpers to determine the beginning of the code in
# this module
# BEGIN
import locale
import os
import subprocess
import warnings
__all__ = ['get_git_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()
__all__ = ['LookupBase']
class LookupBase:
def __init__(self, loader=None, templar=None, **kwargs... |
"""
The GeometryColumns and SpatialRefSys models for the Oracle spatial
backend.
It should be noted that Oracle Spatial does not have database tables
named according to the OGC standard, so the closest analogs are used.
For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns
model and the `SDO_... |
import json
import unittest
from compiled_file_system import CompiledFileSystem
from content_providers import ContentProviders
from extensions_paths import EXTENSIONS
from object_store_creator import ObjectStoreCreator
from test_file_system import TestFileSystem
from test_util import DisableLogging
_CONTENT_PROVIDER... |
__author__ = 'cschmidt'
from lxml import etree
import os
import hashlib
import sys
class Artifact(object):
def __init__(self, group_id, artifact_id, version, classifier=None, extension='jar'):
if not group_id:
raise ValueError("group_id must be set")
if not artifact_id:
rai... |
from __future__ import absolute_import, unicode_literals
from mock import patch
from ...unittest import TestCase
from oauthlib.oauth2.rfc6749.parameters import *
from oauthlib.oauth2.rfc6749.errors import *
from oauthlib import signals
@patch('time.time', new=lambda: 1000)
class ParameterTests(TestCase):
state... |
"""Services for performance counters."""
__author__ = 'Sean Lip'
class PerfCounter(object):
"""Generic in-process numeric counter; not aggregated across instances."""
# TODO(sll): Add aggregation across instances.
def __init__(self, name, description):
if name in Registry._counters:
... |
__source__ = 'https://leetcode.com/problems/maximum-width-ramp/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 962. Maximum Width Ramp
#
# Given an array A of integers, a ramp is a tuple (i, j) for which i < j and A[i] <= A[j].
# The width of such a ramp is j - i.
#
# Find the maximum width of a ramp in A. If ... |
import struct
import time
import cherrypy
from cherrypy._cpcompat import basestring, BytesIO, ntob, set, unicodestr
from cherrypy.lib import file_generator
from cherrypy.lib import set_vary_header
def decode(encoding=None, default_encoding='utf-8'):
"""Replace or extend the list of charsets used to decode a requ... |
from django.db import models
# Create your models here.
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
# from django.contrib.auth.models import User
# from django.db.models.signals import post_save
from datetime import datetime
from users.models import User
import string
i... |
import time
import sys
import struct
import math
import binascii
from bluetooth import set_l2cap_mtu
SX_SELECT = 1 << 0
SX_L3 = 1 << 1
SX_R3 = 1 << 2
SX_START = 1 << 3
SX_DUP = 1 << 4
SX_DRIGHT = 1 << 5
SX_DDOWN = 1 << 6
SX_DLEFT = 1 << 7
SX_L2 = 1 << 8
SX_R2 = 1 << 9
SX_L1 ... |
from nose.tools import assert_equal, raises
from ..connection.info import custom_setup, custom_teardown
from imcsdk.apis.admin.ldap import ldap_enable, ldap_exists,\
ldap_role_group_create, ldap_role_group_exists, ldap_role_group_delete,\
ldap_certificate_management_enable, ldap_certificate_management_... |
"""
===============
Array Internals
===============
Internal organization of numpy arrays
=====================================
It helps to understand a bit about how numpy arrays are handled under the covers to help understand numpy better. This section will not go into great detail. Those wishing to understand the ... |
"""
Classes representing uploaded files.
"""
import os
from io import BytesIO
from django.conf import settings
from django.core.files import temp as tempfile
from django.core.files.base import File
__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',
'SimpleUploadedFile')
class Up... |
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.tempest.api import base_security_groups as base
class SecGroupTest(base.BaseSecGroupTest):
@classmethod
@test.requires_ext(extension="security-group", service="network")
def resource_setup(cls):
super(Sec... |
"""
fs.tests.test_path: testcases for the fs path functions
"""
import unittest
import fs.tests
from fs.path import *
class TestPathFunctions(unittest.TestCase):
"""Testcases for FS path functions."""
def test_normpath(self):
tests = [ ("\\a\\b\\c", "/a/b/c"),
(".", ""),
... |
import unittest
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
from django.utils.six import PY3
class TokenGeneratorTest(TestCase):
def test_make... |
import cv2
from . import login_manager, db
from flask import current_app, url_for
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
@login_manager.user_loader
def load_user(user_id):
re... |
"""Runtime-config resource transforms and symbols dict.
NOTICE: Each TransformFoo() method is the implementation of a foo() transform
function. Even though the implementation here is in Python the usage in resource
projection and filter expressions is language agnostic. This affects the
Pythonicness of the Transform*(... |
"""Constants and interfaces of the Beta API of gRPC Python."""
import abc
import six
import grpc
ChannelConnectivity = grpc.ChannelConnectivity
# FATAL_FAILURE was a Beta-API name for SHUTDOWN
ChannelConnectivity.FATAL_FAILURE = ChannelConnectivity.SHUTDOWN
StatusCode = grpc.StatusCode
class GRPCCallOptions(obje... |
import babel
from datetime import datetime, timedelta
from odoo import http
from odoo.http import request
from odoo.addons.website.controllers.backend import WebsiteBackend
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
class WebsiteCrmBackend(WebsiteBackend):
@http.route()
... |
from vaultcli.workspace import Workspace
from vaultcli.vault import Vault
from vaultcli.card import Card
from vaultcli.secret import Secret
from vaultcli.cypher import Cypher
from vaultcli.exceptions import ResourceUnavailable, Unauthorized, Forbidden
from urllib.parse import urljoin
from os.path import basename
from ... |
class History:
def __init__(self, text, output_sep = "\n"):
self.text = text
self.history = []
self.history_prefix = None
self.history_pointer = None
self.output_sep = output_sep
text.bind("<<history-previous>>", self.history_prev)
text.bind("<<history-next>>... |
'''
Make a colorbar as a separate figure.
'''
from matplotlib import pyplot, mpl
# Make a figure and axes with dimensions as desired.
fig = pyplot.figure(figsize=(8,3))
ax1 = fig.add_axes([0.05, 0.65, 0.9, 0.15])
ax2 = fig.add_axes([0.05, 0.25, 0.9, 0.15])
# Set the colormap and norm to correspond to the data for wh... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from os import close
from tempfile import mkstemp, mkdtemp
from traceback import format_exc
... |
"""A wrapper for motion imitation environment."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gin
import gym
import numpy as np
@gin.configurable
class ImitationWrapperEnv(object):
"""An env using for training policy with motion imitation."""... |
from numpy.distutils.fcompiler import FCompiler
compilers = ['HPUXFCompiler']
class HPUXFCompiler(FCompiler):
compiler_type = 'hpux'
description = 'HP Fortran 90 Compiler'
version_pattern = r'HP F90 (?P<version>[^\s*,]*)'
executables = {
'version_cmd' : ["<F90>", "+version"],
'comp... |
from django import forms
from django.db import models
from django.contrib.admin import widgets
from filer.utils.files import get_valid_filename
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError
from django.conf import settings
if 'cmsplugin_filer_image' in settings.... |
#!/usr/bin/env python
schemas = [
# (new_schema, source_schema)
('tpcds_10gb_orc', 'tpcds.sf10'),
('tpcds_100gb_orc', 'tpcds.sf100'),
('tpcds_1tb_orc', 'tpcds.sf1000'),
]
tables = [
'call_center',
'catalog_page',
'catalog_returns',
'catalog_sales',
'customer',
'customer_address... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import os
import subprocess
from pants.backend.android.targets.android_library import AndroidLibrary
from pants.backend.android.targets.android_resourc... |
#!/usr/bin/env python
# encoding: utf-8
"""Begin retrieve inventory job on Glacier vault. Should be run in conjunction
with `glacier_audit.py`.
"""
import logging
import datetime
from boto.glacier.layer2 import Layer2
from framework.celery_tasks import app as celery_app
from scripts import utils as scripts_utils
fr... |
from __future__ import absolute_import, division, unicode_literals
from . import support # flake8: noqa
import unittest
import codecs
from io import BytesIO
from html5lib.inputstream import (BufferedStream, HTMLInputStream,
HTMLUnicodeInputStream, HTMLBinaryInputStream)
class Buffe... |
# -*- coding: utf-8 -*-
r"""
werkzeug.posixemulation
~~~~~~~~~~~~~~~~~~~~~~~
Provides a POSIX emulation for some features that are relevant to
web applications. The main purpose is to simplify support for
systems such as Windows NT that are not 100% POSIX compatible.
Currently this only imple... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import jinja2
from ansible.compat.tests import unittest
from ansible.template import _escape_backslashes, _count_newlines_from_end
# These are internal utility functions only needed for templating. They're
# algorithmic so good ... |
from copy import copy
from django.utils.module_loading import import_string
# Cache of actual callables.
_standard_context_processors = None
# We need the CSRF processor no matter what the user has in their settings,
# because otherwise it is a security vulnerability, and we can't afford to leave
# this to human error... |
from openerp import http
import simplejson
from openerp.tools import ustr
from openerp.http import request, serialize_exception as _serialize_exception
from cStringIO import StringIO
from collections import deque
try:
import xlwt
except ImportError:
xlwt = None
class TableExporter(http.Controller):
@http... |
from unit.applications.proto import TestApplicationProto
class TestVariables(TestApplicationProto):
prerequisites = {}
def setup_method(self):
assert 'success' in self.conf(
{
"listeners": {"*:7080": {"pass": "routes/$method"}},
"routes": {
... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import Stemmer
import pt_br_mapper as constants
class Processing(object):
"""
All methods has more sense for Portuguese-BR language
"""
def __init__(self, tweet):
self.tweet = tweet
def execute(self):
"""
Execute all process... |
import operator, sys, socket, random
from twisted.protocols import dns
from twisted.internet import defer, error
from twisted.python import failure, log
EMPTY_RESULT = (), (), ()
class ResolverBase:
typeToMethod = None
def __init__(self):
self.typeToMethod = {}
for (k, v) in typeToMethod.ite... |
import numpy as np
from numpy import linalg
import matplotlib.pyplot as plt
from skimage.exposure import rescale_intensity
from skimage.segmentation import random_walker
from skimage.color import separate_stains
from skimage.color import rgb2grey
from skimage.io import imread
import time
from pyamg import *
#Colo... |
"""Tests for tensorflow.contrib.layers.python.ops.sparse_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.layers.python.ops import sparse_ops
from tensorflow.python.framework import dtypes
from tensorflow.p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.