content string |
|---|
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.atom
~~~~~~~~~~~~~~~~~~~~~
This module provides a class called :class:`AtomFeed` which can be
used to generate feeds in the Atom syndication format (see :rfc:`4287`).
Example::
def atom_feed(request):
feed = AtomFeed("My Blog", feed... |
from sahara.plugins.cdh.v5_3_0 import config_helper as c_h
from sahara.tests.unit import base
from sahara.tests.unit.plugins.cdh import utils as ctu
class ConfigHelperTestCase(base.SaharaTestCase):
def test_is_swift_enabled(self):
cluster = ctu.get_fake_cluster(cluster_configs={})
self.assertTrue(... |
from snapcraft import formatting_utils
from snapcraft import tests
class HumanizeListTestCases(tests.TestCase):
def test_no_items(self):
items = []
output = formatting_utils.humanize_list(items, 'and')
self.assertEqual(output, '')
def test_one_item(self):
items = ['foo']
... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsVectorLayerCache.
.. note:: 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 2 of the License, or
(at your option) any later version.
"... |
#!/usr/bin/env python
import sys, fileinput
err=0
# Giant associative set of builtin->intrinsic mappings where clang doesn't
# implement the builtin since the vector operation works by default.
repl_map = {
'__builtin_ia32_addps': '_mm_add_ps',
'__builtin_ia32_addsd': '_mm_add_sd',
'__builtin_ia32_addpd': '_mm_add_... |
from .main import Email
def start():
return Email()
config = [{
'name': 'email',
'groups': [
{
'tab': 'notifications',
'list': 'notification_providers',
'name': 'email',
'options': [
{
'name': 'enabled',
... |
import os
import time
import unittest
from test import support
class StructSeqTest(unittest.TestCase):
def test_tuple(self):
t = time.gmtime()
self.assertIsInstance(t, tuple)
astuple = tuple(t)
self.assertEqual(len(t), len(astuple))
self.assertEqual(t, astuple)
# ... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import traceback
try:
import ovirtsdk4 as sdk
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,... |
from datetime import datetime
from glob import glob
import locale
from pprint import pprint
import re
import sys
from textwrap import dedent
import mistune
from PIL import Image
ROOT = '/Users/karl/Sites/la-grange.net'
INDENTATION = re.compile(r'\n\s{2,}')
META = re.compile(r'^(\w+):([^\n]*)\n')
PATH = re.compile(r'... |
"""Vectorized Laplace distribution class, directly using LinearOperator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.distributions.python.ops import bijectors
from tensorflow.contrib.distributions.python.op... |
import json
import logging
import os
import re
import shutil
import tempfile
from telemetry.util import cloud_storage
class PageSetArchiveInfo(object):
def __init__(self, file_path, data, ignore_archive=False):
self._file_path = file_path
self._base_dir = os.path.dirname(file_path)
# Ensure directory ... |
import numpy as np
import scipy as sp
import logging as logger
import time
import pylab as pl
from collections import defaultdict
from sklearn.metrics import confusion_matrix
class PassiveAggressiveII(object):
"""
Passive Aggressive-II algorithm: squared hinge loss PA.
References:
- http://jmlr.o... |
#!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from utils import utils, inspector, admin
# http://arts.gov/oig
archive = 2005
# options:
# standard since/year options for a year range to fetch from.
# report_id: only bother to process a single report
#
# Notes fo... |
"""Demonstrate how different parsers parse the same markup.
Beautiful Soup can use any of a number of different parsers. Every
parser should behave more or less the same on valid markup, and
Beautiful Soup's unit tests make sure this is the case. But every
parser handles invalid markup differently. Even different vers... |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^... |
import time
import random
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def encrypt():
fname = input('Enter the name/path of the file to be encrypted : ')
f = open(fname, 'r')
msg = f.read()
f.close()
#key = input ('Enter Security Key (character string) for encryption :')
key = ''
kl = random.randint(10,17)... |
# -*- coding: utf-8 -*-
import httplib as http
from flask import request
from framework.auth.decorators import must_be_logged_in
from framework.exceptions import HTTPError
from website.project.decorators import must_have_permission
from website.project.decorators import must_not_be_registration
from website.project... |
from handler.base_plugin import CommandPlugin
import aiohttp, json, time
class EmotionsDetectorPlugin(CommandPlugin):
__slots__ = ("key", "dirt", "clean_time", "requests_amount", "time_delta")
def __init__(self, *commands, prefixes=None, strict=False, key=None, time_delta=60, requests_amount=15):
""... |
"""
Verifies that app bundles are built correctly.
"""
import TestGyp
import TestMac
import os
import plistlib
import subprocess
import sys
if sys.platform in ('darwin', 'win32'):
print "This test is currently disabled: https://crbug.com/483696."
sys.exit(0)
def CheckFileXMLPropertyList(file):
output = subp... |
from __future__ import absolute_import
from __future__ import print_function
class State(object):
"""
A simple class you can use to keep track of state throughout
a test. Just assign whatever you want to its attributes. Its
constructor provides a shortcut to setting initial values for
attribute... |
# performs a simple device inquiry, followed by a remote name request of each
# discovered device
import os
import sys
import struct
import _bluetooth as bluez
def printpacket(pkt):
for c in pkt:
sys.stdout.write("%02x " % struct.unpack("B",c)[0])
print
def read_inquiry_mode(sock):
"""returns t... |
import nest
import unittest
from .utils import extract_dict_a_from_b
__author__ = 'naveau'
class TestStructuralPlasticityManager(unittest.TestCase):
def setUp(self):
nest.ResetKernel()
nest.set_verbosity('M_INFO')
self.exclude_synapse_model = [
'stdp_dopamine_synapse',
... |
import ipaddress
from st2actions.runners.pythonrunner import Action
class IsValidIpAction(Action):
def run(self, ip_address, no_loopback=False, only_v4=False, only_v6=False):
"""
Is this a valid IP address?
Args:
ip_address: The IP address to validate.
no_loopback: Ra... |
"""A class to serve as proxy for the target engine for testing.
Receives documents from the oplog worker threads and indexes them
into the backend.
Please look at the Solr and ElasticSearch doc manager classes for a sample
implementation with real systems.
"""
from threading import RLock
from mongo_connector import... |
"""Tests for initializers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
import tensorflow as tf
class GaussianTest(tf.test.TestCase):
def testGaussianLogPDF(self):
with tf.Session():
batch_size = 6
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.admin.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('conten... |
import os
from supplychainpy._helpers._pickle_config import deserialise_config, serialise_config
APP_DIR = os.path.dirname(__file__, )
REL_PATH_GENETIC_ALGORITHM = '../sample_data/population_genome.txt'
REL_PATH_DASH = 'dash.pickle'
REL_PATH_ARCHIVE = '../../_archive/'
REL_PATH_CSV_MANAGEMENT_CONFIG = '../_pickled/cs... |
list_services = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'services': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
'id': {'type': ['in... |
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory that is passed as an
argument:
nodes_main.txt
nodes_test.txt
These files must consist of lines in the format
<ip>
<ip>:<port>
[<ipv6>]
[<ipv6>]:<port>
<onion>.onion
0xDD... |
# Time: O(n)
# Space: O(h)
#
# Invert a binary tree.
#
# 4
# / \
# 2 7
# / \ / \
# 1 3 6 9
# to
# 4
# / \
# 7 2
# / \ / \
# 9 6 3 1
#
# Time: O(n)
# Space: O(w), w is the max number of the nodes of the levels.
# BFS solution.
class Queue:
def __init__(self):
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... |
# -*- coding: utf-8 -*-
import os
import glob
import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
from BeautifulSoup import BeautifulSoup # required for html prettification
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
loggin... |
from .constants import EQUALS_BYTE, SOH_BYTE
from .message import FixMessage, fix_val
from .data import RAW_DATA_TAGS, RAW_LEN_TAGS
# By default, messages are terminated by the Checksum (10) tag.
DEFAULT_STOP_TAG = 10
class FixParser(object): # skipcq: PYL-R0205
"""FIX protocol message parser.
This class ... |
import sys
import operator
import functools
try:
import builtins
except ImportError:
import __builtin__ as builtins
PY2 = sys.version_info[0] == 2
_identity = lambda x: x
if PY2:
unichr = unichr
text_type = unicode
string_types = (str, unicode)
integer_types = (int, long)
int_to_byte = c... |
import json
import os
import sys
import unittest
from api_data_source import (_JSCModel,
_FormatValue,
_GetEventByNameFromEvents)
from branch_utility import ChannelInfo
from extensions_paths import EXTENSIONS
from file_system import FileNotFoundError
from futur... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
from ansible.errors import AnsibleConnectionFailure
from ansible.plugins.terminal import TerminalBase
class TerminalModule(TerminalBase):
terminal_stdout_re = [
re.compile(br"([\r\n]|(\x1b\[\?7h))[\w\+\-\.... |
import sys
import unittest
from ctypes import *
class MemFunctionsTest(unittest.TestCase):
## def test_overflow(self):
## # string_at and wstring_at must use the Python calling
## # convention (which acquires the GIL and checks the Python
## # error flag). Provoke an error and catch it; see al... |
import eventlet
from eventlet import greenio
import os
__test__ = False
_proc_status = '/proc/%d/status' % os.getpid()
_scale = {'kB': 1024.0, 'mB': 1024.0 * 1024.0,
'KB': 1024.0, 'MB': 1024.0 * 1024.0}
def _VmB(VmKey):
'''Private.
'''
global _proc_status, _scale
# get pseudo file /proc/... |
import unittest
from test.support import run_unittest
from email.test.test_email import TestEmailBase
from email.charset import Charset
from email.header import Header, decode_header
from email.message import Message
# We're compatible with Python 2.3, but it doesn't have the built-in Asian
# codecs, so we have to sk... |
#! /usr/bin/env python
from Crypto.Cipher import AES
from binascii import a2b_base64
def pkcs_7_pad(data, final_len = None):
if final_len == None:
final_len = (len(data)/16 + 1)*16
padding_len = final_len - len(data)
return data + chr(padding_len)*padding_len
def pkcs_7_unpad(data):
padding_len = ord(dat... |
#!/usr/bin/python
import unittest
import os
import sys
# simple magic for using scripts within a source tree
basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.join(basedir, 'virttest')):
sys.path.append(basedir)
from virttest import installer
from virttest import cart... |
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
# Geometry
# ========
# grid compound of 3 x 3 elements
# an element is compound of 3 cyli... |
import logging
import re
from django.core.urlresolvers import reverse_lazy # noqa
from django.utils.translation import ugettext_lazy as _ # noqa
from horizon import exceptions
from horizon import forms
from horizon import messages
from horizon import tabs
from horizon import workflows
from openstack_dashboard impo... |
import datetime
from oslo_config import cfg
import webob.exc
from nova.api.openstack import extensions
from nova import compute
from nova import context as nova_context
from nova.i18n import _
from nova import utils
CONF = cfg.CONF
CONF.import_opt('compute_topic', 'nova.compute.rpcapi')
authorize = extensions.exte... |
# -*- coding: utf-8 -*-
import os
from flask import (Flask, request, jsonify, render_template, # noqa
render_template_string, Blueprint, send_file, abort, make_response,
redirect as flask_redirect, url_for, send_from_directory, current_app
)
import furl
from website import settings
# Create app
app = Flask... |
"""
Test cases for the key classes.
"""
import array
from cinder.keymgr import key
from cinder import test
class KeyTestCase(test.TestCase):
def _create_key(self):
raise NotImplementedError()
def setUp(self):
super(KeyTestCase, self).setUp()
self.key = self._create_key()
class S... |
import re
from xml.sax.saxutils import escape, unescape
from tokenizer import HTMLTokenizer
from constants import tokenTypes
class HTMLSanitizerMixin(object):
""" sanitization of XHTML+MathML+SVG and of inline style attributes."""
acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area',
'art... |
"""Tests for vusion.persist.schedule."""
from datetime import timedelta, datetime
from twisted.trial.unittest import TestCase
from vusion.persist import schedule_generator, DialogueSchedule
from tests.utils import ObjectMaker
from vusion.utils import time_from_vusion_format, time_to_vusion_format
class TestSchedule... |
import copy
import mock
from oslo_serialization import jsonutils
import webob
from nova.api.openstack.compute import image_metadata as image_metadata_v21
from nova import exception
from nova import test
from nova.tests.unit.api.openstack import fakes
from nova.tests.unit import image_fixtures
IMAGE_FIXTURES = image_... |
import sunat
import tables
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import random
import string
from ..func import Func, TestData
class atoi(Func):
def __init__(self):
super(atoi, self).__init__()
self.skips_whitespace = False
self.allows_negative = True
def rand_str(self, length, byte_list=None): #pylint disable=no-self-use
if byte_list is N... |
#!/usr/bin/env python
# File : conductor.py
# Description: Simple driver for sentiment analysis implementation
import os, sys
import tokenize
import normalize
import labelselect
import statsify
import wordselection
import dictizer
import split_dataset
from Token import Token
from parse_args import parse_args
f... |
from hashlib import sha1
import inspect
import re
import collections
from . import compat
def coerce_string_conf(d):
result = {}
for k, v in d.items():
if not isinstance(v, compat.string_types):
result[k] = v
continue
v = v.strip()
if re.match(r'^[-+]?\d+$', v)... |
"""
from twisted.internet import defer
Tests borrowed from the twisted.web.client tests.
"""
import os
import shutil
import sys
from pkg_resources import parse_version
import cryptography
import OpenSSL.SSL
from twisted.trial import unittest
from twisted.web import server, static, util, resource
from twisted.internet ... |
import numpy as np
from random import shuffle
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs:
- W: C x D array of weights
- X: D x N array of data. Data are D-dimensional columns
- y: 1-dimensional array of length N with labels 0...K-1, for K class... |
import functools
from django.conf import settings
from django.db import transaction
from django.db.models import Sum
from waldur_core.core import utils as core_utils
from waldur_freeipa import models as freeipa_models
from . import models, tasks, utils
def if_plugin_enabled(f):
"""Calls decorated handler only ... |
# Test cases where MVC is used for spill slots that end up being out of range.
# RUN: python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s
# There are 8 usable call-saved GPRs, two of which are needed for the base
# registers. The first 160 bytes of the frame are needed for the ABI
# call frame, and a further 8 by... |
"""Replacement for htpasswd"""
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
# one, and tell the user if we can't.
try:
import crypt
except ImportError:
try:
import fcrypt as crypt
except ImportE... |
from django.contrib.gis.gdal import SpatialReference
from django.db import DEFAULT_DB_ALIAS, connections
def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
database=None):
"""
This function takes a GDAL SpatialReference system and adds its information
to the `spa... |
r'''
unit test describing the hyperbolic half-plane with the Poincare metric. This
is a basic model of hyperbolic geometry on the (positive) half-space
{(x,y) \in R^2 | y > 0}
with the Riemannian metric
ds^2 = (dx^2 + dy^2)/y^2
It has constant negative scalar curvature = -2
https://en.wikipedia.org/wiki/Poincare_h... |
"""
"""
import os
import json
from sqlalchemy import (create_engine, Table, Column, String, Integer,
Float, Text, MetaData, select, ForeignKey,
bindparam, delete, and_)
from config import Configuration
engine = create_engine(Configuration.SQLALCHEMY_DATABASE_URI, echo=Tr... |
data = (
'Dang ', # 0x00
'Ma ', # 0x01
'Sha ', # 0x02
'Dan ', # 0x03
'Jue ', # 0x04
'Li ', # 0x05
'Fu ', # 0x06
'Min ', # 0x07
'Nuo ', # 0x08
'Huo ', # 0x09
'Kang ', # 0x0a
'Zhi ', # 0x0b
'Qi ', # 0x0c
'Kan ', # 0x0d
'Jie ', # 0x0e
'Fen ', # 0x0f
'E ', # 0x10
'Ya ', ... |
#!/usr/bin/env python
import re
import json
# https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
# http://stackoverflow.com/a/13436167/96656
def unisymbol(codePoint):
if codePoint >= 0x0000 and codePoint <= 0xFFFF:
return unichr(codePoint)
elif codePoint >= 0x010000 and codePoint <= 0x10FFFF:
... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsScaleWidget
.. note:: 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 2 of the License, or
(at your option) any later version.
"""
__a... |
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
class MyCache(BaseCache):
assoc = 2
block_size = 64
latency = '1ns'
mshrs = 10
tgts_per_mshr = 5
class MyL1Cache(MyCache):
is_top_level = True
tgts_per_mshr = 20
cpu = DerivO3CPU(cpu_id=0)
cpu.addTwoLevelCacheHierar... |
"""
Test unit for the miscutil/mailutils module.
"""
import os
import sys
import pkg_resources
from base64 import encodestring
from six import iteritems, StringIO
from flask import current_app
from invenio.ext.email import send_email
from invenio.testsuite import make_test_suite, run_test_suite, InvenioTestCase
cla... |
"""TensorFlow Summary API v2.
The operations in this package are safe to use with eager execution turned on or
off. It has a more flexible API that allows summaries to be written directly
from ops to places other than event log files, rather than propagating protos
from `tf.summary.merge_all` to `tf.summary.FileWriter... |
from __future__ import absolute_import
import textwrap
def _create_test_package_submodule(env):
env.scratch_path.join("version_pkg_submodule").mkdir()
submodule_path = env.scratch_path / 'version_pkg_submodule'
env.run('touch', 'testfile', cwd=submodule_path)
env.run('git', 'init', cwd=submodule_path... |
"""
The Token class, interchangeable with ``pygments.token``.
A `Token` has some semantics for a piece of text that is given a style through
a :class:`~prompt_toolkit.styles.Style` class. A pygments lexer for instance,
returns a list of (Token, text) tuples. Each fragment of text has a token
assigned, which when combi... |
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
"""
SUMMARY
-------
Display system information and configuration data
::
sys [config]
DESCRIPTION
-----------
This command displays system-specific data. If no arguments are entered,
the same system data shown during crash in... |
from spack import *
class StartupNotification(AutotoolsPackage):
"""startup-notification contains a reference implementation of the
freedesktop startup notification protocol."""
homepage = "https://www.freedesktop.org/wiki/Software/startup-notification/"
url = "http://www.freedesktop.org/softwar... |
import re
import os
import locale
def XmlToString(content, encoding='utf-8', pretty=False):
""" Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structure... |
from __future__ import division
from sympy import (Abs, I, Dummy, Rational, Float, S, Symbol, cos, oo, pi,
simplify, sin, sqrt, symbols, Derivative, asin, acos)
from sympy.geometry import (Circle, Curve, Ellipse, GeometryError, Line, Point,
Polygon, Ray, RegularPolygon, S... |
import sys,traceback,urllib2,re, urllib,xbmc
def createCookie(url,cj=None,agent='Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0'):
urlData=''
try:
import urlparse,cookielib,urllib2
class NoRedirection(urllib2.HTTPErrorProcessor):
def http_response(self, reques... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class R7IE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:
(?:[a-zA-Z]+)\.r7\.com(?:/[^/]+)+/idmedia/|
... |
""" WebMessage module, messaging system"""
__revision__ = "$Id$"
import invenio.webmessage_dblayer as db
from invenio.webmessage_config import CFG_WEBMESSAGE_STATUS_CODE, \
CFG_WEBMESSAGE_RESULTS_FIELD, \
CFG_WEBMESSAGE_SEPARATOR, \
... |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print(df.format('jS F Y H:i'))
7th October 2003 11:39
>>>
"""
from __future__ import unicode_literals
import calendar
import datetime
import re
impo... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsXmlUtils.
.. note:: 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 2 of the License, or
(at your option) any later version.
"""
__aut... |
"""Train NMT Models on WMT'14 English-German machine translation task."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from REDACTED.tensorflow_models.mlperf.models.rough.transformer_lingvo.lingvo import model_registry
from REDACTED.tensorflow... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models, transaction
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ProjectDomain'
db.create_table('sentry_projectdomain', (
('id', self.gf('... |
'''
1. Create 1 Test VMs with VR.
2. After 1 VM created, Check VR Appliance VM ha status.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.ha_operations as... |
import datetime
import decimal
import importlib
import logging
import re
import sqlalchemy
import sqlparse
import sys
import warnings
class SQL(object):
"""Wrap SQLAlchemy to provide a simple SQL API."""
def __init__(self, url, **kwargs):
"""
Create instance of sqlalchemy.engine.Engine.
... |
from .. import abc
from .. import util
machinery = util.import_importlib('importlib.machinery')
import unittest
class FindSpecTests(abc.FinderTests):
"""Test finding frozen modules."""
def find(self, name, path=None):
finder = self.machinery.FrozenImporter
return finder.find_spec(name, pat... |
#!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from test import run_only
from mock import Mock
from mock import patch
from diamond.collector import Coll... |
#!/usr/bin/python
import datetime
from sqlalchemy import and_
from turbogears.database import session
from bkr.server.util import load_config
from bkr.server.model import System, SystemStatus, SystemActivity, \
SystemStatusDuration
from bkr.server.test.assertions import assert_durations_not_overlapping, \
... |
from datetime import datetime, timedelta
import time
import logging
import openerp
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
_logger = logging.getLogger(__name__)
DATE_RANGE_FUNCTION = {
'minutes': lambda interval: timedelta(minu... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
import tower_cli
import tower_cli.utils.exceptions as exc
from tower_cli.... |
"""A library for integrating pyOpenSSL with CherryPy.
The OpenSSL module must be importable for SSL functionality.
You can obtain it from http://pyopenssl.sourceforge.net/
To use this module, set CherryPyWSGIServer.ssl_adapter to an instance of
SSLAdapter. There are two ways to use SSL:
Method One
----------
* ``s... |
from datetime import datetime
import logging
import os
import shutil
from tinydb import TinyDB, Storage, where, Query
import yaml
from .utils import mkdir_open
from .history import Repository
from .credential import split_fullname, make_fullname
class PasspieStorage(Storage):
extension = ".pass"
def __init... |
import xml.etree.ElementTree as ET
import os
import cPickle
import numpy as np
def parse_rec(filename):
""" Parse a PASCAL VOC xml file """
tree = ET.parse(filename)
objects = []
for obj in tree.findall('object'):
obj_struct = {}
obj_struct['name'] = obj.find('name').text
obj_st... |
"""Provides HTTP functions for gdata.service to use on Google App Engine
AppEngineHttpClient: Provides an HTTP request method which uses App Engine's
urlfetch API. Set the http_client member of a GDataService object to an
instance of an AppEngineHttpClient to allow the gdata library to run on
Google App Engin... |
""" Module for holding colour code values. """
import os
import re
import sys
try:
# pylint: disable=F0401
from colorama import Fore, Style
has_colorama = True
except ImportError:
has_colorama = False
mswin = os.name == "nt"
if mswin and has_colorama:
white = Style.RESET_ALL
ul = Style.DIM... |
from .util import normalize_dates
from .transcriptions import Transcriptions
from .base import InstanceResource, ListResource
class Recording(InstanceResource):
subresources = [Transcriptions]
def __init__(self, *args, **kwargs):
super(Recording, self).__init__(*args, **kwargs)
self.formats... |
from __future__ import unicode_literals
import frappe
from frappe import _
from erpnext.crm.report.campaign_efficiency.campaign_efficiency import get_lead_data
def execute(filters=None):
columns, data = [], []
columns=get_columns()
data=get_lead_data(filters, "Lead Owner")
return columns, data
def get_columns():
... |
"""Unit tests for the input.py file."""
import gyp.input
import unittest
import sys
class TestFindCycles(unittest.TestCase):
def setUp(self):
self.nodes = {}
for x in ('a', 'b', 'c', 'd', 'e'):
self.nodes[x] = gyp.input.DependencyGraphNode(x)
def _create_dependency(self, dependent, dependency):
... |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any l... |
"""SCons.Tool.lex
Tool-specific initialization for lex.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permiss... |
from .tabulate import _text_type
def pad(field, total, char=u" "):
return field + (char * (total - len(field)))
def get_separator(num, header_len, data_len):
total_len = header_len + data_len + 1
sep = u"-[ RECORD {0} ]".format(num)
if len(sep) < header_len:
sep = pad(sep, header_len - 1, u"-... |
{
'name' : 'Procurements',
'version' : '1.0',
'author' : 'OpenERP SA',
'website': 'https://www.odoo.com/page/manufacturing',
'category' : 'Hidden/Dependency',
'depends' : ['base', 'product'],
'description': """
This is the module for computing Procurements.
==================================... |
from __future__ import absolute_import
from __future__ import unicode_literals
NOTIFICATIONS_CHECKERS = {}
def register_checker(lang='python', checker=None, color=None, priority=1):
"""Register a Checker (Like PEP8, Lint, etc) for some language.
@lang: language that the checker apply.
@checker: Class to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.