content stringlengths 4 20k |
|---|
"""Test spending coinbase transactions.
The coinbase transaction in block N can appear in block
N+100... so is valid in the mempool when the best block
height is N+99.
This test makes sure coinbase spends that will be mature
in the next block are accepted into the memory pool,
but less mature coinbase spends are NOT.
... |
from django import forms
# Other Imports
from .models import Channel
# Create Chat Form Class
# Contains information for the chat room creation form.
class CreateChatForm(forms.ModelForm):
# NAME FIELD
# These restrictions should be imposed on the client side first, but
# must remain here for security re... |
def ingresar_numero(numero_minimo, numero_maximo):
''' Muestra un cursor de ingreso al usuario para que ingrese un número
tal que numero_mínimo <= ingreso <= numero_máximo. Ante un ingreso
inválido muestra un mensaje descriptivo de error y repregunta.
Devuelve el número ingresado en formato entero.
... |
# -*- coding: utf-8 -*-
from openerp import models
from openerp import fields
class CommonDialogWizard(models.TransientModel):
_name = 'common.dialog.wizard'
_description = u'通用的向导'
message = fields.Text(
u'消息', default=lambda self: self.env.context.get('message'))
company_id = fields.Many2o... |
from .common import TestCrmCases
class NewLeadNotification(TestCrmCases):
def test_new_lead_notification(self):
""" Test newly create leads like from the website. People and channels
subscribed to the Sales Team shoud be notified. """
# subscribe a partner and a channel to the Sales Team ... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... |
# Helpers for current-flow betweenness and current-flow closness
# Lazy computations for inverse Laplacian and flow-matrix rows.
import networkx as nx
def flow_matrix_row(G, weight=None, dtype=float, solver="lu"):
# Generate a row of the current-flow matrix
import numpy as np
solvername = {
"full... |
'''This is a reproduction of the IRNN experiment
with pixel-by-pixel sequential MNIST in
"A Simple Way to Initialize Recurrent Networks of Rectified Linear Units"
by Quoc V. Le, Navdeep Jaitly, Geoffrey E. Hinton
arXiv:1504.00941v2 [cs.NE] 7 Apr 2015
http://arxiv.org/pdf/1504.00941v2.pdf
Optimizer is replaced with RM... |
import ansible.constants as C
class Host(object):
''' a single ansible host '''
__slots__ = [ 'name', 'vars', 'groups' ]
def __init__(self, name=None, port=None):
self.name = name
self.vars = {}
self.groups = []
if port and port != C.DEFAULT_REMOTE_PORT:
self.... |
"""Macintosh-specific module for conversion between pathnames and URLs.
Do not import directly; use urllib instead."""
import string
import urllib
import os
def url2pathname(pathname):
"Convert /-delimited pathname to mac pathname"
#
# XXXX The .. handling should be fixed...
#
tp = urllib.splitty... |
from __future__ import absolute_import, unicode_literals
import os
import shutil
import tempfile
import textwrap
from haas.testing import unittest
from usagi.config import Config
from usagi.exceptions import InvalidVariable, YamlParseError
from ..test_parameters import (
BodyTestParameter, HeadersTestParameter, ... |
"""
The MIT License (MIT) for varex package
Copyright (c) 2015 Wei-Yi Cheng
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,... |
#!/usr/bin/python
import re
"""
user management for ACGLBOT
"""
superadmin = 87244565
# dictionary for Telegram chat IDs
address_book = {
# admin (approvals)
'Justin' : 87244565, #
'Justin2' : 175212803,
'other' : 87244565, # superadmin approves cr, overseer,
'jce' : 621... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import twisted
from twisted.python import runtime
from twisted.python import versions
def usesFlushLoggedErrors(test):
"Decorate a test method that uses flushLoggedErrors with this decorator"
if (sys.version_info[:2] == ... |
# Time-stamp: <2019-09-25 12:27:01 taoliu>
"""Description: Naive call differential peaks from 4 bedGraph tracks for scores.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
# ----------------------------... |
from reclass.storage import NodeStorageBase
STORAGE_NAME = 'memcache_proxy'
class MemcacheProxy(NodeStorageBase):
def __init__(self, real_storage, cache_classes=True, cache_nodes=True,
cache_nodelist=True):
name = '{0}({1})'.format(STORAGE_NAME, real_storage.name)
super(MemcacheP... |
import sys
from instagram.client import InstagramAPI
from instagram.helper import timestamp_to_datetime
from datetime import datetime, timedelta, date, time
import time
import params
class SimpleTrends(object):
def __init__(self, *args,**kwargs):
super(SimpleTrends, self).__init__(**kwargs)
def all_... |
from sys import exit
from random import randint
from textwrap import dedent
class Scene(object):
def enter(self):
print("This scene is not yet configured.")
print("Subclass it and implement enter().")
exit(1)
class Engine(object):
def __init__(self, scene_map):
self.scene_map... |
import pymongo
import datetime
import sys
# establish a connection to the database
connection = pymongo.Connection("mongodb://localhost", safe=True)
def remove_review_date():
print "\n\nremoving all review dates"
# get a handle to the school database
db=connection.school
scores = db.scores
try:
... |
#!/usr/bin/env python
import os.path
import re
import subprocess
import sys
from in_file import InFile
from name_utilities import upper_first_letter
import in_generator
import license
HEADER_TEMPLATE = """
%(license)s
#ifndef %(class_name)s_h
#define %(class_name)s_h
#include "core/css/parser/CSSParserMode.h"
#in... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import animation
import pandas as pd
import numpy as np
parser = argparse.ArgumentParser(description='Plot data from output of the n-body simulation.')
parser.add_argument(... |
# -*- coding: utf-8 -*-
from openerp import fields, http
from openerp.http import request
from openerp.addons.website_sale.controllers.main import website_sale
class WebsiteSale(website_sale):
@http.route()
def product(self, product, category='', search='', **kwargs):
record = request.env['website.s... |
import webnotes
import unittest
from hr.doctype.leave_application.leave_application import LeaveDayBlockedError, OverlapError
class TestLeaveApplication(unittest.TestCase):
def _clear_roles(self):
webnotes.conn.sql("""delete from `tabUserRole` where parent in
("<EMAIL>", "<EMAIL>", "<EMAIL>")""")
def _cle... |
# -*- coding: utf-8 -*-
#from PyQt5.QtCore import QCoreApplication
from qgis.PyQt.QtCore import *
import processing
from qgis.core import *
from os import path
try:
from osgeo import gdal
except ImportError:
import gdal
import numpy as np
from . import Raster as rst
"""
TODO: find highest pt
TODO :... |
from __future__ import unicode_literals
import os
from modularodm import Q
from framework.auth import Auth
from framework.guid.model import Guid
from website.files import exceptions
from website.files.models.base import File, Folder, FileNode, FileVersion, TrashedFileNode
from website.util import permissions
__all... |
"""Database expressions.
This contains a list of expressions that are unsupported by Storm.
Most of them are specific to PostgreSQL
"""
from storm.expr import (Expr, NamedFunc, PrefixExpr, SQL, ComparableExpr,
compile as expr_compile, FromExpr, Undef, EXPR,
is_safe_toke... |
import json
import sys
from sys import stdout
#takes a series id, returning an object containing its attributes iff the series has info about race, education, age, and/or sex
def parseSeriesId(l):
series = {}
l = l.split('\t')
if (int(l[1]) == 40 and l[2] == 'M' and int(l[5]) == 0 and int(l[17]) == 0 and int(l[3... |
from ..terminal import glue_terminal
from mock import MagicMock, patch
class TestTerminal(object):
def test_mpl_non_interactive(self):
"""IPython v0.12 sometimes turns on mpl interactive. Ensure
we catch that"""
import matplotlib
assert not matplotlib.is_interactive()
... |
"""A binary to evaluate Inception on the flowers data set.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from inception import inception_eval
from inception.flowers_data import FlowersData
FLAGS = tf.app.flags.FLAGS
def mai... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_patchdensity.py
--------------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
******************... |
import logging
import retrying
import pytest
import sdk_cmd
import sdk_install
from tests import config
log = logging.getLogger(__name__)
@pytest.fixture(scope="module", autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)
... |
from datetime import datetime
filenames = ['aes128cbc', 'aes128gcm', 'aes256cbc', 'aes256gcm']
for filename in filenames:
with open(filename, 'r') as f:
lines = f.readlines()
first_split = lines[0].strip('\n').split()
last_split = lines[-1].strip('\n').split()
prev_datetime = datetime.strptim... |
from __future__ import with_statement
__all__ = ["WebDriver"]
from selenium_old.webdriver.remote.command import Command
from selenium_old.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from driver import ChromeDriver
class WebDriver(RemoteWebDriver):
def __init__(self):
RemoteWebDriver.__i... |
import sys
import os
import atexit
import subprocess
from gemini import tests
from gemini.tests import test_inheritance
TestFamily = test_inheritance.TestFamily
HOM_REF, HET, UNKNOWN, HOM_ALT = range(4)
load_cmd = "gemini load -v {name}.vcf -p {name}.ped --skip-gene-tables --test-mode {name}.db"
update_cmd = """echo... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import stat
import tempfile
from ansible.constants import mk_boolean as boolean
from ansible.errors import AnsibleError, AnsibleFileNotFound
from ansible.module_utils._text import to_bytes, to_native, to_text... |
import m5
from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
config_root = os.path.dirname(config_path)
m5_root = os.path.d... |
#!/usr/bin/env python
"""
migration from moin 1.2 to moin 1.3
For 1.3, the plugin module loader needs some __init__.py files.
Although we supply those files in the new "empty wiki template" in
wiki/data, many people forgot to update their plugin directories,
so we do that via this mig script n... |
"""Explain device capabilities from /proc/bus/input/devices.
This tool processes the contents of /proc/bus/input/devices, expanding bitfields
of event codes into lists of names for those events.
"""
import argparse
import evdev
import sys
def parse_bitfield(bitfield, word_bits):
"""Parse a serialized bitfield fro... |
"""Add 'create_share_from_snapshot_support' extra spec to share types
Revision ID: 3e7d62517afa
Revises: 48a7beae3117
Create Date: 2016-08-16 10:48:11.497499
"""
# revision identifiers, used by Alembic.
revision = '3e7d62517afa'
down_revision = '48a7beae3117'
from alembic import op
from oslo_utils import timeutils
... |
from django.db import models
from thing.models.character import Character
from thing.models.skill import Skill
ROMAN = ['', 'I', 'II', 'III', 'IV', 'V']
class CharacterSkill(models.Model):
"""Character skill"""
character = models.ForeignKey(Character, on_delete=models.DO_NOTHING)
skill = models.ForeignK... |
from collections import defaultdict
import urllib
import chardet
import jinja2
from jingo import register
from jingo.helpers import datetime
from tower import ugettext as _, ungettext as ngettext
import amo
from amo.urlresolvers import reverse
from amo.helpers import breadcrumbs, impala_breadcrumbs, page_title
from a... |
#!/usr/bin/env python
#
def to_plot(hw,ab,gam=0.001,type='Gaussian'):
import numpy as np
#
fmin = min(hw)
fmax = max(hw)
erange = np.arange(fmin-40*gam,fmax+40*gam,gam/10)#np.arange(fmin-40*gam,fmax+40*gam,gam/10)
spectrum = 0.0*erange
for i in range(len(hw)):
if type=='Gaussian':
... |
import base64
import httplib
import os
import re
import urllib
import urllib2
import urlparse
import xml.dom.minidom
import duplicity.backend
from duplicity import globals
from duplicity import log
from duplicity import util
from duplicity.errors import BackendException, FatalBackendException
class CustomMethodReque... |
from telemetry import test
from measurements import startup
import page_sets
@test.Disabled('snowleopard') # crbug.com/336913
class StartupColdBlankPage(test.Test):
tag = 'cold'
test = startup.Startup
page_set = page_sets.BlankPageSet
options = {'cold': True,
'pageset_repeat': 5}
class Startup... |
import os
from ._project_options import ProjectOptions
from ._project_info import ProjectInfo # noqa: F401
class Project(ProjectOptions):
"""All details around building a project concerning the build environment
and the snap being built."""
def __init__(
self,
*,
use_geoip=False... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import sys
from pants.base.build_environment import pants_release
from pants.help.help_formatter import HelpFormatter
from pants.option.arg_splitter import GLOBAL_SCO... |
import tests
import gtk
import pango
import os
from zim.fs import Dir
from zim.notebook import init_notebook, Notebook, Path, Link
from zim.index import *
from zim.formats import ParseTree
from zim.gui.clipboard import Clipboard
from zim.gui.pageindex import *
class TestIndex(tests.TestCase):
def setUp(self):
... |
from math import sqrt
import random
# An Example [Summer 2012 Final | Q2(c)]
# --------------------------------------
def carpe_noctem(n):
if n <= 1:
return n
return carpe_noctem(n - 1) + carpe_noctem(n - 2)
def yolo(n):
if n <= 1:
return 5
sum = 0
for i in range(n):
sum +... |
import os
import shutil
from gppylib.db import dbconn
from test.behave_utils.utils import check_schema_exists, check_table_exists, drop_table_if_exists
from gppylib.operations.backup_utils import get_lines_from_file
CREATE_MULTI_PARTITION_TABLE_SQL = """
CREATE TABLE %s.%s (trans_id int, date date, amount decimal(9,2)... |
"""Plugin for text file or URL feeds via regex."""
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import re
import logging
import path
from flexget import plugin
from flexget.entry import Entry
from flexget.event impo... |
# The whole fountain consisting of its 77 jets.
U0=range(0,77)
# The outer circle of 36 jets
U1=range(0,36)
# The even and odd jets on the outer circle
U1_EVEN=[jet for jet in U1 if jet%2==0]
U1_ODD=[jet for jet in U1 if jet%2!=0]
# The two halves of the outer circle
U1_HALF1=U1[:18]
U1_HALF2=U1[18:]
# The tw... |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os.path
from ansible import constants as C
from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_text
from ansible.module_utils.common._collections_compat import MutableSequence
from an... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'ProjectKeys', fields ['project']
db.create... |
# ==============================================================================
'''Library to manipulate .srt subtitle files. Currently srtTool can shift
subtitles by seconds or change to new frame rates. It also can match film
script files to spotted timecodes. PAL uses a frame rate of 25, while NTSC
uses a frame ra... |
import neural_network
import gym_runner
import gym
def main():
#game = "Acrobot-v0"
#game = "MountainCar-v0"
#game = "CartPole-v0"
game = "LunarLander-v2"
env = gym.make(game)
env.monitor.start('/tmp/lunar-lander-v2')
layer_param_list = []
layer_param_list.append(
neur... |
from io import StringIO
import random
import string
import numpy as np
from pandas import Categorical, DataFrame, date_range, read_csv, to_datetime
from ..pandas_vb_common import BaseIO, tm
class ToCSV(BaseIO):
fname = "__test__.csv"
params = ["wide", "long", "mixed"]
param_names = ["kind"]
def s... |
import unittest
import kubelet_parser
import regex
lines = ["line 0", "pod 2 3", "abcd podName", "line 3", "failed",
"Event(api.ObjectReference{Namespace:\"podName\", Name:\"abc\", UID:\"uid\"}", "uid"]
filters = {"UID": "", "pod": "", "Namespace": ""}
class KubeletParserTest(unittest.TestCase):
def te... |
import argparse
import datetime
import os
import re
import sys
from collections import defaultdict
################################################################################
# Argument Parser
################################################################################
DESCRIPTION = """Python script to help... |
"""This module is deprecated. Please use `airflow.providers.jdbc.hooks.jdbc`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.jdbc.hooks.jdbc import JdbcHook, jaydebeapi # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.jdbc.hooks.jdbc`.",
DeprecationW... |
from stacker.blueprints.base import Blueprint
from troposphere import (
FindInMap,
GetAtt,
Output,
Sub,
Ref,
Region,
s3,
iam,
)
from .policies import (
s3_arn,
read_only_s3_bucket_policy,
read_write_s3_bucket_policy,
static_website_bucket_policy,
)
# reference:
# http... |
"""Stubifies an AndroidManifest.xml.
Does the following things:
- Replaces the Application class in an Android manifest with a stub one
- Resolve string and integer resources to their default values
usage: %s [input manifest] [output manifest] [file for old application class]
Writes the old application class int... |
import collections
import inspect
import re
import sys
from . import p100_domain_net
from . import p100_chexpert
from . import p200_finetune_ckpt
from . import p200_pix_shuffle
class Registry(object):
"""Registry holding all model specs in the model zoo."""
registry = None
@classmethod
def build_registry(c... |
"""
integration tests for xmodule
Contains:
1. BaseTestXmodule class provides course and users
for testing Xmodules with mongo store.
"""
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.test.client import Client
from edxmako.shortcuts import render_to... |
from flask.ext.script import Manager
from lihub import create_app
from lihub.extensions import db
from lihub.user import User, UserDetail, user_datastore
from lihub.repository import Repository, RepoPermission, Category, RepoFlag
from lihub.utils import MALE, OTHER
try:
from lihub.local_config import DefaultConfi... |
from hachoir_core.field import FieldSet, ParserError
class StaticFieldSet(FieldSet):
"""
Static field set: format class attribute is a tuple of all fields
in syntax like:
format = (
(TYPE1, ARG1, ARG2, ...),
(TYPE2, ARG1, ARG2, ..., {KEY1=VALUE1, ...}),
...
)
... |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, flt
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
from controllers.buying_controller import BuyingController
class DocType(BuyingController):
def __init__(self, d... |
'''
Sinusoidal poisson generator example
------------------------------------
This script demonstrates the use of the `sinusoidal_poisson_generator`
and its different parameters and modes. The source code of the model
can be found in models/sinusoidal_poisson_generator.h.
The script is structured into two parts and c... |
import re
import six
TYPE_NAME_RE = re.compile(r'^([a-zA-Z_]\w*:|:)?[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*$')
NS_RE = re.compile(r'^([a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*)?$')
PREFIX_RE = re.compile(r'^([a-zA-Z_]\w*|=)$')
class NamespaceResolver(object):
def __init__(self, namespaces):
if namespaces is None:
... |
import django
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.expressions import ExpressionNode
if django.VERSION >= (1, 5):
ExpressionNode_BITAND = ExpressionNode.BITAND
ExpressionNode_BITOR = ExpressionNode.BITOR
def find_col_by_node(cols, node):
col = None
... |
#!/usr/bin/env python
"""
This file is part of open-ihm.
open-ihm 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.
open-ihm is di... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
from oauthlib.oauth1.rfc5849.signature import collect_parameters
from oauthlib.oauth1.rfc5849.signature import construct_base_string
from oauthlib.o... |
#!/usr/bin/env python
"""Test the process list module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
from absl import app
from grr_response_core.lib.rdfvalues import client as rdf_client
from grr_response_core.lib.rdfvalues import client_n... |
import argparse
import datetime
import json
import os
import sys
import hail as hl
from .utils import run_all, run_pattern, run_list, RunConfig, init_logging
def main(args_):
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--tests', '-t',
... |
# Fields
NAME = 'name'
SET = 'set'
NUMBER = 'number'
BUILD_TIME = 'build-time'
HOLD_TYPE = 'hold-type'
HOLD_QUANTITY = 'hold-quantity'
ABILITY = 'ability'
TEXT = 'text'
# Set values
HQ_EXP = 'hq'
RECON_EXP = 'recon'
# Ability values
RECON = 'recon'
class Buildings:
ALL_BUILDINGS = [
{
NAME: ... |
"""
This is the burnin class that tests the Servers' functionality
"""
import sys
import stat
import base64
import random
import socket
from vncauthproxy.d3des import generate_response as d3des_generate_response
from synnefo_tools.burnin.common import Proper
from synnefo_tools.burnin.cyclades_common import Cyclades... |
import logging
import os
from telemetry.core import util
from telemetry.internal.backends.chrome import android_browser_finder
from telemetry.internal.platform import profiler
util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android')
try:
from pylib.device import device_errors # pylint: disable=F0401
e... |
from __future__ import print_function
import numpy as np
import tensorflow as tf
import argparse
import time
import os
from six.moves import cPickle
from utils import TextLoader
from model import Model
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--save_dir', type=str, default='save',
... |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 27 09:23:32 2014
@author: wittek
"""
import matplotlib.pyplot as plt
import numpy as np
from common_graphics_settings import initialize_graphics
#fig, axes = plt.subplots(2,2)
#((ax1, ax2), (ax3, ax4)) = axes # unpack the axes
colors = initialize_graphics()
fig = plt.f... |
import json
import logging
import unittest
import urlparse
import test_util
class TestCustom(unittest.TestCase):
def __init__(self, url, methodName='runTest'):
self._base_url = url
self._url = urlparse.urljoin(url, test_util.CUSTOM_ENDPOINT)
unittest.TestCase.__init__(self)
def runT... |
from . import util as test_util
init = test_util.import_importlib('importlib')
import sys
import unittest
import weakref
from test import support
try:
import threading
except ImportError:
threading = None
else:
from test import lock_tests
if threading is not None:
class ModuleLockAsRLockTests:
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.callback import CallbackBase
from ansible import constants as C
class CallbackModule(CallbackBase):
'''
This is the default callback interface, which simply prints messages
to stdout when new cal... |
"""
This module contains unit tests of the rmgpy.element module.
"""
import unittest
from rmgpy.molecule.element import Element
import rmgpy.molecule.element
################################################################################
class TestElement(unittest.TestCase):
"""
Contains unit tests of the ... |
"""Preprocess the Buster Drone model
The model is available for download from
https://sketchfab.com/models/294e79652f494130ad2ab00a13fdbafd
The Python Imaging Library is required
pip install pillow
"""
from __future__ import print_function
import json
import os
import zipfile
from PIL import Image
from ut... |
import math
from rally import exceptions
def mean(values):
"""Find the simple average of a list of values.
:parameter values: non-empty list of numbers
:returns: float value
"""
if not values:
raise exceptions.InvalidArgumentsException(
"the list ... |
from bs4 import BeautifulSoup
from couchpotato.core.helpers.variable import getTitle, tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.helpers.encoding import simplifyString, tryUrlencode
from couchpotato.core.media._base.providers.torrent.base import TorrentProvider
import cookielib
import ... |
from aiida.orm import Code, DataFactory, WorkflowFactory
from aiida.orm.workflow import Workflow
from aiida.orm.calculation.inline import make_inline
#from aiida.workflows.wf_phonon import WorkflowPhonon
# from aiida.orm import load_node, load_workflow
import numpy as np
WorkflowPhonon = WorkflowFactory('wf_phonon')... |
"""
Module with various image related processing functions
"""
import os
import random
import numpy as np
import cv2
import shapely.geometry
import face.utilities
import face.geometry
import face.config
class InvalidBoundingBoxError(Exception):
"""
A simple exception used when bounding boxes appear invalid... |
"""Tests for convolutional recurrent layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
from tensorflow.python import keras
from tensorflow.python.keras import keras_parameterized
from tenso... |
# -*- coding: utf-8 -*-
import requests
import xmltodict
import re
from datetime import datetime, timedelta
from fuzzywuzzy import process
import sys
#Ná í öll mál
def get_mal(session):
url = 'http://www.althingi.is/altext/xml/thingmalalisti/?lthing='+str(session)
response = requests.get(url)
data = xmltodict.pars... |
# -*- 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):
# Adding field 'BlockOnPage.created'
db.add_column('cms_blockonpage', 'created',
self.... |
#!/usr/bin/env python
import sys
import urllib
from Bio import SeqIO
def extract_peptide(fulseq,name,num):
cnum=int(num)
low_=max(cnum-21,0)
high_=min(len(fulseq),cnum+20)
temp=name.split("|")[2]+"\t"+str(cnum)+"\t"+(low_-(cnum-21))*'-'+fulseq[low_:high_]+(cnum+20-high_)*'-'+'\n'
print temp
return temp
filename... |
from math import fabs
from random import random
from scipy.stats.distributions import rv_frozen
from spatiotemporal.time_intervals import TimeInterval
from spatiotemporal.unix_time import random_time, UnixTime
from utility.generic import convert_dict_to_sorted_lists
from utility.functions import Function, FunctionPiece... |
import auracle_test
# SPDX-License-Identifier: MIT
class TestPkgbuild(auracle_test.TestCase):
def testSinglePkgbuild(self):
r = self.Auracle(['show', 'auracle-git'])
self.assertEqual(0, r.process.returncode)
pkgbuild = r.process.stdout.decode()
self.assertIn('pkgname=auracle-git'... |
from openerp.addons.message_center_compassion.mappings.base_mapping import \
OnrampMapping
class HouseHoldMapping(OnrampMapping):
ODOO_MODEL = 'compassion.household'
CONNECT_MAPPING = {
"BeneficiaryHouseholdMemberList": ('member_ids',
'compassion.househo... |
from collections import OrderedDict
from typing import Dict, Type
from .base import FeedItemSetLinkServiceTransport
from .grpc import FeedItemSetLinkServiceGrpcTransport
# Compile a registry of transports.
_transport_registry = (
OrderedDict()
) # type: Dict[str, Type[FeedItemSetLinkServiceTransport]]
_transpor... |
#!/usr/bin/env python3
# import lib
import argparse
import ssl
import http.server
import configparser
from platform import python_version
# import file
import ServerHandler
# constants
CONFIG_FILE = 'config.ini'
CONFIG_SECTION_WEB = 'WEBSERVER'
CONFIG_SECTION_INJ = 'INJECTOR'
CONFIG_KEY_IP = 'ip'
CONFIG_KEY_PORT = '... |
import account
import wizard |
from setuptools import find_packages, setup
setup(
name='dockalot',
description=('Build Docker images for the real world '
'using ansible playbooks'),
author='Mark Aikens',
author_email='<EMAIL>',
license='MIT',
url='https://github.com/markadev/dockalot',
long_description=open('REA... |
# -*- coding: utf-8 -*-
"""Views tests for the Box addon."""
import unittest
from nose.tools import * # noqa (PEP8 asserts)
import mock
import httplib
from datetime import datetime
from framework.auth import Auth
from website.util import api_url_for
from urllib3.exceptions import MaxRetryError
from box.client import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.