content stringlengths 4 20k |
|---|
from airflow.hooks.presto_hook import PrestoHook
from airflow.operators.check_operator import CheckOperator, ValueCheckOperator, IntervalCheckOperator
from airflow.utils.decorators import apply_defaults
class PrestoCheckOperator(CheckOperator):
"""
Performs checks against Presto. The ``PrestoCheckOperator`` e... |
from csacompendium.csa_practice.models import (
CsaPractice,
CsaTheme,
PracticeLevel,
PracticeType,
)
from csacompendium.utils.hyperlinkedidentity import hyperlinked_identity
from csacompendium.utils.serializersutils import (
FieldMethodSerializer,
get_related_content,
get_related_content_ur... |
# Django settings for DjangoApplication1 project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
from os import environ, path
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# testcases.performance_test.py
'''
@since: 2014-11-25
@author: Javier Garcia
@contact: <EMAIL>
@summary: Tests for the performance module
'''
import unittest
import pandas as pd
import numpy as np
from performance import performance
import math
# pylint: disa... |
import unittest
import numpy as np
import six
from chainer import computational_graph as c
from chainer import function
from chainer import testing
from chainer import variable
class MockFunction(function.Function):
def __init__(self, n_in, n_out):
self.n_in = n_in
self.n_out = n_out
def f... |
"""
@author: Elena Colomo
@contact: <EMAIL>
European Space Astronomy Centre (ESAC)
European Space Agency (ESA)
Created on 4 Sept. 2019
"""
__all__ = ['DummyHandler']
class DummyHandler:
def __init__(self, method, parameters):
self._invokedMethod = method
self._parameters = parameters
de... |
import numpy as np
arr = np.array([[8, 1], [4, 5]])
w, v = np.linalg.eig(arr)
print(w)
# [9. 4.]
print(v)
# [[ 0.70710678 -0.24253563]
# [ 0.70710678 0.9701425 ]]
print('value: ', w[0])
print('vector: ', v[:, 0] / v[0, 0])
# value: 9.0
# vector: [1. 1.]
print(w[np.argmax(w)])
print(v[:, np.argmax(w)])
# 9.0
#... |
"""
Tests for course_info
"""
import ddt
from django.conf import settings
from xmodule.html_module import CourseInfoModule
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.xml_importer import import_course_from_xml
from milestones.tests.utils... |
import netifaces
import os
import re
class MaestroEnvironmentError(Exception):
pass
def get_environment_name():
"""Return the name of the environment the container calling this in a part
of."""
return os.environ.get('MAESTRO_ENVIRONMENT_NAME', 'local')
def get_service_name():
"""Returns the se... |
"""
sympylive
~~~~~~~~~
Allow `SymPy Live <http://live.sympy.org/>`_ to be used for interactive
evaluation of SymPy's code examples.
:copyright: Copyright 2014 by the SymPy Development Team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
def builder_inited(app):
if not app.conf... |
"""Deals with creating the output objects.
Copyright (C) 2013, Joshua More and Michele Ceriotti
This program 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 version 3 of the License, or
(at your option) a... |
#!/usr/bin/python
#Soft implementation of an i2c Master
import time
import RPi.GPIO as GPIO
class i2cMaster:
int_clk = -1
SDA = 17 #default sda
SCL = 27 #default scl
def tick(self,anz):
time.sleep(anz*self.int_clk)
def init(self,bitrate,SDAPIN,SCLPIN):
if(SDAPIN != SCLPIN):
... |
from openerp import tools
def rounding(f, r):
# TODO for trunk: log deprecation warning
# _logger.warning("Deprecated rounding method, please use tools.float_round to round floats.")
return tools.float_round(f, precision_rounding=r)
# TODO for trunk: add rounding method parameter to tools.float_round and use this ... |
from flask import render_template
from flask_rest_api import Api
class MyApi(Api):
def _openapi_swagger_ui(self):
return render_template('swaggerui.html', title=self._app.name)
def register_blueprints(app, prefix, blueprints):
for blueprint in blueprints:
app.api.register_blueprint(
... |
{
'name': 'Labour Union',
'version': '1.0',
'category': 'Generic Modules/Human Resources',
'description': """
Labour Union
=====================
This module adds:
* Field on employee record denoting whether the employee is a member of a labour union
* Salary rule for deducting union fee from un... |
import enum
import os
import shlex
import transaction
from pyramid import renderers
from pyramid.config import Configurator as _Configurator
from pyramid.response import Response
from pyramid.security import Allow
from pyramid.tweens import EXCVIEW
from pyramid_rpc.xmlrpc import XMLRPCRenderer
from warehouse import ... |
#!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from diamond.collector import Collector
from example import ExampleCollector
####... |
from spack import *
from distutils.dir_util import copy_tree
class Gradle(Package):
"""Gradle is an open source build automation system that builds
upon the concepts of Apache Ant and Apache Maven and introduces
a Groovy-based domain-specific language (DSL) instead of the XML
form used by Apache Maven... |
from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging
from neutron.plugins.nec.common import config
from neutron.plugins.nec.common import exceptions as nexc
from neutron.plugins.nec.db import api as ndb
from neutron.plugins.nec.db import packetfilter as pf_db
LOG = logging... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import shutil
import time
import socket
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.basic import *
glusterbin = ''
def run_gluster(gargs, **kwargs)... |
import boto3
import uuid
from boto3.dynamodb.conditions import Key, Attr
from botocore.exceptions import ClientError
class JobRepository:
def __init__(self, jobTable):
self.table = boto3.resource('dynamodb').Table(jobTable)
def getJob(self, jobId):
try:
response = self.tabl... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import os
import pipes
import stat
import subprocess
try:
import MySQLdb
except ImportError:
mysqldb_found = False
else:
mysqldb_found = True
# =====================... |
#! /usr/bin/env python
"""RFC 3548: Base16, Base32, Base64 Data Encodings"""
# Modified 04-Oct-1995 by Jack Jansen to use binascii module
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
import re
import struct
import binascii
__all__ = [
# Legacy interface exports traditional RFC 1521 Base6... |
import warnings
from django.conf.urls import include, patterns, url
from django.utils.deprecation import RemovedInDjango20Warning
from .views import (
absolute_kwargs_view, defaults_view, empty_view, empty_view_partial,
empty_view_wrapped, nested_view,
)
other_patterns = [
url(r'non_path_include/$', empt... |
from . import AWSObject, AWSProperty, Join
from .validators import positive_integer
MEMORY_VALUES = [x for x in range(128, 1600, 64)]
def validate_memory_size(memory_value):
""" Validate memory size for Lambda Function
:param memory_value: The memory size specified in the Function
:return: The provided m... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.errors import AnsibleParserError
from ansible.parsing import DataLoader
class DictDataLoader(DataLoader):
def __init__(self, file_mapping=dict()):
assert type(file_mapping) == dict
sel... |
"""Tests for BigQueryReader Op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import re
import socket
import threading
from six.moves import SimpleHTTPServer
from six.moves import socketserver
from tensorflow.contrib.cloud.pytho... |
"""
Copyright (c) 2013 Wei-Cheng Pan <<EMAIL>>
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, copy, modify, merge, publish, di... |
from matplotlib import pyplot as plt
# We load the data with load_iris from sklearn
from sklearn.datasets import load_iris
# load_iris returns an object with several fields
data = load_iris()
features = data.data
feature_names = data.feature_names
target = data.target
target_names = data.target_names
fig,axes = plt.... |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
tetraPoints = vtk.vtkPoints()
tetraPoints.SetNumberOfPoints(4)
tetraPoints.InsertPoint(0,0,0,0)
tetraPoints.InsertPoint(1,1,0,0)
tetraPoints.InsertPoint(2,.5,1,0)
tetraPoints.InsertPo... |
# -*- coding: utf-8 -*-
"""Tests of spike detection routines."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import numpy as np
from numpy.testing import assert_array_equal as ae
from numpy.t... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <<EMAIL>>
This program 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 Foundatio... |
# This file is part of CherryPy <http://www.cherrypy.org/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8
__doc__ = """An implementation of the server-side of HTTP Digest Access
Authentication, which is described in RFC 2617.
Example usage, using the built-in get_ha1_dict_plain function w... |
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import treeano.theano_extensions.irregular_length as il
@treeano.register_node("ungroup_irregular_length_tensors")
class UngroupIrregularLengthTensorsNode(treeano.NodeImpl):
hyperparameter_names = ("lengths_refer... |
import sys
import unittest
from datetime import datetime
import mock
from libcloud.common.aws import AWSRequestSignerAlgorithmV4
from libcloud.common.aws import SignedAWSConnection
from libcloud.common.aws import UNSIGNED_PAYLOAD
from libcloud.test import LibcloudTestCase
class EC2MockDriver(object):
region_nam... |
import time
from openerp.osv import fields, osv
class account_budget_crossvered_summary_report(osv.osv_memory):
"""
This wizard provides the crossovered budget summary report'
"""
_name = 'account.budget.crossvered.summary.report'
_description = 'Account Budget crossvered summary report'
_col... |
import logging
import json
from desktop.lib.django_util import JsonResponse
from desktop.context_processors import get_app_name
from beeswax.server import dbms
from beeswax.server.dbms import get_query_server_config
LOG = logging.getLogger(__name__)
def refresh_tables(request):
app_name = get_app_name(request)
... |
"""Tests for distutils.command.install_headers."""
import sys
import os
import unittest
import getpass
from distutils.command.install_headers import install_headers
from distutils.tests import support
from test.support import run_unittest
class InstallHeadersTestCase(support.TempdirManager,
... |
"""Utilities related to timing various segments of code."""
__authors__ = "David Warde-Farley"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["David Warde-Farley"]
__license__ = "3-clause BSD"
__maintainer__ = "David Warde-Farley"
__email__ = "wardefar@iro"
from contextlib import context... |
"""SCons.Tool.link
Tool-specific initialization for the generic Posix linker.
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 The SCons Founda... |
from itertools import groupby
import numpy as np
import theano
import theano.tensor as T
from learntools.libs.logger import log_me
from learntools.libs.utils import idx_to_mask
from learntools.libs.auc import auc
from learntools.model.math import neg_log_loss
from learntools.model.theano_utils import make_shared, mak... |
"""Common Policy Engine Implementation"""
import logging
import urllib
import urllib2
from glance.openstack.common.gettextutils import _
from glance.openstack.common import jsonutils
LOG = logging.getLogger(__name__)
_BRAIN = None
def set_brain(brain):
"""Set the brain used by enforce().
Defaults use B... |
import sys
import time
def main():
regression = False
size = int(1e6)
if len(sys.argv) > 1 and sys.argv[1] == "-P":
regression = True
size = 20
start = time.clock()
points = []
for i in range(size):
points.append(Point(i, i ** 2, i // 2))
end = time.cl... |
"""
VMware VStorageObject driver
Volume driver based on VMware VStorageObject aka First Class Disk (FCD). This
driver requires a minimum vCenter version of 6.5.
"""
from oslo_log import log as logging
from oslo_utils import units
from oslo_vmware import image_transfer
from oslo_vmware.objects import datastore
from os... |
# coding=utf8
#
from datetime import datetime
from django.db import models
from ckeditor.fields import RichTextField
from django.contrib.auth.models import User
from memodels import SiteConfig as MSiteConfig
from memodels import Vendor as MVendor
from memodels import MCategory, MVideos
class SiteConfig(models.Mod... |
"""
This module defines export functions for decision trees.
"""
# Authors: Gilles Louppe <<EMAIL>>
# Peter Prettenhofer <<EMAIL>>
# Brian Holt <<EMAIL>>
# Noel Dawe <<EMAIL>>
# Satrajit Gosh <<EMAIL>>
# Licence: BSD 3 clause
from ..externals import six
from . import _tree
def e... |
{
'name': 'Bank statement completion from label',
'version': '0.1',
'category': 'Generic Modules/Others',
'license': 'AGPL-3',
'description': """
Improve the basic rule "Match from statement line label (based on partner
field 'Bank Statement Label')" provided by the Bank statement base
c... |
from __future__ import print_function
from color import Coloring
from command import PagedCommand
class Prune(PagedCommand):
common = True
helpSummary = "Prune (delete) already merged topics"
helpUsage = """
%prog [<project>...]
"""
def Execute(self, opt, args):
all_branches = []
for project in self.G... |
DATE_FORMAT = 'j N Y'
DATETIME_FORMAT = "j N Y, G:i:s"
TIME_FORMAT = 'G:i:s'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd-m-Y'
SHORT_DATETIME_FORMAT = 'd-m-Y G:i:s'
FIRST_DAY_OF_WEEK = 1 #Monday
DATE_INPUT_FORMATS = (
'%d-%m-%y', '%d/%m/%y', # '25-10-09' , 25/10/09'
'%d... |
# -*- coding: iso-8859-1 -*-
# MARDS\doc.py
#
# DOCUMENTATION GENERATION
#
from rolne import rolne
from MARDS import st
# the breakdown_rolne contains instructions on how to "break down" the files used in the final docs.
#
def generate_rst_files(schema_rolne, breakdown_rolne, dest_dir, language="en"):
docs = {}
... |
import imp
import os
import sys
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""
name = ".".join([package.__name__, module_name])
try:
# None indicates a cached miss; see mark_miss() in Python/import.c.
return sys.modules[name] is not None
except K... |
#!/usr/bin/env python
#imports go here
#
# Free Coding session for 2014-10-02
# Written by Matt Warren
#
# example of 3-tier pattern
class Data:
data = [{"account": 234, "name":"bob"},
{"account": 643, "name":"joan"}]
def __iter__(self):
for d in self.data:
yield d
def find(... |
import numpy as np
from scipy import sparse as sp
from nose.tools import assert_raises, assert_equal
from numpy.testing import assert_array_equal
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.utils import check_array
class StepSelector(SelectorMixin, Ba... |
"""
Swiss-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
id_re = re.compile(r"... |
from __future__ import print_function
import os
from scrapy import log
from scrapy.utils.job import job_dir
from scrapy.utils.request import request_fingerprint
class BaseDupeFilter(object):
@classmethod
def from_settings(cls, settings):
return cls()
def request_seen(self, request):
ret... |
import ConfigParser
import glob, types, sys, os
import os.path as osp
verbose_print = False
def verboseprint(*args):
if not verbose_print:
return
for arg in args:
print arg,
print
class Upgrader:
tag_set = set()
untag_set = set() # tags to remove by downgrading
by_tag = {}
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Portions of this code have been taken and adapted from PyQt
examples, released under the following license terms
#############################################################################
#
# Copyright (... |
"""
This script is used to design the design matrix for our linear regression.
We explore the influence of linear and quadratic drifts on the model
performance.
Script for the raw data.
Run with:
python noise-pca_script.py
from this directory
"""
from __future__ import print_function, division
import sys, os,... |
try:
# Python 3
from imp import reload
except ImportError:
# Python 2
pass
import unittest
import logging
from nose.tools import eq_
LOG = logging.getLogger('test_ofproto')
class TestOfprotCommon(unittest.TestCase):
""" Test case for ofproto
"""
def test_ofp_event(self):
import... |
from ipalib import api, errors
from ipalib import Str, StrEnum, Bool
from ipalib.plugable import Registry
from ipalib.plugins.baseldap import *
from ipalib import _, ngettext
from ipalib.plugins.hbacrule import is_all
__doc__ = _("""
SELinux User Mapping
Map IPA users to SELinux users by host.
Hosts, hostgroups, use... |
from __future__ import unicode_literals
import zipfile
from io import BytesIO
from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import (
TestCase, modify_settings, override_settings, skipUnlessDBFeature,
)
from .models import City, Country
... |
"""Generates out a Closure deps.js file given a list of JavaScript sources.
Paths can be specified as arguments or (more commonly) specifying trees
with the flags (call with --help for descriptions).
Usage: depswriter.py [path/to/js1.js [path/to/js2.js] ...]
"""
import logging
import optparse
import os
import posixp... |
#!/usr/bin/env python
import os
import json
import types
import subprocess
exclude_files = ()
exclude_dirs = ()
if __name__ == "__main__":
os.chdir('chrome-app')
print("Generating extension in super-neutron.zip\n")
ziplist = ''
for root, dirs, files in os.walk('./'):
for file in files:
skip =... |
"""Tests for the PrefetchDataset serialization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.python.data.experimental.kernel_tests.serialization import dataset_serialization_test_base
from tensorf... |
# -*- coding: utf-8 -*-
try:
import re2 as re
except ImportError:
import re
from lib.cuckoo.common.abstracts import Signature
class Silverlight_JS(Signature):
name = "silverlight_js"
description = "执行伪装过的包含一个Silverlight对象的JavaScript,可能被用于漏洞攻击尝试"
weight = 3
severity = 3
categories = ["explo... |
import os.path
import pytest
import spack.repo
from spack.paths import mock_packages_path
from spack.util.naming import mod_to_class
from spack.spec import Spec
from spack.util.package_hash import package_content
@pytest.mark.usefixtures('config', 'mock_packages')
class TestPackage(object):
def test_load_package... |
"""The Normal distribution: conjugate posterior closed form calculations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.distributions import normal
def normal_conjugates_known_scal... |
import gtk
# PySol imports
from pysollib.mygettext import _
# Toolkit imports
# ************************************************************************
# *
# ************************************************************************
class SoundOptionsDialog:
def __init__(self, parent, title, app, **kw):
... |
from objects.charts.chart import Chart, uniqueIndices
from objects.charts.color import hex2rgb
class BarChart(Chart):
def __init__(self, surface=None, options={}):
super(BarChart, self).__init__(surface, options)
self.bars = []
self.minxdelta = 0.0
self.barWidthForSet = 0.0
... |
'''Pexpect is a Python module for spawning child applications and controlling
them automatically. Pexpect can be used for automating interactive applications
such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
scripts for duplicating software package installations on different servers. It
can be u... |
"""
Created on 2014-03-11
@author: Christian Widmer
@summary: Module for performing GWAS
"""
import logging
import numpy as np
import scipy as sp
import pandas as pd
from scipy import stats
import pylab
import time
import fastlmm.inference as fastlmm
import fastlmm.util.util as util
from fastlmm.pyplink.snpreader... |
from pyNN.random import RandomDistribution, NumpyRNG
#from pyNN.neuron import *
from pyNN.nest import *
from pyNN.utility import get_script_args, Timer, ProgressBar, init_logging, normalized_filename
import matplotlib.pyplot as plt
import numpy as np
globalTimeStep = 0.01
timeStep = globalTimeStep
setup... |
#!/usr/bin/python
"""
Simple tools for images
usage:
python image.py <input img> <color> <treshold value>
"""
import sys
import numpy as np
import cv2
from matplotlib import pyplot as plt
from contours import *
ker1 = 10
CUTING = False
Xi = 100
Yi = 200
Xe = 3900
Ye = 2600
def cutImage(img, xi, yi, ... |
from __future__ import division
from __future__ import unicode_literals
import logging
import datetime as dt
from pymongo.errors import DuplicateKeyError
from modularodm import Q
from modularodm.storage.base import KeyExistsException
from framework.mongo import database
from framework.analytics import clean_page
fr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import re
import sys
import jinja2
from . import Command
from openerp.modules.module import (get_module_root, MANIFEST, load_information_from_description_file as load_manifest)
class Scaffold(Command):
""" Generates an Odoo module skeleton... |
"""Finds desktop mandoline browsers that can be controlled by telemetry."""
import os
import sys
from telemetry.core import exceptions
from telemetry.core import platform as platform_module
from telemetry.internal.backends.mandoline import desktop_mandoline_backend
from telemetry.internal.browser import browser
from ... |
"""
movzap|zuzvideo urlresolver plugin
Copyright (C) 2012 Lynx187
This program 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 version 3 of the License, or
(at your option) any later version.
This program... |
"""Test database sanity checking. Right now this is pretty short
because we don't do that much sanity checking.
"""
import os
from miro import item
from miro import feed
from miro import databasesanity
from miro.fileobject import FilenameType
from miro.test.framework import MiroTestCase
class SanityCheckingTest(Mi... |
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic import ListView
from pads.models import Pad
from... |
__author__ = "eloraiby"
__date__ = "$5-Sep-2010 9:35:29 PM$"
atomic_types = ["unsigned char", "unsigned short", "unsigned int",
"signed char", "signed short", "signed int",
"float", "double"]
glsl_vector_types = ["tvec2", "tvec3", "tvec4"]
glsl_matrix_types = ["tmat2x2", "tmat2x3", "tmat2x4",
"tmat3x2", "t... |
from __future__ import with_statement
import functools, random
from array import array
from heapq import nsmallest
from operator import itemgetter
from threading import Lock
from time import time
from whoosh.compat import iteritems, xrange
try:
from collections import Counter
except ImportError:
class Counte... |
"""
Unit tests run in the shutdown() method, and for c/c++ programs
One should NOT have to give parameters to programs to execute
In the shutdown method, add the following code:
>>> def shutdown():
... ut = UnitTest.unit_test()
... ut.run()
... ut.print_results()
Each object to use as a unit test must be a pro... |
"""Test p2p mempool message.
Test that nodes are disconnected if they send mempool messages when bloom
filters are not enabled.
"""
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class P2PMempoolTests(BitcoinTestFramework):
d... |
from __future__ import division
from sympy import S, sqrt, Sum, symbols
from sympy.physics.quantum.cg import Wigner3j, Wigner6j, Wigner9j, CG, cg_simp
from sympy.functions.special.tensor_functions import KroneckerDelta
def test_cg_simp_add():
j, m1, m1p, m2, m2p = symbols('j m1 m1p m2 m2p')
# Test Varshalovic... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
import glob
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _, ugettext_lazy
from onadata.libs.logg... |
"""
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example aims at showing characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. The last ... |
import pytest
def test_icarus():
import os
import shutil
from edalize_common import compare_files, setup_backend, tests_dir
ref_dir = os.path.join(tests_dir, __name__)
paramtypes = ['plusarg', 'vlogdefine', 'vlogparam']
name = 'test_icarus_0'
tool = 'icarus'
tool... |
from __future__ import print_function
import sys, os, time, re, multiprocessing, random, pprint
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse, workload_runner
r = utils.import_python_driver()
db_name = 'test'
tabl... |
import importlib
import os
from kafkatest.version import get_version, KafkaVersion, DEV_BRANCH
"""This module serves a few purposes:
First, it gathers information about path layout in a single place, and second, it
makes the layout of the Kafka installation pluggable, so that users are not forced
to use the layout ... |
{
'name': 'GOODERP 销售模块',
'author': '<EMAIL>,<EMAIL>',
'website': 'https://www.osbzr.com',
'category': 'gooderp',
'description':
'''
该模块可以方便的管理销货。
通过创建销货订单,审核后将销货订单行中的商品销售给客户,来完成销货功能。
通过创建销货退货订单,审核后将退货订单行中的商品退回,... |
from .TProtocol import TType, TProtocolBase, TProtocolException, TProtocolFactory, checkIntegerLimits
from struct import pack, unpack
from ..compat import binary_to_str, str_to_binary
__all__ = ['TCompactProtocol', 'TCompactProtocolFactory']
CLEAR = 0
FIELD_WRITE = 1
VALUE_WRITE = 2
CONTAINER_WRITE = 3
BOOL_WRITE = ... |
############################################
# [config.py]
# CONFIGURATION SETTINGS FOR A PARTICULAR METER
#
#
# Set the long-form name of this meter
name = "Literary Lab's Meter"
#
# [Do not remove or uncomment the following line]
Cs={}
############################################
####################################... |
#!/usr/bin/env python
import sys, os
import options
from helpers import atoi
optspec = """
redo [targets...]
--
j,jobs= maximum number of jobs to build at once
d,debug print dependency checks as they happen
v,verbose print commands as they are read from .do files (variables intact)
x,xtrace print commands as ... |
from openerp.osv import fields, osv
from openerp import api
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
import openerp
class res_users(osv.Model):
""" Update of res.users class
- add a preference about sending emails about notifications
- make a new user follow itself
... |
# 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 'OAuthToken.session_id'
db.add_column('feed_import_oauthtoken', 'session_id', self.gf('djan... |
#!/usr/bin/env python
import sys
import string
if len( sys.argv ) == 1 :
for asc_line in sys.stdin.readlines():
mpw_line = string.replace(asc_line, "\\xA5", "\245")
mpw_line = string.replace(mpw_line, "\\xB6", "\266")
mpw_line = string.replace(mpw_line, "\\xC4", "\304")
mpw_line = string.replace(mpw_... |
"""SCons.Scanner.C
This module implements the depenency scanner for C/C++ code.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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 wi... |
#!/usr/bin/env python3
"""
Copyright 2019 Harvey Ormston
This file is part of osc_gen.
osc_gen 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 version 3 of the License, or
(at your option)... |
import types
import urllib
import locale
import datetime
import codecs
from decimal import Decimal
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
self.obj = obj
UnicodeDecodeError.__init__(self, *args)
def __str_... |
"""
Place the objects game requires the player to place a number of components
on a background area in the correct place. This could be organs in the correct
place in the human body etc. For these elements a TextArea field is used that
is then cropped / sized accordingly.
"""
import logging
from exe.engine.idevice ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.