content stringlengths 4 20k |
|---|
import logging
import re
import simplejson
from urllib import urlencode
from urllib2 import Request, urlopen, URLError
from mediadrop import USER_AGENT
from mediadrop.lib.filetypes import VIDEO
from mediadrop.lib.i18n import N_, _
from mediadrop.lib.storage.api import EmbedStorageEngine, UserStorageError
from mediadr... |
#!/usr/bin/python2
import sys
sys.path = ['', 'pyglet-1.1.4'] + sys.path
import math
import pyglet
from pyglet.graphics import vertex_list
from pyglet import gl
from pyglet.window import key
window = pyglet.window.Window(width=800, height=600, resizable=True)
fps_display = pyglet.clock.ClockDisplay()
num_points =... |
import l10n_fr_hr_payroll
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
"""
Add a pre-build hook to remove all build files
which do not have a corresponding target
This can be used for example to remove the targets
that have changed name without performing
a full 'waf clean'
Of course, it will only work if there are no dynamically generat... |
import os
import tempfile
from ansible.compat.tests import unittest
from ansible.module_utils._text import to_bytes
from ansible.modules.system.known_hosts import compute_diff
class KnownHostsDiffTestCase(unittest.TestCase):
def _create_file(self, content):
tmp_file = tempfile.NamedTemporaryFile(prefix... |
import unittest
from nose.tools import * # PEP8 asserts
from framework.auth.core import Auth
from website.project.model import AlternativeCitation
from modularodm.exceptions import ValidationError
from tests.base import OsfTestCase
from tests.factories import UserFactory, ProjectFactory
class ModelTests(OsfTestC... |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
"""
Enclosing chart object. The various chart types are actually child objects.
Will probably need to call this indirectly
"""
from openpyxl.compat import unicode
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descrip... |
data = (
'Huai ', # 0x00
'Tai ', # 0x01
'Song ', # 0x02
'Wu ', # 0x03
'Ou ', # 0x04
'Chang ', # 0x05
'Chuang ', # 0x06
'Ju ', # 0x07
'Yi ', # 0x08
'Bao ', # 0x09
'Chao ', # 0x0a
'Min ', # 0x0b
'Pei ', # 0x0c
'Zuo ', # 0x0d
'Zen ', # 0x0e
'Yang ', # 0x0f
'Kou ', # 0x10
... |
import unittest
from os import getenv, path
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
from org.libreoffice.unotest import pyuno, mkPropertyValue
class InsertRemoveCells(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.xContext = pyuno.getCompo... |
"""Identity v3 Endpoint action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import utils
from openstackclient.identity import common
def get_service_name(service):
if hasattr(service, 'name'):
... |
from __future__ import unicode_literals
from unittest import TestCase
from num2words import num2words
class Num2WordsSLTest(TestCase):
def test_ordinal_less_than_twenty(self):
self.assertEqual(num2words(2, ordinal=True, lang='sl'), "drugi")
self.assertEqual(num2words(4, ordinal=True, lang='sl'),... |
import xbmcaddon
import xbmc
import os
import xbmcgui
import base64
import uuid
import hashlib
HOME = xbmcgui.Window(10000)
class Addon(object):
def __init__(self, *args, **kwargs):
self.addon = xbmcaddon.Addon(*args)
self.ID = self.addon.getAddonInfo('id').decode("utf-8")
self.ICON = sel... |
import sys
from django.test import LiveServerTestCase
from django.utils.importlib import import_module
from django.utils.unittest import SkipTest
from django.utils.translation import ugettext as _
class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
webdriver_class = 'selenium.webdriver.firefox.webdriver.Web... |
TEMPLATE_START = """\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
html {
font-family: Arial,Helvetica,sans-serif;
background-color: white;
color: black;
}
table {
border-collapse: coll... |
from mock import patch
from odoo.exceptions import ValidationError
from odoo.tests import common
@common.at_install(False)
@common.post_install(True)
class DynamicListCase(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(DynamicListCase, cls).setUpClass()
cls.tag = cls.env["res.p... |
import os
from django.conf import settings
from django.core.cache import get_cache
from django.core.cache.backends.db import BaseDatabaseCache
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.creation import DatabaseCreation
class SpatiaLiteCreation(DatabaseCreation):
def cr... |
from __future__ import absolute_import
import os
import six
import shutil
import zipfile
def is_unsafe_path(path):
if os.path.isabs(path):
return True
for segment in path.split(os.path.sep):
if segment == os.path.pardir:
return True
return False
def find_common_prefix(member... |
"""Tests for HPCC benchmark."""
import os
import unittest
import mock
from perfkitbenchmarker.linux_benchmarks import hpcc_benchmark
class HPCCTestCase(unittest.TestCase):
def setUp(self):
p = mock.patch(hpcc_benchmark.__name__ + '.FLAGS')
p.start()
self.addCleanup(p.stop)
path = os.path.join(os... |
"""Test cases for Zinnia's ping"""
try:
from io import StringIO
from urllib.error import URLError
from urllib.response import addinfourl
except ImportError: # Python 2
from urllib import addinfourl
from urllib2 import URLError
from cStringIO import StringIO
from django.test import TestCase
fr... |
try:
from pyFMG.fortimgr import FortiManager
HAS_PYFMGR = True
except ImportError:
HAS_PYFMGR = False
class AnsibleFortiManager(object):
def __init__(self, module, ip=None, username=None, passwd=None, use_ssl=True, verify_ssl=False, timeout=300):
self.ip = ip
self.username = username
... |
"""
Tests for the lms_result_processor
"""
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from courseware.tests.factories import UserFactory
from lms.lib.courseware_search.lms_result_processor import LmsSearchResultProc... |
"""Code-coverage tools for CherryPy.
To use this module, or the coverage tools in the test suite,
you need to download 'coverage.py', either Gareth Rees' original
implementation:
http://www.garethrees.org/2001/12/04/python-coverage/
or Ned Batchelder's enhanced version:
http://www.nedbatchelder.com/code/modul... |
"""
A Hyper-V Nova Compute driver.
"""
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt import driver
from nova.virt.hyperv import hostops
from nova.virt.hyperv import livemigrationops
from nova.virt.hyperv import migrationops
from nova.virt.hyperv import... |
"""
The GDAL/OGR library uses an Envelope structure to hold the bounding
box information for a geometry. The envelope (bounding box) contains
two pairs of coordinates, one for the lower left coordinate and one
for the upper right coordinate:
+----------o Upper right; (max_x, max_y)
... |
'''
Created on May 5, 2013
Copyright: Jev Kuznetsov
License: BSD
Program to log tick events to a file
example usage:
> python ib_logQuotes.py SPY,VXX,XLE
start with -v option to show all incoming events
'''
import argparse # command line argument parser
import datetime as dt # dat... |
from subprocess import check_output
import re
import sys
import argparse
def parsePs():
psOutput = check_output(["ps", "aux", "--sort", "-rss"]).decode('utf-8')
return(psOutput.split('\n', 2)[1])
def parseFree():
freeOutput = check_output(["free", "m"]).decode('utf-8')
reg = re.compile('([0-9]+)')
... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class SearchPhotosByTag(Choreography):
def __init__(self, temboo_session):
"""
Crea... |
from m5.objects import *
from arm_generic import *
import checkpoint
root = LinuxArmFSSystemUniprocessor(mem_mode='atomic',
mem_class=SimpleMemory,
cpu_class=AtomicSimpleCPU).create_root()
run_test = checkpoint.run_test |
import logging
import oauth2
import oauth2.clients.imap
from .imap_daemon import IMAPDaemon
_LOG = logging.getLogger(__name__)
class GmailIMAPDaemon(IMAPDaemon):
def connect_oauth(
self, consumer_key: str, consumer_secret: str,
user_token: str, user_secret: str) -> None:
if no... |
from __future__ import absolute_import
import gzip
import io
import warnings
import zipfile
from collections import OrderedDict
import magic
import pytz
import relatime
import requests
from tzlocal import get_localzone
try:
#pylint: disable=ungrouped-imports
from requests.packages.urllib3 import exceptions
ex... |
from ref import Ref
class Tag(Ref):
def __repr__(self):
return "<tag %s>" % (self.name,)
class LocalTag(Tag):
pass
class RemoteTag(Tag):
pass |
"""Stuff that differs in different Python versions and platform
distributions."""
from __future__ import absolute_import, division
import os
import imp
import sys
from pip._vendor.six import text_type
try:
from logging.config import dictConfig as logging_dictConfig
except ImportError:
from pip.compat.dictcon... |
import dev_appserver
dev_appserver.fix_sys_path()
import json
import unittest
import webapp2
from google.appengine.ext import testbed
import main
class TestHandlers(unittest.TestCase):
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_datastore_... |
# -*- coding: utf-8 -*-
from openerp import models, fields, api, osv
# We just create a new model
class mother(models.Model):
_name = 'test.inherit.mother'
_columns = {
# check interoperability of field inheritance with old-style fields
'name': osv.fields.char('Name'),
'state': osv.fie... |
"""
Created on 22/03/2013
@author: thom
"""
import logging
import os
from parameters import Parameters
from reactor_model.spatial_reaction_vessel import SpatialReactionVessel
from ULPS import Float_t
class ChargeReactionVessel(SpatialReactionVessel):
"""
n-dimensional structure of fixed size. Molecules b... |
import numpy as np #python utilities
import scipy.optimize as so
def rsquared(z,zf,ze):
# reduced chi-squared
dz = z-zf;
rr = 1/(numel(z)-8)*sum(dz^2/ze^2); # minus 8 because there are 7 fit parameters +1 (DOF)
return rr
def gaussFit(matrizSTA):
# Return the properties of the gaussian fit
xData, yData, zData... |
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python
# USAGE:
# from fn_plotting.py import *
# PREAMBLE:
import numpy as np
import sys
import os
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib as mpl
from matplotlib.ticker import NullFormatter
stdev = np.std
sqrt = np.... |
import time
from datadog import api, initialize
from airflow.exceptions import AirflowException
from airflow.hooks.base_hook import BaseHook
from airflow.utils.log.logging_mixin import LoggingMixin
class DatadogHook(BaseHook, LoggingMixin):
"""
Uses datadog API to send metrics of practically anything measur... |
"""Logging tensorflow::tfprof::OpLogProto.
OpLogProto is used to add extra model information for offline analysis.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.profiler.tfprof_logger import write_op_log as _write_op_log
from te... |
try:
import bigsuds
bigsuds_found = True
except ImportError:
bigsuds_found = False
from ansible.module_utils.basic import env_fallback
def f5_argument_spec():
return dict(
server=dict(
type='str',
required=True,
fallback=(env_fallback, ['F5_SERVER'])
... |
"""
## @file
This file generates data for the PCA/KNN classifier tests
"""
import logging
import numpy
LOGGER = logging.getLogger(__name__)
def generate(numDims, numClasses, k, numPatternsPerClass,
numPatterns, numTests, numSVDSamples, keep):
LOGGER.info('N dims=%s', numDims)
LOGGER.info('N class... |
# Problem Set 2:
# Visualization code for simulated robots.
# See the problem set for instructions on how to use this code.
import math
import time
from tkinter import *
class RobotVisualization:
def __init__(self, num_robots, width, height, delay = 0.2):
"Initializes a visualization with the specified p... |
import ubx
import struct
import calendar
import os
import gobject
import logging
import sys
import socket
import time
d = {}
start = time.time()
TIMEOUT = 20
loop = gobject.MainLoop()
state = 0
def timeout(*args):
print("timeout")
loop.quit()
def poll_nav_status(*args):
#print("poll_nav_status")
t.se... |
from oslo.serialization import jsonutils
import webob
from nova.api.openstack.compute.contrib import extended_virtual_interfaces_net
from nova import compute
from nova import network
from nova import test
from nova.tests.unit.api.openstack import fakes
FAKE_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
FAKE_VIFS =... |
"""Enable multiple processes to send logs to a central server through ZeroMQ.
Thanks to Zachary Voase: https://github.com/zacharyvoase/logbook-zmqpush
Slightly modified to support Logbook 0.4.1.
"""
import errno
import json
import socket
import logbook.queues
from logbook.base import LogRecord
import zmq
from zmq.uti... |
from environment import GymEnvironment
from ddpg_agent import DDPGAgent
import numpy as np
import sys
import random
import os
import json
import pdb
def main():
model_path = sys.argv[1]
conf_path = os.path.join(model_path, 'config.json')
json_data = open(conf_path).read()
conf = json.loads(json_data)
... |
"""ComboBox dropped height Test
**What is checked**
It is ensured that the height of the list displayed when the combobox is
dropped down is not less than the height of the reference.
**How is it checked**
The value for the dropped rectangle can be retrieved from windows. The height
of this rectangle is calcu... |
#!/usr/bin/env python
#coding=utf-8
import os
import numpy
import array
from utils import *
from mhd_utils import *
def read_flt_file(filename):
"""
Read the diffusion signals from a flt file.
Usage:
(dsize, data) = read_flt_file(filename)
please see example below for explanation.
A flt... |
import random
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.zaqar import utils as zutils
from rally.task import validation
class ZaqarBasic(zutils.ZaqarScenario):
"""Benchmark scenarios for Zaqar."""
@validation.number("name_length", minval=10)
@scenario.configure(c... |
from sys import argv
import numpy
from gensim import corpora, models, similarities
from gensim.corpora import MmCorpus
from nltk.corpus import stopwords
import os
from pprint import pprint
from numpy import median
# Enables ease of recall in the future
modelFile = '.' + os.sep + 'IndustrialHygieneModel'
os.makedirs(m... |
"""This module contains the general information for LsbootBootSecurity ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class LsbootBootSecurityConsts:
SECURE_BOOT_DISABLED = "Disabled"
SECURE_BOOT_ENABLED = "Enabled"
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
qualities,
determine_ext,
)
class TeacherTubeIE(InfoExtractor):
IE_NAME = 'teachertube'
IE_DESC = 'teachertube.com videos'
_VALID_URL = r'https?://(?:www\.)?teachert... |
from __future__ import print_function
import os
import numpy as np
try:
import vtk
from vtk.util.numpy_support import vtk_to_numpy
except BaseException:
pass
def calculate_vtk_max_pointwise_difference(file1, file2, tol=1e-6):
arrays = [0] * 2
reader = vtk.vtkStructuredPointsReader()
for i, fn... |
"""High level API for learning with TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
# pylint: disable=wildcard-import
from tensorflow.contrib.learn.python.learn import basic_session_run_hooks
from tensorflow.contrib.learn.... |
from spack import *
class Archer(CMakePackage):
"""ARCHER, a data race detection tool for large OpenMP applications."""
homepage = "https://github.com/PRUNERS/ARCHER"
url = "https://github.com/PRUNERS/archer/archive/v1.0.0.tar.gz"
version('1.0.0', '790bfaf00b9f57490eb609ecabfe954a')
depend... |
from omero.testlib import ITest
from omero.callbacks import CmdCallbackI
from omero.cmd import Delete2
from omero.grid import ImportSettings
from omero.model import ChecksumAlgorithmI
from omero.model import FilesetI
from omero.model import FilesetEntryI
from omero.model import ImageI
from omero.model import OriginalF... |
from __future__ import unicode_literals
import warnings
from django.apps import apps
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.shortcuts import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnI... |
import falcon
from oslo_log import log as logging
import six
from zaqar.common import decorators
from zaqar.i18n import _
from zaqar.storage import errors as storage_errors
from zaqar.transport import acl
from zaqar.transport import utils
from zaqar.transport import validation
from zaqar.transport.wsgi import errors a... |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.system_info import get_info, NotFoundError
from numpy.distutils.misc_util import Configuration
from scipy._build_utils i... |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from cms.utils.compat.dj import get_user_model
from .models import EmailUser
class UserCreationForm(forms.ModelForm):
"""
A form for creating a new user, including the required
email and passw... |
from sys import version_info
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
install_requires = [
"requests-oauthlib>=0.3.0",
"requests>=2.3.0",
"python-dateutil>=2.1",
]
tests_require = None
if version_info[0] == 2:
tests_require = [
"mock",
... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'curated'}
import traceback
from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import ec2_argument_spec, ec2_connect, connect_to_aws, \
get_ec2_security_group_... |
"""Extensible class instrumentation.
The :mod:`sqlalchemy.ext.instrumentation` package provides for alternate
systems of class instrumentation within the ORM. Class instrumentation
refers to how the ORM places attributes on the class which maintain
data and track changes to that data, as well as event hooks installed... |
from msrest.serialization import Model
class UserSecretStoreFragment(Model):
"""Properties of a user's secret store.
:param key_vault_uri: The URI of the user's Key vault.
:type key_vault_uri: str
:param key_vault_id: The ID of the user's Key vault.
:type key_vault_id: str
"""
_attribute... |
import scrapy
from scrapy import log
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from rcbi.items import Part
import os
import urlparse
import urllib
MANUFACTURERS = ["Cobra", "DTF-UHF", "EMAX", "FatShark", "Foxeer", "FrSky", "Gemfan", "ImmersionRC", "XHover"]
CORRECT =... |
import unittest
from webkitpy.common.net.buildbot import Build
from webkitpy.common.net.failuremap import *
from webkitpy.common.net.regressionwindow import RegressionWindow
from webkitpy.tool.mocktool import MockBuilder
class FailureMapTest(unittest.TestCase):
builder1 = MockBuilder("Builder1")
builder2 = M... |
{
'name': 'Project Management',
'version': '1.1',
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'category': 'Project Management',
'sequence': 8,
'summary': 'Projects, Tasks',
'images': [
'images/gantt.png',
'images/project_dashboard.jpeg',
'images/p... |
#!/usr/bin/env python
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat =lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,3,0,False ],[traindat,testdat,4,0,False]]
def kernel_comm_ulong_string_modular (fm_train_dna=traindat,fm_test_... |
"""
DAG designed to test what happens when a DAG with pooled tasks is run
by a BackfillJob.
Addresses issue #1225.
"""
from datetime import datetime
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
dag = DAG(dag_id='test_backfill_pooled_task_dag')
task = DummyOperator(
tas... |
"""Base classes for server/gateway implementations"""
from types import StringType
from util import FileWrapper, guess_scheme, is_hop_by_hop
from headers import Headers
import sys, os, time
__all__ = ['BaseHandler', 'SimpleHandler', 'BaseCGIHandler', 'CGIHandler']
try:
dict
except NameError:
def dict(items)... |
from __future__ import print_function
# Callback manager
cm = None
pyrebox_print = None
def module_loaded(params):
'''
Callback for loaded modules
'''
global cm
global pyrebox_print
pid = params["pid"]
pgd = params["pgd"]
base = params["base"]
size = params["size"]
name = para... |
# encoding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
)
class WSJIE(InfoExtractor):
_VALID_URL = r'https?://video-api\.wsj\.com/api-video/player/iframe\.html\?guid=(?P<id>[a-zA-Z0-9-]+)'
IE_DESC = 'Wall Street J... |
from __future__ import with_statement
import IECore
# renders a sphere
class sphereProcedural( IECore.ParameterisedProcedural ) :
def __init__( self ) :
IECore.ParameterisedProcedural.__init__( self, "Renders a sphere." )
rad_param = IECore.FloatParameter(
name = "radius",
description ... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify that we can still call Install() and InstallAs() even when
no Tool modules have been loaded.
"""
import TestSCons
test = TestSCons.TestSCons()
test.subdir('iii')
test.write('SConstruct', """
env = Environment(tools = [])
env.Install('iii', 'f... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import io
import yaml
try:
from _yaml import ParserError
except ImportError:
from yaml.parser import ParserError
from ansible.compat.tests import unittest
from ansible.parsing import vault
from ansible.parsing.yaml import... |
"""
Generic test utilities and decorators.
"""
from __future__ import division, print_function, absolute_import
import os
import sys
from numpy.testing import dec
__all__ = ['knownfailure_overridable', 'suppressed_stdout']
def knownfailure_overridable(msg=None):
if not msg:
msg = "Undiagnosed issues ... |
"""
Tests that check that we ignore the appropriate files when importing courses.
"""
import unittest
from mock import Mock
from xmodule.modulestore.xml_importer import import_static_content
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.tests import DATA_DIR
class IgnoredFilesTestCase(uni... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, getdate
def execute(filters=None):
if not filters: filters = {}
validate_filters(filters)
columns = get_columns()
item_map = get_item_details(filters)
iwb_map = get_item_warehouse_map(filters)
data = []
... |
from datetime import datetime, date
import nose
import numpy as np
from numpy.testing import assert_almost_equal as np_assert_almost_equal
from pandas import Timestamp, Period
from pandas.compat import u
import pandas.util.testing as tm
from pandas.tseries.offsets import Second, Milli, Micro
try:
import pandas.t... |
import testtools
from tempest.api.compute import base
from tempest.common.utils.linux import remote_client
from tempest import config
from tempest import test
CONF = config.CONF
class AttachVolumeTestJSON(base.BaseV2ComputeTest):
def __init__(self, *args, **kwargs):
super(AttachVolumeTestJSON, self).__... |
"""
Example Usage:
List Stacki Nodes
$ ./stack.py --list
Example Configuration:
---
stacki:
auth:
stacki_user: admin
stacki_password: abc12345678910
stacki_endpoint: http://192.168.200.50/stack
use_hostnames: false
"""
import argparse
import os
import sys
import yaml
from distutils.version impo... |
"""
Extract metadata from RIFF file format: AVI video and WAV sound.
"""
from lib.hachoir_metadata.metadata import Metadata, MultipleMetadata, registerExtractor
from lib.hachoir_metadata.safe import fault_tolerant, getValue
from lib.hachoir_parser.container.riff import RiffFile
from lib.hachoir_parser.video.fourcc imp... |
from __future__ import absolute_import, division, print_function
import pytest
from invenio_db import db
from invenio_records.models import RecordMetadata
from invenio_search import current_search_client as es
from invenio_workflows import workflow_object_class
from inspirehep.bat.arsenic import Arsenic
from inspire... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.eos import eos_banner
from units.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
CLI = dict(transport="cli")
EAPI = dict(tra... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class asset_depreciation_confirmation_wizard(osv.osv_memory):
_name = "asset.depreciation.confirmation.wizard"
_description = "asset.depreciation.confirmation.wizard"
_columns = {
'period_id': fields.many2one('account.period',... |
from sqlalchemy import (MetaData, Table, Column, Integer, String, ForeignKey,
create_engine)
from sqlalchemy.orm import (mapper, relationship, sessionmaker)
meta = MetaData()
org_table = Table('organizations', meta,
Column('org_id', Integer, primary_key=True),
Column('org_name', Strin... |
from saw.saw import Saw
import datetime
import sys
from saw.node import Node
with open('test.txt', 'r') as content_file:
text = content_file.read()
start_time = datetime.datetime.now()
saw = Saw.load(text)
end_time = datetime.datetime.now()
print 'Time of text load - ' + str(end_time - start_time)
print saw.s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import glob
import os
import re
import socket
import struct
from ansible.module_utils.facts.network.base import Network, NetworkCollector
from ansible.module_utils.facts.utils import get_file_content
class LinuxNetwork(Network)... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Title(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterpolargl.marker.colorbar"
_path_str = "scatterpolargl.marker.colorbar.title"
_valid_pro... |
#!/usr/bin/python
""" PN-CLI vrouter-bgp-add/vrouter-bgp-remove/vrouter-bgp-modify """
#
# This file is part of Ansible
#
# Ansible 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 Lice... |
"""
Matlab Problem Page.
"""
from bok_choy.page_object import PageObject
class MatlabProblemPage(PageObject):
"""
View of matlab problem page.
"""
url = None
def is_browser_on_page(self):
return self.q(css='.ungraded-matlab-result').present
@property
def problem_name(self):
... |
#/u/GoldenSights
import traceback
from dateutil.parser import parse as dateparse
import string
import datetime
import time
import praw
import sqlite3
import re
""" USER CONFIG """
USERAGENT = ""
#Describe the bot and what it does. Include your username
USERNAME = "GoldenSights"
#This is the bot's username
PASSWORD = ... |
import logging
import shutil
import tempfile
import tlscanary.firefox_downloader as fd
import tlscanary.firefox_extractor as fe
# Silence logging
logging.disable(logging.INFO)
logging.disable(logging.WARNING)
logging.disable(logging.ERROR)
logging.disable(logging.CRITICAL)
# Global variables for all tests
# CAVE: Mu... |
from ovito.io import import_file, export_file
from ovito.modifiers import PythonScriptModifier, CalculateDisplacementsModifier
import numpy
# Load input data and create an ObjectNode with a data pipeline.
node = import_file("simulation.dump", multiple_frames = True)
# Calculate per-particle displacements with respect... |
from flask import Flask, jsonify
from librato_python_web.instrumentor.context import _get_state
app = Flask(__name__)
@app.route('/')
def get_state():
return jsonify(_get_state())
if __name__ == '__main__':
app.run() |
game= [[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]
def Winner(g, p):
if g[1][1] == p:
return (g[0][0] == p and g[2][2] == p) \
or (g[1][0] == p and g[1][2] == p) \
or (g[0][1] == p and g[2][1] == p)\
or (g[0][2] == p and g[2][0] == p)
else:
retur... |
from . import sweep
import numpy as np
import matplotlib.pyplot as plt
class interleaved_benchmarking:
def __init__(self, measurer, set_seq, interleavers = None, random_sequence_num=8):
self.measurer = measurer
self.set_seq = set_seq
self.interleavers = {}
if interleavers is not None:
for name, gate in in... |
# -*- coding: utf-8 -*-
"""
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 is distributed in ... |
from ..broker import Broker
class SpmInterfacesDefaultGridBroker(Broker):
controller = "spm_interfaces_default_grids"
def index(self, **kwargs):
"""Lists the available spm interfaces default grids. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the variou... |
from __future__ import unicode_literals
from mezzanine.utils.cache import (cache_key_prefix, cache_installed,
cache_get, cache_set)
# Deprecated settings and their defaults.
DEPRECATED = {
"PAGES_MENU_SHOW_ALL": True
}
class TemplateSettings(dict):
"""
Dict wrapper for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.