content string |
|---|
#!/usr/bin/env python
'''automated testing of Samba3 against windows'''
import sys, os
import optparse
import wintest
def set_libpath(t):
t.putenv("LD_LIBRARY_PATH", "${PREFIX}/lib")
def set_krb5_conf(t):
t.run_cmd("mkdir -p ${PREFIX}/etc")
t.write_file("${PREFIX}/etc/krb5.conf",
''... |
"""Strptime-related classes and functions.
CLASSES:
LocaleTime -- Discovers and stores locale-specific time information
TimeRE -- Creates regexes for pattern matching a string of text containing
time information
FUNCTIONS:
_getlang -- Figure out what language is being used for the locale
... |
from __future__ import absolute_import
from django.conf import settings
from django.contrib import comments
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
from . import CommentTestCase
class CommentAppAPITests(CommentTestCase):
"""Tests for the "comment ... |
from flask_mail import Message
from flask import render_template, url_for
import NodeDefender
import smtplib
@NodeDefender.decorators.mail_enabled
@NodeDefender.decorators.celery_task
def new_node(group, node):
group = NodeDefender.db.group.get(group)
if group is None:
return False
if group.email i... |
"""Implementation of Cluster Resolvers for Kubernetes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.distribute.cluster_resolver.cluster_resolver import ClusterResolver
from tensorflow.python.distribute.cluster_resolver.cluster_r... |
"""Tests for setuptools.find_packages()."""
import os
import sys
import shutil
import tempfile
import unittest
import platform
import setuptools
from setuptools import find_packages
from setuptools.tests.py26compat import skipIf
find_420_packages = setuptools.PEP420PackageFinder.find
# modeled after CPython's test.s... |
#
from datetime import datetime
class Program ( ):
#private:
"""
id # int
datetime # datetime
description # string
status # boolean
inactive # boolean
weekly # boolean
pin # int(4)
id_related_dev # int
id_initiator # int
"""
def __init__(self,**kwargs):
"""
@**kwargs:
id: int
datetime: date... |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer.testing import attr
if cuda.available:
cuda.init()
class TestSplitAxis0(unittest.TestCase):
def setUp(self):
self.x = numpy.arange(42, dtype=numpy.flo... |
"""Start a simple interactive console with TensorFlow available."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import code
import sys
def main(_):
"""Run an interactive console."""
code.interact()
return 0
if __name__ == '__main__':
sys.exi... |
# Standard imports
import unittest
import datetime as pydt
import logging
import uuid
import json
import emission.storage.timeseries.abstract_timeseries as esta
import emission.storage.decorations.analysis_timeseries_queries as esda
import emission.storage.timeseries.timequery as estt
import emission.core.get_databas... |
"""
Transmit 2 signals, one out each daughterboard.
Outputs SSB (USB) signals on side A and side B at frequencies
specified on command line.
Side A is 600 Hz tone.
Side B is 350 + 440 Hz tones.
"""
from gnuradio import gr, uhd
from gnuradio import filter
from gnuradio import analog
from gnuradio import blocks
from g... |
"""
Unit tests for the API module
"""
import datetime
import mock
import pytz
import urlparse
from nose.plugins.attrib import attr
from opaque_keys.edx.keys import CourseKey
from student.tests.factories import AdminFactory
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils ... |
from robot.utils import html_escape, py2to3, setter
from .itemlist import ItemList
from .modelobject import ModelObject
@py2to3
class Message(ModelObject):
"""A message created during the test execution.
Can be a log message triggered by a keyword, or a warning or an error
that occurred during parsing o... |
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import os
import sys
import unittest
from contextlib import contextmanager
__all__ = [
'add_metaclass',
'redirect_stderr',
'redirect_stdout',
'TestCase',
'UTILS_PATH',
]
UTILS_PATH = os.path.abspath(os.path.... |
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import gzip
from io import BytesIO
from tempfile import TemporaryFile
import zipfile
import zlib
from mo_logs.exceptions import suppress_exception
from mo_logs import Log
from mo_math import Math
# LIBRARY ... |
import pybullet as p
import time
p.connect(p.GUI)
useCollisionShapeQuery = True
p.configureDebugVisualizer(p.COV_ENABLE_GUI, 0)
geom = p.createCollisionShape(p.GEOM_SPHERE, radius=0.1)
geomBox = p.createCollisionShape(p.GEOM_BOX, halfExtents=[0.2, 0.2, 0.2])
baseOrientationB = p.getQuaternionFromEuler([0, 0.3, 0]) #[0... |
import cv2
import pymatlab as mlb
class DPMObjectDetection:
def __init__(self):
self.session = mlb.session_factory()
self.session.run('cd ./voc-dpm/')
self.model = None
def trainDPMmodel(self, model, pos, neg, warp, randneg, nbiter, nbnegiter,
maxnumexamp... |
from django.shortcuts import render
from articles.models import Article
from docs.models import Document
def home(request):
return render(request, 'home.html', {
'top_stories': Article.objects.all()[:5],
})
def email_list_signup(request):
return render(request, 'email-list-signup.html')
def cont... |
import json
import marisa_trie
import os
import shutil
from operator import itemgetter
import TileStache
from werkzeug.serving import run_simple
from werkzeug.wrappers import Request, Response
from cartograph import Utils
from cartograph import Config
""" This is an example from a summer research projec... |
import mock
import os
import tempfile
from cuckoo.common.elastic import Elastic
from cuckoo.common.mongo import Mongo, mongo
from cuckoo.common.objects import File
from cuckoo.main import cuckoo_create
from cuckoo.misc import set_cwd
from cuckoo.reporting.mongodb import MongoDB
def test_mongo_init_nouser():
set_c... |
#!/usr/bin/env python
import httpretty
import os
import unittest
import urlparse
import ari
import requests
class AriTestCase(unittest.TestCase):
"""Base class for mock ARI server.
"""
BASE_URL = "http://ari.py/ari"
def setUp(self):
"""Setup httpretty; create ARI client.
"""
... |
"""
Prints package completion strings.
"""
from rez.vendor import argparse
__doc__ = argparse.SUPPRESS
def setup_parser(parser, completions=False):
pass
def command(opts, parser, extra_arg_groups=None):
from rez.cli._util import subcommands, hidden_subcommands
import os
import re
# get comp i... |
'''Data transformation functions.
From bytes to a number, number to bytes, etc.
'''
from __future__ import absolute_import
try:
# We'll use psyco if available on 32-bit architectures to speed up code.
# Using psyco (if available) cuts down the execution time on Python 2.5
# at least by half.
import p... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals
from atomic_reactor.build import ImageName
from atomic_reactor.koji_util import creat... |
"""Tests for tf.test.compute_gradient and tf.compute_gradient_error."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.py... |
import util
import xs_errors
import statvfs
import stat
import iscsilib
import mpath_cli
import os
import glob
import time
import scsiutil
import mpp_luncheck
import mpp_mpathutil
import devscan
import re
import wwid_conf
iscsi_mpath_file = "/etc/iscsi/iscsid-mpath.conf"
iscsi_default_file = "/etc/iscsi/iscsid-default... |
# coding=utf-8
"""
This collector uses the [ipmitool](http://openipmi.sourceforge.net/) to read
hardware sensors from servers
using the Intelligent Platform Management Interface (IPMI). IPMI is very common
with server hardware but usually not available in consumer hardware.
#### Dependencies
* [ipmitool](http://ope... |
# -*- encoding: utf-8 -*-
"""
Usage::
hammer puppet-class [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
info Show a puppetclass
list List all... |
import os
import gnupg
import socket
import struct
import re
import sys
import getpass
from socket_utils import *
# For the generation of the key you may want to run
# sudo rngd -r /dev/urandom
# to generate randomnes
class PGP:
def __init__(self, path, email=None, verbose=False, pass_phrase=None):
self.D... |
"""
Make sure the link order of object files is the same between msvs and ninja.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
CHDIR = 'linker-flags'
test.run_gyp('link-ordering.gyp', chdir=CHDIR)
test.build('link-ordering.gyp', test.ALL, chdir=C... |
"""Internal support module for sre"""
import sys
import _sre
import sre_parse
from sre_constants import *
from _sre import MAXREPEAT
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
if _sre.CODESIZE == 2:
MAXCODE = 65535
else:
MAXCODE = 0xFFFFFFFF
def _identityfunction(x):
return x
_LITERAL_CODES =... |
from urllib.parse import urlencode
from datetime import datetime
from pycds import Network, CrmpNetworkGeoserver as cng
from pdp_util.util import get_stn_list, get_clip_dates, get_extension
import pytest
from sqlalchemy import text
from webob.request import Request
def test_get_stn_list(test_session):
stns = ge... |
import platform
from distutils.unixccompiler import UnixCCompiler
from numpy.distutils.exec_command import find_executable
from numpy.distutils.ccompiler import simple_version_match
if platform.system() == 'Windows':
from numpy.distutils.msvc9compiler import MSVCCompiler
class IntelCCompiler(UnixCCompiler):
... |
"Misc. utility functions/classes for admin documentation generator."
import re
from email.Parser import HeaderParser
from email.Errors import HeaderParseError
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_str
try:
import docutils.... |
import sys
from numpy.testing import *
import numpy as np
types = [np.bool_, np.byte, np.ubyte, np.short, np.ushort, np.intc, np.uintc,
np.int_, np.uint, np.longlong, np.ulonglong,
np.single, np.double, np.longdouble, np.csingle,
np.cdouble, np.clongdouble]
real_types = [ np.byte, np.ubyte,... |
"""Unittests for run.py."""
import json
import re
import unittest
import run
class UnitTest(unittest.TestCase):
def test_parse_args_ok(self):
cmd = [
'--app',
'./foo-Runner.app',
'--host-app',
'./bar.app',
# Required
'--xcode-build-version',
'123abc',
... |
import sys
import json
import urllib
import urllib2
from urlparse import urlparse
from datetime import datetime
import ec2utils
from xmltodict import parse
class BaseClient(object):
def __init__(self, access, secret, url, format=None,
timeout=300, debug=False, region='Beijing'):
self.a... |
from paste.auth.digest import *
from paste.wsgilib import raw_interactive
from paste.response import header_value
from paste.httpexceptions import *
from paste.httpheaders import AUTHORIZATION, WWW_AUTHENTICATE, REMOTE_USER
import os
def application(environ, start_response):
content = REMOTE_USER(environ)
star... |
x = set(['a','r','bg','Z'])
assert x==set(['bg','Z','a','r'])
assert len(x)==4
x.add('tail')
assert len(x)==5
x.add('tail')
assert len(x)==5
assert 'r' in x
assert 'rty' not in x
y = set([1,2,3])
assert x.isdisjoint(y)
y.add('r')
assert not x.isdisjoint(y)
z = set(['a','r'])
assert z.issubset(x)
assert z <= x
assert... |
from cli import base
from core import data, container
import shutil
import os
import sys
import tarfile
from docker import Client
from urllib.request import urlretrieve
from cement.core.controller import CementBaseController, expose
class InstallController(CementBaseController):
class Meta:
label = 'instal... |
"""
Library Content XBlock Wrapper
"""
from __future__ import absolute_import
from bok_choy.page_object import PageObject
class LibraryContentXBlockWrapper(PageObject):
"""
A PageObject representing a wrapper around a LibraryContent block seen in the LMS
"""
url = None
BODY_SELECTOR = '.xblock-st... |
import sys
import os
import numpy as np
import cv2
def split_rgb(image):
'''Split the target image into its red, green and blue channels.
image - a numpy array of shape (rows, columns, 3).
output - three numpy arrays of shape (rows, columns) and dtype same as
image, containing the corresponding cha... |
#!/usr/bin/env python
import os
import sys
from distutils import spawn
class CompilerException(Exception):
pass
def generate_proto(source, output_dir,
with_plugin='python', suffix='_pb2.py', plugin_binary=None):
"""Invokes the Protocol Compiler to generate a _pb2.py from the given
.p... |
import subscription
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
Structured Tagging based on XBlockAsides
"""
from xblock.core import XBlockAside, XBlock
from xblock.fragment import Fragment
from xblock.fields import Scope, Dict
from xmodule.x_module import STUDENT_VIEW
from xmodule.capa_module import CapaModule
from abc import ABCMeta, abstractproperty
from edxmako.shortcuts i... |
import time
functions = {
'today': lambda x: time.strftime('%d/%m/%Y', time.localtime()).decode('latin1')
}
#
# TODO: call an object internal function too
#
def print_fnc(fnc, arg):
if fnc in functions:
return functions[fnc](arg)
return ''
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shift... |
#!/usr/bin/env python
""" hg-to-git.py - A Mercurial to GIT converter
Copyright (C)2007 Stelian Pop <<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 Foundation; either version 2, or (a... |
""" Copyright (c) 2003-2007 LOGILAB S.A. (Paris, FRANCE).
http://www.logilab.fr/ -- mailto:<EMAIL>
manipulate pdf and fdf files. pdftk recommended.
Notes regarding pdftk, pdf forms and fdf files (form definition file)
fields names can be extracted with:
pdftk orig.pdf generate_fdf output truc.fdf
to merge fdf an... |
from tkinter import *
class SearchDialogBase:
title = "Search Dialog"
icon = "Search"
needwrapbutton = 1
def __init__(self, root, engine):
self.root = root
self.engine = engine
self.top = None
def open(self, text, searchphrase=None):
self.text = text
if no... |
from myhdl import *
from mn.cores.usb_ext import fl_fx2
from mn.cores.usb_ext import fpgalink_fx2
def fpgalink_led(
# ~~ FX2 interface signals ~~
IFCLK, # 48 MHz clock from FX2
RST, # active low async reset
SLWR, # active low write strobe
SLRD, # active low read strobe
... |
"""Utility functions
Including functions of get/getbulk/walk/set of snmp for three versions
"""
import imp
import re
import logging
def load_module(mod_name, path, host=None, credential=None):
""" Load a module instance.
:param str mod_name: module name
:param str path: directory of the module
:pa... |
from openerp.osv import osv, fields
class product_template(osv.Model):
_inherit = 'product.template'
_columns = {
'website_published': fields.boolean('Available in the website', copy=False),
}
_defaults = {
'website_published': False,
} |
"""Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
"""create is_encrypted
Revision ID: 1507a7289a2f
Revises: e3a246e0dc1
Create Date: 2015-08-18 18:57:51.927315
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.engine.reflection import Inspector
# revision identifiers, used by Alembic.
revision = '1507a7289a2f'
down_revision = 'e3a246e0dc1'
branch_l... |
"""Helpers for the student app. """
from datetime import datetime
import urllib
from pytz import UTC
from django.core.urlresolvers import reverse, NoReverseMatch
import third_party_auth
from verify_student.models import VerificationDeadline, SoftwareSecurePhotoVerification # pylint: disable=import-error
from course_... |
"""Utility functions for Windows builds.
This file is copied to the build directory as part of toolchain setup and
is used to set up calls to tools used by the build that need wrappers.
"""
from __future__ import print_function
import os
import re
import shutil
import subprocess
import stat
import sys
# Embedded vp... |
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.utils import lru_cache, six
from django.utils.deprecation import RemovedInDjango110Warning
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
from .base import Context, Lexer, Par... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1,6))
fib = 0
for num in it:
fib += num
self.assertEqual(__ , fib)
def test_iter... |
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
return True
if module_exists('PIL'):
from PIL import Image
class _body(object):
def __init__(self):
self.events = {}
def appendChild(self, obj):
self... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.codegen.targets.java_antlr_library import JavaAntlrLibrary
from pants.backend.codegen.targets.java_protobuf_library import JavaProtobufLibrary
from ... |
"""
EasyBuild support for SuiteSparse, implemented as an easyblock
@author: Stijn De Weirdt (Ghent University)
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
"""
import fileinput
import re
impor... |
import logging
import time
from pandas import HDFStore
import os
# Adding logging support
logger = logging.getLogger(__name__)
def run_radial1d(radial1d_model, history_fname=None):
if history_fname:
if os.path.exists(history_fname):
logger.warn('History file %s exists - it will be overwritten... |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 01 20:20:16 2011
Author: Josef Perktold
License: BSD-3
TODO:
check orientation, size and alpha should be increasing for interp1d,
but what is alpha? can be either sf or cdf probability
change it to use one consistent notation
check: instead of bound checking I could us... |
"""
An example demonstrating PowerIterationClustering.
Run with:
bin/spark-submit examples/src/main/python/ml/power_iteration_clustering_example.py
"""
# $example on$
from pyspark.ml.clustering import PowerIterationClustering
# $example off$
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark =... |
#!/usr/bin/env python
"""
This script is a trick to setup a fake Django environment, since this reusable
app will be developed and tested outside any specific Django project.
Via ``settings.configure`` you will be able to set all necessary settings
for your app and run the tests as if you were calling ``./manage.py te... |
#! /usr/bin/python
from xml.etree import cElementTree as ET
import os
import sqlite3
import sys
import getopt
# map XML attributes/elements to SQL rows
# --POC: iterate through the children and attributes of the memberdef elelement
# and search it in doxygen_sqlite3.db
g_conn=None
val=[]
def print_unprocessed_... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
)
from ..utils import (
parse_duration,
parse_iso8601,
str_to_int,
)
class FourTubeIE(InfoExtractor):
IE_NAME = '4tube'
_VALID_URL = r'https?://(?:www\.)?4tube\.c... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import unified_strdate
class StreetVoiceIE(InfoExtractor):
_VALID_URL = r'https?://(?:.+?\.)?streetvoice\.com/[^/]+/songs/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'http://s... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import get_exception
try:
import pan.xapi
from pan.xapi import PanXapiError
HAS_... |
import sys
import getpass
"""
Interactive console emulator.
Presents the caller with a MOTD, Username and password prompt and expects
the password to match the username.
It then provides a console prompt-like behavior.
- ROOT_CMD allows becoming root by entering the password
- UNROOT_CMD allows leaving root session
... |
import collections
import json
from contextlib import contextmanager
from copy import deepcopy
from ansible.module_utils.basic import env_fallback, return_values
from ansible.module_utils.connection import Connection
from ansible.module_utils.network.common.netconf import NetconfConnection
from ansible.module_utils._t... |
"""Support for monitoring a Smappee energy sensor."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_POWER, ENERGY_WATT_HOUR, POWER_WATT, VOLT
from .const import DOMAIN
TREND_SENSORS = {
"total_power": [
"Total consumption - Active power",
Non... |
from __future__ import absolute_import
from __future__ import unicode_literals
import jinja2
from whichcraft import which
from behave import given
from command_steps import step_i_successfully_run_command
import table_utils
GPGKEY_CONF_TMPL = """
%no-protection
%transient-key
Key-Type: {{ key_type|default("RSA") }}... |
__doc__ = """
hashlib backwards-compatibility module for older (pre-2.5) Python versions
This does not not NOT (repeat, *NOT*) provide complete hashlib
functionality. It only wraps the portions of MD5 functionality used
by SCons, in an interface that looks like hashlib (or enough for our
purposes, anyway). In fact, ... |
#!/usr/bin/env python
import sys
from subprocess import run
def colorize_text(text, color):
return f'%{{F{color}}}{text}%{{F-}}'
if __name__ == '__main__':
xrdb = run('xrdb -query', shell=True, capture_output=True, text=True, check=True)
raw_colors = (
line.replace('*', '').split(':')
f... |
#!/usr/bin/env python
import SimpleITK as sitk
import numpy as np
def zpad(img,nzbot=0,nztop=0):
"""
Return an augmented copy of an image object: the central part is the same
as the original, but we add nzbot (nztop) copies of the bottom (top) layer
to the bottom (top).
"""
if type(img) != sit... |
"""Support for file notification."""
import logging
import os
import voluptuous as vol
from homeassistant.const import CONF_FILENAME
import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util
from homeassistant.components.notify import (
ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_... |
from __future__ import division
from statsmodels.compat.python import iterkeys, zip, lrange, iteritems, range
from numpy.testing import assert_, assert_raises, dec
from numpy.testing import run_module_suite
# utilities for the tests
from statsmodels.compat.collections import OrderedDict
from statsmodels.api import d... |
"""Script to test TF-TensorRT integration."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import numpy as np
import six as _six
# normally we should do import tensorflow as tf and then
# tf.placeholder, tf.constant, tf.nn.conv2d etc but... |
from utils import *
def test_anubarak():
game = prepare_empty_game()
anubarak = game.player1.give("AT_036")
anubarak.play()
game.player1.discard_hand()
assert len(game.player1.field) == 1
assert len(game.player1.hand) == 0
anubarak.destroy()
assert len(game.player1.field) == 1
assert len(game.player1.hand) =... |
"""
Tutorial - Multiple objects
This tutorial shows you how to create a site structure through multiple
possibly nested request handler objects.
"""
import cherrypy
class HomePage:
def index(self):
return '''
<p>Hi, this is the home page! Check out the other
fun stu... |
"""Implements (a subset of) Sun XDR -- eXternal Data Representation.
See: RFC 1014
"""
import struct
try:
from cStringIO import StringIO as _StringIO
except ImportError:
from StringIO import StringIO as _StringIO
__all__ = ["Error", "Packer", "Unpacker", "ConversionError"]
# exceptions
class Error(Exceptio... |
"""
ExactTarget OAuth support.
Support Authentication from IMH using JWT token and pre-shared key.
Requires package pyjwt
"""
from datetime import timedelta, datetime
import jwt
from social.exceptions import AuthFailed, AuthCanceled
from social.backends.oauth import BaseOAuth2
class ExactTargetOAuth2(BaseOAuth2):
... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
get_dict_of_struct,
o... |
from __future__ import unicode_literals
import os
from django.contrib.staticfiles.finders import get_finders
from pipeline.conf import settings
from manifesto import Manifest
from pipeline.packager import Packager
class PipelineManifest(Manifest):
def __init__(self):
self.packager = Packager()
... |
import os
# freevo modules
from plugins.idlebar import IdleBarPlugin
import plugin, config
class PluginInterface(IdleBarPlugin):
"""
Show the status of all rom drives.
Activate with:
| plugin.activate('idlebar.cdstatus')
"""
def __init__(self):
IdleBarPlugin.__init__(self)
s... |
"""
TCP support for IOCP reactor
"""
import socket, operator, errno, struct
from zope.interface import implementer, classImplements
from twisted.internet import interfaces, error, address, main, defer
from twisted.internet.protocol import Protocol
from twisted.internet.abstract import _LogOwner, isIPv6Address
from t... |
#!/usr/bin/env python
#
# Script to build and install Python-bindings.
import glob
import platform
import os
import shutil
import subprocess
import sys
from distutils import sysconfig
from distutils import util
from distutils.ccompiler import new_compiler
from distutils.command.build_ext import build_ext
from distuti... |
"""
SQL functions reference lists:
http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-sql-3.0.0.html
https://web.archive.org/web/20130407175746/http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.0.0.html
http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html
"""
import re
import sys
from django.contrib.gis.db.... |
from vtdb import dbexceptions
from vtdb import field_types
import framework
import cache_cases1
import cache_cases2
import cases_framework
class TestWillNotBeCached(framework.TestCase):
def setUp(self):
self.env.log.reset()
def tearDown(self):
self.env.execute("drop table vtocc_nocache")
def test_no... |
import scipy.io
from skfeature.function.similarity_based import SPEC
from skfeature.utility import unsupervised_evaluation
def main():
# load data
mat = scipy.io.loadmat('../data/COIL20.mat')
X = mat['X'] # data
X = X.astype(float)
y = mat['Y'] # label
y = y[:, 0]
# specify the seco... |
from bok_choy.page_object import PageObject
from selenium.webdriver.common.keys import Keys
from ..common.utils import click_css
from selenium.webdriver.support.ui import Select
class BaseComponentEditorView(PageObject):
"""
A base :class:`.PageObject` for the component and visibility editors.
This class... |
from slicc.ast.StatementAST import StatementAST
class CheckAllocateStatementAST(StatementAST):
def __init__(self, slicc, variable):
super(StatementAST, self).__init__(slicc)
self.variable = variable
def __repr__(self):
return "[CheckAllocateStatementAst: %r]" % self.variable
def g... |
# -*- coding: utf-8 -*-
#
# Django documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 27 09:06:53 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... |
import os, time, calendar
import datetime
import volatility.conf as conf
import volatility.debug as debug
try:
import pytz
tz_pytz = True
except ImportError:
tz_pytz = False
config = conf.ConfObject()
class OffsetTzInfo(datetime.tzinfo):
"""Timezone implementation that allows offsets specified in secon... |
import os
from pprint import pformat
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
from django.utils.encoding import force_unicode, smart_str, iri_to_uri
# NOTE: d... |
import snapcraft
class JdkPlugin(snapcraft.BasePlugin):
def __init__(self, name, options, project):
super().__init__(name, options, project)
self.stage_packages.append('default-jdk')
def env(self, root):
return ['JAVA_HOME=%s/usr/lib/jvm/default-java' % root,
'PATH=%s... |
import urllib.parse
import settings
import logs
def application(environ, start_response):
#print("environ='%s'\n" % environ, file=sys.stderr)
path = environ.get('PATH_INFO', '')
params = dict(urllib.parse.parse_qsl(environ.get('QUERY_STRING', '')))
#print("params='%s'\n" % params, file=sys.stderr)
... |
import account_followup
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.network.avi.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.