content string |
|---|
"""Exceptional cases that need some extra wrapping"""
from OpenGL.platform import GL,GLU,createBaseFunction
from OpenGL import arrays, error, wrapper
from OpenGL.arrays.arraydatatype import GLfloatArray, GLdoubleArray
from OpenGL import constants as data_types
from OpenGL.lazywrapper import lazy
from OpenGL.raw import ... |
# encoding: UTF-8
'''
本文件包含了CTA引擎中的策略开发用模板,开发策略时需要继承CtaTemplate类。
'''
from ctaBase import *
from vtConstant import *
########################################################################
class CtaTemplate(object):
"""CTA策略模板"""
# 策略类的名称和作者
className = 'CtaTemplate'
author = EMPTY_UNICODE
... |
"""Mad libs
Create a Mad Libs program that reads in text files and lets the user add their own
text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB appears in the text file.
For example, a text file may look like this::
The ADJECTIVE panda walked to the NOUN and then VERB. A nearby NOUN was
unaffected by ... |
#encoding=utf-8
from _secret import Base
from sqlalchemy import Integer, Unicode, Column, ForeignKey, Float, DateTime
from shunova.models import subjects, Subject, InUseMixin, FormMixin, stores, Store, products, Product, users, User, SKUSupport, add_models
from sqlalchemy.orm import relationship, backref
from datetime ... |
# Michael A. Alcorn (<EMAIL>)
# A (slightly modified) implementation of the Recurrent Convolutional Neural Network (RCNN) found in [1].
# [1] Siwei, L., Xu, L., Kang, L., and Zhao, J. 2015. Recurrent convolutional
# neural networks for text classification. In AAAI, pp. 2267-2273.
# http://www.aaai.org/o... |
from __future__ import unicode_literals
import securetrading.util
# Exception class
class SecureTradingError(Exception):
"""The generic class for Secure Trading errors."""
def __init__(self, code, data=None):
"""Initialises a SecureTradingError.
This will initialise the SecureTradingError an... |
r"""Downloads and converts cifar10 data to TFRecords of TF-Example protos.
This module downloads the cifar10 data, uncompresses it, reads the files
that make up the cifar10 data and creates two TFRecord datasets: one for train
and one for test. Each TFRecord dataset is comprised of a set of TF-Example
protocol buffers... |
import FreeCAD
import FreeCADGui
from PySide import QtCore, QtGui
from PathScripts.PathPreferences import PathPreferences
from PathScripts.PathPostProcessor import PostProcessor
class JobPreferencesPage:
def __init__(self, parent=None):
self.form = FreeCADGui.PySideUic.loadUi(":preferences/PathJob.ui")
... |
"""Builders to generate in memory representation of model and fields tree."""
from __future__ import absolute_import
from collections import defaultdict
import six
from . import errors
from .fields import NotSet
class Builder(object):
def __init__(self, parent=None, nullable=False, default=NotSet):
s... |
import socket
import time
import os
import sys
import subprocess
print("This little window is running your connection to the WiN network.\nFeel free to minimise it but don't close it or you won't get any messages.")
def send(message):
ANY = '0.0.0.0'
SENDERPORT=1501
MCAST_ADDR = '224.168.2.9'
MCAST_PORT = 8946
s... |
"""The tests for Kodi device triggers."""
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.kodi import DOMAIN
from homeassistant.components.media_player.const import DOMAIN as MP_DOMAIN
from homeassistant.setup import async_setup_component
from . import init_integra... |
"""
Provides common classes used to migrate content unit storage to
the standard path format introduced in pulp 2.8. Each plugin needs
to add a migration using these classes.
For example:
from pulp.plugins.migration.standard_storage_path import Migration, Plan
from pulp.server.db import connection
def migrate(*args,... |
import operator
import os
from collections import OrderedDict
from bokeh.io import output_notebook, show
from cave.analyzer.parameter_importance.base_parameter_importance import BaseParameterImportance
from cave.html.html_helpers import figure_to_html
class LocalParameterImportance(BaseParameterImportance):
"""... |
import time
sttime= time.clock()
print("Importing essential modules...")
import numpy as np
import matplotlib.pyplot as plt
#from sklearn import svm
import sys
caffe_root = "/root/py-faster-rcnn/caffe-fast-rcnn/"
import sys
#sys.path.insert(0, caffe_root + "python")
import caffe
print("\t\tsuccessfully imported in ... |
import json
import struct
import re
import base64
import httplib
import sys
settings = {}
class AmsterdamCoinRPC:
OBJID = 1
def __init__(self, host, port, username, password):
authpair = "%s:%s" % (username, password)
self.authhdr = "Basic %s" % (base64.b64encode(authpair))
self.conn = httplib.HTTPConnection... |
# -*- coding:utf-8 -*-
"""
Created on 2015/02/04
@author: Jimmy Liu
@group : waditu
@contact: <EMAIL>
"""
import pandas as pd
import tushare as ts
from pandas import compat
import os
class Store(object):
def __init__(self, data=None, name=None, path=None):
if isinstance(data, pd.DataFrame... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import User
from allauth.socialaccount.models import SocialAccount
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import StravaProvider
class S... |
import h5py
import os
import string
from PIL import Image
from pylab import *
from random import choice
if len(sys.argv) != 2:
print "\033[1;31;40mError: Missing Parameters, minimum number of parameter is 2 \033[0;37;40m"
print "Usage: "
print " $ hdfVideoExtractor.py input.h5"
print ""
sys.e... |
import os
from datetime import datetime, timedelta
from django.http import Http404
from rest_framework import permissions
from rest_framework import mixins, generics
from rest_framework.parsers import FileUploadParser, FormParser, MultiPartParser
from rest_framework.views import APIView
from rest_framework_jwt.utils im... |
"""Helper functions that may be used throughout the application"""
from datetime import datetime, timedelta, date
from django.utils import timezone
FITBIT_DATETIME_FORMAT = "%Y-%m-%d"
def validate_date_range(begin_date, end_date):
"""begin_date and end_date should both be dates (not datetimes)"""
if begin_da... |
from supybot.test import *
class GamesTestCase(ChannelPluginTestCase):
plugins = ('Games',)
_nonKickRe = re.compile(r'bang|click|spin', re.I)
def testRoulette(self):
self.irc.feedMsg(ircmsgs.op(self.channel, self.irc.nick))
sawKick = False
for i in xrange(100):
m = self.... |
"""A "Test Server Spawner" that handles killing/stopping per-test test servers.
It's used to accept requests from the device to spawn and kill instances of the
chrome test server on the host.
"""
import BaseHTTPServer
import logging
import os
import sys
import threading
import time
import urlparse
# Path that are ne... |
"""Unit tests for the config module."""
import re
import sre_constants
from pylint import config
import pytest
RE_PATTERN_TYPE = getattr(re, "Pattern", getattr(re, "_pattern_type", None))
def test__regexp_validator_valid():
result = config._regexp_validator(None, None, "test_.*")
assert isinstance(result,... |
import numpy
from pyanalyzer.stats.timeseries import TimeSeries
from unittest import TestCase
from pyanalyzer.calendar import Calendar
class not_implemented(object):
def __init__(self, kwargs_name):
self.kwargs_name = kwargs_name
def __call__(self, f):
def wrapper(*args, **kwargs):
... |
"""Image Processing SciKit (Toolbox for SciPy)
``scikit-image`` (a.k.a. ``skimage``) is a collection of algorithms for image
processing and computer vision.
The main package of ``skimage`` only provides a few utilities for converting
between image data types; for most features, you need to import one of the
following... |
# -*- coding: utf-8 -*-
"""
E2E tests for the LMS.
"""
from .helpers import UniqueCourseTest
from ..pages.studio.auto_auth import AutoAuthPage
from ..pages.lms.courseware import CoursewarePage
from ..pages.lms.staff_view import StaffPage
from ..fixtures.course import CourseFixture, XBlockFixtureDesc
from textwrap impo... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from math import pi
from math import degrees
from math import acos
from compas.geometry._core import subtract_vectors
from compas.geometry._core import subtract_vectors_xy
from compas.geometry._core import dot... |
"""Command to set properties."""
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions as c_exc
from googlecloudsdk.command_lib.config import completers
from googlecloudsdk.core import log
from googlecloudsdk.core import properties
from googlecloudsdk.core.configurations import named_... |
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_invoice_refund(osv.osv_memory):
"""Refunds invoice"""
_name = "account.invoice.refund"
_description = "Invoice Refund"
_columns = {
'date': fields.date('Date', help='This date will be used as t... |
import unittest
import StringIO
from packetsexample import PacketsExample
from prers import Identity
class TestIdentity(unittest.TestCase):
def reinit(self):
self.__stringbuffer1 = StringIO.StringIO()
self.__stringbuffer2 = StringIO.StringIO()
self.__p1 = Identity(self.__stringbuffer1)
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: Exp
Date: 2015-04-19
Code: POJ 1002
Problem: 487-3276
URL:
"""
import sys
numDict = dict([('A', '2'), ('B', '2'), ('C', '2'),
('D', '3'), ('E', '3'), ('F', '3'),
('G', '4'), ('H', ... |
from __future__ import absolute_import, division, print_function, unicode_literals
from azure_common import BaseTest, arm_template
class CostFilterTest(BaseTest):
@arm_template('vm.json')
def test_cost_resource(self):
p = self.load_policy({
'name': 'test-cost-filter',
'resou... |
import os, sys, re, string, datetime
if len(sys.argv) < 3:
print('Usage: ' + sys.argv[0] + ' <renderer dir name> <renderer class suffix>')
sys.exit(1)
renderer_name = sys.argv[1]
renderer_suffix = sys.argv[2]
# change to the renderer directory
os.chdir(os.path.join(os.path.dirname(sys.argv[0]), "..", "src", ... |
###################################################################
## MENACE_empujones, por Julio Enciso septiembre 2014
##
## Version sin prueba de errores, con fines de prueba
###################################################################
import json
import unicodedata
import pybrain
########################... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 10 13:38:00 2016
@author: armeev
"""
import numpy as np
from scipy.interpolate import griddata
import peakutils
from scipy import ndimage, optimize, stats, misc
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def build_grid(p,nx,ny):
'''
creation... |
from __future__ import division
import math
import numpy as np
import scipy.ndimage as nd
from sinusoidfitter import onedsinusoidfit,onedsinusoid
from gaussfitter import gaussfit,onedgaussfit,onedgaussian,onedloggaussfit,onedloggaussian
from gaborfitter import gaborfit,onedgaborfit,onedgabor
class SinusoidFit(object):... |
from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy import Text
from nova.ope... |
import re
try:
from hashlib import md5
except ImportError:
from md5 import md5
import datetime
import dateutil.parser
from geoposition import Geoposition
from django.contrib.auth.models import Group
from django.utils.importlib import import_module
def cache_key(name):
m = md5()
m.update(name)
retu... |
from django.contrib.gis.db.models import PointField, LineStringField, GeoManager
from django.db import models
DIFFICULTIES = (
(1, 'easy'),
(2, 'moderate'),
(3, 'difficult'),
(4, 'very difficult'),
(5, 'expert'),
)
TYPES = (
('mountain-biking','mountain-biking'),
('hiking','hiking'),
(... |
from botocore.client import ClientError
from common.methods import set_progress
from resourcehandlers.aws.models import AWSHandler
RESOURCE_IDENTIFIER = 'db_identifier'
def discover_resources(**kwargs):
discovered_mysql = []
for handler in AWSHandler.objects.all():
wrapper = handler.get_api_wrapper(... |
from nose.tools import assert_equal, assert_not_equal
from api.services.assignment_service import AssignmentService
from core.experiment import Experiment, Variant
from storage.dict import DictStorage
class TestAssignmentService(object):
def test_when_variants_are_changed_existing_assignments_stay_the_same(self... |
'''Defines OSM entities adaptations.'''
CORRECTIONS = {'fuel': 'gas station', 'parking': 'parking lot',
'taxi': 'taxi stand', 'doctors': 'doctor\'s office',
'dentist': 'dentist\'s office', 'gambling': 'gambling place',
'police': 'police station', 'shower': 'public bath',
'mall shop': 'mall', 'general shop'... |
import time
from steem import Steem
from steemtools.markets import Markets
settings = {
"sleep_time_seconds": 60,
"minimum_spread_pct": 1.0,
"sbd_usd_peg": True,
}
witness = "furion"
if __name__ == '__main__':
steem = Steem()
markets = Markets()
def get_last_published_price():
my_in... |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class netnamespaces_intro(ShutItModule):
def build(self, shutit):
# https://www.youtube.com/watch?v=_WgUwUf1d34
shutit.send('rm -rf /tmp/netnamespaces_intro_vm')
shutit.send('mkdir -p /tmp/netnamespaces_intro_vm')
shutit.sen... |
"""
Module dedicated functions/classes dealing with rate limiting requests.
"""
import collections
import copy
import httplib
import math
import re
import time
from oslo_serialization import jsonutils
from oslo_utils import importutils
import webob.dec
import webob.exc
from trove.common import base_wsgi
from trove.c... |
import os
ENTETE = """# -*-coding:Utf-8 -*
# Copyright (c) {copyright}
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright noti... |
"""
Here, we have implemented RMSD calculation using both Kabsch algorithm and
via the quaterion-based characteristic polynomial. Both are implemented
in pure python/numpy.
Notes
-----
This module works at a frame-by-frame level, not the trajectory level.
Reference
---------
Rapid calculation of RMSDs using a quater... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
import random
from merge import merge_sort
@pytest.fixture(scope="function")
def unsorted():
unsorted = [8, 4, 6, 3, 5, 1, 9, -3, 10, 2, 5.5, 7]
return unsorted
@pytest.fixture(scope="function")
def binary()... |
# -*- coding: UTF-8 -*-
#! python3 # noqa E265
"""
Isogeo API v1 - Model of Metadata search entity
See: http://help.isogeo.com/api/complete/index.html#definition-search
"""
# #############################################################################
# ########## Libraries #############
# ################... |
import time
import hazelcast
from hazelcast.serialization.api import Portable
from hazelcast.predicate import sql
class Employee(Portable):
FACTORY_ID = 666
CLASS_ID = 2
def __init__(self, name=None, age=None):
self.name = name
self.age = age
def write_portable(self, writer):
... |
from django.db import models
from decimal import Decimal
from django.core.validators import MinValueValidator, MaxValueValidator
from coupons.models import Coupon
from shop.models import Product
from django.utils.translation import gettext_lazy as _
class Order(models.Model):
first_name = models.CharField(verbose_... |
from __future__ import division, absolute_import, print_function
import os
from numpy.distutils.fcompiler.gnu import GnuFCompiler
compilers = ['VastFCompiler']
class VastFCompiler(GnuFCompiler):
compiler_type = 'vast'
compiler_aliases = ()
description = 'Pacific-Sierra Research Fortran 90 Compiler'
... |
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app
from flask.ext.login import UserMixin
from . import db, login_manager
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.I... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Database schema as namedtuples
"""
import re
from collections import namedtuple
_Provenance = namedtuple("Provenance", ["doc_id", "begin", "end"])
class Provenance(_Provenance):
def __new__(cls, doc_id, begin, end):
assert begin <= end, "Invalid span, expe... |
__author__ = 'rcj1492'
__created__ = '2017.05'
__license__ = 'MIT'
'''
remove services
'''
_remove_details = {
'title': 'Remove',
'description': 'Removes clutter from your records.',
'help': 'removes a service from the registry',
'benefit': 'Removes a service listing from the lab registry.... |
"""Fixtures for Waze Travel Time tests."""
from unittest.mock import patch
from WazeRouteCalculator import WRCError
import pytest
@pytest.fixture(name="skip_notifications", autouse=True)
def skip_notifications_fixture():
"""Skip notification calls."""
with patch("homeassistant.components.persistent_notificat... |
import unittest
import crypto.alphabets
import string
import json
class AlphabetTests(unittest.TestCase):
def setUp(self):
self.alph = crypto.alphabets.Alphabet()
self.alph._alph = string.ascii_uppercase
def test_indexing(self):
self.assertEqual(self.alph[0], 'A')
self.assertE... |
import sys
import itk
if len(sys.argv) != 6:
print(
"Usage: " + sys.argv[0] + " <inputImage> <outputImage> "
"<numberOfIterations> <timeStep> <conductance>"
)
sys.exit(1)
inputImage = sys.argv[1]
outputImage = sys.argv[2]
numberOfIterations = int(sys.argv[3])
timeStep = float(sys.argv[4])
... |
from mocker import MockerTestCase
from cloudinit.cs_utils import Cepko
SERVER_CONTEXT = {
"cpu": 1000,
"cpus_instead_of_cores": False,
"global_context": {"some_global_key": "some_global_val"},
"mem": 1073741824,
"meta": {"ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2E.../hQ5D5 john@doe"},
"name": ... |
source("../../shared/qtcreator.py")
def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
targets = Targets.desktopTargetClasses()
if not checkDebuggingLibrary(Targets.intToArray(targets)):
test.fatal("Error while checking debugging librarie... |
from tempest.common import image
from tempest.lib.common import rest_client
from tempest.tests import base
class TestImage(base.TestCase):
def test_get_image_meta_from_headers(self):
resp = {
'x-image-meta-id': 'ea30c926-0629-4400-bb6e-f8a8da6a4e56',
'x-image-meta-owner': '8f421f9... |
import pprint
import re
import sys
import unittest
import weakref
sys.path.insert(0, '..')
import pycparser.c_ast as c_ast
import pycparser.plyparser as plyparser
class Test_c_ast(unittest.TestCase):
def test_BinaryOp(self):
b1 = c_ast.BinaryOp(
op='+',
left=c_ast.C... |
"""Training command line arguments."""
from absl import flags
FLAGS = flags.FLAGS
# Training flags
flags.DEFINE_integer('seed', 1, 'Random seed')
flags.DEFINE_string('device', '/CPU:0', 'Tensorflow device')
flags.DEFINE_string('model_path', '/tmp/model.h5', 'Path to save trained model')
flags.DEFINE_integer('epochs',... |
from lxml.builder import E
from odoo import fields, models, api
class Product(models.Model):
_name = _description = 'ttu.product'
class Root(models.Model):
_name = _description = 'ttu.root'
product_id = fields.Many2one('ttu.product')
product_qty = fields.Integer()
qty_producing = fields.Integer(... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
# we've got extra respondents per backend
for respondent in orm.Respondent.objects.all().order_by('id'):
... |
#!/usr/bin/env python
"""
_review_
Tools for working with and reviewing PRs on GitHub,
including ability to set a specific status context for a branch
to allow for confirmation of reviews for code compliance etc
"""
import os
import sys
import pprint
from argparse import ArgumentParser
from cirrus.github_tools impor... |
import unittest
import sys
import os
import psycopg2
import MySQLdb
import sqlite3
from upsert import Upsert
class OneByOne:
def test_insert_1_0(self):
#print(sys._getframe(0).f_code.co_name)
upsert = Upsert(self.cursor, 'pets')
upsert.row({'name': 'Jerry'})
self.execute_sql("sele... |
from lpdec.imports import *
code = HammingCode(4)
# alternative: code = BinaryLinearBlockCode(parityCheckMatrix='~/codes/SomeCode.alist')
# simple IP decoder
decoder1 = CplexIPDecoder(code, name='CPLEX IP Decoder')
# IP decoder with more options
decoder2 = CplexIPDecoder(code, cplexParams={'threads': 1}, name='Cplex ... |
import structlog
import json
from traffic_descriptor import TrafficDescriptor
from twisted.internet.defer import inlineCallbacks, returnValue
from ..adtran_olt_handler import AdtranOltHandler
from voltha.adapters.openolt.protos import openolt_pb2
log = structlog.get_logger()
class OltTrafficDescriptor(TrafficDescrip... |
import numpy as np
import tensorflow as tf
from ..core.image_warp import image_warp
class ImageWarpTest(tf.test.TestCase):
def _warp_test(self, first, second, flow, debug=False):
num_batch, height, width, channels = second.shape
second_ = tf.placeholder(tf.float32, shape=second.shape, name='im')
... |
__title__ = "FreeCAD FEM element rotation 1D document object"
__author__ = "Bernd Hahnebach"
__url__ = "https://www.freecadweb.org"
## @package element_rotation1D
# \ingroup FEM
# \brief element rotation 1D object
from . import base_fempythonobject
class ElementRotation1D(base_fempythonobject.BaseFemPythonObject)... |
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.types import String
import sqlalchemy.types as types
class tsvector(types.UserDefinedType):
__visit_name__ = "user_defined"
def __init__(self):
pass
def get_col_spec(self):
return "tsvector"
def bind_processo... |
import logging
from telemetry.core.backends import png_bitmap
class WebDriverTabBackend(object):
def __init__(self, browser_backend, window_handle):
self._browser_backend = browser_backend
self._window_handle = window_handle
def Disconnect(self):
pass
@property
def browser(self):
return self... |
#!/usr/bin/python
from os.path import dirname, join, isfile, realpath, relpath, split
from zipfile import ZipFile
import sys
sys.path.insert(0, 'buildlib/jinja2.egg')
sys.path.insert(0, 'buildlib')
from fnmatch import fnmatch
import tarfile
import os
import shutil
import subprocess
import time
import jinja2
# The ex... |
# coding=utf-8
import unittest
"""462. Minimum Moves to Equal Array Elements II
https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/description/
Given a **non-empty** integer array, find the minimum number of moves required
to make all array elements equal, where a move is incrementing a selected
e... |
#from __future__ import division
import numpy as np
from scipy.sparse import spdiags, block_diag
from scipy.sparse.linalg import spsolve, isolve
from matplotlib import pyplot as plt
import copy
class rnet(object):
def __init__(self):
pass
def sediment__discharge_per_unit_width(self):
"""
Compute q_s ... |
"""***************************************************************************
test_sphere_standard_operations: test operations like reciprocity
Randy Direen
6/26/2015
Test standard operations like 'reciprocity' or 'directivity'
***************************************************************************"""
f... |
import os
import re
import sys
import math
import getopt
import string
###
# Utility Functions
##
def remove_punctuation(s):
table = string.maketrans("", "")
return s.translate(table, string.punctuation)
def tokenize(long_text):
long_text = remove_punctuation(long_text)
long_text = long_text.lower()... |
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.
import sys
sys.path.append("./CommonTestScripts")
import Test
import FsmUtil
atfDocService.OpenNewDocument(editor)
print "Cut and paste one state"
state1 = FsmUtil.AddNewStateAndVerify(editingContext, 100, 100, "cutMe-state", 70)
Test.Equ... |
# -*- coding: utf-8 -*-
"""Module handling Dashboards accordion.
"""
from navmazing import NavigateToSibling, NavigateToObject
from cfme.base import Server
from cfme.fixtures import pytest_selenium as sel
from cfme.intelligence.reports.ui_elements import NewerDashboardWidgetSelector
from cfme.web_ui import Form, accor... |
"""iteration_test.py - integration tests for scoring iterations
This file is part of cMonkey Python. Please see README and LICENSE for
more information and licensing details.
"""
import meme
import motif
import unittest
import util
import rsat
import organism as org
import microbes_online
import stringdb
import datama... |
from sos.report.plugins import Plugin, RedHatPlugin
class Alternatives(Plugin, RedHatPlugin):
short_desc = 'System alternatives'
packages = ('chkconfig',)
commands = ('alternatives',)
def setup(self):
self.add_cmd_output('alternatives --version')
alts = []
ignore = [
... |
"""Command-line application to export a table from BigQuery to Google Cloud
Storage.
This sample is used on this page:
https://cloud.google.com/bigquery/exporting-data-from-bigquery
For more information, see the README.md under /bigquery.
"""
import argparse
import time
import uuid
from googleapiclient import ... |
"""
the PICORobot class takes the title and abstract of a clinical trial as
input, and returns Population, Comparator/Intervention Outcome
information in the same format, which can easily be converted to JSON.
The model was described using the corpus and methods reported in our
ACL 2018 paper "A corpus with multi-leve... |
# Arithmetic:
print(10 * 'x') # xxxxxxxxxx
print(5 / 2) # 2.5
print(5 // 2) # 2
print(2 ** 8) # 256
# Indexing:
list = [1, 2, 3, 4, 5]
print(list[0]) # 1
print(list[-1]) # 5
# print(list[99]) # IndexError: list index out of range
# Slicing:
list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(list[1:4]) # [2, 3,... |
import gtk
import os
from xpn_src.UserDir import get_wdir
class Config_File:
def get_configs(self):
return self.configs
def write_configs(self):
f=open(os.path.join(get_wdir(),"config.txt"),"w")
for key in self.configs.keys():
f.write(key+"="+self.configs[key].encode("utf-... |
from msrest.serialization import Model
class JobExecutionInformation(Model):
"""Contains information about the execution of a job in the Azure Batch
service.
:param start_time: The start time of the job. This is the time at which
the job was created.
:type start_time: datetime
:param end_tim... |
import io
import openpyxl
from django.test import (
Client, TestCase
)
from django.urls import reverse
from core.models import (
User, Batch, Section, Election, Candidate, CandidateParty,
CandidatePosition, Vote, VoterProfile, Setting, UserType
)
class ResultsExporter(TestCase):
"""
Tests the r... |
#!/usr/bin/env python3
# Requires:
# psutil
# ifaddr>=0.1.4
# toml>=0.10.0
# Create a file in /opt/tufin/ngps/conf.txt like this:
#
# sshd_ports = [ 22 ]
# sshd_port_ranges = [ [22001, 22999] ]
#
# This says to expect incoming connections on ports 22 and ports
# from 22001 through and including 22999.
import psutil,... |
import json
import time
from tempest.common.rest_client import RestClient
from tempest import exceptions
class InterfacesClientJSON(RestClient):
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(InterfacesClientJSON, self).__init__(config, username, password,
... |
"""Extend pool for support backend re-encryption
Revision ID: a1f689aecc1d
Revises: 1afc932f1ca2
Create Date: 2018-10-23 20:47:52.405865
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a1f689aecc1d'
down_revision = '1afc932f1ca2'
def upgrade():
op.add_c... |
#!/usr/bin/env python
"""
Script for finding all media items, which have some tag, from
KPhotoAlbum index.xml.
"""
# Copyright (C) 2006 Tuomas Suutari <<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 Soft... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 23 12:00:26 2015
@author: pre
"""
import mapapi.MapClasses as MapHierarchy
import warnings
class Radiator(MapHierarchy.MapComponent):
"""Representation of AixLib.Fluid.HeatExchangers.Radiators.Radiator
"""
def init_me(self):
self.fluid_two_port()... |
import os
import re
import tempfile
import time
import shutil
import unittest
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoSuchFrameException
def not_available_on_remote(func):
def testMethod(self):
print self.driver
if type(self.driver) ==... |
"""
This is a simple HelloWorld example to show the basics of writing a Http api
using Spyne's push utilities.
"""
import logging
from spyne.application import Application
from spyne.decorator import rpc
from spyne.protocol.cloth import XmlCloth
from spyne.protocol.http import HttpRpc
from spyne.service import Servi... |
import datetime
import os
import threading
import time
import pickle
try:
import pymongo
import pymongo.errors
import bson
except ImportError:
pymongo = None
bson = None
from beaker.container import NamespaceManager
from beaker.synchronization import SynchronizerImpl
from beaker.util import SyncDi... |
import copy
from os_client_config import cloud_config
from os_client_config.tests import base
fake_config_dict = {'a': 1, 'os_b': 2, 'c': 3, 'os_c': 4}
fake_services_dict = {
'compute_api_version': 2,
'compute_endpoint': 'http://compute.example.com',
'compute_region_name': 'region-bl',
'interface': '... |
import asyncio
import ssl
from asyncio import AbstractEventLoop, BaseTransport, Protocol, Task
from typing import Optional, Tuple, cast
from sygnal.exceptions import ProxyConnectError
from sygnal.helper.proxy.proxy_asyncio import HttpConnectProtocol
from tests import testutils
from tests.asyncio_test_helpers import (... |
# coding=utf-8
"""
The GridEngineCollector parses qstat statistics from Sun Grid Engine,
Univa Grid Engine and Open Grid Scheduler.
#### Dependencies
* Grid Engine qstat
"""
import os
import re
import subprocess
import sys
import xml.dom.minidom
import diamond.collector
class GridEngineCollector(diamond.collec... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import unittest
from datetime import datetime, timedelta
from loganalysis import utils
from loganalysis import logre
class TupleRegexTest(unittest.TestCase):
def setUp(self):
self.now = datetime(2014, 1, 1, 0, 0, 0)
def t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.