content stringlengths 4 20k |
|---|
from mldb import mldb
def find_column(response, column, value):
for col in response[0]["columns"]:
if col[0] == column:
assert col[1] == value
return
assert False
conf = {
"type": "stemmer",
"params": {
"language": "english"
}
}
res = mldb.put("/v1/functi... |
#!/usr/bin/python
from trac.tests.functional import *
from trac.util.text import unicode_to_base64, unicode_from_base64
class TestBasicSettings(FunctionalTwillTestCaseSetup):
def runTest(self):
"""Check basic settings."""
self._tester.go_to_admin()
tc.formvalue('modbasic', 'url', 'https://m... |
from oslo_log import log as logging
import six
import webob
from webob import exc
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _LI
from cinder import replication as replicationAPI
from cinder import volume
L... |
import xml.etree.ElementTree
import sqlite3
database_file = 'database.db'
#database_file = 'E:\\Github Projects\\Tibialyzer\\Tibialyzer\\Database\\database.db'
cities_xmlfile = "Extra Information/killinginthenameof.xml"
from coordinates import convert_x, convert_y
conn = sqlite3.connect(database_file)
c = conn.curso... |
import logging
from pylons import request, response, session, tmpl_context as c
from zkpylons.lib.helpers import redirect_to
from pylons.decorators import validate
from pylons.decorators.rest import dispatch_on
from formencode import validators, htmlfill
from formencode.variabledecode import NestedVariables
from zkp... |
import unittest
from csrv.model import cards
from csrv.model import deck
from csrv.model import events
from csrv.model import game
from csrv.model import premade_decks
from csrv.model import test_base
from csrv.model import timing_phases
from csrv.model.cards import corp
from csrv.model.cards.runner import card01010
... |
#!/usr/bin/python -u
""" test on huge file which tends to expose "interesting" behavior """
import os
import sys
import time
print "NOTE: intended to be run from the gzipstream directory in CVS"
print
from gzipstream import GzipStream
INPUT = os.path.join(os.path.dirname(sys.argv[0]), 'huge-all-zeros.txt.gz')
BUFSIZ... |
import os, time
import gobject, gtk
from hal_widgets import _HalWidgetBase
import linuxcnc
from hal_glib import GStat
from hal_actions import _EMC_ActionBase, _EMC_Action
from hal_filechooser import _EMC_FileChooser
import gtksourceview2 as gtksourceview
class EMC_SourceView(gtksourceview.View, _EMC_ActionBase):
... |
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.auth.models import User
from apps.statistics.models import MStatistics
from apps.rss_feeds.models import Feed
from optparse import make_option
from utils import feed_fetcher
from utils.management_functions import da... |
import pytest
from unittest import mock
from django.core.urlresolvers import reverse
from django.core import mail
from taiga.base.utils import json
from taiga.hooks.github import event_hooks
from taiga.hooks.github.api import GitHubViewSet
from taiga.hooks.exceptions import ActionSyntaxException
from taiga.projects.... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.aws.core import AnsibleAWSModule
from ansible.module_utils.ec2 import (AWSRetry,
boto3_conn,
... |
from datetime import datetime
import gviz_api
class GvizGrapher(object):
"""A grapher that produces JSON output for the Google Visualizaton
Datatable.
"""
def __init__(self):
pass
def _get_nested_attr(self, item, attr):
attributes = attr.split(".")
ret = item
for a... |
#!/usr/bin/env python
from numpy import array,hstack
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
label_traindat = lm.load_labels('../data/label_train_twoclass.dat')
p... |
import logging
from django.core.urlresolvers import reverse
from django.template import defaultfilters as filters
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from horizon.utils import filters as u... |
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from django.conf import settings
from lettuce import step, world
from nose.tools import assert_false, assert_true
from selenium.webdriver.common.keys import Keys
from cms.djangoapps.contentstore.features.common import type_in_codemirror
TEST_... |
import re
import warnings
from urllib.parse import urlparse
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.mail import mail_managers
from django.http import HttpResponsePermanentRedirect
from django.urls import is_valid_path
from django.utils.cache import (
cc... |
# -*- coding: utf-8 -*-
from openerp.addons.website_blog.tests.common import TestWebsiteBlogCommon
class TestWebsiteBlogFlow(TestWebsiteBlogCommon):
def test_website_blog_followers(self):
""" Test the flow of followers and notifications for blogs. Intended
flow :
- people subscribe to ... |
import unittest
from mock import Mock, sentinel
from specs.utils import an_event_with, human_time_to_py, ObjectWithTruthValue
from timelinelib.db.backends.memory import MemoryDB
from timelinelib.db.objects import Container
from timelinelib.editors.container import ContainerEditor
from timelinelib.repositories.interfa... |
import nose
from pandas import DataFrame
import numpy as np
import pandas.util.testing as tm
from pandas.io.json import json_normalize, nested_to_record
def _assert_equal_data(left, right):
if not left.columns.equals(right.columns):
left = left.reindex(columns=right.columns)
tm.assert_frame_equal(l... |
# -*- coding: utf-8 -*-
"""
flask.logging
~~~~~~~~~~~~~
Implements the logging support for Flask.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from logging import getLogger, StreamHandler, Formatter, getLoggerClas... |
import mock
from neutron.agent.linux import ebtables_manager as em
from neutron.tests import base
LONG_NAME = "1234567890" * 3
class EbtablesManagerBaseTestCase(base.BaseTestCase):
def setUp(self):
super(EbtablesManagerBaseTestCase, self).setUp()
mock.patch.object(em, "binary_name", return_valu... |
import glob
import json
import tarfile
import tempfile
import time
from . import ApolloTestCase, wa
class RemoteTest(ApolloTestCase):
def test_delete_organism(self):
org_info = self.waitOrgCreated('temp_org')
wa.remote.delete_organism(org_info['id'])
self.waitOrgDeleted('temp_org')
... |
__revision__ = "src/engine/SCons/Sig.py 2014/07/05 09:42:21 garyo"
__doc__ = """Place-holder for the old SCons.Sig module hierarchy
This is no longer used, but code out there (such as the NSIS module on
the SCons wiki) may try to import SCons.Sig. If so, we generate a warning
that points them to the line that cause... |
import GemRB
from GUIDefines import *
from ie_stats import *
import CharGenCommon
import GUICommon
import CommonTables
RaceWindow = 0
TextAreaControl = 0
DoneButton = 0
def OnLoad():
global RaceWindow, TextAreaControl, DoneButton
global RaceTable
if GUICommon.CloseOtherWindow (OnLoad):
if(RaceWindow):
RaceW... |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import, division)
import unittest
import os
from os.path import isfile
import shutil
from lib import constants as const
from lib import utils
from lib import library
from tests import mock_constants
from tests import mo... |
import django.test
from django.contrib.auth.models import User
from django.conf import settings
from django.test.utils import override_settings
from course_groups.models import CourseUserGroup
from course_groups.cohorts import (get_cohort, get_course_cohorts,
is_commentable_cohorted... |
#!/usr/bin/env python
import sys
import string
import numpy
import scipy.io
from matplotlib.pylab import *
from fractionS import *
N_A = 6.0221367e23
E2 = 5
V = 1e-15
def plot_theory( K ):
N = 1000
minE1 = 0.1
maxE1 = 100.
e1array = numpy.mgrid[minE1:maxE1:(maxE1-minE1)/N]
farray = [ fracti... |
# 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):
# Removing unique constraint on 'ProjectDomain', fields ['project', 'domain']
db.delete_unique('sentry_projectdoma... |
"""Tests for distutils.file_util."""
import unittest
import os
import shutil
from distutils.file_util import move_file
from distutils import log
from distutils.tests import support
from test.support import run_unittest
class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
def _log(self, msg, *args):... |
# Kleine correctie op BTW te vorderen hoog, id was hetzelfde voor beide, waardoor hoog werd overschreven door # overig. Verduidelijking van omschrijvingen in belastingcodes t.b.v. aangifte overzicht.
# versie 5.0.1.4
# BTW omschrijvingen aangepast, zodat rapporten er beter uitzien. 2a en 5b e.d. verwijderd en enk... |
"""
.. todo::
WRITEME
"""
import numpy as np
from pylearn2.datasets import dense_design_matrix
from pylearn2.utils.serial import load
from pylearn2.utils.rng import make_np_rng
from pylearn2.utils import contains_nan
class TFD(dense_design_matrix.DenseDesignMatrix):
"""
Pylearn2 wrapper for the Toronto ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
(c) Copyright Yoan BOUZIN
This file is part of Pérégrination v1.0.
Pérégrination v2.0 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either versi... |
from odoo import fields
from odoo.addons.financial.tests.financial_test_classes import \
FinancialTestCase
class ManualFinancialProcess(FinancialTestCase):
""" Story: Manual Financial Process
As a Financial User
I want to registry a manual receivable
So that I can get our cash flow"""... |
""" Copy-paste from PaddleSeg with minor modifications.
https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.1/train.py
"""
import argparse
import paddle
from smoke.cvlibs import manager, Config
from smoke.utils import logger
from smoke.core import train
def parse_args():
parser = argparse.ArgumentPar... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_ut... |
"""Test the RPC HTTP basics."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import http.client
import urllib.parse
class HTTPBasicsTest (BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 3
def setup_network(self):
self.set... |
from optparse import make_option
from django.core.cache.backends.db import BaseDatabaseCache
from django.core.management.base import LabelCommand, CommandError
from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS
from django.db.utils import DatabaseError
from django.utils.encoding import fo... |
"""A simple log mechanism styled after PEP 282."""
# The class here is styled after PEP 282 so that it could later be
# replaced with a standard Python logging implementation.
DEBUG = 1
INFO = 2
WARN = 3
ERROR = 4
FATAL = 5
import sys
class Log:
def __init__(self, threshold=WARN):
self.threshold = thre... |
__author__ = 'alberto'
from datetime import datetime
def create_and_add_mapping(connection, index_name, type_name):
try:
connection.indices.create(index_name)
except:
# we skip exception if index already exists
pass
connection.cluster.health(wait_for_status="yellow")
connection... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
from ansible.module_utils.eos import run_commands
from ansible.module_... |
#!/usr/bin/env python
"""
Usage: manage.py {lms|cms} [--settings env] ...
Run django management commands. Because edx-platform contains multiple django projects,
the first argument specifies which project to run (cms [Studio] or lms [Learning Management System]).
By default, those systems run in with a settings file ... |
"""
Implementation of Simple Storage Service support.
:py:class:`S3Target` is a subclass of the Target class to support S3 file system operations
"""
from __future__ import division
import itertools
import logging
import os
import os.path
try:
from urlparse import urlsplit
except ImportError:
from urllib.pars... |
microcode = '''
def macroop MULSS_XMM_XMM {
mmulf xmml, xmml, xmmlm, size=4, ext=Scalar
};
def macroop MULSS_XMM_M {
ldfp ufp1, seg, sib, disp, dataSize=8
mmulf xmml, xmml, ufp1, size=4, ext=Scalar
};
def macroop MULSS_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, disp, dataSize=8
mmulf xmml, xmml, ... |
# -*- coding: utf-8 -*-
import pycurl
from module.network.HTTPRequest import HTTPRequest
from module.network.Browser import Browser
from ..internal.Addon import Addon
from ..internal.misc import encode
class UserAgentSwitcher(Addon):
__name__ = "UserAgentSwitcher"
__type__ = "hook"
__version__ = "0.16"
... |
import gtk
import pango
import ascpy
import os
HAVE_SOURCEVIEW=0
try:
from gtksourceview2 import Buffer as MyBuffer, View as MyView, language_manager_get_default
# Ensure that the ascend.lang settings are accessible for gtksourceview
# TODO move this to ascdev / ascend scripts, it shouldn't be here as
# it contai... |
import multiprocessing
import numpy as np
import pickle
from operator import add
from dask.context import set_options
from dask.multiprocessing import get, _dumps, _loads
from dask.utils_test import inc
def test_pickle_globals():
""" For the function f(x) defined below, the only globals added in pickling
sho... |
#!/usr/local/bin/python-2.5/bin/python
Info="""
Module name: lmp2data.py
Author: (c) Andres Jaramillo-Botero
California Institute of Technology
<EMAIL>
Project: pEFF
Version: August 2009
Extracts the electron radii from a lammps trajectory dump of style custom:
dump 1 all custom period dump_file id type x y z s... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, getdate
from frappe import _
from erpnext.stock.utils import get_valid_serial_nos
from erpnext.utilities.transaction_base import TransactionBase
class InstallationNote(TransactionBase):
def __init__(self, arg1, arg2=None):
super... |
#!/usr/bin/env python
"""
This exports a bunch of images from the base-dependency-diagram.graffle file
using py-appscript:
http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/index.html
This example from GitHub was particularly helpful as a template:
https://github.com/fikovnik/omnigraffle-export/blob/m... |
from tests.test_helper import *
from braintree.test.nonces import Nonces
class TestMerchantGateway(unittest.TestCase):
def setUp(self):
self.gateway = BraintreeGateway(
client_id="client_id$development$signup_client_id",
client_secret="client_secret$development$signup_client_secret"... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the 'context_processors' option of the configuration
of a DjangoTemplates backend and use... |
"""
Linear Solvers
==============
The default solver is SuperLU (included in the scipy distribution),
which can solve real or complex linear systems in both single and
double precisions. It is automatically replaced by UMFPACK, if
available. Note that UMFPACK works in double precision only, so
switch it off by::
... |
#!/usr/bin/env python
import argparse
import json
import logging
import os
import eutils
logging.basicConfig(level=logging.INFO)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='EFetch', epilog='')
parser.add_argument('db', help='Database to use, sometimes "none" (e.g. *check)')
... |
from __future__ import unicode_literals
import email
from moto.core import BaseBackend, BaseModel
from .exceptions import MessageRejectedError
from .utils import get_random_message_id
RECIPIENT_LIMIT = 50
class Message(BaseModel):
def __init__(self, message_id):
self.id = message_id
class RawMessag... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.playbook.task_include import TaskInclude
from ansible.playbook.role_include import IncludeRole
from ansible.template import Templar
try:
from __main__ import display
except ImportError:
from ansible... |
from google.appengine._internal import django
import os.path
import re
def get_svn_revision(path=None):
"""
Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files.
If path... |
"""Parse SQL statements."""
# Setup namespace
from sqlparse import sql
from sqlparse import cli
from sqlparse import engine
from sqlparse import tokens
from sqlparse import filters
from sqlparse import formatter
from sqlparse.compat import text_type
__version__ = '0.2.0'
__all__ = ['engine', 'filters', 'formatter', ... |
__author__ = 'Charles'
from collections import defaultdict
from warpper import check_files
from model import IMAGE_OUTPUT_MODEL
from datetime import datetime
import logging
import sys
import image
import numpy as np
reload(sys)
sys.setdefaultencoding('utf-8')
logger = logging.getLogger()
logger.setLevel(logging.DEBUG... |
from distutils.version import LooseVersion
import unittest
import glob
import os
import numpy as np
import pandas as pd
import pyarrow as pa
from pyspark import pandas as ps
from pyspark.testing.pandasutils import PandasOnSparkTestCase, TestUtils
class DataFrameSparkIOTest(PandasOnSparkTestCase, TestUtils):
"""... |
import time, sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, 'test', 'common')))
import workload_common
num_keys = 10000
class TestError(Exception):
def __init__(self, str):
self.str = str
def __str__(self):
return repr(self.str)
... |
import datetime
import json
import uuid
from xml.dom import minidom
import webob
from cinder.api import common
from cinder.api.openstack.wsgi import MetadataXMLDeserializer
from cinder.api.openstack.wsgi import XMLDeserializer
from cinder import test
from cinder.tests.api import fakes
from cinder import volume
def ... |
"""Aggregates EMMA coverage files to produce html output."""
import fnmatch
import json
import optparse
import os
import sys
import traceback
from pylib import cmd_helper
from pylib import constants
def _GetFilesWithExt(root_dir, ext):
"""Gets all files with a given extension.
Args:
root_dir: Directory in ... |
__author__ = '<EMAIL> (Jeff Scudder)'
import unittest
import gdata.client
import gdata.gauth
import gdata.data
import atom.mock_http_core
import StringIO
class ClientLoginTest(unittest.TestCase):
def test_token_request(self):
client = gdata.client.GDClient()
client.http_client = atom.mock_http_core.Setta... |
'''
Texture compression tool
========================
This tool is designed to compress images into:
- PVRTC (PowerVR Texture Compression), mostly iOS devices
- ETC1 (Ericson compression), working on all GLES2/Android devices
Usage
-----
In order to compress a texture::
texturecompress.py [--dir <directory>] <... |
import sale_stock
import report
import company
import res_config |
from bpy import data, types
from .. import constants, logger
from .constants import MULTIPLY, WIRE, IMAGE
def _material(func):
"""
:param func:
"""
def inner(name, *args, **kwargs):
"""
:param name:
:param *args:
:param **kwargs:
"""
material = Non... |
from a10sdk.common.A10BaseClass import A10BaseClass
class PoolGroup(A10BaseClass):
"""Class Description::
Configure CGNv6 one-to-one pool group.
Class pool-group supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param mem... |
import sys, os, re, requests, shutil, webbrowser, CppHeaderParser, json, cgi
from lxml import html
def to_snake(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
scriptpath = os.path.realpath(__file__)
projectpath = os.path.join(os.path.dirname(os.... |
# -*- encoding: utf-8 -*-
from abjad import *
def test_pitchtools_inventory_named_inversion_equivalent_interval_classes_01():
all_dics = pitchtools.inventory_named_inversion_equivalent_interval_classes()
assert all_dics == [
pitchtools.NamedInversionEquivalentIntervalClass('perfect', 1),
pit... |
import warnings
import numpy as np
import pytest
from pandas.errors import PerformanceWarning
import pandas as pd
from pandas import Index, MultiIndex
import pandas._testing as tm
def test_drop(idx):
dropped = idx.drop([("foo", "two"), ("qux", "one")])
index = MultiIndex.from_tuples([("foo", "two"), ("qux... |
r"""
************************
espressopp.FixedPairList
************************
.. function:: espressopp.FixedPairList(storage)
:param storage:
:type storage:
.. function:: espressopp.FixedPairList.add(pid1, pid2)
:param pid1:
:param pid2:
:type pid1:
:type pid2:
:rtype:
.. function:: espresso... |
import logging
import pprint
import signal
import warnings
from twisted.internet import defer
from zope.interface.exceptions import DoesNotImplement
try:
# zope >= 5.0 only supports MultipleInvalid
from zope.interface.exceptions import MultipleInvalid
except ImportError:
MultipleInvalid = None
from zope.... |
"""Implementation of all the magic functions built into IPython.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distribu... |
"""
Copyright (C) 2013 Matthew Woodruff
This script 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 3 of the License, or
(at your option) any later version.
This script is distributed in th... |
from setuptools import setup, find_packages
import sys, os
PACKAGE = 'arlequin'
VERSION = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),'oldowan', PACKAGE, 'VERSION')).read().strip()
desc_lines = open('README', 'r').readlines()
setup(name='oldowan.%s' % PACKAGE,
version=VERSION,
descript... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
def overrides(method):
'''
Initially meant to be used as
class B:
@overrides(A.m1)
def m1(self):
pass
but as we want to be compatible with Jython 2.1 where decorators have an uglier syntax (needing an assign
after the method), it should now be used witho... |
import GemRB
import GUICommon
import GUICommonWindows
import GUIClasses
from GUIDefines import *
MessageWindow = 0
PortraitWindow = 0
def OnLoad():
global MessageWindow, PortraitWindow
GemRB.GameSetPartySize(PARTY_SIZE)
GemRB.GameSetProtagonistMode(2)
GemRB.SetDefaultActions(1,14,16,17)
GemRB.LoadWindowPack(GUIC... |
import sys
import os
import json
sys.path.append(os.getcwd())
from datetime import datetime
from datetime import date, timedelta
from sys import stdout, path
import glob
import json
import re
class Enumerator(object):
def __init__(self):
self.names = []
def get_enum(self, name):
if name not ... |
'''
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use,... |
"""
Utilities for generating and manipulating sequences, for use in
experimentation and tests.
"""
import numpy
class SequenceMachine(object):
"""
Base sequence machine class.
"""
def __init__(self,
patternMachine,
seed=42):
"""
@param patternMachine (PatternMachine) P... |
import os
needs_sphinx = '1.6'
author = 'MongoDB, Inc'
# -- Options for HTML output ----------------------------------------------
smart_quotes = False
html_show_sourcelink = False
# Note: http://www.sphinx-doc.org/en/1.5.1/config.html#confval-html_copy_source
# This will degrade the Javascript quicksearch if we ev... |
from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djblets.util.db import ConcurrencyManager
from reviewboard.reviews.models import Group, ReviewRequest
class ReviewRequestVisit(models.Model):
"""
... |
from core.platform import models
from core.tests import test_utils
(feedback_models,) = models.Registry.import_models([models.NAMES.feedback])
CREATED_ON_FIELD = 'created_on'
LAST_UPDATED_FIELD = 'last_updated'
DELETED_FIELD = 'deleted'
FIELDS_NOT_REQUIRED = [CREATED_ON_FIELD, LAST_UPDATED_FIELD, DELETED_FIELD]
cla... |
"""A stand-alone example for tf.learn's random forest model on mnist."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import tempfile
# pylint: disable=g-backslash-continuation
from tensorflow.contrib.learn.python.learn\
... |
import MySQLdb as mdb
import sys
#global Variables (change as required)
host = "localhost"
user = "mangos"
passw = "mangos"
# databases format: list of [name, expansion]
databases = [ ["mangos", 2] ]
#databases = [ ["zero_db", 0], ["tbcdb", 1], ["udb_clean", 2], ["ytdb", 2] ]
# Should the current condition... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from django.conf... |
import unittest
from tito.buildparser import BuildTargetParser
from tito.compat import * # NOQA
from tito.exception import TitoException
class BuildTargetParserTests(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.valid_branches = ["branch1", "branch2"]
self.rele... |
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <<EMAIL>>'
"""
Microsoft LIT HTML tag and attribute tables, copied from ConvertLIT.
"""
TAGS = [
None,
None,
None,
"a",
"acronym",
"address",
"applet",
"area",
"b",
"base",
"basefont",
"bdo",
"b... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from ....unittest import TestCase
import json
import mock
from oauthlib.common import Request
from oauthlib.oauth2.rfc6749 import errors
from oauthlib.oauth2.rfc6749.grant_types import AuthorizationCodeGrant
from oauthlib.oauth2.rfc6749.t... |
import XenAPI, inventory, sys
def warn(txt):
print >> sys.stderr, txt
def show_pifs(pifs):
print "NIC MAC Notes"
print "----------------------------------------------"
for ref in pifs.keys():
notes = []
if pifs[ref]['management']:
notes.append("management inte... |
from EnvironmentProperties import EnvironmentProperties
class AcceptEnvironmentProperties(EnvironmentProperties):
def __init__(self,environmentName,cost = '',rationale = ''):
EnvironmentProperties.__init__(self,environmentName)
self.theCost = cost
self.theRationale = rationale
def cost(self): return s... |
# Python test set -- part 2, opcodes
from test_support import *
print '2. Opcodes'
print 'XXX Not yet fully implemented'
print '2.1 try inside for loop'
n = 0
for i in range(10):
n = n+i
try: 1/0
except NameError: pass
except ZeroDivisionError: pass
except TypeError: pass
... |
import random
import collections
import gc
from calendar import monthrange
from datetime import date
from copy import deepcopy
from classes.chromosome import Chromosome
class Evolution(object):
"""docstring for Evolution"""
# CONSTANTS
PAR_MAX = 1500
PAR_MIN = -500
POPULATION_SIZE = 100
SELE... |
"""Tests for the conversion code from GTFlow format to Chauffeur."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from google.protobuf import text_format
from tensorflow.contrib.boosted_trees.estimator_batch import custom_export_strategy
from tensorflow.... |
import numpy as np
class _MockFunction:
def __init__(self, return_value = None):
self.number_calls = 0
self.return_value = return_value
self.last_args = ([], {})
def __call__(self, *args, **kwargs):
self.number_calls += 1
self.last_args = (args, kwargs)
return s... |
import collections
import copy
import json
import os
import pipes
import re
import subprocess
import sys
import bb_utils
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from pylib import constants
CHROMIUM_COVERAGE_BUCKET = 'chromium-code-coverage'
_BotConfig = collections.namedtuple(
'BotConfig... |
from __future__ import print_function
import numpy
import numpy as np
from keras.preprocessing import sequence
from keras.datasets import imdb
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import LS... |
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import blocks
import argparse
from volk_test_funcs import *
######################################################################
def float_to_char(N):
op = blocks.float_to_char()
tb = helper(N, op, gr.sizeof_float, gr.sizeof_char, 1, 1)
return... |
## \file
## \ingroup tutorial_tdataframe
## This tutorial shows how to get information about the efficiency of the filters
## applied
##
## \macro_code
##
## \date May 2017
## \author Danilo Piparo
import ROOT
fill_tree_code ='''
using FourVector = ROOT::Math::XYZTVector;
using FourVectors = std::vector<FourVector>;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.