content string |
|---|
from io import BytesIO
from django.core.handlers.wsgi import WSGIRequest
from django.core.servers.basehttp import WSGIRequestHandler
from django.test import SimpleTestCase
from django.test.client import RequestFactory
from django.test.utils import captured_stderr
class Stub(object):
def __init__(self, **kwargs):... |
"""Attribute selector plugin.
Oftentimes when testing you will want to select tests based on
criteria rather then simply by filename. For example, you might want
to run all tests except for the slow ones. You can do this with the
Attribute selector plugin by setting attributes on your test methods.
Here is an example:... |
"""Fix incompatible renames
Fixes:
* sys.maxint -> sys.maxsize
"""
# based on Collin Winter's fix_import
# Local imports
from .. import fixer_base
from ..fixer_util import Name, attr_chain
MAPPING = {"sys": {"maxint" : "maxsize"},
}
LOOKUP = {}
def alternates(members):
return "(" + "|".join(map(rep... |
"""Provides a thread-local transactional wrapper around the root Engine class.
The ``threadlocal`` module is invoked when using the
``strategy="threadlocal"`` flag with :func:`~sqlalchemy.engine.create_engine`.
This module is semi-private and is invoked automatically when the threadlocal
engine strategy is used.
"""
... |
"""
Verifies that dependent Xcode settings are processed correctly.
"""
import TestGyp
import TestMac
import subprocess
import sys
if sys.platform == 'darwin':
print "This test is currently disabled: https://crbug.com/483696."
sys.exit(0)
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
CHDIR = '... |
def pytest_configure():
from django.conf import settings
settings.configure(
DEBUG_PROPAGATE_EXCEPTIONS=True,
DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'}},
SITE_ID=1,
SECRET_KEY='not very secret in tests',
... |
import datetime
import base64
import hashlib
import math
def _write_cpp_header(f, include_guard):
year = datetime.date.today().year
f.write((
"// Copyright %(year)d The Chromium Authors. All rights reserved.\n"
"// Use of this source code is governed by a BSD-style license"
" that can b... |
from __future__ import absolute_import, print_function
import time
import parser
import warnings
from numpy import (float32, float64, complex64, complex128,
zeros, random, array)
from numpy.testing import (TestCase, assert_equal,
assert_allclose, run_module_suite)
from ... |
import settings
import logging
from django.utils.datastructures import SortedDict
logger = logging.getLogger(__name__)
def _formatReport(callback):
"""
Added as workaround to the changes made in #3006.
"""
rsp = callback.getResponse()
if not rsp:
return # Unfinished
import omero
... |
from django.template.defaultfilters import addslashes
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class AddslashesTests(SimpleTestCase):
@setup({'addslashes01': '{% autoescape off %}{{ a|addslashes }} {{ b|addslashes }}{% endautoescape %}'})
... |
""" Unit tests for the easy_xml.py file. """
import gyp.easy_xml as easy_xml
import unittest
import StringIO
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.stderr = StringIO.StringIO()
def test_EasyXml_simple(self):
self.assertEqual(
easy_xml.XmlToString(['test']),
'<... |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class User(models.Model):
username = models.CharField(max_length=100)
email = models.EmailField()
def __str__(self):
return self.username
@python_2_unicode_compatible
class Us... |
import base64
import unittest
from nose.tools import eq_
from ryu.lib import stringify
class C1(stringify.StringifyMixin):
def __init__(self, a, c):
print "init", a, c
self.a = a
self._b = 'B'
self.c = c
class Test_stringify(unittest.TestCase):
""" Test case for ryu.lib.stri... |
try:
import httplib as httplib
except ImportError:
import http.client as httplib
try:
import json
except ImportError:
json = None
try:
from collections import OrderedDict # New in Python 2.7
except ImportError:
from ordereddict import OrderedDict # Can be easy_install'ed for <= 2.6
from coll... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'community'}
import operator
import re
import os
# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exceptio... |
from django.db.models import Q
__all__ = ('AutocompleteModel', )
class AutocompleteModel(object):
"""
Autocomplete which considers choices as a queryset.
choices
A queryset.
limit_choices
Maximum number of choices to display.
search_fields
Fields to search in, configurabl... |
try:
import _winreg as winreg
except ImportError:
import winreg
from tzlocal.windows_tz import win_tz
import pytz
_cache_tz = None
def valuestodict(key):
"""Convert a registry key's values to a dictionary."""
dict = {}
size = winreg.QueryInfoKey(key)[1]
for i in range(size):
data = wi... |
from flask import session
from indico.core import signals
from indico.core.logger import Logger
from indico.modules.attachments.logging import connect_log_signals
from indico.modules.attachments.models.attachments import Attachment
from indico.modules.attachments.models.folders import AttachmentFolder
from indico.modu... |
import pytest
from ezdxf.math import convex_hull_2d
from io import StringIO
def import_asc_coords(file_obj):
""" Import allplan asc-format point file.
returns: a dictionary of Coordinates ('name': Coordinate)
"""
points = dict()
lines = file_obj.readlines()
for line in lines:
name, x,... |
"""Modify the current mode of the Flask XSM module.
"""
from xen.xm.opts import OptionError
from xen.xm import main as xm_main
from xen.xm.main import server
from xen.util import xsconstants
def help():
return """
Usage: xm setenforce [ Enforcing | Permissive | 1 | 0 ]
Modifies the current mode of the Fl... |
import subprocess
import time
import socket
import select
import struct
import espressopp
IMD_HANDSHAKE = 4
IMDVERSION = 2
IMD_DISCONNECT, \
IMD_ENERGIES, \
IMD_FCOORDS, \
IMD_GO, \
IMD_HANDSHAKE, \
IMD_KILL, \
IMD_MDCOMM, \
IMD_PAUSE, \
IMD_TRATE, \
IMD_IOERROR = range(10)
def h... |
from __future__ import nested_scopes
"""
################################################################################
#
# SOAPpy - Cayce Ullman (<EMAIL>)
# Brian Matthews (<EMAIL>)
# Gregory Warnes (<EMAIL>)
# Christopher Blunck (<EMAIL>)
#
#################################... |
"""Matplotlib based plotting of quantum circuits.
Todo:
* Optimize printing of large circuits.
* Get this to work with single gates.
* Do a better job checking the form of circuits to make sure it is a Mul of
Gates.
* Get multi-target gates plotting.
* Get initial and final states to plot.
* Get measurements to plo... |
"""
We perform uniqueness checks explicitly on the serializer class, rather
the using Django's `.full_clean()`.
This gives us better separation of concerns, allows us to use single-step
object creation, and makes it possible to switch between using the implicit
`ModelSerializer` class and an equivalent explicit `Seria... |
#!/usr/bin/python
from Aion.data_generation.reconstruction.Numerical import *
from Aion.data_inference.visualization.visualizeData import *
from Aion.utils.graphics import *
from Aion.utils.data import *
import pickledb
import glob, sys, time, os, argparse, hashlib
def defineArguments():
parser = argparse.Argum... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# serves the twitter files in redis via REST API on URL:8088
from cgi import parse_qs
import requests
import datetime
import os
import os.path
import redis
import json
REDIS = redis.Redis()
# Format:
# HOUR = HH (str)
# DATE = DD-MM-YYYY (str)
# ARRAY = key for keywords... |
import argparse
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', '..', '..',
'build', 'android')))
from pylib import constants
from pylib.utils import findbugs
_EXPECTED_... |
from msrest.serialization import Model
class TemplateLink(Model):
"""
Entity representing the reference to the template.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar uri: URI referencing the template. Default value:
"https://azuresdkci.blob.c... |
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns
from django.contrib.messages.api import inf... |
"""Tests for the anomalyzer."""
import csv
from mock import MagicMock, patch
from StringIO import StringIO
import unittest2 as unittest
from nupic.data.file_record_stream import FileRecordStream
from nupic.data.generators import anomalyzer
class AnomalyzerTest(unittest.TestCase):
"""Tests for the anomalyzer."""
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 07 11:30:17 2015
@author: AkishinoShiame
"""
import cPickle, gzip, theano.tensor
### file out put code below
try:
out1 = open("CR_data-train_set.pic.txt","w")
out2 = open("CR_data-train_set.lab.txt","w")
out3 = open("CR_data-valid_set.pic.txt","w")
out4 ... |
#!/usr/bin/python
#import Libraries
import cgi
import cgitb
import time
import thread
import subprocess
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
wifif = form.getvalue('wifi')
wifif = '"%s"'%wifif
passwordf = form.getvalue('password')
passwordf = '"%s"'%passwordf
sudo = '/us... |
{
'name': 'Calendar',
'version': '1.0',
'depends': ['base', 'mail', 'base_action_rule', 'web_calendar'],
'summary': 'Personal & Shared Calendar',
'description': """
This is a full-featured calendar system.
========================================
It supports:
------------
- Calendar of events
... |
"""Unit tests for InferenceShifter."""
from nupic.data.inference_shifter import InferenceShifter
from nupic.frameworks.opf.opfutils import InferenceElement, ModelResult
from nupic.support.unittesthelpers.testcasebase import (TestCaseBase,
unittest)
class TestIn... |
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.core import management
from django.contrib.auth.models import User
from django.test import TestCase
from models import (Person, Group, Membership, UserMembership,
Car, Driver, CarDriver)
cla... |
# Load the AlchemyAPI module code.
import AlchemyAPI
# Create an AlchemyAPI object.
alchemyObj = AlchemyAPI.AlchemyAPI()
# Load the API key from disk.
alchemyObj.loadAPIKey("api_key.txt");
'''
# Extract a title from a web URL.
result = alchemyObj.URLGetTitle("http://www.techcrunch.com/");
print result
'''
# Extr... |
from openerp import tools, models, fields
from openerp.addons.decimal_precision import decimal_precision as dp
class hr_timesheet_report(models.Model):
_name = "hr.timesheet.report"
_description = "Timesheet"
_auto = False
_rec_name = "date"
date = fields.Date('Date', readonly=True)
product_i... |
import time
from fabric.api import run, execute, env
environment = "production"
env.use_ssh_config = True
env.hosts = ["shaaaaa"]
branch = "master"
repo = "<EMAIL>:konklone/shaaaaaaaaaaaaa.git"
username = "shaaaaa"
home = "/home/%s/%s" % (username, username)
shared_path = "%s/shared" % home
versions_path = "%s/vers... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import translation
@override_settings... |
"""Tests for distributions KL mechanism."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops import array_ops
from tensorflow.python.ops.distributions import kullback_leibler
from tensorflow.python.ops.distributions import normal
f... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.become import BecomeBase
class BecomeModule(BecomeBase):
name = 'runas'
def build_become_command(self, cmd, shell):
# runas is implemented inside the winrm connection plugin
return c... |
"""
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
"""
from __future__ import unicode_literals
... |
import re
from inspect import getmembers, signature
from coala_utils.decorators import generate_repr
from .base import aspectbase
from .docs import Documentation
from .exceptions import AspectTypeError
from .taste import Taste
class aspectclass(type):
"""
Metaclass for aspectclasses.
Root aspectclass ... |
from itertools import chain
import time
from openerp import tools
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from openerp.exceptions import UserError
from openerp import api, models, field... |
import argparse
from contextlib import closing
import logging
from io import StringIO
from lib.utility import misc
from lib.elasticbeanstalk.model import EnvironmentTier
from scli.resources import CLISwitch, CLISwitchMsg, EBSCliAttr
from scli.constants import CommandType, ServiceDefault, ServiceRegionId, \
Paramet... |
import kfp
from kfp import components
chicago_taxi_dataset_op = components.load_component_from_url('https://raw.githubusercontent.com/kubeflow/pipelines/e3337b8bdcd63636934954e592d4b32c95b49129/components/datasets/Chicago%20Taxi/component.yaml')
convert_csv_to_apache_parquet_op = components.load_component_from_url('h... |
""" Module defines exceptions used by gsmmodem """
class GsmModemException(Exception):
""" Base exception raised for error conditions when interacting with the GSM modem """
class TimeoutException(GsmModemException):
""" Raised when a write command times out """
def __init__(self, data=None):
... |
"""
Admin site models for managing :class:`.ConfigurationModel` subclasses
"""
from django.forms import models
from django.contrib import admin
from django.contrib.admin import ListFilter
from django.core.cache import caches, InvalidCacheBackendError
from django.core.urlresolvers import reverse
from django.http import... |
import document_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import tarfile
import logging
import os
import hashlib
import tempfile
import shutil
import functools
import random
import errno
# version, , represent versions and specifications, internal
from yotta.lib import version
# fsutils, , misc filesystem utils, internal
from yotta.lib import fsutils
# folders, , where yotta... |
import json
import re
from .common import InfoExtractor
from ..utils import determine_ext
class NewgroundsIE(InfoExtractor):
_VALID_URL = r'(?:https?://)?(?:www\.)?newgrounds\.com/audio/listen/(?P<id>\d+)'
_TEST = {
u'url': u'http://www.newgrounds.com/audio/listen/549479',
u'file': u'549479.m... |
import getpass
from urllib import urlencode
from urllib2 import urlopen
from geopy.geocoders.base import Geocoder
from geopy import util
import csv
class GeocoderDotUS(Geocoder):
def __init__(self, username=None, password=None, format_string='%s'):
if username and (password is None):
password =... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
# ===========================================
# Stackdriver module specific support methods.
#
try:
import json
except ImportError:
try:
import simplejson as json... |
import unittest
import subprocess
import sys
from numba.tests.support import TestCase
class TestNumbaImport(TestCase):
"""
Test behaviour of importing Numba.
"""
def run_in_subproc(self, code, flags=None):
if flags is None:
flags = []
cmd = [sys.executable,] + flags + ["-... |
import pickle, os
import thorpy
from PyWorld2D.mapobjects.objects import MapObject
def ask_save(me):
choice = thorpy.launch_binary_choice("Do you want to save this map ?")
default_fn = me.get_fn().replace(".map","")
if choice:
fn = thorpy.get_user_text("Filename", default_fn, size=(me.W//2,40))
... |
"""
Functions for creating and restoring url-safe signed JSON objects.
The format used looks like this:
>>> signing.dumps("hello")
'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk'
There are two components here, separated by a ':'. The first component is a
URLsafe base64 encoded JSON of the object passed to dumps(). T... |
def web_socket_do_extra_handshake(request):
if request.ws_origin == 'http://example.com':
return
raise ValueError('Unacceptable origin: %r' % request.ws_origin)
def web_socket_transfer_data(request):
request.connection.write('origin_check_wsh.py is called for %s, %s' %
... |
from .compat import *
import binascii
#This code is shared with tackpy (somewhat), so I'd rather make minimal
#changes, and preserve the use of a2b_base64 throughout.
def dePem(s, name):
"""Decode a PEM string into a bytearray of its payload.
The input must contain an appropriate PEM prefix and postfix
... |
import itertools
import telemetry.timeline.event_container as event_container
import telemetry.timeline.sample as tracing_sample
import telemetry.timeline.slice as tracing_slice
class Thread(event_container.TimelineEventContainer):
''' A Thread stores all the trace events collected for a particular
thread. We org... |
"""Implements basics of Capa, including class CapaModule."""
import json
import logging
import sys
from lxml import etree
from pkg_resources import resource_string
import dogstats_wrapper as dog_stats_api
from .capa_base import CapaMixin, CapaFields, ComplexEncoder
from capa import responsetypes
from .progress import... |
""" Hangman Game (v1.0)
Name: Joe Young
Date: 24/09/2016
"""
#Joe Young
#06/09/2016
import sys
import platform
if "windows" == platform.system():
sys.path.append(sys.path[0]+'\\Extra')
else:
sys.path.append(sys.path[0]+'//Extra')
from random import *
from time import *
import hangmanp
def load_file... |
from __future__ import absolute_import, print_function, division
import itertools
import traceback
import click
from mitmproxy import contentviews
from mitmproxy import ctx
from mitmproxy import exceptions
from mitmproxy import filt
from netlib import human
from netlib import strutils
def indent(n, text):
l = ... |
# This class will represent the checkers board.
"""
~ 1 2 3 4 5 6 7 8
__________________
a | O O O O | a
b | O O O O | b
c | O O O O | c
d | - - - - | d
e | - - - - | e
f | x x x x | f
g | x x x x | g
h | x x x x | h
------------------
~ 1 2 3 4 5... |
# -*- coding: utf-8 -*-
"""
Author: Bernhard Scheirle
"""
from __future__ import unicode_literals
import os
from pelican.contents import Content
from pelican.utils import slugify
from . import avatars
class Comment(Content):
mandatory_properties = ('author', 'date')
default_template = 'None'
def __init... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from utilities import css_styles
css_styles()
# <markdowncell>
# # IOOS System Test - Theme 3 - Scenario A - [Description](https://github.com/ioos/system-test/wiki/Development-of-Test-Themes#scenario-3a-assessing-seabird-vulnerability-in-the-bering-sea... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
merge_dicts,
try_get,
unescapeHTML,
unified_timestamp,
urljoin,
)
class RayWenderlichIE(InfoEx... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.bigswitch_utils import Rest, Response
from ansible.module_utils.pycompat24 import get_exce... |
from sympy import I, Matrix, symbols, conjugate, Expr, Integer
from sympy.physics.quantum.dagger import adjoint, Dagger
from sympy.external import import_module
from sympy.utilities.pytest import skip
def test_scalars():
x = symbols('x', complex=True)
assert Dagger(x) == conjugate(x)
assert Dagger(I*x) =... |
from setuptools import setup
from nffg import VERSION
MODULE_NAME = "nffg"
setup(name=MODULE_NAME,
version=VERSION,
description="Network Function Forwarding Graph",
author="Janos Czentye, Balazs Nemeth, Balazs Sonkoly",
long_description="Python-based implementation of "
... |
"""
Modules that get shown to the users when an error has occurred while
loading or rendering other modules
"""
import hashlib
import logging
import json
import sys
from lxml import etree
from xmodule.x_module import XModule, XModuleDescriptor
from xmodule.errortracker import exc_info_to_str
from xmodule.modulestore ... |
#!/usr/bin/env python
"Makes working with XML feel like you are working with JSON"
from xml.parsers import expat
from xml.sax.saxutils import XMLGenerator
from xml.sax.xmlreader import AttributesImpl
try: # pragma no cover
from cStringIO import StringIO
except ImportError: # pragma no cover
try:
from... |
import httplib
import logging
import unittest
import urllib2
import testsetup
import transferclient
import moreasserts
M = 1024 * 1024
def assertVdiZero(self, ip, port, record, vdi_mb):
# Make a new record with the IP and port fields updated
r = dict(record, ip=ip, port=port)
moreasserts.assertVdiIsZeroU... |
import check_print
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import unittest
import ossie.utils.testing
import os
from omniORB import any
class ComponentTests(ossie.utils.testing.ScaComponentTestCase):
"""Test for all component implementations in noise_source_f"""
def testScaBasicBehavior(self):
##################################################################... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.pooler
import openerp.addons.decimal_precision as dp
import time
class customs_form(osv.osv):
_name = 'customs.form'
_description = ''
def name_get(self, cr, uid, ids, context):
if not len(ids):
... |
"""
shared options and groups
The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parses general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this de... |
{
'name': 'Anglo-Saxon Accounting',
'version': '1.2',
'author': 'OpenERP SA, Veritos',
'website': 'https://www.odoo.com',
'description': """
This module supports the Anglo-Saxon accounting methodology by changing the accounting logic with stock transactions.
=========================================... |
"""
:synopsis: remaining "secondary" views for askbot
This module contains a collection of views displaying all sorts of secondary and mostly static content.
"""
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, ... |
from StringIO import StringIO
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
CloudFiles = get_driver(Provider.CLOUDFILES_US)
driver = CloudFiles('username', 'api key')
container = driver.create_container(container_name='my_website')
iterator1 = StringIO('<p>Hello Worl... |
import unittest
from nupic.data.generators.pattern_machine import (PatternMachine,
ConsecutivePatternMachine)
class PatternMachineTest(unittest.TestCase):
def setUp(self):
self.patternMachine = PatternMachine(10000, 5, num=50)
def testGet(self):
pat... |
import hashlib
import datetime
from flask_login import UserMixin, AnonymousUserMixin
import mediacloud as mcapi
import app
from app.core import db, mc
# User class
class User(UserMixin):
def __init__(self, username, key, active=True, profile=None):
self.name = username
self.id = key
self... |
from papyon.media import *
from papyon.event.media import *
import pygst
pygst.require('0.10')
import farsight
import gobject
import gst
import logging
import sys
logger = logging.getLogger("papyon.media.conference")
codecs_definitions = {
"audio" : [
(114, "x-msrta", farsight.MEDIA_TYPE_AUDIO, 16000),
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: purefa_pg
version_added: '2.4'
short_description: Manage pro... |
import wx
import string
class DigitOnlyValidator(wx.PyValidator):
def __init__(self, choices=None):
wx.PyValidator.__init__(self)
self.choices = choices
self.Bind(wx.EVT_CHAR, self.OnChar)
def Clone(self):
return DigitOnlyValidator(self.choices)
def Tra... |
import json
try:
from urllib.request import urlopen # Python 3
from urllib.parse import urlencode
except ImportError:
from urllib import urlopen # Python 2
from urllib import urlencode
import socket
import math
from . import vehicles, log
from . import EmissionsJsonParser
from .exceptions import Rout... |
import argparse
import sys
from .. import handlers, commandline, reader
def get_parser(add_help=True):
parser = argparse.ArgumentParser("format",
description="Format a structured log stream", add_help=add_help)
parser.add_argument("--input", action="store", default=None,
... |
#!/usr/bin/env python
"""
txXBee installation script
"""
from setuptools import setup
import os
import sys
import subprocess
import txXBee
setup(
name = "txXBee",
version = txXBee.__version__,
author = "Wagner Sartori Junior",
author_email = "<EMAIL>",
url = "http://github.com/trunet/txxbee",
d... |
"""Checks WebKit style for XML files."""
from __future__ import absolute_import
from xml.parsers import expat
class XMLChecker(object):
"""Processes XML lines for checking style."""
def __init__(self, file_path, handle_style_error):
self._handle_style_error = handle_style_error
self._handle... |
"""Classes and methods to create and manage Announcements."""
__author__ = 'Saifu Angto (<EMAIL>)'
import datetime
import urllib
from common import tags
from common import utils
from common.schema_fields import FieldArray
from common.schema_fields import FieldRegistry
from common.schema_fields import SchemaField
fr... |
from paste.httpheaders import *
import time
def _test_generic(collection):
assert 'bing' == VIA(collection)
REFERER.update(collection,'internal:/some/path')
assert 'internal:/some/path' == REFERER(collection)
CACHE_CONTROL.update(collection,max_age=1234)
CONTENT_DISPOSITION.update(collection,filena... |
from openerp.tools import convert
original_xml_import = convert.xml_import
class WebkitXMLImport(original_xml_import):
# Override of xml import in order to add webkit_header tag in report tag.
# As discussed with the R&D Team, the current XML processing API does
# not offer enough flexibity to do it in ... |
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
#-------------------------------------------------------------------------
#
# set up logging
#
#-------------------------------------------------------------------------
import logging
log = logging.getLogger(".paperstyle")
#-------------... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)
"""
Batched builds - compile faster
instead of compiling object files one by one, c/c++ compilers are often able to compile at once:
cc -c ../file1.c ../file2.c ../file3.c
Files are output on the directory where the compiler is called, and dependencies... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# http://binux.me
# Created on 2014-10-08 15:04:08
import urlparse
def connect_database(url):
"""
create database object by url
mysql:
mysql+type://user:passwd@host:port/database
sqlite:
... |
from ctypes.util import find_library
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.base import (
_sqlite_extract, _sqlite_date_trunc, _sqlite_regexp, _sqlite_format_dtdelta,
connection_created, Database, DatabaseWrapper as SQLiteDatabas... |
#--------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
raven.contrib.zope
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from inspect import getouterframes, currentframe, getinnerframes
from ... |
# -*- encoding: utf-8 -*-
from abjad import *
def test_scoretools_Note_grace_01():
r'''Attach one grace note.
'''
note = Note("c'4")
grace_container = scoretools.GraceContainer([Note(2, (1, 16))])
attach(grace_container, note)
assert systemtools.TestManager.compare(
note,
r''... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abstractmethod, abstractproperty
from pants.util.meta import AbstractClass
class Scm(AbstractClass):
"""Abstracts high-level scm operations needed... |
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
import six
import webob.exc
from wsme.rest import json
from glance.api import policy
from glance.api.v2.model.metadef_resource_type import ResourceType
from glance.api.v2.model.metadef_resource_type import R... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.