content stringlengths 4 20k |
|---|
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.jvm.targets.jvm_target import JvmTarget
from pants.base.exceptions import TargetDefinitionException
class JavaThriftLibrary(JvmTarget):
"""Gener... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Tag(models.Model):
name = models.CharField(max_length=10)
parent = models.ForeignKey(
'self',
models.SET_NULL,
blank=Tr... |
# -*- coding: utf-8 -*-
import openerp
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.website.models.website import unslug
from openerp.tools.translate import _
from openerp.addons.web.http import request
import werkzeug.urls
class WebsiteCustomer(http.Controller):
_refer... |
from essentia_test import *
class TestSpectralComplexity(TestCase):
def testSinusoid(self):
# make sure each frame's spectral complexity is zero since we only
# have one frequency
filename = join(testdata.audio_dir, 'generated/synthesised/sin5000.wav')
audio = MonoLoader(filename=f... |
from xml.dom.minidom import parseString
from django.core import mail
from django.template import Context, Template
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.contrib.auth.decorators import login_required, permission_required
from django.forms.forms import Form
from dja... |
"""Provides flags that are common to scripts.
Common flags from train/eval/vis/export_model.py are collected in this script.
"""
import collections
import copy
import json
import tensorflow as tf
flags = tf.app.flags
# Flags for input preprocessing.
flags.DEFINE_integer('min_resize_value', None,
... |
import os
import threading
import logging
import re
logger = logging.getLogger(__name__)
blobstore_service = None
server = None
from wsgiref.simple_server import WSGIRequestHandler
class NoLogRequestHandler(WSGIRequestHandler):
def log_request(self, code='-', size='-'):
"""Normally logs an accepted re... |
import sys
import logging
import os
import datetime
from libs.config_libs import *
from libs.verify_libs import *
from libs.utils_libs import *
def main():
print 'For now skipping this entire suite ..'
sys.exit(1)
#Run the Testcases:
test = test_gbp_prs_pr_shared_func()
if test.test_gbp_prs_pr_sha... |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.views.generic import RedirectView
from . import views
urlpatterns = [
url(r'^get_view/$', views.get_view, name='get_view'),
url(r'^post_view/$', views.post_view),
url(r'^trace_view/$', views.trace_view),
u... |
"""Calculator for General Energy-based Fragmentation"""
from sys import stdout
from ase.units import Ha
from ase.calculators.nwchem import NWChem
from numpy import zeros, append, array, transpose, savetxt, abs
#maybe later we can make let it inherit from the Calculator base class
class GEBF(object):
"""Initialize... |
import time
import datetime
from dateutil.relativedelta import relativedelta
from openerp import tools
from openerp.osv import fields,osv
def _code_get(self, cr, uid, context=None):
acc_type_obj = self.pool.get('account.account.type')
ids = acc_type_obj.search(cr, uid, [])
res = acc_type_obj.read(cr, uid,... |
from django.test import TestCase
from django.core.urlresolvers import reverse, resolve
class UserUrlsTest(TestCase):
def test_user_new_collection_viewname_to_url(self):
url = reverse('collection-new', kwargs={"user":"testuser"})
self.assertEqual(url, '/users/testuser/collections/new/')
def te... |
from helper import unittest, PillowTestCase
from PIL import Image
from io import BytesIO
codecs = dir(Image.core)
test_card = Image.open('Tests/images/test-card.png')
test_card.load()
# OpenJPEG 2.0.0 outputs this debugging message sometimes; we should
# ignore it---it doesn't represent a test failure.
# 'Not enoug... |
from flask import Flask,request,get_flashed_messages
from flask.ext.wtf import Form
from wtforms import TextField, PasswordField
from wtforms.validators import Required
app = Flask("My app with forms")
app.debug = True
def messages_to_html():
html = ""
messages = get_flashed_messages()
if messages:
html += '<ul>... |
import xmpp
import urllib, urllib2
import xmlrpclib
from sso.services import BaseService
from django.conf import settings
class JabberService(BaseService):
settings = { 'require_user': True,
'require_password': True,
'provide_login': False,
'use_auth_username': ... |
import logging
from lxml import etree
log = logging.getLogger(__name__)
GRADER_TYPE_IMAGE_DICT = {
'SA': '/static/images/self_assessment_icon.png',
'PE': '/static/images/peer_grading_icon.png',
'ML': '/static/images/ml_grading_icon.png',
'IN': '/static/images/peer_grading_icon.png',
'BC': '/static... |
"""
Connects to a Wink hub and loads relevant components to control its devices.
"""
import logging
# pylint: disable=no-name-in-module, import-error
import homeassistant.external.wink.pywink as pywink
from homeassistant import bootstrap
from homeassistant.loader import get_component
from homeassistant.helpers import... |
import boto.swf.layer2
from boto.swf.layer2 import Domain, ActivityType, WorkflowType, WorkflowExecution
from tests.unit import unittest
from mock import Mock
class TestDomain(unittest.TestCase):
def setUp(self):
boto.swf.layer2.Layer1 = Mock()
self.domain = Domain(name='test-domain', description... |
import unittest
from unittest import mock
from airflow.providers.microsoft.azure.sensors.azure_cosmos import AzureCosmosDocumentSensor
DB_NAME = 'test-db-name'
COLLECTION_NAME = 'test-db-collection-name'
DOCUMENT_ID = 'test-document-id'
class TestAzureCosmosSensor(unittest.TestCase):
@mock.patch('airflow.provid... |
import os
import time
import urllib2
import tempfile
import threading
import JS
from Box import Box
from ProgressBar import ProgressBar
from Server import publish, request
JS_UPDATING = """
function update_progress_%(id)s() {
/* Retrieve status
*/
info = {};
$.ajax ({type: 'GET', url: "%(url)s/info", async: ... |
# -** coding: utf-8 -*-
import os, sys, re, time
import logging
import json
from collections import OrderedDict
class StatisticsReader(object):
def __init__(self, db):
self.db = db
self.author = None
self.language = None
self.title = None
self.lines = None
... |
"""quodsite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... |
import argparse
import pprint
import mxnet as mx
from ..logger import logger
from ..config import config, default, generate_config
from ..symbol import *
from ..dataset import *
from ..core.loader import TestLoader
from ..core.tester import Predictor, pred_eval
from ..utils.load_model import load_param
def test_rcnn... |
#!/usr/bin/env python
"""
Script to generate test coverage reports.
Usage:
$ bin/coverage_report.py
This will create a directory covhtml with the coverage reports. To
restrict the analysis to a directory, you just need to pass its name as
argument. For example:
$ bin/coverage_report.py sympy/logic
runs only the t... |
from __future__ import unicode_literals
import random
import string
from .exceptions import MessageAttributesInvalid
def generate_receipt_handle():
# http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ImportantIdentifiers.html#ImportantIdentifiers-receipt-handles
length = 185
retur... |
import sys
from TileCache.Layer import MetaLayer
class Mapnik(MetaLayer):
config_properties = [
{'name':'name', 'description': 'Name of Layer'},
{'name':'mapfile', 'description': 'Location of Mapnik XML map description.'},
{'name':'projection', 'description': 'Target map projection.'},
... |
"""
gutter.models
~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
# Standard Library
import threading
from collections import defaultdict
from functools import partial
from itertools import ifilter
# External Li... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_allclose, assert_equal, run_module_suite
from scipy.stats._tukeylambda_stats import tukeylambda_variance, \
tukeylambda_kurtosis
def test_tukeylambda_stats... |
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: IntervalTree, removal of intervals
Submitted as issue #41 (Interval removal breaks this tree) by escalonn
Copyright 2013-2018 Chaim Leib Halbert
Licensed unde... |
"""Polynomial manipulation algorithms and algebraic objects. """
__all__ = []
from . import polytools
__all__.extend(polytools.__all__)
from .polytools import *
from . import polyfuncs
__all__.extend(polyfuncs.__all__)
from .polyfuncs import *
from . import rationaltools
__all__.extend(rationaltools.__all__)
from .... |
"""This example gets all third party ads for a given ad group.
To add a third party ad, add_third_party_redirect_ad.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authe... |
{
'name': 'Associations Management',
'version': '0.1',
'category': 'Specific Industry Applications',
'complexity': "normal",
'description': """
This module is to configure modules related to an association.
==============================================================
It installs the profile for a... |
"""
Default settings for the control package. ::
audiosystem_autostart : bool
start the audiosystem when Expyriment is initialized
audiosystem_bit_depth : int
the audio bit depth; negative values mean signed sample values
audiosystem_buffer_size: int
the audio buffer size in sampl... |
import os
import blivet
from blivet.size import Size
from blivet.util import set_up_logging, create_sparse_tempfile
from blivet.devices.lvm import LVMCacheRequest
set_up_logging()
b = blivet.Blivet() # create an instance of Blivet (don't add system devices)
# create a disk image file on which to create new devices... |
import os
import sys
import textwrap
import unittest
import subprocess
from test import test_support
from test.script_helper import assert_python_ok
class TestTool(unittest.TestCase):
data = """
[["blorpie"],[ "whoops" ] , [
],\t"d-shtaeou",\r"d-nthiouh",
"i-vhbjkh... |
# -*- coding: utf-8 -*-
"""
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import os
import re
import time
import hashlib
from base64 import b64encode
from .compat import urlparse, str
from .cookies import extract_cookies_to_jar
from .utils import parse_dict_header, ... |
import argparse
import bugz.cli
from bugz.definitions import __version__
def make_arg_parser():
parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)
parser.add_argument('--config-file',
help='read an alternate configuration file')
parser.add_argument('--connection... |
from azure.cli.core.profiles import supported_api_version, PROFILE_TYPE
from azure.cli.core.sdk.util import (
create_service_adapter,
ServiceGroup)
from ._util import (
get_sql_server_azure_ad_administrators_operations,
get_sql_capabilities_operations,
get_sql_databases_operations,
get_sql_datab... |
# -*- coding: utf-8 -*-
import numpy as np
from numpy.random import random
from solarsys import dlng, dlat, dalt, bottom, top, north_pole, south_pole, theta
context = {}
g = 9.80665
Omega = 2 * np.pi / (24 * 3600 * 0.99726966323716)
gamma = 6.49 / 1000
gammad = 9.80 / 1000
cv = 718.0
cp = 1005.0
R = 287
miu = 1.... |
"""Command line implementation."""
import errno
import logging
import os
import pathlib
import sys
from typing import TYPE_CHECKING, List, Set, Type
from rich.markdown import Markdown
from ansiblelint import cli, formatters
from ansiblelint.color import console, console_stderr
from ansiblelint.generate_docs import r... |
'''Functions for parallel computation on multiple cores.
Introduced in Python-RSA 3.1.
.. note::
Requires Python 2.6 or newer.
'''
from __future__ import print_function
import multiprocessing as mp
import rsa.prime
import rsa.randnum
def _find_prime(nbits, pipe):
while True:
integer = rsa.randnu... |
# -*- coding: utf-8 -*-
"""
tests.exceptions
~~~~~~~~~~~~~~~~
The tests for the exception classes.
TODO:
- This is undertested. HTML is never checked
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
from werkzeug import exceptions... |
"""
Unit tests for parallelbuild.py
@author: Kenneth Hoste (Ghent University)
"""
import os
import re
import stat
import sys
from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered, init_config
from unittest import TextTestRunner
from vsc.utils.fancylogger import setLogLevelDebug, logToScreen
from e... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
compat_str,
)
from ..utils import (
ExtractorError,
find_xpath_attr,
fix_xml_ampersands,
HEADRequest,
unescapeHTML,
url_basename,
... |
"""
==================================
Sensitivity map of SSP projections
==================================
This example shows the sources that have a forward field
similar to the first SSP vector correcting for ECG.
"""
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
from mne import read_forward_soluti... |
#!/usr/bin/python
import unittest
import optparse
from common import check_env
from regressionjava import TestOpenmamajava
import globals
if __name__ == '__main__':
usage = "usage: python regression.py --m <middleware> --tport <pub_transport> <sub_transport>"
parser = optparse.OptionParser()
parser.add_o... |
from django.test import TestCase
from .models.default_related_name import Author, Book, Editor
class DefaultRelatedNameTests(TestCase):
def setUp(self):
self.author = Author.objects.create(first_name="Dave", last_name="Loper")
self.editor = Editor.objects.create(name="Test Editions",
... |
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, getdate, nowdate, fmt_money
from frappe import msgprint, _
from frappe.model.document import Document
form_grid_templates = {
"journal_entries": "templates/form_grid/bank_reconciliation_grid.html"
}
class BankReconciliation(Document)... |
import sys
import io
import linecache
import time
import socket
import traceback
import thread
import threading
import Queue
from idlelib import CallTips
from idlelib import AutoComplete
from idlelib import RemoteDebugger
from idlelib import RemoteObjectBrowser
from idlelib import StackViewer
from idlelib import rpc
... |
"""Test the prioritisetransaction mining RPC."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.mininode import COIN, MAX_BLOCK_BASE_SIZE
class PrioritiseTransactionTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean... |
from __future__ import division, print_function, absolute_import
from scipy import *
from iterative import *
def test_fun(alpha, x, beta, y, A, n):
# compute z = alpha*A*x + beta*y
xx = x[:n]
yy = y[:n]
w = dot(A,xx)
z = alpha*w+beta*yy
y[:n] = z
return
def test_fun_t(alpha, x, beta, y,... |
"""
Microsoft Cabinet (CAB) archive.
Author: Victor Stinner
Creation date: 31 january 2007
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (FieldSet, Enum,
CString, String,
UInt16, UInt32, Bit, Bits, PaddingBits, NullBits,
DateTimeMSDOS32, RawBytes)
from lib.hachoir_parser.com... |
{
'name': 'Picking Before Manufacturing',
'version': '1.0',
'category' : 'Warehouse Management',
'description': """
This module allows an intermediate picking process to provide raw materials to production orders.
==========================================================================================... |
from oslo_serialization import jsonutils
import webob
from nova.compute import flavors
from nova import test
from nova.tests.unit.api.openstack import fakes
FAKE_FLAVORS = {
'flavor 1': {
"flavorid": '1',
"name": 'flavor 1',
"memory_mb": '256',
"root_gb": '10',
"swap": 512,... |
import pytest
from app.database import Serial, AuthTokens, Task
from app.utils import get_module_columns
from app.api.constants import LIMIT_PER_CHUNK
BASE = '/api/v1/tickets'
@pytest.mark.usefixtures('c')
def test_unauthorized_request(c):
response = c.get(BASE,
follow_redirects=True,
... |
"""CAS authentication middleware"""
from urllib import urlencode
import datetime
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import login, logout
from django.core.urlresolvers im... |
#!/usr/bin/env python
# coding: utf8
'''
@author: qitan
@contact: <EMAIL>
@file: views.py
@time: 2017/3/30 15:34
@desc:
'''
from django.shortcuts import render, get_object_or_404, redirect
from django.http import Http404, HttpResponse
from django.contrib.auth.decorators import login_required
from asset_info import Mu... |
import re, sys, os
# Finds out the version (so we don't have to manually edit that file every
# time we change the version)
cassandra_build_file = '../../build.xml'
with open(cassandra_build_file) as f:
m = re.search("name=\"base\.version\" value=\"([^\"]+)\"", f.read())
if not m or m.lastindex != 1:
r... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compa... |
import numpy
from sensorimotor.abstract_world import AbstractWorld
class OneDWorld(AbstractWorld):
def __init__(self,
universe,
sensorSequence):
"""
Represents a simple 1D world.
@param universe (AbstractUniverse) Universe that the world belongs to.
@param se... |
# -*- test-case-name: twisted.test.test_stdio -*-
"""Standard input/out/err support.
Future Plans::
support for stderr, perhaps
Rewrite to use the reactor instead of an ad-hoc mechanism for connecting
protocols to transport.
Maintainer: James Y Knight
"""
import warnings, errno, os
from zope.interf... |
from optparse import make_option
from django.conf import settings
from django.core.management.commands.runserver import BaseRunserverCommand
from django.contrib.staticfiles.handlers import StaticFilesHandler
class Command(BaseRunserverCommand):
option_list = BaseRunserverCommand.option_list + (
make_opti... |
#
# LAPACK wrappers
#
from info import __doc__
__all__ = ['get_lapack_funcs','calc_lwork','flapack','clapack']
import calc_lwork
# The following ensures that possibly missing flavor (C or Fortran) is
# replaced with the available one. If none is available, exception
# is raised at the first attempt to use the resou... |
"""Determine which implementation of the protobuf API is used in this process.
"""
import os
import warnings
import sys
try:
# pylint: disable=g-import-not-at-top
from google.protobuf.internal import _api_implementation
# The compile-time constants in the _api_implementation module can be used to
# switch to ... |
{
'name' : 'Portal',
'version': '1.0',
'depends': [
'base',
'share',
'auth_signup',
],
'author': 'OpenERP SA',
'category': 'Portal',
'description': """
Customize access to your OpenERP database to external users by creating portals.
===================================... |
# -*- coding: utf-8 -*-
from collections import namedtuple
from datetime import date
from datetime import datetime
from datetime import timedelta
import pytest
from cfme import test_requirements
from cfme.cloud.provider import CloudProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.infrastructure.prov... |
"""Contains TestBackend class"""
import backend
class TestBackend(backend.BackendBase):
"""Interface to a help backend."""
pages = {
'page1': {
'title': 'Hot',
'subtitle': 'This page is awesome!',
'contents': 'This is a long description of heat and thermodynamics.\n... |
try:
from urllib.parse import urlparse
except ImportError: # Python 2
from urlparse import urlparse
from functools import wraps
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.utils.decorators import availab... |
"""Loads and checks driver threads."""
import ast
import signal
import sys
import thread
from threading import Lock, Timer, Thread
from oslo.config import cfg
import zmq
from kwapi.openstack.common import log
LOG = log.getLogger(__name__)
driver_manager_opts = [
cfg.IntOpt('check_drivers_interval',
... |
import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .provider import WeiboProvider
class WeiboOAuth2Adapter(OAuth2Adapter... |
from django.template.defaultfilters import unordered_list
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class UnorderedListTests(SimpleTestCase):
@setup({'unordered_list01': '{{ a|unordered_list }}'})
def test_unordered_list01(self):
o... |
"""
Decision Tree Regression Example.
"""
from __future__ import print_function
from pyspark import SparkContext
# $example on$
from pyspark.mllib.tree import DecisionTree, DecisionTreeModel
from pyspark.mllib.util import MLUtils
# $example off$
if __name__ == "__main__":
sc = SparkContext(appName="PythonDecisio... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazu... |
""" Client to directly access server endpoints.
Not part of the UJT -- only used to test the server without
having to run or setup the UJT to call the server.
"""
import datetime as dt
import graph_structures_pb2
import grpc
import server_pb2
import server_pb2_grpc
if __name__ == "__main__":
with grpc.insecure... |
import http.client
import rose.macro
class URLChecker(rose.macro.MacroBase):
"""Class to check if a URL is valid."""
BAD_RESPONSE = "No response for this url: {0}"
def validate(self, config, meta_config):
"""Validate a string containing a URL."""
self.reports = []
seq = [1, 1]
... |
import uuid
from keystoneclient import exceptions
from keystoneclient.tests.unit.v3 import utils
from keystoneclient.v3.contrib.fiware_roles import allowed
from keystoneclient.v3.contrib.fiware_roles import roles
from keystoneclient.v3.contrib.fiware_roles import role_assignments
from keystoneclient.v3.contrib.fiware_... |
import os
from lib.common import helpers
import pdb
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-EventLogBackdoor',
'Author': ['@sixdub'],
'Description': ('Starts the event-loop backdoor.'),
'Background' : False,
... |
# pylint: disable=protected-access, missing-docstring
import unittest
from vprof import runner
from unittest import mock
class RunnerUnittest(unittest.TestCase):
@mock.patch('vprof.runner.run_profilers')
@mock.patch('gzip.compress')
@mock.patch('urllib.request.urlopen')
def testRun_CheckResult(self,... |
import endpoints
from . import config as config_lib
from . import oauth
import webapp2
from google.appengine.api import users
__all__ = [
'WSGIApplication',
]
def middleware(app):
def respond(environ, start_response):
# Handle internal URLs for sign in and sign out.
airlock_path = app.config['airlock_p... |
from gns3server.controller.drawing import Drawing
async def test_create_drawing(controller_api, project):
params = {
"svg": '<svg height="210" width="500"><line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2" /></svg>',
"x": 10,
"y": 20,
"z": 0
}
... |
"""
Commands for showing a repository's sync and publish history
"""
from gettext import gettext as _
from pulp.client.commands.options import OPTION_REPO_ID
from pulp.client.extensions.extensions import PulpCliOption, PulpCliFlag, PulpCliCommand
from pulp.client import validators
# The default limit on the number ... |
"""
Datastore utility functions
"""
from oslo_log import log as logging
from oslo_vmware import exceptions as vexc
from oslo_vmware.objects import datastore as ds_obj
from oslo_vmware import pbm
from oslo_vmware import vim_util as vutil
from nova import exception
from nova.i18n import _, _LE, _LI
from nova.virt.vmwar... |
import optparse
from mdchecker import app
# courtesy of http://flask.pocoo.org/snippets/133/
def flaskrun(app, default_host="127.0.0.1",
default_port="5000"):
"""
Takes a flask.Flask instance and runs it. Parses
command-line flags to configure the app.
"""
# Set up the command-... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
"""
Import chart of accounts from OpenERP sources
"""
from __future__ import unicode_literals
import os, json
import ast
from xml.etree import ElementTree as ET
from frappe.utils.csvutils import read_csv_content
import frappe
path = "/Users/nabinhait/projects/odoo/addons"
accounts = {}
charts = {}
all_account_types ... |
from pybtex.style.sorting import BaseSortingStyle
class SortingStyle(BaseSortingStyle):
name = 'none'
def sort(self, entries):
return entries |
import sys
class Mux(object):
def __init__(self, d = None):
self.commands = {}
for k,v in d.items():
self.commands[k] = v
def match(self, name, a):
self.commands[name] = a
def parse(self, args=None):
if not args:
args = sys.argv
... |
from msrest.serialization import Model
class UsageName(Model):
"""The Usage Names.
:param value: Gets a string describing the resource name.
:type value: str
:param localized_value: Gets a localized string describing the resource
name.
:type localized_value: str
"""
_attribute_map ... |
"""Setup script"""
from setuptools import setup
def get_version():
"""Get version from the spec file"""
with open('packaging/obs-service-git-buildpackage.spec', 'r') as spec:
for line in spec.readlines():
if line.lower().startswith('version:'):
return line.split(':', 1)[1]... |
import json
import logging
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon.utils import memoized
from openstack_dashboard.contrib.sahara.api import sahara as saha... |
from copy import deepcopy
from datetime import datetime
from mangrove.datastore.database import DataObject
from mangrove.datastore.documents import SurveyResponseDocument, DataRecordDocument
from mangrove.datastore.entity import DataRecord
from mangrove.utils.types import is_string, sequence_to_str, is_sequence, is_em... |
from shinken_test import *
from shinken.property import UnusedProp, BoolProp, IntegerProp, FloatProp, CharProp, StringProp
class TestConfig(ShinkenTest):
#Uncomment this is you want to use a specific configuration
#for your test
def setUp(self):
pass
#Test the bool property class
def ... |
"""
Custom forms-related types
"""
from django.core.exceptions import ValidationError
from django.forms import Field, MultipleHiddenInput, NullBooleanField, Select
class MultiValueField(Field):
"""
Field class that supports a set of values for a single form field.
The field input can be specified as:
... |
#!/usr/bin/env python3
"""Extracting data from ytcrawl.tar.gz.
See the YTCrawl directory for details on creating it.
"""
# pylama:ignore=E501,D213
import json
import os
import sys
import inspect
import tarfile
from bs4 import BeautifulSoup
ALL_BRAG_BAR = set()
def log(msg, *args):
"""Log to stderr with opti... |
import operator
import GenLib
_token_map = {}
_sorted_tokens = []
_alias_tokens = set()
def write_bison_token_spec(bison_file):
""" Write the bison %token declaration """
print "Writing to %s" % bison_file
token_decls = ""
for token in _sorted_tokens:
# TODO: Filter tokens only relevant to... |
"""\
=======================================================
DVB-T (Digital Terrestrial TV) Tuner & Demuxing Service
=======================================================
Tunes to the specified frequency, using the specified parameters, using a DVB
tuner device; then demultiplexes packets by packet ID (PID) from DVB... |
from setuptools import setup, find_packages
def read(filename):
"""
Read a file relative to setup.py location.
"""
import os
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, filename)) as fd:
return fd.read()
def find_version(filename):
"""
Find ... |
"""A base user-interface workflow, to be inherited by UI modules."""
import tempfile
import benchmark
import better_webbrowser
import config
import data_sources
import geoip
import nameserver_list
import reporter
import site_connector
import util
__author__ = '<EMAIL> (Thomas Stromberg)'
class BaseUI(object):
"... |
import re
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.messages.middleware import MessageMiddleware
from django.contrib.sessions.middleware import SessionMiddleware
from django.middleware.cs... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from itertools import chain
from types import MethodType
from django.apps import apps
from django.conf import settings
from django.core import checks
from .management import _get_builtin_permissions
def check_user_model(app_configs=None, **kwargs):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.