content string |
|---|
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 28 15:18:19 2017
@author: yanofsky
from https://gist.github.com/yanofsky/5436496
"""
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = "hGqgNKnozGGUZB3IyW6Noheky"
consumer_secret =... |
import os
import subprocess
import sys
import unittest
import needy.process
class ProcessTest(unittest.TestCase):
def test_list_command_output(self):
self.assertEqual('hello', needy.process.command_output([sys.executable, '-c', 'print(\'hello\')']).strip())
def test_shell_command_output(self):
... |
from __future__ import unicode_literals
import frappe
import unittest, json
# test_records = frappe.get_test_records('Auto Email Report')
class TestAutoEmailReport(unittest.TestCase):
def test_auto_email(self):
frappe.delete_doc('Auto Email Report', 'Permitted Documents For User')
auto_email_report = frappe.ge... |
#!/usr/bin/python
import os
def get_devkitarm_bin():
try:
return os.path.join(os.environ['DEVKITARM'], 'bin')
except KeyError:
return ''
def detect(conf):
from Logs import warn
if 'DEVKITARM' not in os.environ:
warn("`DEVKITARM' variable is not set, compiler may not be found")
... |
"""Synthetic dataset generators."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.learn.python.learn.datasets.base import Dataset
def circles(n_samples=100, noise=None, seed=None, factor=0.8, n_classes=2, *args... |
from __future__ import division
import itertools
def valid_formula(truth_table, x_coeff, y_coeff, z_coeff, offset):
for x in [0,1]:
for y in [0,1]:
z = truth_table[2*x + y]
# we require that z can be set to the correct value, but can *not* be set to the incorrect one
if ... |
"""Cholesky decomposition functions."""
from __future__ import division, print_function, absolute_import
from numpy import asarray_chkfinite, asarray
# Local imports
from .misc import LinAlgError, _datacopied
from .lapack import get_lapack_funcs
__all__ = ['cholesky', 'cho_factor', 'cho_solve', 'cholesky_banded',
... |
#! /usr/bin/env python
from time import strftime, localtime
def convert_h():
f = open("_hermes_common_api_new.h", "w")
f.write("/* Generated by convert_api.py on %s */\n\n" % \
strftime("%a %b %d %H:%M:%S %Y", localtime()));
lines = open("_hermes_common_api.h").readlines()
line = lines[0];... |
import sys
sys.path.append("/usr/share/rhn")
from up2date_client import rhnreg
from up2date_client import rhnregGui
import gtk
from gtk import glade
import gettext
_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
gtk.glade.bindtextdomain("rhn-client-tools")
from firstboot.module import Module
from firstboot.c... |
from numpy import zeros, asarray, eye, poly1d, hstack, r_
from scipy import linalg
__all__ = ["pade"]
def pade(an, m, n=None):
"""
Return Pade approximation to a polynomial as the ratio of two polynomials.
Parameters
----------
an : (N,) array_like
Taylor series coefficients.
m : int
... |
import requests
import bs4
import json
class NoMaxQuantity(Exception):
pass
def load_single_page(url):
response = requests.get(url)
soup = bs4.BeautifulSoup(response.text, 'html.parser')
return soup
def _find_options_from_form(soup):
form = soup.find("form", class_="variations_form cart")
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
import pipes
import platform
import pwd
import re
import shlex
import sys
import te... |
from __future__ import unicode_literals
from indico.modules.events.timetable.controllers.display import (RHTimetable, RHTimetableEntryInfo,
RHTimetableExportPDF, RHTimetableExportDefaultPDF)
from indico.modules.events.timetable.controllers.legacy import ... |
# coding: utf-8
from flask import g, render_template, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_oauthlib.provider import OAuth1Provider
db = SQLAlchemy()
def enable_log(name='flask_oauthlib'):
import logging
logger = logging.getLogger(name)
logger.addHandler(logging.StreamHandl... |
"""Query and friends.
All requests are defined as a Query class which is a Runnable.
"""
import errno
from twisted.internet import defer, reactor
from twisted.internet import error as neterror
try:
from OpenSSL import SSL, crypto
from twisted.internet import ssl
except ImportError:
SSL = None
from nagc... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 14:12:12 2015
@author: rc, alex
"""
import os
import sys
if __name__ == '__main__' and __package__ is None:
filePath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(filePath)
import numpy as np
import yaml
from copy import deepcop... |
#!/usr/bin/env python
import XenAPI
import sanitychecklib
from pprint import pprint, pformat
#Generally, we wish to announce the name of this file.
#When running in the interpreter, however, this doesn't exist, and we
#probably shouldn't log out either
try:
this_test_name = __file__
logout_after_test = True
e... |
from future import All, Future
from object_store import ObjectStore
class CacheChainObjectStore(ObjectStore):
'''Maintains an in-memory cache along with a chain of other object stores to
try for the same keys. This is useful for implementing a multi-layered cache.
The in-memory cache is inbuilt since it's synch... |
# -*- coding: utf-8 -*-
"""
Tests for auth manager Basic Auth access to postgres.
This is an integration test for QGIS Desktop Auth Manager postgres provider that
checks if QGIS can use a stored auth manager auth configuration to access
a username/password protected postgres.
Configuration from the environment:
... |
"""
The Keys implementation.
"""
from __future__ import unicode_literals
class Keys(object):
"""
Set of special keys codes.
"""
NULL = '\ue000'
CANCEL = '\ue001' # ^break
HELP = '\ue002'
BACKSPACE = '\ue003'
BACK_SPACE = BACKSPACE
TAB = '\ue004'
CLEAR = '\ue005'
RETURN =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import current_app
from flask_principal import Permission, RoleNeed, UserNeed, identity_loaded
from flask_login import current_user
# admin_need = RoleNeed('admin')
# editor_need = RoleNeed('editor')
# writer_need = RoleNeed('writer')
# reader_need = ... |
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'core',
'version': '1.0'}
import cgi
import datetime
import os
import shutil
import tempfile
try:
import json
except ImportError:
import simplejson as json
from ansible.module_utils.basic import Ansible... |
import os
import unittest
import autoconfig
import parser_test_case
from pygccxml import utils
from pygccxml import parser
from pygccxml import declarations
class tester_t( parser_test_case.parser_test_case_t ):
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *ar... |
"""For internal use only; no backwards-compatibility guarantees."""
from google.protobuf import any_pb2
from google.protobuf import struct_pb2
def pack_Any(msg):
"""Creates a protobuf Any with msg as its content.
Returns None if msg is None.
"""
if msg is None:
return None
result = any_pb2.Any()
re... |
from thorpy._utils.images import load_image
from thorpy._utils.interpolation import get_y
from pygame import surfarray
import math, pygame
from PyWorld2D.rendering.tilers.roundtiler import RoundTiler
class BeachTiler(RoundTiler):
def get_round(self, radius, background):
w,h = self.c.get_size()
s... |
# -*- coding: utf-8 -*-
from outwiker.core.attachment import Attachment
from outwiker.core.defines import PAGE_ATTACH_DIR
from .basethumbgenerator import BaseThumbGenerator
class ThumbTableGenerator (BaseThumbGenerator):
"""
Создание списка превьюшек в виде таблицы
"""
def __init__(self, items, thum... |
import sys
import inspect
from functools import update_wrapper
from ._compat import iteritems
from ._unicodefun import _check_for_unicode_literals
from .utils import echo
from .globals import get_current_context
def pass_context(f):
"""Marks a callback as wanting to receive the current context
object as fir... |
"""Wrappers for candidate sampling operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import random_seed
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gen_candidate_sampling_ops
fr... |
{
'name': 'Automated Action Rules',
'version': '1.0',
'category': 'Sales Management',
'description': """
This module allows to implement action rules for any object.
============================================================
Use automated actions to automatically trigger actions for various screens.
... |
import unittest
import sys
from sequencer.commons import get_header, GenericDB
import re
import logging
_logger = logging.getLogger()
_formatter = logging.Formatter('%(relativeCreated)s %(levelname)s %(funcName)s() - %(message)s')
_handler = logging.StreamHandler(sys.stdout)
_handler.setFormatter(_formatter)
_logger... |
from browser.local_storage import storage # legacy import
from browser.session_storage import storage as sess_storage # legacy import
from browser.object_storage import ObjectStorage
assert(storage.storage_type == "local_storage")
assert(sess_storage.storage_type == "session_storage")
storage.clear()
sess_storage.c... |
import unittest
from webkitpy.common.memoized import memoized
class _TestObject(object):
def __init__(self):
self.callCount = 0
@memoized
def memoized_add(self, argument):
"""testing docstring"""
self.callCount += 1
if argument is None:
return None # Avoid th... |
import unittest as ut
import numpy as np
import espressomd
import unittest_decorators as utx
N_PART = 10
VELOCITY = np.array([1.0, 2.0, 3.0])
MASS = 2.1
@utx.skipIfMissingFeatures("MASS")
class LinearMomentumTest(ut.TestCase):
system = None
@classmethod
def setUpClass(cls):
cls.system = espress... |
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
from .test_extends import inheritance_templates
class ExceptionsTests(SimpleTestCase):
@setup({'exception01': "{% extends 'nonexistent' %}"})
def test_exception01(self):
... |
"""
blink1_pyusb.py -- blink(1) Python library using PyUSB
Uses "PyUSB 1.0" to do direct USB HID commands
See: https://github.com/walac/pyusb
Linux (Ubuntu/Debian):
% sudo apt-get install pip
% sudo pip install pyusb
Note: will give "not claimed" error or similar. Try blink1.py instead
Mac OS X:
do "brew inst... |
"""Verify interface implementations
"""
from zope.interface.exceptions import BrokenImplementation, DoesNotImplement
from zope.interface.exceptions import BrokenMethodImplementation
from types import FunctionType, MethodType
from zope.interface.interface import fromMethod, fromFunction, Method
import sys
# This will b... |
# encoding: utf-8
"""
Utility functions for loading files for unit testing
"""
import os
import sys
from lxml import etree
from pptx.oxml import oxml_parser
_thisdir = os.path.split(__file__)[0]
test_file_dir = os.path.abspath(os.path.join(_thisdir, '..', 'test_files'))
def abspath(relpath):
thisdir = os.pa... |
import json
import os
from ctypes import addressof, byref, c_double, c_void_p
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.driver import Driver
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.prototypes import raster as capi
from django.contrib.gis... |
"""Tests for tools.docs.doc_generator_visitor."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.platform import googletest
from tensorflow.tools.docs import doc_generator_visitor
class DocGeneratorVisitorTest(googletest.TestCase):... |
{
'name': 'Weighting Scale Hardware Driver',
'version': '1.0',
'category': 'Hardware Drivers',
'sequence': 6,
'summary': 'Hardware Driver for Weighting Scales',
'website': 'https://www.odoo.com/page/point-of-sale',
'description': """
Barcode Scanner Hardware Driver
==========================... |
from openerp import models, api, fields
from openerp.tools.translate import _
class StockInvoiceOnshipping(models.TransientModel):
_inherit = "stock.invoice.onshipping"
@api.model
def _get_journal_type(self):
res_id = self.env.context.get('active_id', False)
picking = self.env['stock.pick... |
"""Starter script for Nova API.
Starts both the EC2 and OpenStack APIs in separate greenthreads.
"""
import sys
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
import nova.conf
from nova import config
from nova import exception
from nova.i18n import _LE, _LW
from nova imp... |
""" interactive debugging with PDB, the Python Debugger. """
from __future__ import absolute_import
import pdb
import sys
import pytest
def pytest_addoption(parser):
group = parser.getgroup("general")
group._addoption('--pdb',
action="store_true", dest="usepdb", default=False,
h... |
# -*- coding: utf-8 -*-
"""URL router for v1 API endpoints."""
from ..routers import GroupedRouter
from .viewsets import (
BrowserViewSet, FeatureViewSet, MaturityViewSet, ReferenceViewSet,
SectionViewSet, SpecificationViewSet, SupportViewSet, VersionViewSet,
HistoricalBrowserViewSet, HistoricalFeatureView... |
#!/usr/bin/env python
from xml.sax.saxutils import escape, quoteattr
from emit import Emit
from param import known_param_fields, known_units
from lxml import etree
# Emit ArduPilot documentation in an machine readable XML format for Mission Planner
class XmlEmitMP(Emit):
def __init__(self, *args, **kwargs):
... |
from core.vectors import PhpCode, ShellCmd, ModuleExec, Os
from core.module import Module
from core import modules
class Cp(Module):
"""Copy single file."""
aliases = [ 'cp', 'copy' ]
def init(self):
self.register_info(
{
'author': [
'Emilio Pinna... |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
''' Code to manage ebook library'''
def db(path=None, read_only=False):
from calibre.db.legacy import LibraryDatabase
from calibre.utils.config import prefs
from calibre.utils.filenames import expanduser
return Libra... |
#=========================================================================
# pisa_slt_test.py
#=========================================================================
import pytest
import random
import pisa_encoding
from pymtl import Bits
from PisaSim import PisaSim
from pisa_inst_test_utils import *
#---------... |
import imaplib
import unittest
import logging
import os
import re
import sys
import shutil
import subprocess
import tempfile
import random
random.seed()
from offlineimap.CustomConfig import CustomConfigParser
from . import default_conf
class OLITestLib():
cred_file = None
testdir = None
"""Absolute path ... |
"""
Unshuffle previously shuffled file
unshuffle.py input_file.csv output_file.csv <max. lines in memory> <random seed>
"""
import sys
import random
input_file = sys.argv[1]
output_file = sys.argv[2]
try:
lines_in_memory = int( sys.argv[3] )
except IndexError:
lines_in_memory = 100000
print "caching %s lines at... |
__author__ = 'parallels'
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.CRITICAL)
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='direct_logs',
... |
"""QBD (Questionnaire Bank Details) Module"""
from ..date_tools import FHIR_datetime
class QBD(object):
"""Details needed to define a QB"""
def __init__(
self, relative_start, iteration, recur=None, recur_id=None,
questionnaire_bank=None, qb_id=None):
"""Hold details needed to... |
"""
This is an special module, it provides stuff used by setup.py at build time.
But also used by pygit2 at run time.
"""
# Import from the Standard Library
import os
from os import getenv
#
# The version number of pygit2
#
__version__ = '0.24.0'
#
# Utility functions to get the paths required for bulding extension... |
import unittest
import json
from pylib.utils import json_results_generator
class JSONGeneratorTest(unittest.TestCase):
def setUp(self):
self.builder_name = 'DUMMY_BUILDER_NAME'
self.build_name = 'DUMMY_BUILD_NAME'
self.build_number = 'DUMMY_BUILDER_NUMBER'
# For archived results.
self._json =... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2016 Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to u... |
# -*- coding: utf-8 -*-
import codecs
import re
from os import path
from distutils.core import setup
from setuptools import find_packages
def read(*parts):
return codecs.open(path.join(path.dirname(__file__), *parts),
encoding='utf-8').read()
def find_version(*file_paths):
version_fil... |
"""Compatibility module defining operations on duck numpy-arrays.
Shamelessly copied from xarray."""
import numpy as np
try:
import dask.array as dsa
has_dask = True
except ImportError:
has_dask = False
def _dask_or_eager_func(name, eager_module=np, list_of_args=False, n_array_args=1):
"""Create a... |
"""utilities for analyzing expressions and blocks of Python
code, as well as generating Python from AST nodes"""
from mako import exceptions, pyparser, compat
import re
class PythonCode(object):
"""represents information about a string containing Python code"""
def __init__(self, code, **exception_kwargs):... |
"""
WSGI config for Aike project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... |
"""
Russian-language mappings for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
directives = {
u'блок-строк': u'line-block',
u'meta': u'meta',
u'математика': 'math',
u'обработанный-литерал': u'parsed-literal',
u'выделенная-цитата': u'pull-quote',
u'код': 'code',
u'comp... |
"""
This module provides a set of REST API dedicated to OpenStack Ryu plug-in.
- Interface (uuid in ovsdb) registration
- Maintain interface association to a network
Used by OpenStack Ryu plug-in.
"""
import json
from webob import Response
from ryu.base import app_manager
from ryu.app.wsgi import (ControllerBase,
... |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from mock import Mock
from ..vocab import Vocab
from ..tokens import Doc, Span, Token
from ..tokens.underscore import Underscore
def test_create_doc_underscore():
doc = Mock()
doc.doc = doc
uscore = Underscore(Underscore.doc_extension... |
import itertools
import tempfile
from cStringIO import StringIO
import base64
import csv
import codecs
from openerp.osv import orm, fields
from openerp.tools.translate import _
class AccountUnicodeWriter(object):
"""
A CSV writer which will write rows to CSV file "f",
which is encoded in the given enco... |
# -*- coding: utf-8 -*-
import re
from .._globals import IDENTITY
from ..helpers.methods import varquote_aux
from .base import BaseAdapter
class MySQLAdapter(BaseAdapter):
drivers = ('MySQLdb','pymysql', 'mysqlconnector')
commit_on_alter_table = True
support_distributed_transaction = True
types = {
... |
"""This module handles file-backed storage of the core classes.
The storage is logically organized as follows:
Storage -> N Archives -> 1 Symbol index
N Snapshots -> 1 Mmaps dump.
-> 0/1 Native heap dump.
Where an "archive" is essentially a collect... |
#!/usr/bin/env python
#python 2.7.5 requires biopython
#crossClustCount.py
#Version 1. Adam Taranto, April 2015
#Contact, Adam Taranto, <EMAIL>
#Take two transcriptomes and a Corset cluster map.
#Determine number of member transcripts in each cluster that belong to each of the input transcriptomes.
import os
import c... |
add_remove_list_flavor_access = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'flavor_access': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy import (abs, arctan2, asarray, cos, exp, floor, log, log10,
arange, pi, prod, roll, seterr, sign, sin, sqrt, sum, where,
zeros, tan, tanh, dot)
try:
from sci... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..utils import str_to_int
class NineGagIE(InfoExtractor):
IE_NAME = '9gag'
_VALID_URL = r'''(?x)^https?://(?:www\.)?9gag\.tv/
(?:
v/(?P<numid>[0-9]+)|
p/(?P<id>[a-zA-Z0-9]+)/(... |
# -*- coding: utf-8 -*-
"""
License: BSD
(c) 2009 ::: www.CodeResort.com - BV Network AS (<EMAIL>)
"""
import os
import unittest
import urllib2
from tracrpc.tests import rpc_testenv, TracRpcTestCase
from tracrpc.api import IRPCProtocol
from trac.core import *
from trac.test import Mock
class ProtocolProvider... |
class MyGen:
def __init__(self):
self.v = 0
def __iter__(self):
return self
def __next__(self):
self.v += 1
if self.v > 5:
raise StopIteration
return self.v
def gen():
yield from MyGen()
def gen2():
yield from gen()
print(list(gen()))
print(l... |
"""Utility functions for writing decorators (which modify docstrings)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
def get_qualified_name(function):
# Python 3
if hasattr(function, '__qualname__'):
return function.__qualname__
... |
"""Debug the tf-learn iris example, based on the tf-learn tutorial."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import sys
import tempfile
import numpy as np
from six.moves import urllib
import tensorflow as tf
from tensorf... |
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.forms import Form
from django.forms.fields import IntegerField, BooleanField
from django.forms.utils import ErrorList
from django.forms.widgets import HiddenInput
from django.utils.encoding import python_2_unicode_co... |
from collections import OrderedDict
import testtools
from testtools.tests.matchers import helpers
from nova.tests.unit import matchers
class TestDictMatches(testtools.TestCase, helpers.TestMatchersInterface):
matches_dict = OrderedDict(sorted({'foo': 'bar', 'baz': 'DONTCARE',
'cat': {'tabby': True, 'fl... |
import samba.getopt as options
import common
from samba.net import Net
from samba.netcmd import (
Command,
)
class cmd_time(Command):
"""Retrieve the time on a server.
This command returns the date and time of the Active Directory server specified on the command. The server name specified may be the loc... |
"""
9. Many-to-many relationships via an intermediary table
For many-to-many relationships that need extra fields on the intermediary
table, use an intermediary model.
In this example, an ``Article`` can have multiple ``Reporter`` objects, and
each ``Article``-``Reporter`` combination (a ``Writer``) has a ``position`... |
import unittest
import logging
from nose.tools import eq_
from ryu.ofproto.inet import *
LOG = logging.getLogger('test_inet')
class TestInet(unittest.TestCase):
""" Test case for inet
"""
def test_ip_proto(self):
eq_(IPPROTO_IP, 0)
eq_(IPPROTO_HOPOPTS, 0)
eq_(IPPROTO_ICMP, 1)
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
import time
from ansible.module_utils.basic import AnsibleModule
from ansible.m... |
"""Test processing of feefilter messages."""
from decimal import Decimal
import time
from test_framework.messages import msg_feefilter
from test_framework.mininode import mininode_lock, P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import sync_blocks, sync_mempoo... |
def array(p_object, dtype=None, copy=True, order=None, subok=False, ndmin=0): # real signature unknown; restored from __doc__
"""
array(object, dtype=None, copy=True, order=None, subok=False, ndmin=0)
Create an array.
Parameters
----------
object : array_like
An arr... |
"""Loading unittests."""
import os
import re
import sys
import traceback
import types
import unittest
from fnmatch import fnmatch
from django.utils.unittest import case, suite
try:
from os.path import relpath
except ImportError:
from django.utils.unittest.compatibility import relpath
__unittest = True
de... |
"""Contains form class defintions for form for the questions app.
Classes: [
SurveyQuestionForm
]
"""
from django import forms
from django.core.urlresolvers import reverse
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout
fro... |
"""Unit test utilities for Google C++ Testing Framework."""
__author__ = '<EMAIL> (Zhanyong Wan)'
import atexit
import os
import shutil
import sys
import tempfile
import unittest
_test_module = unittest
# Suppresses the 'Import not at the top of the file' lint complaint.
# pylint: disable-msg=C6204
try:
import sub... |
from __future__ import absolute_import, unicode_literals
import os
from datetime import timedelta, datetime
from celery.task import task, group
from celery.utils.log import get_task_logger
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.management import call_co... |
"""Support for Vera scenes."""
import logging
from homeassistant.components.scene import Scene
from homeassistant.util import slugify
from . import VERA_CONTROLLER, VERA_ID_FORMAT, VERA_SCENES
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up t... |
#Coded by Matthew Harrison, July, 2015.
#Read ESRI shapefiles and calculate district areas
#Using Albers Equal Area Projection for North America
#Including Alaska and Hawaii
from mpl_toolkits.basemap import Basemap
from pyproj import Proj
from shapely.geometry import LineString, Point, shape
import fiona
from fiona im... |
source("../../shared/qtcreator.py")
def main():
projectDir = os.path.join(srcPath, "creator", "tests", "manual", "cplusplus-tools")
proFileName = "cplusplus-tools.pro"
if not neededFilePresent(os.path.join(projectDir, proFileName)):
return
# copy example project to temp directory
tempDir = ... |
#!/usr/bin/python
## Revision history ############################################################
__author__ = 'Wouter Eerdekens <<EMAIL>>'
__date__ = '2011-08-12'
__version__ = 0.1
__history__ = """
2011-08-12 - Prepare for initial release <<EMAIL>>
2006-07-26 - initial version.
"""
#############################... |
from django import template
from django.conf import settings
from django.db import models
from django.contrib.sites.models import Site
from django.template import Context, loader
register = template.Library()
Analytics = models.get_model('googleanalytics', 'analytics')
def do_get_analytics(parser, token):
conte... |
#! /usr/bin/env python
# encoding: utf-8
"""
Copyright 2016 Nathan John Sowatskey
These are sample functions for the Cisco Fog Director REST API.
See:
http://www.cisco.com/c/en/us/td/docs/routers/access/800/software/guides/iox/fog-director/reference-guide/1-0/fog_director_ref_guide.html
Licensed under the Apache L... |
"""Common code for unit tests of the interoperability test code."""
from tests.interop import methods
class IntraopTestCase(object):
"""Unit test methods.
This class must be mixed in with unittest.TestCase and a class that defines
setUp and tearDown methods that manage a stub attribute.
"""
def testE... |
#!/usr/bin/python
# Client for the backdoor which
# uses HTTP CODE header for inserting code
# Got the idea after seeing this sort of payload
# dropped by a phpmyadmin exploit on rdot :)
# Is also good to learn how to use urllib
# and not be lazy arse with requests all of time!
# Insecurety Research (2013) - insecurety... |
import os.path
import numpy
from filter import Filter
from ..utils.svm import SVM
class SVMFilter(Filter):
"""An abstract class representing a filter that uses SVM"""
def __init__(self, threshold, invert_threshold, svm_file):
super(SVMFilter, self).__init__(threshold, invert_threshold)
if... |
"""The hosts admin extension."""
import webob.exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
ALIAS... |
import pkg_resources
from pyramid.view import view_config
from ringo.lib.helpers import (
get_ringo_version,
get_app_version,
get_app_name,
get_app_title
)
from ringo.lib.renderer import (
DTListRenderer
)
@view_config(route_name='home', renderer='/index.mako')
def index_view(request):
value... |
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import flt, today
from erpnext.accounts.utils import get_fiscal_year
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
class TestPeriodClosingVoucher(unittest.TestCase):
def test_closing_entr... |
"""Allow Google Apps domain administrators to set users' email settings.
EmailSettingsService: Set various email settings.
"""
__author__ = '<EMAIL>'
import gdata.apps
import gdata.apps.service
import gdata.service
API_VER='2.0'
# Forwarding and POP3 options
KEEP='KEEP'
ARCHIVE='ARCHIVE'
DELETE='DELETE'
ALL_MAI... |
"""This showcases how simple it is to build image classification networks.
It follows description from this TensorFlow tutorial:
https://www.tensorflow.org/versions/master/tutorials/mnist/pros/index.html#deep-mnist-for-experts
"""
from __future__ import absolute_import
from __future__ import division
from __futur... |
#! /usr/bin/env python
"""The Tab Nanny despises ambiguous indentation. She knows no mercy.
tabnanny -- Detection of ambiguous indentation
For the time being this module is intended to be called as a script.
However it is possible to import it into an IDE and use the function
check() described below.
Warning: The ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.