content string |
|---|
#**************************************************************************#
#* FILE ************** accelerate_tools.py ************************#
#**************************************************************************#
#* Author: Patrick Miller February 9 2002 *#
#***********... |
#!/usr/bin/python
#
# Test for smbcontrol command line argument handling.
#
import comfychair
class NoArgs(comfychair.TestCase):
"""Test no arguments produces usage message."""
def runtest(self):
out = self.runcmd("smbcontrol", expectedResult = 1)
self.assert_re_match("Usage: smbcontrol", out[... |
from .lexerconstants import CHAR_MAP, HAS_ARGS, IMP_CONST, \
STACK_MANIPULATION_CONST, ARITHMETIC_CONST, HEAP_ACCESS_CONST, \
FLOW_CONTROL_CONST, IO_CONST, NUM_CONST
from .ws_token import Tokeniser
class IntError(ValueError):
'''Exception when invalid integer is found'''
class Lexer(object):
def __i... |
import os
import re
import json
import sys
import copy
from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule, BOOLEANS_TRUE, BOOLEANS_FALSE
from ansible.module_utils.six.moves.urllib.parse import urlparse
HAS_DOCKER_PY = True
HAS_DOCKER_PY_2 = False
HAS_DOCKER_ERROR = None
t... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
# TODO: Disabled RETURN as it is breaking the build for docs. Needs to be fixed.
import time
#TODO: get this info from API
STATES = ['present', 'absent']
DATACENTERS = ['ams01','ams03','ch... |
"""Tests for functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import load_library
from tensorflow.python.ops import data_flow_ops
from tensorflow.python.... |
"""Tests specific to deferred-build `Sequential` models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import unittest
import numpy as np
from tensorflow.python import keras
from tensorflow.python.compat import v2_compat
from tensorflow.pyth... |
import sys
import simpleubjson
from ..draft8 import Draft8Decoder
from ..draft9 import Draft9Decoder
from ..exceptions import EarlyEndOfStreamError
def pprint(data, output=sys.stdout, allow_noop=True,
indent=' ' * 4, max_level=None, spec='draft-9'):
"""Pretty prints ubjson data using the handy [ ]-nota... |
from pyparser.grammar.pclass import Class as BaseClass, Extractor as BaseExtractor
from pyparser.grammar.exception import InvalidSyntax
from pyparser.lang.php.grammar.method import Extractor as MethodExtractor
from pyparser.lang.php.grammar.classprop import Extractor as PropExtractor
keywords = ['abstract', 'class']
... |
"""
Example DAG demonstrating the usage of BranchPythonOperator with depends_on_past=True, where tasks may be run
or skipped on alternating runs.
"""
import airflow
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import BranchPythonOperat... |
"""
Forms and validation code for user registration.
Note that all of these forms assume Django's bundle default ``User``
model; since it's not possible for a form to anticipate in advance the
needs of custom user models, you will need to write your own forms if
you're using a custom model.
"""
from django.contrib.... |
'''
Created on Apr 7, 2012
@author: Demicow
'''
import pygame
#Tie circle collion to self. leftside etc
class customSprite(pygame.sprite.DirtySprite):
def __init__(self, scene, image, location):
#init the sprite!
pygame.sprite.DirtySprite.__init__(self)
#info about t... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from djangocms_accordion.models import Accordion, AccordionEntry
class AccordionPlugin(CMSPluginBase):
model = Accordion
name = _('Accordion')
... |
import time
from openerp.report import report_sxw
#
# Use period and Journal for selection or resources
#
class journal_print(report_sxw.rml_parse):
def lines(self, journal_id, *args):
self.cr.execute('select id from account_analytic_line where journal_id=%s order by date,id', (journal_id,))
ids = ... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.compat import long
from numpy.testing import (
TestCase, assert_, assert_equal, assert_array_equal, run_module_suite
)
from numpy.lib.type_check import (
common_type, mintypecode, isreal, iscomplex, isposinf, isn... |
"""Stats Command."""
from __future__ import print_function
import collections
import datetime
import re
import random
import time
import socket
import logging
from os import environ
import tabulate
from six.moves.configparser import ConfigParser
from biggraphite.cli import command
from prometheus_client import wr... |
"""BibEncode helper functions.
Functions that are used throughout the BibEncode module
"""
import os
import subprocess
import unicodedata
import re
import sys
import time
try:
from uuid import uuid4
except ImportError:
import random
def uuid4():
return "%x" % random.getrandbits(16*8)
from invenio... |
import sys
import json
import requests
import re
class BitportAPI:
access_token = ""
apiBaseUrl = "https://api.bitport.io/v2"
isTvShowRegex = re.compile("[Ss]\d{1,2}[Ee]\d{1,2}")
getNameRegex = re.compile("(^[a-zA-Z. _\-0-9()'\"]*?)\(?2\d\d\d|(^[a-zA-Z. _\-0-9()'\"]*)([Ss]\d{1,2}[Ee]\d{1,2})")
... |
from __future__ import division # required for float results when dividing ints
import os, sys
from glob import glob
from os.path import isfile, join
from itertools import islice
INPUT=sys.argv[1]
# zoom=int(sys.argv[3])
def convert(filename):
# todo: get zoom from filename
zoom=15# current zoom level - sets x & y... |
from django.conf.urls import url
from django.contrib import messages
from django.core.urlresolvers import reverse
from django import forms
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, Template
from django.template.response import TemplateResponse
from django.vie... |
"""
Test that environment variables are ignored when --ignore-environment is
specified.
"""
import os
import TestGyp
os.environ['GYP_DEFINES'] = 'FOO=BAR'
os.environ['GYP_GENERATORS'] = 'foo'
os.environ['GYP_GENERATOR_FLAGS'] = 'genflag=foo'
os.environ['GYP_GENERATOR_OUTPUT'] = 'somedir'
test = TestGyp.TestGyp(form... |
# -*- coding: utf-8 -*-
"""
RealWorldish Benchmark
~~~~~~~~~~~~~~~~~~~~~~
A more real-world benchmark of Jinja2. Like the other benchmark in the
Jinja2 repository this has no real-world usefulnes (despite the name).
Just go away and ignore it. NOW!
:copyright: (c) 2009 by the Jinja Team.
... |
"""
This module houses the GDAL & SRS Exception objects, and the
check_err() routine which checks the status code returned by
GDAL/OGR methods.
"""
# #### GDAL & SRS Exceptions ####
class GDALException(Exception):
pass
# Legacy name
OGRException = GDALException
class SRSException(Exception):
pass
cla... |
import re
import codecs
class MalformedLocaleFileError(Exception):
pass
def parse_file(path):
return parse(read_file(path), path)
def read_file(path):
try:
return codecs.open( path, "r", "utf-8" ).readlines()
except UnicodeDecodeError, e:
raise MalformedLocaleFileError(
'Fol... |
from __future__ import absolute_import, division, print_function, \
with_statement
import os
import sys
import hashlib
import logging
from shadowsocks import common
from shadowsocks.crypto import rc4_md5, openssl, sodium, table
method_supported = {}
method_supported.update(rc4_md5.ciphers)
method_supported.upda... |
'''examples to check summary, not converted to tests yet
'''
from __future__ import print_function
if __name__ == '__main__':
from statsmodels.regression.tests.test_regression import TestOLS
#def mytest():
aregression = TestOLS()
TestOLS.setupClass()
results = aregression.res1
r_summary = s... |
from rope.base import ast, evaluate, builtins, pyobjects
from rope.refactor import patchedast, occurrences
class Wildcard(object):
def get_name(self):
"""Return the name of this wildcard"""
def matches(self, suspect, arg):
"""Return `True` if `suspect` matches this wildcard"""
class Suspec... |
import unittest
from tests.baseclass import CommandTest
class FC3_TestCase(CommandTest):
command = "keyboard"
def runTest(self):
# pass
self.assert_parse("keyboard us", "keyboard us\n")
# fail
self.assert_parse_error("keyboard")
self.assert_parse_error("keyboard us uk"... |
"""
Utilities to use when interfacing with Postgres.
- These utilities support the workflow wherein you store annoated
sentences in a database.
"""
__author__ = 'arunchaganty'
import os
import stanza
import requests
import logging
def unescape_sql(inp):
"""
:param inp: an input string to be unescaped
:re... |
import unittest
from unittest import mock
import pytest
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.sagemaker import SageMakerHook
from airflow.providers.amazon.aws.operators.sagemaker_transform import SageMakerTransformOperator
role = 'arn:aws:iam:role/test-role'
bucket ... |
"""
Tests for the Studio authoring XBlock mixin.
"""
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
class AuthoringMixinTestCase(ModuleStoreTestCase):
... |
# Time: O(nlogn + nlogk) = O(nlogn), k is the length of the result.
# Space: O(1)
# You have a number of envelopes with widths and heights given
# as a pair of integers (w, h). One envelope can fit into another
# if and only if both the width and height of one envelope is greater
# than the width and height of the ot... |
"""
Jawbone OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/jawbone.html
"""
from social.utils import handle_http_errors
from social.backends.oauth import BaseOAuth2
from social.exceptions import AuthCanceled, AuthUnknownError
class JawboneOAuth2(BaseOAuth2):
name = 'jawbone'
AUTHORIZA... |
import asyncio
import datetime
import math
import time
import unittest
from SimpleCommander.src.simple_commander.game.hero import Hero
from SimpleCommander.src.simple_commander.game.invader import Invader
class Controller():
game_field = {'height': 1000, 'width': 1000}
collisions = {}
@asyncio.coroutine... |
"""
A test harness for the logging module. Tests new fileConfig (not yet a complete test).
Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.
"""
import logging, logging.config
def doLog(logger):
logger.debug("Debug")
logger.info("Info")
logger.warning("Warning")
logger.error("Error")
logge... |
# -*- coding: utf-8 -*-
"""
werkzeug._internal
~~~~~~~~~~~~~~~~~~
This module provides internally used helpers and constants.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
import string
import inspect
from weakre... |
from setuptools import setup, find_packages
from whoson import __version__
tests_require = [
'mock',
'nose',
'coverage',
'yanc',
'preggy',
'tox',
'ipdb',
'coveralls',
'sphinx',
]
setup(
name='whoson',
version=__version__,
description="Server for the who's on plugin.",
... |
#!/usr/bin/python -u
#
# this tests the DTD validation with the XmlTextReader interface
#
import sys
import glob
import string
import libxml2
try:
import StringIO
str_io = StringIO.StringIO
except:
import io
str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
err=""
expect="""../../tes... |
import PyQt4.QtCore as qtcore
import PyQt4.QtGui as qtgui
from beeutil import *
from beetypes import *
from beeapp import BeeApp
# object to handle the undo/redo history
class CommandStack:
def __init__(self,window,type,maxundo=50):
self.commandstack=[]
self.index=0
self.changessincesave=0
self.type=type
... |
# 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 field 'Song.album_art'
db.add_column('djpandora_song', 'album_art', self.gf('django.db.models.fie... |
from string import ascii_letters
from hashlib import md5
from CodernityDB.tree_index import MultiTreeBasedIndex, TreeBasedIndex
from couchpotato.core.helpers.encoding import toUnicode, simplifyString
class MediaIndex(MultiTreeBasedIndex):
_version = 3
custom_header = """from CodernityDB.tree_index import Mu... |
from django_webtest import WebTest
from django.core.urlresolvers import reverse
from django.core import mail
from oscar.apps.customer.models import ProductAlert
from oscar.test.factories import create_product, create_stockrecord
from oscar.test.factories import UserFactory
class TestAUser(WebTest):
def test_can... |
# -*- coding: utf-8 -*-
"""
werkzeug.useragents
~~~~~~~~~~~~~~~~~~~
This module provides a helper to inspect user agent strings. This module
is far from complete but should work for most of the currently available
browsers.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more deta... |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
import sys
import os
import subprocess
import shutil
from copy import copy, deepcopy
from test.support import (run_unittest, TESTFN, unlink, get_attribute,
... |
from django.contrib.auth.models import AnonymousUser
from nose.tools import eq_
from kitsune.questions.forms import NewQuestionForm, WatchQuestionForm
from kitsune.questions.tests import TestCaseBase
from kitsune.users.tests import user
class WatchQuestionFormTests(TestCaseBase):
"""Tests for WatchQuestionForm.... |
import mmap
# import tempfile
# import shutil
# import os
class LargeFileReader (object):
"""
FOr mapping file to virtual memory.
File-like (read-only) object trimmed for low memory footprint.
Reading and finding does not advance the offset.
Usage:
# open
file = LargeFileReader("/f... |
import threading
from django.conf import settings
from corehq.toggles import NEW_EXPORTS, TF_DOES_NOT_USE_SQLITE_BACKEND
_thread_local = threading.local()
def get_local_domain_sql_backend_override(domain):
try:
return _thread_local.use_sql_backend[domain]
except (AttributeError, KeyError):
... |
__author__ = 'api.jscudder (Jeff Scudder)'
import unittest
import getpass
import gdata.client
import gdata.service
import gdata
username = ''
password = ''
def Utf8String(my_string):
return unicode(my_string, 'UTF-8')
class ClientLiveTest(unittest.TestCase):
def setUp(self):
self.client = gdata.client.... |
from spack import *
class PerlDevelGlobaldestruction(PerlPackage):
"""Makes Perl's global destruction less tricky to deal with"""
homepage = "http://search.cpan.org/~haarg/Devel-GlobalDestruction-0.14/lib/Devel/GlobalDestruction.pm"
url = "http://search.cpan.org/CPAN/authors/id/H/HA/HAARG/Devel-Glob... |
class classifier(object):
# initialize classifier setting all weights to 0.5:
def __init__(self, tag, feat_vec, lmi_dict, top_x):
self.tag = tag
self.top_x = top_x
self.lmi_dict = lmi_dict
self.feat_vec = feat_vec
self.weight_vector = [0.0 for ind in range(len(feat_vec))... |
r'''
DOCUMENTATION:
inventory: host_list
version_added: "2.4"
short_description: Parses a 'host list' string
description:
- Parses a host list string as a comma separated values of hosts
- This plugin only applies to inventory strings that are not paths and contain a comma.
EXAMPLES: |
... |
"""
Authors: Tim Bedin
Copyright 2015 CSIRO, Australian Government Bureau of Meteorology
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
Unless required ... |
"""Module for testing the update cluster systemlist command."""
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
class TestUpdateClusterSystemList(TestBrokerCommand):
def test_100_update_rg_single_host(self):
self.noouttest... |
#! /usr/bin/env python
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
times. See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Command line ... |
# coding=utf-8
"""
Supports the definition of commands in separate classes to be composed into cmd2.Cmd
"""
from typing import Optional, Type
from .constants import COMMAND_FUNC_PREFIX
from .exceptions import CommandSetRegistrationError
# Allows IDEs to resolve types without impacting imports at runtime, breaking cir... |
import argparse
import cStringIO
import gzip
import json
import os
import requests
import urlparse
treeherder_base = "https://treeherder.mozilla.org/"
"""Simple script for downloading structured logs from treeherder.
For the moment this is specialised to work with web-platform-tests
logs; in due course it should mov... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .common import InfoExtractor
class SztvHuIE(InfoExtractor):
_VALID_URL = r'http://(?:(?:www\.)?sztv\.hu|www\.tvszombathely\.hu)/(?:[^/]+)/.+-(?P<id>[0-9]+)'
_TEST = {
'url': 'http://sztv.hu/hirek/cserkeszek-nepszerusitettek-a-kornye... |
"""Utils for Estimator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import tensorflow as tf
FLAGS = tf.flags.FLAGS
def assert_estimator_contract(tester, estimator_class):
"""Asserts whether given estimator satisfies the expected... |
# -*- coding: utf-8 -*-
import os
import urllib
import logging
from django.db import models
from addons.base import exceptions
from addons.base.models import (BaseOAuthNodeSettings, BaseOAuthUserSettings,
BaseStorageAddon)
from addons.onedrive import settings
from addons.onedrive.clien... |
"""report.py - Utilities for reporting statistics about benchmark results
"""
import os
class BenchmarkColor(object):
def __init__(self, name, code):
self.name = name
self.code = code
def __repr__(self):
return '%s%r' % (self.__class__.__name__,
(self.name, sel... |
import logging
from webkitpy.common.net.layouttestresults import LayoutTestResults
from webkitpy.common.net.unittestresults import UnitTestResults
from webkitpy.tool.steps.runtests import RunTests
_log = logging.getLogger(__name__)
# FIXME: This class no longer has a clear purpose, and should probably
# be made par... |
"""
pyDatalog
Copyright (C) 2012 Pierre Carbonnelle
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This lib... |
import errno
import logging
import os
import shutil
import stat
import sys
from theano import config
from theano.gof.cmodule import get_lib_extension
from theano.gof.compilelock import get_lock, release_lock
from theano.sandbox import cuda
from theano.sandbox.cuda import nvcc_compiler
from .shared_code import this_di... |
from enum import Enum
from collections import namedtuple
class UIComponents:
# named tuple to hold two xPath values for each platform
Component = namedtuple('Component', ['iOS', 'Android'])
LABEL = Component(iOS='//XCUIElementTypeStaticText[{}]', Android='//android.widget.TextView[{}]')
BUTTON = Com... |
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
# Read in the image and print out some stats
# Note: in the previous example we were reading a .jpg
# Here we read a .png and convert to 0,255 bytescale
image = mpimg.imread('../images/test.jpg')
# Grab the x and y size and make a co... |
"""Unit tests for the source_control module."""
import unittest
import mock
import source_control
class SourceControlTest(unittest.TestCase):
@mock.patch('source_control.bisect_utils.CheckRunGit')
def testQueryRevisionInfo(self, mock_run_git):
# The QueryRevisionInfo function should run a sequence of git c... |
"""Upgrade script to move from pre-release schema to new schema.
Usage examples:
bazel run tensorflow/contrib/lite/schema/upgrade_schema -- in.json out.json
bazel run tensorflow/contrib/lite/schema/upgrade_schema -- in.bin out.bin
bazel run tensorflow/contrib/lite/schema/upgrade_schema -- in.bin out.json
bazel run te... |
from __future__ import unicode_literals
from base64 import b64encode as b64e
import unittest
from airflow.contrib.operators.pubsub_operator import (
PubSubTopicCreateOperator, PubSubTopicDeleteOperator,
PubSubSubscriptionCreateOperator, PubSubSubscriptionDeleteOperator,
PubSubPublishOperator)
try:
f... |
"""Test case for the function create snapshot."""
import copy
import mock
import time
from cinder import db
from cinder import exception
from cinder.tests.unit import fake_snapshot
from cinder.tests.unit import utils
from cinder.tests.unit.volume.drivers import disco
class CreateSnapshotTestCase(disco.TestDISCODri... |
import functools
from flask_login import current_user
from flask_restful import abort
from funcy import flatten
view_only = True
not_view_only = False
ACCESS_TYPE_VIEW = 'view'
ACCESS_TYPE_MODIFY = 'modify'
ACCESS_TYPE_DELETE = 'delete'
ACCESS_TYPES = (ACCESS_TYPE_VIEW, ACCESS_TYPE_MODIFY, ACCESS_TYPE_DELETE)
def... |
from django.conf import settings
from django.conf.urls import include, url
from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore import hoo... |
''' Provide decorators help with define Bokeh validation checks.
'''
from __future__ import absolute_import
from functools import partial
from six import string_types
def _validator(code_or_name, validator_type):
if validator_type == "error":
from .errors import codes
from .errors import EXT
... |
import logging
from xmodule.modulestore import search
from xmodule.modulestore.django import modulestore, ModuleI18nService
from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem
from xmodule.open_ended_grading_classes.controller_query_service import ControllerQueryService
from xmodule.open_ended_g... |
#encoding=utf-8
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent)
print(" / ".join(result))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。")
cuttest("工信处女干事每月经过下属科室都要亲口交代24口... |
from django import http
from django.conf import settings
from common import exception
from common import util
def debug_only(handler):
def _wrapper(request, *args, **kw):
if not settings.DEBUG:
raise http.Http404()
return handler(request, *args, **kw)
_wrapper.__name__ = handler.__name__
return _w... |
from test_plus.test import TestCase
from datetime import date
from pyconca2017.pycon_schedule.models import Schedule
class WebPagesTests(TestCase):
def test_homepage(self):
response = self.client.get(self.reverse('home'))
self.assertEqual(response.status_code, 200)
def test_about(self):
... |
# -*- coding: utf-8 -*-
""" Print information of the users who got unassigned tickets."""
from django.core.management.base import BaseCommand, CommandError
from django.core import urlresolvers
from django.conf import settings
from conference import models
from conference import utils
from p3 import models as p3_model... |
import os.path
from Common import *
from ConfigParser import *
class ConfigKeyValuePair(object):
def __init__(self, prop_name, prop_value):
self.prop_name = prop_name
self.prop_value = prop_value
class ConfigUtil(object):
def __init__(self, config_file_path, section_name, logger):
"""
... |
import matplotlib.pyplot as plt
# Matplotlib module has been used for plotting
# Class plot1 has been made to plot given coordinates in different graph styles
# For each graph style a function has been defined
# For saving the figure a function has been defined , You have to provide the full path
# For example in Ubunt... |
import logging
from datetime import timedelta, datetime
import telecommand
from obc.experiments import ExperimentType
from response_frames.common import ExperimentSuccessFrame
from system import auto_power_on, runlevel
from tests.base import RestartPerTest
from utils import TestEvent
class TestExperimentD... |
"""Normalization layers.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.keras._impl.keras import backend as K
from tensorflow.python.keras._impl.keras import constraints
from tensorflow.python.keras._impl.keras import initializers... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.parsing.splitter import split_args, parse_kv
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject, AnsibleMapping
from ansible.playbook.attribute import FieldAttribute
from ansible.playbook.base im... |
from google.protobuf.descriptor import FieldDescriptor
import re
from jinja2 import Template, Environment
import hashlib
FIELD_LABEL_MAP = {
FieldDescriptor.LABEL_OPTIONAL: 'optional',
FieldDescriptor.LABEL_REQUIRED: 'required',
FieldDescriptor.LABEL_REPEATED: 'repeated'
}
FIELD_TYPE_MAP = {
FieldDesc... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri May 26 10:24:07 2017
@author: pach0
"""
import os
from fnmatch import fnmatch
import pandas as pd
root = '/home/pach0/Documents/autonomous_bicycle/code/'
pattern = "*.csv"
filenames = []
files = []
for path, subdirs, files in os.walk(root):
for n... |
"""
The :mod:`sklearn.metrics.scorer` submodule implements a flexible
interface for model selection and evaluation using
arbitrary score functions.
A scorer object is a callable that can be passed to
:class:`sklearn.grid_search.GridSearchCV` or
:func:`sklearn.cross_validation.cross_val_score` as the ``scoring`` parame... |
# coding: utf-8
from __future__ import print_function, absolute_import, division, unicode_literals
if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
__all__ = ["ScalarInt", "BinaryInt", "OctalInt", "HexInt", "HexCapsInt"]
from .compat import no_limit_int # NOQA
class ScalarInt(no_limit_int):... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
for amimoto_alexa
"""
from helpers import *
from debugger import *
import yaml
import random
def dispatch_question(intent, session):
"""Dispatch questions and return answer.
"""
session_attributes = build_session_attributes(session)
should_end_sessi... |
import os
import csv
from splice.environment import Environment
from splice.webapp import create_webapp
from flask.ext.testing import TestCase
db_uri = os.environ.get('TEST_DB_URI') or 'postgres://localhost/splice_test'
env = Environment.instance(test=True, test_db_uri=db_uri)
class BaseTestCase(TestCase):
def ... |
#!/usr/bin/env python
from pyfdt.pyfdt import *
phandle = 1
root = FdtNode("/")
chosen = FdtNode("chosen")
aliases = FdtNode("aliases")
memory = FdtNode("memory")
cpus = FdtNode("cpus")
clocks = FdtNode("clocks")
soc = FdtNode("soc")
soc_intc = FdtNode("interrupt-controller")
soc_uart = FdtNode("uart@0xF000E000")
ro... |
from openstack.identity import identity_service
from openstack import resource
class Group(resource.Resource):
resource_key = 'group'
resources_key = 'groups'
base_path = '/groups'
service = identity_service.IdentityService()
# capabilities
allow_create = True
allow_get = True
allow_u... |
"""SCons.Tool.gcc
Tool-specific initialization for MinGW (http://www.mingw.org/)
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 T... |
import re
import traceback
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.helpers.variable import tryInt, splitString
from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.torrent.base import TorrentProvider
lo... |
# -*- coding: utf-8 -*-
from typing import Any, List, Optional, Text
import django
import mock
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.user_groups import (
check_add_user_to_user_group,
check_remove_user_from_user_group,
create_user_group,
get_user_groups,
user_groups_in_... |
apiAttachAvailable = u'API disponible'
apiAttachNotAvailable = u'Indisponible'
apiAttachPendingAuthorization = u'Autorisation en attente'
apiAttachRefused = u'Refus\xe9'
apiAttachSuccess = u'Connexion r\xe9ussie'
apiAttachUnknown = u'Inconnu'
budDeletedFriend = u'Supprim\xe9 de la liste d\u2019amis'
budFriend = ... |
import gdb
from linux import constants
from linux import utils
from linux import tasks
from linux import lists
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
def __init__(self):
super(LxCmdLine,... |
""" Tests for models. """
import ddt
from django.test import TestCase
from commerce.api.v1.models import Course
from course_modes.models import CourseMode
@ddt.ddt
class CourseTests(TestCase):
""" Tests for Course model. """
def setUp(self):
super(CourseTests, self).setUp()
self.course = Cour... |
#!/usr/bin/env python
"""
This script is used to create color-coded sub-DAGs for the documentation. It
is intended to be run from the "doc" directory, and can be triggered by running
the Makefile target "dags".
The "Snakefile" is run with each set of targets defined by the
config.yaml file to create a DAG just for th... |
"""Tests for VGG16 application."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.keras._impl import keras
from tensorflow.python.platform import test
class VGG16Test(test.TestCase):
def test_with_top(self):
model = keras.ap... |
# -*- 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):
# Deleting field 'Theme.rules'
db.delete_column(u'django_diazo_theme', 'rules')
def backwards(self, or... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class TMZIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tmz\.com/videos/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'http://www.tmz.com/videos/0_okj015ty/',
'md5': '4d22a51ef205b6c06395d8394f72d560',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.