content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
#----------------------------------------------------------
# ir_http modular http routing
#----------------------------------------------------------
import datetime
import hashlib
import logging
import re
import sys
import werkzeug
import werkzeug.exceptions
import werkzeug.routing
import wer... |
import zipfile
from io import BytesIO
from django.conf import settings
from django.http import HttpResponse
from django.template import loader
def compress_kml(kml):
"Returns compressed KMZ from the given KML string."
kmz = BytesIO()
zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
zf.writestr('do... |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from QWidget import QWidget
class QLineEdit(QWidget):
"""
QLineEdit(QWidget parent=None)
QLineEdit(QString, QWidget parent=None)
... |
from __future__ import division
import numpy as np
from ..constants import molwt
from ..RCPs.rcp45 import Emissions as r45e
def Stevens(emissions, stevens_params=np.array([0.001875, 0.634, 60.]),
ref_isSO2=True, E_pi=0):
"""Calculates aerosol forcing based on Stevens (2015) that relates sulphate
aerosol ... |
import local_git_util
import posixpath
from environment import IsTest
from file_system import FileNotFoundError, FileSystem, StatInfo
from future import Future
from local_file_system import LocalFileSystem
from path_util import IsDirectory
class LocalGitFileSystem(FileSystem):
'''Class to fetch filesystem data fro... |
# SSReader Pdg2 ActiveX control (pdg2.dll)
# CVE-2007-5892
import logging
log = logging.getLogger("Thug")
def Register(self, arg0, arg1):
if len(arg1) > 255:
log.ThugLogging.log_exploit_event(self._window.url,
"SSReader Pdg2 ActiveX",
... |
import re, urllib, urlparse
from resources.lib.modules import cleantitle
from resources.lib.modules import client
class source:
def __init__(self):
self.priority = 1
self.language = ['fr']
self.domains = ['dpstreaming.me']
self.base_link = 'http://dpstreaming.me'
self.key_l... |
import os
import socket
import ssl
from thrift.transport import TSocket
from thrift.transport.TTransport import TTransportException
class TSSLSocket(TSocket.TSocket):
"""
SSL implementation of client-side TSocket
This class creates outbound sockets wrapped using the
python standard ssl module for encrypted c... |
'''
Created on 28.10.2013
@author: marscher
'''
from numpy.testing import assert_allclose as assert_allclose_np
__all__ = ['assert_allclose',
]
def assert_allclose(actual, desired, rtol=1.e-5, atol=1.e-8,
err_msg='', verbose=True):
r"""wrapper for numpy.testing.allclose with defau... |
def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words):
"""Prints the first word after popping it off."""
word = words.pop(0)
print word... |
import click
from tower_cli import models, resources
from tower_cli.utils import types
class Resource(models.Resource):
cli_help = 'Manage teams within Ansible Tower.'
endpoint = '/teams/'
identity = ('organization', 'name')
name = models.Field(unique=True)
organization = models.Field(type=types... |
import warnings
import _zeros
from numpy import finfo
_iter = 100
_xtol = 1e-12
# not actually used at the moment
_rtol = finfo(float).eps * 2
__all__ = ['newton', 'bisect', 'ridder', 'brentq', 'brenth']
CONVERGED = 'converged'
SIGNERR = 'sign error'
CONVERR = 'convergence error'
flag_map = {0 : CONVERGED, -1 : SIG... |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import random
import copy
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
from h2o.grid.grid_search import H2OGridSearch
def grid_cars_GLM():
cars = h2o.import_file(path=pyunit_u... |
from __future__ import unicode_literals
import json
import sys
from django.conf import settings
from django.core.exceptions import ValidationError # backwards compatibility
from django.utils import six, timezone
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import e... |
# -*- coding: utf-8 -*-
'''
Management of Mongodb users
===========================
.. note::
This module requires PyMongo to be installed.
'''
# Define the module's virtual name
__virtualname__ = 'mongodb_user'
def __virtual__():
if 'mongodb.user_exists' in __salt__:
return __virtualname__
retu... |
from . import constants
import sys
from .charsetprober import CharSetProber
class CharSetGroupProber(CharSetProber):
def __init__(self):
CharSetProber.__init__(self)
self._mActiveNum = 0
self._mProbers = []
self._mBestGuessProber = None
def reset(self):
CharSetP... |
from __future__ import unicode_literals
from sys import version_info
import flask_login
from flask_login import login_required, current_user, logout_user
from flask import flash
from wtforms import (
Form, PasswordField, StringField)
from wtforms.validators import InputRequired
from flask import url_for, redirec... |
import sqlalchemy as sa
from twisted.internet import defer
from buildbot.db import base
from buildbot.util import identifiers
class WorkersConnectorComponent(base.DBConnectorComponent):
# Documentation is in developer/database.rst
def findWorkerId(self, name):
tbl = self.db.model.workers
# ... |
"""
Django settings for inventory project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pa... |
from __future__ import absolute_import
import logging
import os
import sys
import tempfile
from pip.compat import uses_pycache, WINDOWS, cache_from_source
from pip.exceptions import UninstallationError
from pip.utils import (rmtree, ask, is_local, dist_is_local, renames,
normalize_path)
from pi... |
from ansible.utils import safe_eval
import ansible.utils as utils
import ansible.errors as errors
def flatten(terms):
ret = []
for term in terms:
if isinstance(term, list):
ret.extend(term)
else:
ret.append(term)
return ret
class LookupModule(object):
def __ini... |
from .utils.dataIO import fileIO
from .utils import checks
from __main__ import send_cmd_help
from __main__ import settings as bot_settings
# Sys.
from operator import itemgetter, attrgetter
import discord
from discord.ext import commands
#from copy import deepcopy
import aiohttp
import asyncio
import json
import os
im... |
default_app_config = 'providers.org.arxiv.apps.AppConfig'
"""
Example Record
<entry>
<id>http://arxiv.org/abs/cond-mat/0102536v1</id>
<updated>2001-02-28T20:12:09Z</updated>
<published>2001-02-28T20:12:09Z</published>
<title>Impact of Electron-Electron Cusp on Configuration Interaction Energies</title... |
import unittest
from autothreadharness.harness_case import HarnessCase
class Commissioner_8_3_1(HarnessCase):
role = HarnessCase.ROLE_COMMISSIONER
case = '8 3 1'
golden_devices_required = 2
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main() |
"""
Summary
-------
This plugin allows easy, variable length summaries directly embedded into the
body of your articles.
"""
from __future__ import unicode_literals
from pelican import signals
from pelican.generators import ArticlesGenerator, StaticGenerator, PagesGenerator
def initialized(pelican):
from pelican... |
#!/usr/bin/env python
"""\
Sanitize a bitbake file following the OpenEmbedded style guidelines,
see http://openembedded.org/wiki/StyleGuide
(C) 2006 Cyril Romain <<EMAIL>>
MIT license
TODO:
- add the others OpenEmbedded variables commonly used:
- parse command arguments and print usage on misuse
. prevent gi... |
#!/usr/bin/env python
"""
Run a jsbsim model as a child process.
"""
from __future__ import print_function
import atexit
import errno
import fdpexpect
import math
import os
import select
import signal
import socket
import struct
import sys
import time
import pexpect
from pymavlink import fgFDM
from .. pysim import u... |
# -*- coding: utf-8 -*-
'''
calc.py: DNS-based calculator
Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
This software is open source.
Redistribution and use in source and binary forms, with or without
modification, are permitte... |
"""Ordered bijector."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import check_ops
from tensorflow.python.ops import control_f... |
from openerp.addons.web.http import Controller, route, request
from openerp.addons.web.controllers.main import _serialize_exception, content_disposition
from openerp.osv import osv
from openerp.tools import html_escape
import simplejson
from werkzeug import exceptions, url_decode
from werkzeug.test import Client
from ... |
from __future__ import unicode_literals
import keyword
import re
from collections import OrderedDict
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections
class Command(BaseCommand):
help = "Introspects the database tables in the given database and... |
#!/usr/bin/env python
from tools.load import LoadMatrix
import shogun as sg
lm=LoadMatrix()
traindna = lm.load_dna('../data/fm_train_dna.dat')
testdna = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindna,testdna,3,0,False],[traindna,testdna,3,0,False]]
def distance_canberraword (fm_train_dna=traindn... |
import unittest
from tensorflow.compat.v1 import gfile
from fedlearner.common import dfs_client
class TestDFSClient(unittest.TestCase):
def setUp(self):
self.test_base_dir = "./test_dfs_base"
if gfile.Exists(self.test_base_dir):
gfile.DeleteRecursively(self.test_base_dir)
def tes... |
import setuptools, sys, glob
from distutils.command.install import install as _install
from distutils.errors import DistutilsArgError
class install(_install):
"""Use easy_install to install the package, w/dependencies"""
user_options = _install.user_options + [
('old-and-unmanageable', None, "Try not ... |
from files import *
from mods import MOD
import re
class DiseaseLoader:
def get_data(self, disease_data):
disease_annots = {}
list_to_yield = []
dateProduced = disease_data['metaData']['dateProduced']
dataProvider = disease_data['metaData']['dataProvider']
release = None... |
microcode = '''
def macroop PCMPEQB_XMM_XMM {
mcmpi2r xmml, xmml, xmmlm, size=1, ext=0
mcmpi2r xmmh, xmmh, xmmhm, size=1, ext=0
};
def macroop PCMPEQB_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
mcmpi2r xmml, xmml, ufp1, size=1, ext=0
... |
import logging
import datetime
import tempfile
import os
import re
import paasmaker
from paasmaker.common.controller import BaseController, BaseControllerTest
from paasmaker.common.core import constants
from ..service.base import BaseService
from user import UserEditController
from upload import UploadController
from ... |
#!/usr/bin/env python
import threading
import time
import dns
from dnsdisttests import DNSDistTest
class TestRoutingPoolRouting(DNSDistTest):
_config_template = """
newServer{address="127.0.0.1:%s", pool="real"}
addPoolRule("pool.routing.tests.powerdns.com", "real")
addAction(makeRule("poolaction.rout... |
"""
Reboot a Crazyflie remotely using a Crazyradio
"""
import sys
from cflib.utils.power_switch import PowerSwitch
if len(sys.argv) != 2:
print("Error: uri is missing")
print('Usage: {} uri'.format(sys.argv[0]))
sys.exit(-1)
PowerSwitch(sys.argv[1]).stm_power_cycle() |
from PIL import Image
import affdex
def affdex_license():
return """
{
"token":"2d70e932a6974f8d6930e0abc8c267bb5561580efdedd4f6d79ba82a3b93e293",
"licensor":"Affectiva Inc.",
"expires":"2016-06-07",
"developerId":"<EMAIL>",
... |
"""
Procedures for writing to a Filterbank File
"""
import time
import numpy as np
from .sigproc import generate_sigproc_header
def write_to_fil(wf, filename_out, *args, **kwargs):
""" Write data to .fil file.
It check the file size then decides how to write the file.
Args:
filename_out (str)... |
"""Support for Nuimo device over Bluetooth LE."""
import logging
import threading
import time
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (CONF_MAC, CONF_NAME, EVENT_HOMEASSISTANT_STOP)
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'nuimo_controller... |
#
# Test script for the curses module
#
# This script doesn't actually display anything very coherent. but it
# does call every method and function.
#
# Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(),
# init_color()
# Only called, not tested: getmouse(), ungetmouse()
#
import sys, tempfile, os
... |
import time
import logging
import threading
from rx.core import Scheduler, Disposable
from .schedulerbase import SchedulerBase
from .eventloopscheduler import EventLoopScheduler
log = logging.getLogger('Rx')
class NewThreadScheduler(SchedulerBase):
"""Creates an object that schedules each unit of work on a sepa... |
#! -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import errno
import hashlib
import json
import os
import shutil
import tempfile as sys_tempfile
import unittest
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http.m... |
"""Aexpect setup script"""
from setuptools import setup
if __name__ == '__main__':
setup(name='aexpect',
version='1.6.1',
description='Aexpect',
author='Aexpect developers',
author_email='<EMAIL>',
url='http://avocado-framework.github.io/',
packages=['a... |
from datetime import datetime
from django import forms
from django.conf import settings
from django.contrib.auth import forms as auth_forms, models as auth_models
from django.forms.extras import widgets
from django.utils import safestring
from django.utils.translation import ugettext_lazy as _
from youtune.account im... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Logging Test
url(r'^fail500/$', 'homepage.views.fail500', name='fail500'),
# Login
url(r'^signup/?$', 'users.views.signup', name='signup'),
url(r'^login/?$', 'users.views.user_login',... |
from distutils import versionpredicate
from oslo_log import log as logging
from nova.compute import arch
from nova.compute import hv_type
from nova.compute import vm_mode
from nova.scheduler import filters
from nova import utils
LOG = logging.getLogger(__name__)
class ImagePropertiesFilter(filters.BaseHostFilter)... |
"""Support the sensor of a BloomSky weather station."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (TEMP_FAHRENHEIT, CONF_MONITORED_CONDITIONS)
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_v... |
"""
A generic comment-moderation system which allows configuration of
moderation options on a per-model basis.
To use, do two things:
1. Create or import a subclass of ``CommentModerator`` defining the
options you want.
2. Import ``moderator`` from this module and register one or more
models, passing the model... |
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Autofs(Plugin):
"""Autofs on-demand automounter
"""
plugin_name = "autofs"
profiles = ('storage', 'nfs')
files = ('/etc/sysconfig/autofs', '/etc/default/autofs')
packages = ('autofs',)
def checkdebug(self):
... |
"""Extensions to the 'distutils' for large or complex distributions"""
from setuptools.extension import Extension, Library
from setuptools.dist import Distribution, Feature, _get_unpatched
import distutils.core, setuptools.command
from setuptools.depends import Require
from distutils.core import Command as _Command
fro... |
try:
from osgeo import gdal
except ImportError:
import gdal
import sys
def Usage():
print('Usage: gdalchksum.py [-b band] [-srcwin xoff yoff xsize ysize] file')
sys.exit(1)
# =============================================================================
# Mainline
# ==================================... |
"""
@author: Andrew Case
@license: GNU General Public License 2.0
@contact: <EMAIL>
@organization:
"""
import volatility.obj as obj
import volatility.plugins.mac.common as common
import volatility.plugins.mac.lsmod as lsmod
class mac_notifiers(lsmod.mac_lsmod):
""" Detects rootkits that add hooks... |
import logging
import os
import shutil
from tempfile import mkstemp
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
from pylons.decorators import jsonify
from pylons import config
from repoze.what.predicates import has_permission
from repoze.what... |
"""
This file contains implementation of the DlrnHash object.
To reach transparency for the operation of the other elements in the
promotion on both single pipeline and integration pipeline scenarios,
the complexity of the separation and difference between the two pipelines has
been moved to dlrn sections only.
The cla... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: intersight_rest_api
short_description: REST API configuratio... |
"""A command to clean the StudentModuleHistory table.
When we added XBlock storage, each field modification wrote a new history row
to the db. Now that we have bulk saves to avoid that database hammering, we
need to clean out the unnecessary rows from the database.
This command that does that.
"""
import datetime
... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
import errors, traceback, message
import re, datetime, time
import StringIO
import pytz
from smshandler import SmsHandler
class TextSmsHandler(SmsHandler):
SCTS_FMT = "%y/%m/%d,%H:%M:%S"
CMGL_MATCHER=re.compile(r'^\+CMGL: (\d+),"(.+?)","(.+?)",... |
import webob.exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import db
from nova.openstack.common.gettextutils import _
authorize = extensions.extension_authorizer('compute', 'cloudpipe_update')
class CloudpipeUpdateController(wsgi.Controller):
"""Handle updating the ... |
"""
Copyright 2014 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 ... |
from openerp import http
from openerp.addons.website_crm.controllers.main import contactus
class ContactUs(contactus):
@http.route(['/crm/contactus'])
def contactus(self, **kwargs):
if 'zipcode' in kwargs:
kwargs['zip'] = kwargs['zipcode']
return super(ContactUs, self).contactus(**... |
"""Different Leading and Trailing Spaces Test
**What is checked**
Checks that the same space characters (<space>, <tab>, <enter>, <vertical tab>)
are before and after all non space characters in the title of the control when
compared to the reference control.
**How is it checked**
Find the 1st non-space chara... |
"""
### Usage: ctmigrate [load|dump] [--domain=DOMAIN] [--port=PORT] [--filename=FILENAME] [--skip=SKIP] [-n]
### Options:
-h, --help show this help message and exit
-d DOMAIN, --domain=DOMAIN
domain of target server (default: localhost)
-p PORT, --port=PORT port of... |
"""Base classes for indexed operations (sums and products)"""
from abc import ABCMeta
from .abstract_algebra import Expression, Operation
from .exceptions import InfiniteSumError
from ..pattern_matching import wc
from ...utils.indices import (
IdxSym, IndexRangeBase, SymbolicLabelBase, yield_from_ranges, )
__all... |
from __future__ import unicode_literals
from django.test import SimpleTestCase
from localflavor.de.forms import DEIdentityCardNumberField, DEStateSelect, DEZipCodeField
class DELocalFlavorTests(SimpleTestCase):
def test_DEStateSelect(self):
f = DEStateSelect()
out = '''<select name="states">
<op... |
# coding: utf-8
from __future__ import unicode_literals
import base64
import json
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
compat_str,
)
from ..utils import (
extract_attributes,
ExtractorError,
get_elements_by_class,
urlencode_postdata,
)
class EinthusanIE(I... |
import datetime
import time
import json
from motherbrain.api_server.go import GoHandler
from datetime import timedelta
from motherbrain.api_server.handlers import UrlistHandler, _json
from motherbrain.api_server.handlers.api import UrlistContextMixin
from tornado import gen
from tornado.web import authenticated, as... |
"""SpreadsheetsService extends the GDataService to streamline Google
Spreadsheets operations.
SpreadsheetService: Provides methods to query feeds and manipulate items.
Extends GDataService.
DictionaryToParamList: Function which converts a dictionary into a list of
UR... |
"""
Kodi urlresolver plugin
Copyright (C) 2016 script.module.urlresolver
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) ... |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import sys
import setuptools
try:
# work-around to avoid "setup.py test" error
# see: http://bugs.python.org/issue15881#msg170215
import multiprocessing
assert multiprocessing
except ImportError:
pass
py_version = sys.version_info
with ope... |
# This challenge could, in theory, be solved in multiple ways. However, for the
# sake of learning how to simulate an alternate filesystem, please solve this
# challenge according to structure provided below. As a challenge, once you have
# an initial solution, try solving this in an alternate way.
#
# Problem descript... |
"""NIOS plugin for integration tests."""
from __future__ import absolute_import, print_function
import os
from . import (
CloudProvider,
CloudEnvironment,
)
from ..util import (
find_executable,
display,
)
from ..docker_util import (
docker_run,
docker_rm,
docker_inspect,
docker_pul... |
import sys, os, tempfile, shutil, subprocess
from optparse import OptionParser
# The resolution used by PhantomJS is supposed to be 72dpi
# However, we have to compute the viewport dimensions
# as if the resolution was 72 dots per cm.
# Moreover, a zoom factor of 0.5 will be needed when rendering
# (see sozi2pdf.js, f... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
sanitized_Request,
urlencode_postdata,
)
class PrimeShareTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?primeshare\.tv/download/(?P<id>[\da-zA-Z]+)'
_TEST = {
'url': 'h... |
"""
Utils for working with ReferenceGenome maker.
"""
import os
import tempfile
from Bio import SeqIO
from django.conf import settings
from reference_genome_maker import reference_genome_maker
# from debug.debug_util import FakeException
from main.exceptions import ValidationException
from main.model_utils import cl... |
from __future__ import division
import numpy as np
from struct import pack, unpack
from neon import logger as neon_logger
def ceil_div(x, y):
return -(-x // y)
def out_dim(S, X, padding, strides):
return ceil_div(X - S + 1 + 2 * padding, strides)
def strip_mantissa(val):
i = unpack('I', pack('f', val))[0... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from copy import deepcopy
from ansible.module_utils.basic import AnsibleModule
fro... |
data = (
'Ji ', # 0x00
'Cha ', # 0x01
'Zhou ', # 0x02
'Xun ', # 0x03
'Yue ', # 0x04
'Hong ', # 0x05
'Yu ', # 0x06
'He ', # 0x07
'Wan ', # 0x08
'Ren ', # 0x09
'Wen ', # 0x0a
'Wen ', # 0x0b
'Qiu ', # 0x0c
'Na ', # 0x0d
'Zi ', # 0x0e
'Tou ', # 0x0f
'Niu ', # 0x10
'Fou ', ... |
from __future__ import absolute_import
import datetime
import logging
import os
import socket
from socket import error as SocketError, timeout as SocketTimeout
import warnings
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http_client imp... |
import stock
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import json
import six
from tornado.template import Loader, Template
from social.utils import build_absolute_uri
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class TornadoTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
path, tpl = tpl.rsplit('/',... |
# -*- coding: utf-8 -*-
"""
This example demonstrates the use of ImageView, which is a high-level widget for
displaying and analyzing 2D and 3D data. ImageView provides:
1. A zoomable region (ViewBox) for displaying the image
2. A combination histogram and gradient editor (HistogramLUTItem) for
controlling t... |
"""This module represents the Sundanese language.
.. seealso:: http://en.wikipedia.org/wiki/Sundanese_language
"""
from translate.lang import common
class su(common.Common):
"""This class represents Sundanese."""
mozilla_nplurals = 2
mozilla_pluralequation = "n!=1 ? 1 : 0" |
import elphie
slides = elphie.Slides("example.pdf")
slide = slides.new_title_slide("Elphie")
slide.text("Stanislav Böhm\n~tt{http://github.com/spirali/elphie}")
slide = slides.new_slide()
slide.h2("Elphie is a presentation framework\n"
"based on ~emph{Python} and ~emph{Inkscape}")
slide = slides.new_slid... |
#! /usr/bin/env python
"""Test script for the gzip module.
"""
import unittest
from test import support
import os
import gzip
data1 = b""" int length=DEFAULTALLOC, err = Z_OK;
PyObject *RetVal;
int flushmode = Z_FINISH;
unsigned long start_total_out;
"""
data2 = b"""/* zlibmodule.c -- gzip-compatible data c... |
from __future__ import absolute_import
from sentry.utils.compat import mock
from django.core.urlresolvers import reverse
from sentry.models import UserEmail
from sentry.testutils import APITestCase
class UserEmailsConfirmTest(APITestCase):
def setUp(self):
self.user = self.create_user(email="<EMAIL>")
... |
from __future__ import with_statement
import gobject
import gtk
import pango
import re
import datetime
from zim.plugins import PluginClass, WindowExtension, extends
from zim.notebook import Path
from zim.formats import HEADING
from zim.gui.widgets import LEFT_PANE, PANE_POSITIONS, BrowserTreeView, populate_popup_add... |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para videozed
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core... |
# -*- coding: utf-8 -*-
import datetime as dt
from flask.ext.login import UserMixin
from wexplorer.extensions import bcrypt
from wexplorer.database import (
Column,
db,
Model,
ReferenceCol,
relationship,
SurrogatePK,
)
class Role(SurrogatePK, Model):
__tablename__ = 'roles'
name = Co... |
"""The tests for Climate device actions."""
import pytest
import voluptuous_serialize
import homeassistant.components.automation as automation
from homeassistant.components.climate import DOMAIN, const, device_action
from homeassistant.helpers import config_validation as cv, device_registry
from homeassistant.setup im... |
class AccountAttribute(object):
def __init__(self, connection=None):
self.connection = connection
self.attribute_name = None
self.attribute_values = None
def startElement(self, name, attrs, connection):
if name == 'attributeValueSet':
self.attribute_values = Attribut... |
import os, sys, subprocess
keepOriginals = 0
formatIn = "bmp"
formatOut = "jpg"
border = 0
def print_exit(s): print s; sys.exit()
dir = sys.argv[len(sys.argv) - 1]
try:
if (len(sys.argv)) == 1: raise Exception('input', 'error')
for i in range(1, len(sys.argv) - 1):
if sys.argv[i].startswith("-k"): keepOrig... |
#!/usr/bin/env python
'''
calculate GPS lag from DF log
'''
import sys, time, os
from argparse import ArgumentParser
parser = ArgumentParser(description=__doc__)
parser.add_argument("--plot", action='store_true', default=False, help="plot errors")
parser.add_argument("--minspeed", type=float, default=6, help="minimu... |
"""Migrate volume"""
from baseCmd import *
from baseResponse import *
class migrateVolumeCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""destination storage pool ID to migrate the volume to"""
"""Required"""
self.storageid = None
self.typeInfo... |
import os
import platform
import re
import subprocess
import pyauto
class MissingRequiredBinaryException(Exception):
pass
class WebrtcTestBase(pyauto.PyUITest):
"""This base class provides helpers for WebRTC calls."""
DEFAULT_TEST_PAGE = 'webrtc_jsep01_test.html'
def ExtraChromeFlags(self):
"""Adds f... |
class ModuleDocFragment(object):
# Standard documentation fragment
DOCUMENTATION = '''
options:
api_token:
description:
- Scaleway OAuth token.
aliases: ['oauth_token']
api_url:
description:
- Scaleway API URL
default: 'https://api.scaleway.com'
aliases: ['base_url']
api_t... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
from svtplay_dl.output import output, ETA, progressbar
from svtplay_dl.fetcher import VideoRetriever
class HTTP(VideoRetriever):
def name(self):
return "http"
def download(... |
from oslo_config import cfg
from oslo_log import log as logging
from neutron.common import constants as const
from neutron import context as n_context
from neutron.db import api as db_api
from neutron.i18n import _LW
from neutron.plugins.ml2.common import exceptions as ml2_exc
from neutron.plugins.ml2 import driver_ap... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.