content string |
|---|
# -*- coding: utf-8 -*-
'''
test_qgsoptional.py
--------------------------------------
Date : September 2016
Copyright : (C) 2016 Matthias Kuhn
email : <EMAIL>
***************************************************... |
import logging
from webkitpy.tool.steps.abstractstep import AbstractStep
from webkitpy.tool.steps.options import Options
_log = logging.getLogger(__name__)
class Build(AbstractStep):
@classmethod
def options(cls):
return AbstractStep.options() + [
Options.build,
Options.quiet... |
import pandas
import logging
import openfisca_france_data
from openfisca_france_data.input_data_builders import get_input_data_frame
from openfisca_france_data.surveys import SurveyScenario
from openfisca_core.rates import average_rate
from ipp_work.utils import from_simulation_to_data_frame_by_entity_key_plural
log ... |
"""Import a new upstream version from a git branch onto the Debian branch"""
import os
import sys
import gbp.command_wrappers as gbpc
from gbp.deb.git import GitRepositoryError
from gbp.config import GbpOptionParserDebian, GbpOptionGroup
from gbp.errors import GbpError
import gbp.log
from gbp.scripts.common import Exi... |
import pytest
import py
mypath = py.path.local(__file__).new(ext=".py")
@pytest.mark.xfail
def test_forwarding_to_warnings_module():
pytest.deprecated_call(py.log._apiwarn, "1.3", "..")
def test_apiwarn_functional(recwarn):
capture = py.io.StdCapture()
py.log._apiwarn("x.y.z", "something", stacklevel=1)
... |
# You must first run "bokeh serve" to view this example
import numpy as np
from bokeh.client import push_session
from bokeh.models import BoxSelectTool, LassoSelectTool, Paragraph
from bokeh.plotting import curdoc, figure, hplot, vplot
# create three normal population samples with different parameters
x1 = np.random... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = r'Y \m. E j \d.'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = r'Y \m. E j \d., H:i'
YEAR_MONTH_FORMAT = r'Y \m. F'
MONTH_DAY_FORMAT = r'E j \d... |
"""Unit test module for portal views"""
from datetime import datetime
import tempfile
import urllib
from flask_swagger import swagger
from flask_webtest import SessionScope
from swagger_spec_validator import validate_spec_url
from portal.config.config import TestConfig
from portal.extensions import db
from portal.fa... |
# -*- coding: utf-8 -*-
"""
Production Configurations
"""
from __future__ import absolute_import, unicode_literals
from django.utils import six
from .common import * # noqa
# Enable social integration plugins
SOCIAL_ACCOUNTS = (
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.face... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
limit_length,
)
class InstagramIE(InfoExtractor):
_VALID_URL = r'https://instagram\.com/p/(?P<id>[\da-zA-Z]+)'
_TEST = {
'url': 'https://instagram.com/p/aye83DjauH/?foo=bar#... |
'''
@author: frank
'''
from kvmagent import kvmagent
from zstacklib.utils import jsonobject
from zstacklib.utils import http
from zstacklib.utils import log
from zstacklib.utils import lock
from zstacklib.utils import shell
from zstacklib.utils import linux
import os
import traceback
CHECK_PHYSICAL_NETW... |
# This file is part of CherryPy <http://www.cherrypy.org/>
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:expandtab:fileencoding=utf-8
import cherrypy
from cherrypy._cpcompat import md5, ntob
from cherrypy.lib import auth_basic
from cherrypy.test import helper
class BasicAuthTest(helper.CPWebCase):
def setup_server():... |
import logging
import logging.handlers
import os
def convert_log_level(level=26):
"""
Get a numeric log level from a string. The default 26 is for SHORT logs.
:param level
:return level
"""
# annoying but the level can be passed in as None
if not level:
level = 26
levels = {'... |
import uno
import string
import unohelper
import xmlrpclib
from com.sun.star.task import XJobExecutor
if __name__<>"package":
from lib.gui import *
from lib.error import ErrorDialog
from lib.functions import *
from ServerParameter import *
from lib.logreport import *
from lib.rpc import *
fr... |
import os
import sys
from collections import defaultdict
from UserList import UserList
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
sys.path.append('scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from SchedGui... |
from openerp.osv import orm, fields
class oehealth_annotation(orm.Model):
_inherit = 'oehealth.annotation'
_columns = {
'pharmacy_id' : fields.many2one ('oehealth.pharmacy', 'Pharmacy'),
}
oehealth_annotation() |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Heatmap.py
---------------------
Date : November 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
********************... |
import contextlib
import uuid
import mock
from oslo.config import cfg
from neutron.agent.common import config as agent_config
from neutron.agent import l3_agent
from neutron.agent.linux import ip_lib
from neutron.common import config as base_config
from neutron import context
from neutron.plugins.common import consta... |
"""This module contains a Google Cloud Functions Hook."""
import time
from typing import Any, Dict, List, Optional, Sequence, Union
import requests
from googleapiclient.discovery import build
from airflow.exceptions import AirflowException
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
... |
"""Self-test for the Crypto.Random.Fortuna package"""
__revision__ = "$Id$"
import os
def get_tests(config={}):
tests = []
from Crypto.SelfTest.Random.Fortuna import test_FortunaAccumulator; tests += test_FortunaAccumulator.get_tests(config=config)
from Crypto.SelfTest.Random.Fortuna import test_FortunaG... |
""" merge rec sort tests module """
import unittest
import random
from sort import merge_rec
from tests import helper
class MergeSortTests(unittest.TestCase):
""" merge rec sort unit tests class """
max = 100
arr = []
def setUp(self):
""" setting up for the test """
self.arr = random... |
from __future__ import absolute_import, division, unicode_literals
import time
from qtpy import QtGui
from qtpy import QtWidgets
from qtpy.QtCore import Qt
from qtpy.QtCore import Signal
from .. import core
from .. import qtutils
from ..i18n import N_
from . import defs
from .text import VimTextEdit
class LogWidget... |
{
'name': 'United States - Chart of accounts',
'version': '1.1',
'author': 'OpenERP SA',
'category': 'Localization/Account Charts',
'description': """
United States - Chart of accounts.
==================================
""",
'website': 'http://www.openerp.com',
'depends': ['account_char... |
#!/usr/bin/env python
import roslib
import rospy
import sys
from geometry_msgs.msg import Twist
import numpy as np
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion
import matplotlib.pyplot as plt
from sensor_msgs.msg import PointCloud2
import sensor_msgs.point_cloud2 as pc2
imp... |
# -*- coding: utf-8 -*-
import datetime
import mock
import os
import pytest
import time
import unittest
from django.utils import timezone
from flask import Flask
from nose.tools import * # noqa (PEP8 asserts)
import blinker
from tests.base import OsfTestCase, DbTestCase
from osf_tests.factories import RegistrationFa... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, override_settings
@override_settings(ROOT_URLCONF='view_tests.generic_urls')
class URLHandling(TestCase):
"""
Tests for URL handling in views and responses.
"""
redirect_target = "/%E4%B8%AD%E6%96%87/tar... |
from __future__ import print_function, division
from pyglet.gl import *
from plot_mode_base import PlotModeBase
from sympy.core import S
from sympy.core.compatibility import xrange
class PlotCurve(PlotModeBase):
style_override = 'wireframe'
def _on_calculate_verts(self):
self.t_interval = self.inte... |
import gtk
# DBWidgets imports
from evogtk.widgets import DBSpinButton
class AccessClass:
"""
Class for gtk.SpinButton
"""
def supported_widgets(self):
"""
Supported widgets for this access class
"""
return [gtk.Adjustment,gtk.SpinButton,DBSpinButton]
def supported... |
"""
A PyQT4 dialog to select from automated issue matches
"""
"""
Copyright 2012-2014 Anthony Beville
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
... |
import json
from base64 import b64encode
import sickbeard
from sickbeard import logger
from sickbeard.clients.generic import GenericClient
from lib.requests.exceptions import RequestException
class DelugeAPI(GenericClient):
def __init__(self, host=None, username=None, password=None):
super(DelugeAPI, se... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y年n月j日' # 2016年9月5日
TIME_FORMAT = 'H:i' # 20:45
DATETIME_FORMAT = 'Y年n月j日 H:i' # 2016年9月5日 2... |
# -*- coding: utf-8 -*-
"""Displayhook for IPython.
This defines a callable class that IPython uses for `sys.displayhook`.
Authors:
* Fernando Perez
* Brian Granger
* Robert Kern
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Developmen... |
from snorky.services.base import format_call
from snorky.hashable import make_hashable
class TestRequest(object):
"""Mocked Request class for use with RPC services"""
def __init__(self, service, client, command, params):
self.service = service
self.client = client
self.command = comma... |
"""Event loop and event loop policy."""
__all__ = ['AbstractEventLoopPolicy',
'AbstractEventLoop', 'AbstractServer',
'Handle', 'TimerHandle',
'get_event_loop_policy', 'set_event_loop_policy',
'get_event_loop', 'set_event_loop', 'new_event_loop',
'get_child_watcher... |
from __future__ import print_function
import aerospike
import sys
import time
from aerospike import predicates as p
class TweetService(object):
def __init__(self, client):
self.client = client
def createTweet(self):
print("\n********** Create Tweet **********\n")
# /*****************... |
'''module for example task hook'''
from collections import Counter
from heron.common.src.python.utils.log import Log
from heron.common.src.python.utils.topology import ITaskHook
# pylint: disable=unused-argument
class TestTaskHook(ITaskHook):
"""TestTaskHook logs event information every 10000 times"""
CONST = 100... |
"""
Read data file users.avro in local Spark distro:
$ cd $SPARK_HOME
$ ./bin/spark-submit --driver-class-path /path/to/example/jar \
> ./examples/src/main/python/avro_inputformat.py \
> examples/src/main/resources/users.avro
{u'favorite_color': None, u'name': u'Alyssa', u'favorite_numbers': [3, 9, 15, 20]}
{u'favorit... |
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, Http404
from django.core.exceptions import ValidationError
from notes.models import Note
from notes.utils import notes_enabled_for_course
from courseware.courses... |
microcode = '''
def macroop JMP_I
{
# Make the default data size of jumps 64 bits in 64 bit mode
.adjust_env oszIn64Override
rdip t1
limm t2, imm
wrip t1, t2
};
def macroop JMP_R
{
# Make the default data size of jumps 64 bits in 64 bit mode
.adjust_env oszIn64Override
wripi reg, 0
};... |
"This is the locale selecting middleware that will look at accept headers"
from django.conf import settings
from django.core.urlresolvers import (
LocaleRegexURLResolver, get_resolver, get_script_prefix, is_valid_path,
)
from django.http import HttpResponseRedirect
from django.utils import translation
from django.... |
import operator
import os
import re
import sys
from threading import *
import traceback
import pyxp
from pyxp import fcall, fields
from pyxp.mux import Mux
from pyxp.types import *
if os.environ.get('NAMESPACE', None):
namespace = os.environ['NAMESPACE']
else:
try:
namespace = '/tmp/ns.%s.%s' % (
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import subprocess, os, socket
def validate_ip(addr):
try:
socket.inet_aton(addr)
return True # legal
except socket.error:
return False # Not legal
def get_stdout(pi):
result = pi.communicate()
if len(result[0])>0:
return resu... |
"""Tensor utility functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow... |
from collections import defaultdict
import operator
import time
import numpy
from unity_client.server import Server
from nupic.encoders.coordinate import CoordinateEncoder
from nupic.encoders.scalar import ScalarEncoder
from nupic.algorithms.monitor_mixin.trace import CountsTrace
from sensorimotor.extended_temporal_m... |
#!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
weblab_xilinx_experiment_xilinx_device = 'FPGA'
weblab_xilinx_experiment_port_number = 1
# This should be something like this:
# import os as _os
# xilinx_home = _os.getenv('XILINX_HOME')
# if xilinx_home == None:
# if _os.name == 'nt':
# xilinx_home = r'C:... |
#!/usr/bin/env python
import sys, getopt, argparse
from kazoo.client import KazooClient
import json
def loadZookeeperOptions(opts,zk):
node = "/all_clients/"+opts['client']+"/offline/semvec"
if zk.exists(node):
data, stat = zk.get(node)
jStr = data.decode("utf-8")
print "Found zookeeper... |
#!/usr/bin/env python
# Single purpose HTTP server
# - accepts POST of ureport JSON and dumps it to a file
import sys
import json
import BaseHTTPServer, cgi
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
# parse form data
form = cgi.FieldStorage(
fp=self.rfile... |
class ModuleDocFragment(object):
DOCUMENTATION = r'''
options:
display_skipped_hosts:
name: Show skipped hosts
description: "Toggle to control displaying skipped task/host results in a task"
type: bool
default: yes
env:
- name: DISPLAY_SKIPPED_HOSTS
... |
from logbook import Logger
from sqlalchemy.orm import reconstructor
from eos.utils.stats import DmgTypes
pyfalog = Logger(__name__)
class FighterAbility:
# We aren't able to get data on the charges that can be stored with fighters. So we hardcode that data here, keyed
# with the fighter squadron role
... |
from django.test import SimpleTestCase
from ..utils import setup
inheritance_templates = {
'inheritance01': "1{% block first %}&{% endblock %}3{% block second %}_{% endblock %}",
'inheritance02': "{% extends 'inheritance01' %}"
"{% block first %}2{% endblock %}{% block second %}4{% endblo... |
#! /usr/bin/env python
"""Whimpy test script for the cl module
Roger E. Masse
"""
import cl
from test.test_support import verbose
clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID',
'ALGORITHM_VERSION', 'AUDIO', 'AWARE_ERROR', 'AWARE_MPEG_AUDIO',
'AWARE_MULTIRATE', 'AWCMP_CONST_QUAL', 'AWCMP_FIXED_RATE',
'A... |
from openerp.osv import fields,osv
class ir_exports(osv.osv):
_name = "ir.exports"
_order = 'name'
_columns = {
'name': fields.char('Export Name', size=128),
'resource': fields.char('Resource', size=128, select=True),
'export_fields': fields.one2many('ir.exports.line', 'export_id',... |
import unittest
from unittest import TestCase
from myhdl import Simulation, Signal, delay, intbv, bin
from bin2gray import bin2gray
MAX_WIDTH = 10
def nextLn(Ln):
""" Return Gray code Ln+1, given Ln. """
Ln0 = ['0' + codeword for codeword in Ln]
Ln1 = ['1' + codeword for codeword in Ln]
Ln1.reverse(... |
import pytest
from anchore_engine.services.policy_engine.engine.policy.gates.vulnerabilities import (
VulnerabilitiesGate,
UnsupportedDistroTrigger,
FeedOutOfDateTrigger,
VulnerabilityMatchTrigger,
)
from anchore_engine.db import Image, get_thread_scoped_session
from tests.integration.services.policy_e... |
import os
from cloudify.exceptions import CommandExecutionException
from cloudify_agent import VIRTUALENV
from cloudify_agent.api import defaults
from cloudify_agent.api import exceptions
from cloudify_agent.api import utils
from cloudify_agent.api.pm.base import Daemon
class NonSuckingServiceManagerDaemon(Daemon):... |
"""
mediatum - a multimedia content repository
Copyright (C) 2007 Arne Seifert <<EMAIL>>
Copyright (C) 2007 Matthias Kramm <<EMAIL>>
Copyright (C) 2012 Iryna Feuerstein <<EMAIL>>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publishe... |
from azure import (
MANAGEMENT_HOST,
_str,
)
from azure.servicemanagement import (
WebSpaces,
WebSpace,
Sites,
Site,
MetricResponses,
MetricDefinitions,
PublishData,
_XmlSerializer,
)
from azure.servicemanagement.servicemanagementclient import (
_ServiceManagementClie... |
import time
from openerp.osv import fields
from openerp.osv import osv
from openerp.tools.translate import _
class hr_employee(osv.osv):
_name = "hr.employee"
_inherit = "hr.employee"
_columns = {
'product_id': fields.many2one('product.product', 'Product', help="Specifies employee's designation as... |
# -*- 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 ... |
__all__=('dumpttf',)
def dumpttf(fn,fontName=None, verbose=0):
'''dump out known glyphs from a ttf file'''
import os
if not os.path.isfile(fn):
raise IOError('No such file "%s"' % fn)
from reportlab.pdfbase.pdfmetrics import registerFont, stringWidth
from reportlab.pdfbase.ttfonts import TTF... |
from openerp.osv import osv
from challenge import MAX_VISIBILITY_RANKING
class res_users_gamification_group(osv.Model):
""" Update of res.users class
- if adding groups to an user, check gamification.challenge linked to
this group, and the user. This is done by overriding the write method.
"""
... |
# -*- coding: utf-8 -*-
"""
Tests for course access
"""
from django.conf import settings
from django.test.utils import override_settings
import mock
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.courses import (
get_course_by_id, get_cms_course_link, course_image_url,
get_course... |
# -*- coding: utf-8 -*-
# FILE: handlers.py
# MODIFIED: 20:28:26 18/04/2012
# DESCRIPTION: URL Route
from api import *
from home import *
from lang import *
from forum import *
from member import *
from problem import *
from contest import *
from backstage import *
'''
'' Handler 命名规范: [动宾结构 / 名词] + Handler
'''
han... |
{
'name' : 'Authentication via LDAP',
'version' : '1.0',
'depends' : ['base'],
'images' : ['images/ldap_configuration.jpeg'],
'author' : 'OpenERP SA',
#'description': < auto-loaded from README file
'website' : 'https://www.odoo.com',
'category' : 'Authentication',
'data' : [
... |
"""Routines to handle the string class registry used by declarative.
This system allows specification of classes and expressions used in
:func:`.relationship` using strings.
"""
from ...orm.properties import ColumnProperty, RelationshipProperty, \
SynonymProperty
from ...schema import _get... |
"""Tests for various MIME issues, including the safe_multipart Tool."""
from cherrypy.test import test
test.prefer_parent_path()
import cherrypy
def setup_server():
class Root:
def multipart(self, parts):
return repr(parts)
multipart.exposed = True
def ... |
__all__ = ['normal', 'uniform', 'poisson']
from ..defmatrix import *
# Special object used internally to specify the placeholder which will be replaced by output ID
# This helps to provide dml containing output ID in constructSamplingNode
OUTPUT_ID = '$$OutputID$$'
def constructSamplingNode(inputs, dml):
"""
... |
from pupylib.PupyModule import *
from rpyc.utils.classic import download
import os
import os.path
import textwrap
import logging
import datetime
from zlib import compress, crc32
import struct
import subprocess
__class_name__="Screenshoter"
def pil_save(filename, pixels, width, height):
from PIL import Image, ImageFi... |
from __future__ import print_function
import unittest
import numpy as np
from paddle.fluid.tests.unittests.op_test import OpTest
class TestQuantizeOp(OpTest):
def setUp(self):
self.op_type = 'quantize'
self.scale = 255.0
self.shift = 0.0
self.input_size = [1, 1, 5, 5] # Naive nCh... |
from gipsy.dashboard.dashboard import Dashboard
from gipsy.dashboard.widgets import widgets, widgets_google_analytics
class DashboardDefault(Dashboard):
"""
Defaut and exemple class for dashboards using google analytics specific widgets.
This class simply uses a render method where widgets are added. The ... |
import unittest
from sre_yield import cachingseq
class CachingFuncSequenceTest(unittest.TestCase):
def testLimits(self):
c = cachingseq.CachingFuncSequence(lambda i: i, 10)
self.assertEqual(9, c[9])
self.assertEqual(9, c[-1])
self.assertEqual(0, c[0])
self.assertEqual(0, c... |
#! /usr/bin/env python
# Minimal interface to the Internet telnet protocol.
#
# It refuses all telnet options and does not recognize any of the other
# telnet commands, but can still be used to connect in line-by-line mode.
# It's also useful to play with a number of other services,
# like time, finger, smtp and even ... |
'''
Geometry utilities
==================
This module contains some helper functions for geometric calculations.
'''
__all__ = ('circumcircle', 'minimum_bounding_circle')
from kivy.vector import Vector
def circumcircle(a, b, c):
'''
Computes the circumcircle of a triangle defined by a, b, c.
See: http:... |
"""
homeassistant.components.device_tracker.luci
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Device tracker platform that supports scanning a OpenWRT router for device
presence.
It's required that the luci RPC package is installed on the OpenWRT router:
# opkg install luci-mod-rpc
Configuration:
To use the Luci t... |
"""
Plot selected years of monthly ERSSTv5 global data
Website : https://www1.ncdc.noaa.gov/pub/data/cmb/ersst/v5/netcdf/
Author : Zachary M. Labe
Date : 22 July 2017
"""
from netCDF4 import Dataset
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, addcyclic, shiftgrid
import numpy a... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
"""
This tool is totally deprecated
Try using:
.pc.in files for .pc files
the feature intltool_in - see demos/intltool
make-like rules
"""
import shutil, re, os
from waflib import TaskGen, Node, Task, Utils, Build, Errors
from waflib.TaskGen i... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <<EMAIL>>
#
# The licence is in the file __manifest__.py
#
########... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception
import shlex
def main():
module = AnsibleModule(
argument_spec={
... |
import actionscheduler
def make_archipel_plugin(configuration, entity, group):
"""
This function is the plugin factory. It will be called by the object you want
to be plugged in. It must return a list whit at least on dictionary containing
a key for the the plugin informations, and a key for the plugi... |
import json
import urllib
from base64 import urlsafe_b64decode
from django.conf import settings
from django.utils.translation import get_language
import commonware.log
import tower
from lib import l10n_utils
log = commonware.log.getLogger('facebookapps.utils')
def unwrap_signed_request(request):
"""
Decod... |
from __future__ import division
import argparse
# Debugging flag - set to 1 to see debug messages.
DEBUG=1
# SPECIAL text - what do you want added after the atomic Z to show it as special?
SPECIAL=":exc"
# Element dictionary - note that element 0 is given the UKN moniker.
elements = { 1 : "H", 2 : "He", 3 : "Li", 4... |
import logging
import os
import ap_configurator
import selenium.common.exceptions
class DLinkAPConfigurator(ap_configurator.APConfigurator):
"""Derived class to control the DLink DAP-1522."""
def __init__(self, pyauto_instance, admin_interface_url):
super(DLinkAPConfigurator, self).__init__(pyauto_instance)... |
"""
===================================================
Recursive feature elimination with cross-validation
===================================================
A recursive feature elimination example with automatic tuning of the
number of features selected with cross-validation.
"""
print(__doc__)
import matplotlib.p... |
import Image
##
# The <b>ImageChops</b> module contains a number of arithmetical image
# operations, called <i>channel operations</i> ("chops"). These can be
# used for various purposes, including special effects, image
# compositions, algorithmic painting, and more.
# <p>
# At this time, channel operations are only i... |
#!/usr/bin/python
import decimal
import types
import unicodedata
import urllib
def DisplayFriendlySize(bytes):
"""DisplayFriendlySize -- turn a number of bytes into a nice string"""
t = type(bytes)
if t != types.LongType and t != types.IntType and t != decimal.Decimal:
return 'NotANumber(%s=%s)' %(t, byte... |
'''
Created on Mar 6, 2016
@author: Laurent Marchelli
'''
import os
import sys
import shutil
import unittest
from . import dir_res, dir_tmp
class TestCase(unittest.TestCase):
args_dict = {}
@classmethod
def setUpClass(cls, system, emulator):
# Define test system configuration path
cls.pa... |
import wizard
import product_margin
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import codecs
import re
class CrashLogs(object):
PID_LINE_REGEX = re.compile(r'\s+Global\s+PID:\s+\[(?P<pid>\d+)\]')
def __init__(self, host, results_directory=None):
self._host = host
self._results_directory = results_directory
def find_newest_log(self, process_name, pid=None, include_... |
#
# euc_kr.py: Python Unicode Codec for EUC_KR
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_kr, codecs
import _multibytecodec as mbc
codec = _codecs_kr.getcodec('euc_kr')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncrementalEncod... |
#!/usr/bin/env python
#Stinger-Tor
#Function names are written in the order metasploit launches attacks: RECON - EXPLOIT - PAYLOAD - LOOT for entertainment purposes.
#Requires Socksipy (socks.py) in the current directory. Download it from here: https://raw.githubusercontent.com/mikedougherty/SocksiPy/master/socks.py
#I... |
import pilas
from pilas.actores import Texto
from pilas import colores
class Temporizador(Texto):
"""Representa un contador de tiempo con cuenta regresiva.
Por ejemplo:
>>> t = pilas.actores.Temporizador()
>>> def hola_mundo():
... pilas.avisar("Hola mundo, pasaron 10 segundos..."... |
import logging
from collections import defaultdict
from androguard.decompiler.dad.basic_blocks import (build_node_from_block,
StatementBlock, CondBlock)
from androguard.decompiler.dad.instruction import Variable
logger = logging.getLogger('dad.graph')
class Graph()... |
"""
Template file used by the OPF Experiment Generator to generate the actual
description.py file by replacing $XXXXXXXX tokens with desired values.
This description.py file was generated by:
'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py'
"""
from nupic.... |
from __future__ import unicode_literals
import os
from unittest import skipUnless
from django.template import Context, Engine, TemplateSyntaxError
from django.template.base import Node
from django.template.library import InvalidTemplateLibrary
from django.test import SimpleTestCase
from django.test.utils import exten... |
import unittest
import sys
from ctypes import *
from ctypes.util import find_library
from ctypes.test import is_resource_enabled
if sys.platform == "win32":
lib_gl = find_library("OpenGL32")
lib_glu = find_library("Glu32")
lib_gle = None
elif sys.platform == "darwin":
lib_gl = lib_glu = find_library("O... |
from weboob.tools.test import BackendTest
class PrixCarburantsTest(BackendTest):
BACKEND = 'prixcarburants'
def test_prixcarburants(self):
products = list(self.backend.search_products('gpl'))
self.assertTrue(len(products) == 1)
prices = list(self.backend.iter_prices(products[0]))
... |
import os
import tempfile
from measurements import session_restore
from measurements import session_restore_with_url
import page_sets
from profile_creators import small_profile_creator
from telemetry import test
from telemetry.page import profile_generator
class _SessionRestoreTest(test.Test):
@classmethod
def ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
from ansible.module_utils.network.aruba.aruba import run_commands
from ansible.... |
from clang.cindex import CursorKind
from clang.cindex import TypeKind
from nose.tools import raises
from .util import get_cursor
from .util import get_tu
kInput = """\
typedef int I;
struct teststruct {
int a;
I b;
long c;
unsigned long d;
signed long e;
const int f;
int *g;
int ***h;
};
"""
def te... |
"""Gradients for operators defined in sparse_ops.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.ops import array_ops
from tensorf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.