content string |
|---|
# Django settings for DjangoAnalysisTestApp project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '... |
import numpy as np
from sklearn import cross_validation
from sklearn import metrics
from sklearn import preprocessing
def multiclass_roc_auc_score(y_true, y_score, label_binarizer=None, **kwargs):
"""Compute ROC AUC score for multiclass.
:param y_true: true multiclass predictions [n_samples]
:param y_scor... |
import controllers
import res_config
import res_users |
"""Extract reference documentation from the NumPy source tree.
"""
import inspect
import textwrap
import re
import pydoc
from StringIO import StringIO
from warnings import warn
class Reader(object):
"""A line-based string reader.
"""
def __init__(self, data):
"""
Parameters
-----... |
import string
from rhn.UserDictCase import UserDictCase
from spacewalk.common.rhnException import rhnException
import sql_base
import sql_lib
class Row(UserDictCase):
""" This class allows one to work with the columns of a particular row in a more
convenient manner (ie, using a disctionary interface). ... |
from datetime import date, datetime
from openerp.osv import fields, osv
from openerp.tools import ustr, DEFAULT_SERVER_DATE_FORMAT
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
# ---------------------------------------------------------
# Utils
# -------------------------------... |
import sys
from testrunner import run
# The default timeout is not enough for this test on some of the slower boards
TIMEOUT = 30
BENCHMARK_REGEXP = r"\s+{func}:\s+\d+us\s+---\s+\d*\.*\d+us per call\s+---\s+\d+ calls per sec"
def testfunc(child):
child.expect_exact('Runtime of Selected Core API functions')
... |
import frappe
from frappe.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact
from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this
class Investor(Document):
def onload(self):
"""Load address and contacts i... |
"""Constrained Network Server. Serves files with supplied network constraints.
The CNS exposes a web based API allowing network constraints to be imposed on
file serving.
TODO(dalecurtis): Add some more docs here.
"""
import logging
from logging import handlers
import mimetypes
import optparse
import os
import sign... |
from __future__ import unicode_literals
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.test import TestCase
from django.utils import six
from .models import Author, Book, Car, Person
class BaseSignalTest(TestCase):
def setUp(self):
# Sa... |
"""Moving average optimizer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.python.framework import ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import variables
from tensorflow.python.tra... |
import unittest
from heron.instance.src.python.utils.topology import TopologyContextImpl
import heron.instance.tests.python.utils.mock_generator as mock_generator
import heron.instance.tests.python.mock_protobuf as mock_protobuf
class TopologyContextImplTest(unittest.TestCase):
def setUp(self):
self.context = ... |
"""Tests for context-dependent indentation
"""
__version__='''$Id: test_platypus_indents.py 3660 2010-02-08 18:17:33Z damian $'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
import sys, os, random
from operator import truth
import unittest
from report... |
import socket
import subprocess as sp
import sys
from app import app
class Components():
def __init__(self):
self._binaries = (app.config['CHECKSYS_DICT']["IPTABLES"], app.config['CHECKSYS_DICT']["CONNTRACK"])
self._services = None
if app.config['TEST_MODE']:
self._services = ... |
class ModuleDocFragment(object):
# Standard openstack documentation fragment
DOCUMENTATION = '''
options:
cloud:
description:
- Named cloud to operate against. Provides default values for I(auth) and
I(auth_type). This parameter is not needed if I(auth) is provided or if
OpenStack O... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None):
period_list = get_period_list(filters.fiscal_year, filters.periodicity)
income = get_d... |
import re, socket, string, sys
if __name__ == "__main__":
if len(sys.argv) < 3:
sys.exit(2)
target_address = (sys.argv[1])
target_port = int(sys.argv[2])
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((target_address, target_port))
ssl_sock = socket.ssl(s)
# print the cert info
#pr... |
import copy
from django.utils.functional import empty # noqa
from django.utils.functional import LazyObject # noqa
class LazySettings(LazyObject):
def _setup(self, name=None):
from django.conf import settings
from horizon.conf.default import HORIZON_CONFIG as DEFAULT_CONFIG # noqa
HORI... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import unittest
import warnings
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geoip import HAS_GEOIP
from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
from django.test import ignore_warnings
f... |
import numpy as np
import pandas
import cv2
def cargar_imagen(archivo):
'''
Carga en variables dos matrices de la imágen, una gris y otra a color,
devuelve un diccionario con las dos versiones.
'''
imagen = {}
imagen['gris'] = cv2.imread(archivo,0)
imagen['color'] = cv2.imread(archivo)
... |
from django.shortcuts import get_object_or_404
from django.template import Context, loader as template_loader
from django.conf import settings
from django.core.context_processors import csrf
from rest_framework import decorators, permissions
from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAP... |
import os
import shutil
import tempfile
from contextlib import contextmanager
from importlib import import_module
from django.apps import apps
from django.db import connection
from django.db.migrations.recorder import MigrationRecorder
from django.test import TransactionTestCase
from django.test.utils import extend_sy... |
"""
GDAL - Constant definitions
"""
from ctypes import (
c_byte, c_double, c_float, c_int16, c_int32, c_uint16, c_uint32,
)
# See http://www.gdal.org/gdal_8h.html#a22e22ce0a55036a96f652765793fb7a4
GDAL_PIXEL_TYPES = {
0: 'GDT_Unknown', # Unknown or unspecified type
1: 'GDT_Byte', # Eight bit unsigned int... |
import unittest
from scrapy.contrib.downloadermiddleware.redirect import RedirectMiddleware, MetaRefreshMiddleware
from scrapy.spider import Spider
from scrapy.exceptions import IgnoreRequest
from scrapy.http import Request, Response, HtmlResponse
from scrapy.utils.test import get_crawler
class RedirectMiddlewareTes... |
from django.db import connection
from django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis, spatialite
from django.utils import unittest
test_srs = ({'srid' : 4326,
'auth_name' : ('EPSG', True),
'auth_srid' : 4326,
'srtext' : 'GEOGCS["WGS 84",DATUM["WGS... |
from abc import ABCMeta, abstractmethod
import struct
import binascii, os, sys
class HexFileFormat(object):
"""Parses out Hex File format into a byte stream"""
def __init__(self, path=None, file=None):
self.path = path
self.file = file
pass
def get_bytes(self):
with open(se... |
from ns_portal.core.resources import (
MetaEndPointResource
)
from marshmallow import (
Schema,
fields,
EXCLUDE,
ValidationError
)
from ns_portal.database.main_db import (
TUsers
)
from sqlalchemy import (
and_
)
from sqlalchemy.orm.exc import (
MultipleResultsFound
)
from pyramid.securi... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import subprocess
import sys
import pytest
def test_wcsapi_extension(tmpdir):
# Test that we can build a simple C extension with the astropy.wcs C API
setup_path = os.path.dirname(__file__)
astropy_path = os.pa... |
"""Centralized catalog of paths."""
import os
class DatasetCatalog(object):
DATA_DIR = "datasets"
DATASETS = {
"coco_2017_train": {
"img_dir": "coco/train2017",
"ann_file": "coco/annotations/instances_train2017.json"
},
"coco_2017_val": {
"img_dir":... |
#! /usr/bin/env python3
import sys
import matplotlib
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib.lines import Line2D
from mule.postprocessing.JobsData import *
from mule.postprocessing.JobsDataConsolidate import *
if len(sys.argv) > ... |
from __future__ import with_statement
from pybench import Test
class WithFinally(Test):
version = 2.0
operations = 20
rounds = 80000
class ContextManager(object):
def __enter__(self):
pass
def __exit__(self, exc, val, tb):
pass
def test(self):
cm ... |
import numpy as np
class ReducedChiSquaredWeight(object):
def __init__(self):
self.expected = 1.0
self.model = None
def function(self, ind):
return np.abs(self.model.red_chisq.data[ind] - self.expected)
def map(self, mask, slices=slice(None, None)):
thing = self.model.re... |
import asyncio
import unittest
from heralding.capabilities.pop3 import Pop3
from heralding.misc.common import cancel_all_pending_tasks
from heralding.reporting.reporting_relay import ReportingRelay
class Pop3Tests(unittest.TestCase):
def setUp(self):
self.loop = asyncio.new_event_loop()
asyncio.set_event_... |
from openerp.osv import fields, osv
class account_chart(osv.osv_memory):
"""
For Chart of Accounts
"""
_name = "account.chart"
_description = "Account chart"
_columns = {
'fiscalyear': fields.many2one('account.fiscalyear', \
'Fiscal year', \
... |
import copy
import os
import sys
from importlib import import_module
from django.utils import six
def import_string(dotted_path):
"""
Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImportError if the import failed.
"""
try:
module... |
try:
import pyutilib.th as unittest
pyutilib_available=True
except:
pyutilib_available=False
import os
from os.path import dirname, abspath, abspath, basename
import sys
if pyutilib_available:
currdir = dirname(abspath(__file__))+os.sep
datadir = os.sep.join([dirname(dirname(abspath(__file__))),'do... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_application_name
except ImportError:
... |
import sys, psutil, os, stat, tempfile, argparse, time, datetime
sys.path.extend(['.','..','../..','py'])
import h2o_sandbox
# Stripped down, similar to h2o.py has for these functions
# Possible to do this in bash, but the code becomes cryptic.
# You can execute this as sh2junit.py <bash command string>
# sh2junit ru... |
import os
import sys
from azure import (
WindowsAzureError,
DEV_ACCOUNT_NAME,
DEV_ACCOUNT_KEY,
_ERROR_STORAGE_MISSING_INFO,
)
from azure.http import HTTPError
from azure.http.httpclient import _HTTPClient
from azure.storage import _storage_error_handler
#-------------------------------------------... |
import os
import fixtures
from oslo_config import cfg
from nova import paths
CONF = cfg.CONF
class ApiPasteFixture(fixtures.Fixture):
def setUp(self):
super(ApiPasteFixture, self).setUp()
CONF.set_default('api_paste_config',
paths.state_path_def('etc/nova/api-paste.in... |
#!/usr/local/bin/python2
# Ex7.1.py Python 2 version
# Script to parse an XML file and enumerate tags
import sys
from xml.parsers import expat
# Allow user to provide a filename, or default to books.xml
filename = sys.argv[1] if sys.argv[1:] else 'books.xml'
Tags = 0
tags = {}
class ExpatError(Exception):
pass... |
import valkyrie
import struct
class GeometryWriter:
GT_GeometryMesh = 0
GT_GeometryCollection = 1
GT_GeometryLOD = 2
DM_Internal = 0
DM_Exteral = 1
def __init__(self):
self.stream = []
self.material_map = {}
def write(self, multi_mesh):
self.stream += struct.pack('<I', GeometryWriter.GT_GeometryM... |
from LogAnalyzer import Test,TestResult
import DataflashLog
from math import sqrt
class TestIMUMatch(Test):
'''test for empty or near-empty logs'''
def __init__(self):
Test.__init__(self)
self.name = "IMU Mismatch"
def run(self, logdata, verbose):
#tuning parameters:
war... |
"""
Futures tools for threadly
"""
import threading
import time
class ListenableFuture(object):
"""
This class i used to make a Future that can have listeners and callbacks
added to it. Once setter(object) is called all listeners/callbacks are
also called. Callbacks will be given the set object, an... |
"""Test the finalizeblock RPC calls."""
import time
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
set_node_times,
wait_until,
)
RPC_FINALIZE_INVALID_BLOCK_ERROR = 'finalize-invalid-block'
RPC_FORK_PRIOR_FINALIZE... |
"""
Jabber Identifier support.
This module provides an object to represent Jabber Identifiers (JIDs) and
parse string representations into them with proper checking for illegal
characters, case folding and canonicalisation through L{stringprep<twisted.words.protocols.jabber.xmpp_stringprep>}.
"""
from twisted.words.p... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
provider:
description:
- B(Deprecated)
- "Starting with Ansible 2.5 we recommend using C(connection: network_cli)."
- This option is only required if you are using NX-API.
- For ... |
from twisted.internet import reactor
from twisted.spread import pb
from twisted.python import log
from buildbot import util
from collections import defaultdict
class StepProgress:
"""I keep track of how much progress a single BuildStep has made.
Progress is measured along various axes. Time consumed is one th... |
from __future__ import absolute_import
from __future__ import print_function
import keras
from keras.datasets import mnist
import keras.models
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.regularizers import l2, l1
from keras.constraints import maxnorm, nonneg
... |
import pygame
from pygame.locals import *
pygame.display.init()
pygame.display.set_mode((80,80),32)
def prep(name):
fname = name+".png"
img = pygame.image.load(fname)
w,h = img.get_width()/2,img.get_height()/2
out = pygame.Surface((w*3,h*3),SWSURFACE|SRCALPHA,32)
out.fill((0,0,0,0))
out.bl... |
from __future__ import print_function
import json
import mmap
import os
import re
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("filenames", help="list of files to check, all files if unspecified", nargs='*')
parser.add_argument("-e", "--skip-exceptions", help="ignore hack/verify-f... |
from oslo.config import cfg
from neutron.common import topics
from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
SG_RPC_VERSION = "1.1"
security_group_opts = [
cfg.StrOpt(
'firewall_driver',
default='neutron.agent... |
from twisted.internet import defer
from twisted.python import log
import p2pool
from p2pool.bitcoin import data as bitcoin_data
from p2pool.util import deferral, forest, jsonrpc, variable
class HeaderWrapper(object):
__slots__ = 'hash previous_hash'.split(' ')
@classmethod
def from_header(cls, header... |
import os
import unittest
import urllib2
import json
import uuid
import wptserve
from wptserve.router import any_method
from base import TestUsingServer, doc_root
class TestResponseSetCookie(TestUsingServer):
def test_put_take(self):
@wptserve.handlers.handler
def handler(request, response):
... |
test_config = {} |
"""
This modules provides classes for evaluating distributions where the
probability density function is a power law.
"""
import numpy
from pycbc.distributions import bounded
class UniformPowerLaw(bounded.BoundedDist):
r"""
For a uniform distribution in power law. The parameters are
independent of each ot... |
# Barcode Example
#
# This example shows off how easy it is to detect bar codes using the
# OpenMV Cam M7. Barcode detection does not work on the M4 Camera.
import sensor, image, time, math
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) # High Res!
sensor.set_windowing((640, 80... |
from designate.objects import base
class Blacklist(base.DictObjectMixin, base.PersistentObjectMixin,
base.DesignateObject):
FIELDS = {
'pattern': {
'schema': {
'type': 'string',
'description': 'Regex for blacklisted zone name',
'f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Type-transformation rules.
"""
__author__ = "Lluís Vilanova <<EMAIL>>"
__copyright__ = "Copyright 2012-2014, Lluís Vilanova <<EMAIL>>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
__email__ = "<EM... |
# -*- coding: utf-8 -*-
"""
security.py
~~~~~~~~~~~~
This module implements Settings HP OneView REST API
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install... |
"""Exception classes raised by urllib.
The base exception class is URLError, which inherits from IOError. It
doesn't define any behavior of its own, but is the base class for all
exceptions defined in this package.
HTTPError is an exception class that is also a valid HTTP response
instance. It behaves this way beca... |
import os
from boto.file.key import Key
from boto.file.simpleresultset import SimpleResultSet
from boto.s3.bucketlistresultset import BucketListResultSet
class Bucket(object):
def __init__(self, name, contained_key):
"""Instantiate an anonymous file-based Bucket around a single key.
"""
sel... |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths... |
# -*- coding: utf-8 -*-
# Import the PyQt and QGIS libraries
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
class HelloWorld:
def __init__(self, iface):
# Save reference to the QGIS interface
self.iface = iface
self.canvas = iface.mapCanvas()
def initGui... |
from __future__ import absolute_import
import unittest
import hamcrest as hc
from apache_beam.metrics.cells import DistributionData
from apache_beam.metrics.cells import DistributionResult
from apache_beam.metrics.execution import MetricKey
from apache_beam.metrics.execution import MetricResult
from apache_beam.metr... |
from __future__ import absolute_import
import os
from distutils.version import LooseVersion
HAS_AVI = True
try:
import avi.sdk
sdk_version = getattr(avi.sdk, '__version__', None)
if ((sdk_version is None) or (sdk_version and (LooseVersion(sdk_version) < LooseVersion('17.1')))):
# It allows the __ve... |
import numpy as np
import unittest
import scipy.stats
from . import test_connect_helpers as hf
from .test_connect_parameters import TestParams
class TestPairwiseBernoulli(TestParams):
# specify connection pattern and specific params
rule = 'pairwise_bernoulli'
p = 0.5
conn_dict = {'rule': rule, 'p': ... |
from PySide.QtGui import *
import timeit
#import camera
import cv2
import os
import sys
import numpy as np
def generate_crop_indexes_3d(width, height, crop_width, crop_height):
idxs = []
for row in xrange(0, height, crop_height):
for col in xrange(0, width / crop_width):
indexes = []
... |
# Checks whether the isuser() function works as it should
# Stubs the cloud_request() functions for these tests
from xclib.sigcloud import sigcloud
from xclib import xcauth
from xclib.check import assertEqual
def setup_module():
global xc, sc
xc = xcauth(domain_db={
b'xdomain': b'99999\thttps://rem... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
sipa.py
~~~~~~~~~~~~~~
This file shall be used to start the Flask app. Specific things are handled
in the `sipa` package.
"""
import argparse
import logging
from sipa import create_app
from sipa.utils import support_hotline_available
logger = loggi... |
import decimal
import json
import unittest
import uuid
from django import forms
from django.core import exceptions, serializers, validators
from django.core.management import call_command
from django.db import IntegrityError, connection, models
from django.test import TransactionTestCase, override_settings
from django... |
from ._split import BaseCrossValidator
from ._split import KFold
from ._split import LabelKFold
from ._split import StratifiedKFold
from ._split import LeaveOneLabelOut
from ._split import LeaveOneOut
from ._split import LeavePLabelOut
from ._split import LeavePOut
from ._split import ShuffleSplit
from ._split import L... |
to_19_fr = ( u'zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six',
'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize',
'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf' )
tens_fr = ( 'vingt', 'trente', 'quarante', 'Cinquante', 'Soixante', 'Soixante-dix', 'Quatre-v... |
"""
The welcome message. This is displayed when the editor opens without any files.
"""
from __future__ import unicode_literals
from prompt_toolkit.formatted_text.utils import fragment_list_len
import prompt_toolkit
import pyvim
import platform
import sys
version = sys.version_info
pyvim_version = pyvim.__version__
_... |
"""
Verify that building an object file correctly depends on running actions in
dependent targets, but not the targets themselves.
"""
import os
import sys
import TestGyp
# NOTE(piman): This test will not work with other generators because:
# - it explicitly tests the optimization, which is not implemented (yet?) on
... |
"""Tests for SavedModel utils."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorflow.python.lib.io import file_io
from tensorflow.python.op... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = """
options:
provider:
description:
- A dict object containing connection details.
default: null
suboptions:
host:
description:
- Specifies the DNS host name or address for conne... |
from django.conf import settings
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import CompatCookie
from django.utils import simplejson as json
from django.utils.crypto import salted_hmac, constant_time_compare
class MessageEncoder(... |
import datetime
import sys
import socket
from socket import timeout as SocketTimeout
import warnings
from .packages import six
try: # Python 3
from http.client import HTTPConnection as _HTTPConnection, HTTPException
except ImportError:
from httplib import HTTPConnection as _HTTPConnection, HTTPException
cla... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
from ansible.module_utils.facts.hardware.base import Hardware, HardwareCollector
class HPUXHardware(Hardware):
"""
HP-UX-specific subclass of Hardware. Defines memory and CPU facts:
- memfree_mb
... |
'''
Google Movie Showtimes parser class for Python.
This script provides a Python class that can be used to parse Google Movie
Showtimes (www.google.com/movies) pages into dictionary objects.
@author Vaidik Kapoor
@version 0.1
'''
import httplib, urllib, BeautifulSoup, re
from copy import deepcopy
from BeautifulSoup... |
from openerp.osv import osv, fields
class crm_lead_to_project_issue_wizard(osv.TransientModel):
""" wizard to convert a Lead into a Project Issue and move the Mail Thread """
_name = "crm.lead2projectissue.wizard"
_inherit = 'crm.partner.binding'
_columns = {
"lead_id": fields.many2one("crm.l... |
'''
IDE: Eclipse (PyDev)
Python version: 2.7
Operating system: Windows 8.1
@author: Emil Carlsson
@copyright: 2015 Emil Carlsson
@license: This program is distributed under the terms of the GNU General Public License
'''
from View import GlobalFunc
from View.Board import Board
class GameView(object):
__root ... |
#!/usr/bin/env python
import json
import time
import xml.etree.ElementTree as ET
import argparse
import sys
import subprocess
import requests
from decimal import Decimal
from gomatic.gocd.pipelines import Pipeline, PipelineGroup
from gomatic.gocd.agents import Agent
from gomatic.xml_operations import Ensurance, Possi... |
import unittest
from test import test_support
import base64
class LegacyBase64TestCase(unittest.TestCase):
def test_encodestring(self):
eq = self.assertEqual
eq(base64.encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n")
eq(base64.encodestring("a"), "YQ==\n")
eq(base64.encod... |
__author__ = "Filippo Panessa <<EMAIL>>"
__copyright__ = ("Copyright (c) 2016 S3IT, Zentrale Informatik,"
" University of Zurich")
from . import main
@main.route('/', methods=['GET', 'POST'])
def index():
return '', 200 |
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_time_log_list(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.get_values("Time Log", filters, ["name", "activity_type", "owner"])
@frappe.whitelist()
def query_task(doctype, txt, searchfield, start, page_len, fil... |
"""
Settings used when generating static assets for use in tests.
For example, Bok Choy uses two different settings files:
1. test_static_optimized is used when invoking collectstatic
2. bok_choy is used when running CMS and LMS
Note: it isn't possible to have a single settings file, because Django doesn't
support bo... |
"""Tests covering the Programs listing on the Studio home."""
import json
from django.conf import settings
from django.core.urlresolvers import reverse
import httpretty
import mock
from oauth2_provider.tests.factories import ClientFactory
from provider.constants import CONFIDENTIAL
from openedx.core.djangoapps.progra... |
import six
if six.PY3:
xrange = range
import functools
def to_arr(this):
"""Returns Python array from Js array"""
return [this.get(str(e)) for e in xrange(len(this))]
ARR_STACK = set({})
class ArrayPrototype:
def toString():
# this function is wrong but I will leave it here fore debuggi... |
"""
Generator that produces an externs file for the Closure Compiler.
Note: This is a work in progress, and generated externs may require tweaking.
See https://developers.google.com/closure/compiler/docs/api-tutorial3#externs
"""
from code import Code
from model import *
from schema_util import *
import os
from date... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
@pytest.mark.online
class TestInputSites(object):
config = ("""
templates:
global:
headers:
User-Agent: "Moz... |
"""
Tests for the birch clustering algorithm.
"""
from scipy import sparse
import numpy as np
from sklearn.cluster.tests.common import generate_clustered_data
from sklearn.cluster.birch import Birch
from sklearn.cluster.hierarchical import AgglomerativeClustering
from sklearn.datasets import make_blobs
from sklearn.l... |
"""
This is an L2 learning switch derived originally from NOX's pyswitch
example. It is now a demonstration of the ofcommand library for constructing
OpenFlow messages.
"""
from time import time
# TODO: mac_to_str and mact_to_int aren't currently defined in packet_utils...
#from pox.lib.packet.packet_utils import ... |
from openerp.osv import osv,fields as old_fields
from openerp import api, models, fields, tools
from openerp.tools.safe_eval import safe_eval
try:
from openerp.addons.email_template.email_template import mako_template_env
except ImportError:
try:
from openerp.addons.mail.mail_template import mako_templa... |
# Simple implementation of a json test runner to run the test against json-py.
import sys
import os.path
import json
import types
if len(sys.argv) != 2:
print "Usage: %s input-json-file", sys.argv[0]
sys.exit(3)
input_path = sys.argv[1]
base_path = os.path.splitext(input_path)[0]
actual_path = base_path ... |
"""TestSuite"""
import sys
import unittest
from django.utils.unittest import case, util
__unittest = True
class BaseTestSuite(unittest.TestSuite):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
def __init__(self, tests=()):
self._tests = []
self.addTests... |
from __future__ import absolute_import
import logging
import os
import tempfile
from pip.compat import uses_pycache, WINDOWS, cache_from_source
from pip.exceptions import UninstallationError
from pip.utils import rmtree, ask, is_local, renames, normalize_path
from pip.utils.logging import indent_log
logger = loggin... |
import sys
import traceback
import logging
from printrun.pronsole import pronsole
if __name__ == "__main__":
interp = pronsole()
interp.parse_cmdline(sys.argv[1:])
try:
interp.cmdloop()
except SystemExit:
interp.p.disconnect()
except:
logging.error(_("Caught an exception, e... |
from openerp.osv import fields,osv
from openerp.tools.sql import drop_view_if_exists
class report_timesheet_line(osv.osv):
_name = "report.timesheet.line"
_description = "Timesheet Line"
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
'user_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.