content string |
|---|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain
# buildable and runnable over time. Each tuple in the list contains
#
# (example_name, do_run, do_valgrind_run).
#
... |
from pygame.locals import *
from pyrepl.console import Console, Event
from pyrepl import pygame_keymap
import pygame
import types
lmargin = 5
rmargin = 5
tmargin = 5
bmargin = 5
try:
bool
except NameError:
def bool(x):
return not not x
modcolors = {K_LCTRL:1,
K_RCTRL:1,
K_LM... |
"""Symbolizes stack traces generated by Chromium for Android.
Sample usage:
adb logcat chromium:V | symbolize.py
"""
import os
import re
import sys
from pylib import constants
# Uses symbol.py from third_party/android_platform, not python's.
sys.path.insert(0,
os.path.join(constants.DIR_SOURCE_ROO... |
"""This example updates the display name of a single custom targeting key.
To determine which custom targeting keys exist, run
get_all_custom_targeting_keys_and_values.py."""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
# Import appropriate modules from the client library.
from googleads import dfp... |
"""
Test cases for Collator
"""
import itertools
import numpy as np
from holoviews.core import Collator, HoloMap, NdOverlay, Overlay, GridSpace
from holoviews.element import Curve
from holoviews.element.comparison import ComparisonTestCase
class TestCollation(ComparisonTestCase):
def setUp(self):
alphas,... |
# -*- coding: utf-8 -*-
"Core blessed Terminal() tests."
# std
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import collections
import warnings
import platform
import locale
import sys
import imp
import os
# local
from .accessories import (
as_subprocess,
TestTerminal,... |
from __future__ import unicode_literals
from django.apps import apps
from django.db import models
from django.template import Context, Template
from django.test import TestCase, override_settings
from django.utils.encoding import force_text
from .models import (
Child1,
Child2,
Child3,
Child4,
Chi... |
from datetime import datetime
from os import listdir
import os.path
import pandas as pd
import pytz
import zipline
from zipline.finance.trading import with_environment
DATE_FORMAT = "%Y%m%d"
zipline_dir = os.path.dirname(zipline.__file__)
SECURITY_LISTS_DIR = os.path.join(zipline_dir, 'resources', 'security_lists')
... |
"""Signs and zipaligns APK.
"""
import optparse
import shutil
import sys
import tempfile
from util import build_utils
def SignApk(key_path, key_name, key_passwd, unsigned_path, signed_path):
shutil.copy(unsigned_path, signed_path)
sign_cmd = [
'jarsigner',
'-sigalg', 'MD5withRSA',
'-digestalg'... |
from django import template
from django.core.cache import cache
from django.template import Node, TemplateSyntaxError, Variable
register = template.Library()
class CacheNode(Node):
def __init__(self, nodelist, expire_time, key):
self.nodelist = nodelist
self.expire_time = Variable(expire_time)
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import itertools
import tempfile
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
callable_default_counter = itertools.count()
def callab... |
#! /usr/bin/python
# Joe Deller 2014
# Our first Minecraft program written in the Python language
# Level : Beginner
# Uses : Libraries
# When learning any programming language there is a tradition of writing
# your first program to simply say "Hello World!"
# The very first line of this program tells the Raspberr... |
from cinderclient import exceptions as cinder_exception
import mock
from nova import context
from nova import exception
from nova import test
from nova.volume import cinder
class FakeCinderClient(object):
class Volumes(object):
def get(self, volume_id):
return {'id': volume_id}
def l... |
import concurrent.futures
from . import Command
from itertools import chain
import logging
from ..utils import blue
logger = logging.getLogger("repose.command.install")
class Install(Command):
command = True
def _run(self, repoq, target):
repositories = {}
for repa in self.repa:
... |
# -*- coding: utf-8 -*-
from django.contrib.localflavor.se.forms import (SECountySelect,
SEOrganisationNumberField, SEPersonalIdentityNumberField,
SEPostalCodeField)
import datetime
from django.test import SimpleTestCase
class SELocalFlavorTests(SimpleTestCase):
def setUp(self):
# Mocking dateti... |
# -*- coding: utf-8 -*-
"""
flask.debughelpers
~~~~~~~~~~~~~~~~~~
Various helpers to make the development experience better.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from ._compat import implements_to_string
class UnexpectedUnicodeError(AssertionEr... |
import inspect
FILENAME = inspect.getfile(inspect.currentframe())
def _select(index):
import utils
#utils.DialogOK(str(index))
if index < 0:
return
import xbmc
import utils
view = 0
count = 10
while view < 1 and count > 0:
count -= 1
view ... |
#! /usr/bin/python
import os
import sys
import glob
import optparse
import tempfile
import logging
import shutil
import ConfigParser
class Fail(Exception):
def __init__(self, test, msg):
self.msg = msg
self.test = test
def getMsg(self):
return '\'%s\' - %s' % (self.test.path, self.msg)... |
"Tests for account creation"
import ddt
import unittest
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AnonymousUser
from django.utils.importlib import import_... |
import pytest
from flexmock import flexmock
from tgit.announcer import Announcer
pytestmark = pytest.mark.unit
class Listener(object):
def event_occurred(self, event):
pass
@pytest.fixture
def announcer():
return Announcer()
@pytest.fixture
def event():
return "event"
def test_announces_to... |
from django.conf import settings
from django.contrib.auth import models
from django.contrib.auth.decorators import login_required, permission_required
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.test import TestCase, override_settings
from django.test.client impo... |
"""Utilities for tf.data options."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def _internal_attr_name(name):
return "_" + name
class OptionsBase(object):
"""Base class for representing a set of tf.data options.
Attributes:
_options: Sto... |
"""Parser for IE index.dat files.
Note that this is a very naive and incomplete implementation and should be
replaced with a more intelligent one. Do not implement anything based on this
code, it is a placeholder for something real.
For anyone who wants a useful reference, see this:
http://heanet.dl.sourceforge.net/p... |
#!/usr/bin/env python
from nose.tools import *
import networkx
from networkx import *
from networkx.generators.degree_seq import *
from networkx.utils import uniform_sequence,powerlaw_sequence
def test_configuration_model_empty():
# empty graph has empty degree sequence
deg_seq=[]
G=configuration_model(deg... |
from mock import MagicMock, patch, mock_open, call
import unittest
import os
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from package.scripts.presto_worker import Worker
from package.scripts.params import memory_configs
class TestWorker(unittest.TestCase):
dummy_config_properties = ... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'CalibrationHistory', fields ['student_id', 'location']
db.create_unique('peer... |
from __future__ import unicode_literals
import unittest
import frappe
test_dependencies = ['Physician Schedule']
class TestPhysician(unittest.TestCase):
def tearDown(self):
frappe.delete_doc_if_exists('Physician', '_Testdoctor2', force=1)
def test_schedule_and_time(self):
physician = frappe.new_doc('Physician... |
"""Gnuplot -- A pipe-based interface to the gnuplot plotting program.
This is the main module of the Gnuplot package.
Written by "Michael Haggerty", mailto:<EMAIL> Inspired
by and partly derived from an earlier version by "Konrad Hinsen",
mailto:<EMAIL> If you find a problem or have a suggestion,
please "let me kno... |
import envi
import vivisect
import vivisect.parsers as v_parsers
from vivisect.const import *
def parseFd(vw, fd, filename=None):
fd.seek(0)
arch = vw.config.viv.parsers.blob.arch
bigend = vw.config.viv.parsers.blob.bigend
baseaddr = vw.config.viv.parsers.blob.baseaddr
try:
envi.getArchModu... |
"""
This package provides a front-end to various fast Fourier transform
implementations within PyCBC.
"""
import pycbc
import pycbc.scheme
# These are global variables, that are modified by the various scheme-
# dependent submodules, to maintain a list of all possible backends
# for all possible schemes that are ava... |
import urllib
from oslo.config import cfg
from webob import exc
from neutron.common import constants
from neutron.common import exceptions
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def get_filters(request, attr_info, skips=[]):
"""Extracts the filters from the reque... |
import BoostBuild
###############################################################################
#
# test_building_file_from_specific_project()
# ------------------------------------------
#
###############################################################################
def test_building_file_from_specific_project(... |
import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from scipy.stats import rankdata, tiecorrect
import pytest
class TestTieCorrect(object):
def test_empty(self):
"""An empty array requires no correction, should return 1.0."""
ranks = np.array([], dtype=np.float64)
... |
"""
call_metrics v0.01
a class function decorator which collects metrics (number of calls and total execution time)
Copyright 2012 Brian Monkaba
This file is part of ga-bitbot.
ga-bitbot is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published... |
from django.shortcuts import render, redirect, HttpResponse, get_object_or_404
from django.http import Http404
from django.http import HttpResponseNotFound
from django.views.generic import View
from django.views.generic import ListView
from django.views.generic.edit import FormView, ProcessFormView, CreateView
from ... |
import re
import urllib
import urllib.request
import json
import sys
import codecs
def search_doi(s):
url = "http://api.crossref.org/works/" + s
with urllib.request.urlopen(url) as htmlfile:
htmltext = htmlfile.read().decode('utf-8')
curdata = json.loads(htmltext)
print(htmltext)
return cur... |
#! /usr/bin/env python
# Released to the public domain, by Tim Peters, 03 October 2000.
"""reindent [-d][-r][-v] [ path ... ]
-d (--dryrun) Dry run. Analyze, but don't make any changes to, files.
-r (--recurse) Recurse. Search for all .py files in subdirectories too.
-n (--nobackup) No backup. Does not make a... |
"""
sentry.services.smtp
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import asyncore
import email
import logging
from smtpd import SMTPServer, SMTPChannel
from ... |
"""Tokenization help for Python programs.
generate_tokens(readline) is a generator that breaks a stream of
text into Python tokens. It accepts a readline-like method which is called
repeatedly to get the next line of input (or "" for EOF). It generates
5-tuples with these members:
the token type (see token.py)
... |
import os
wd = os.path.dirname(os.path.realpath(__file__))
def download(url, target):
os.system("wget {} -O {}".format(url, target))
if __name__ == "__main__":
base_url = "https://cloud.githubusercontent.com/assets/3307514/"
demo_list = {"20012566/cbb53c76-a27d-11e6-9aaa-91939c9a1cd5.jpg":"000001.jpg",
... |
from django.conf import settings
from django.utils.encoding import smart_bytes
from django.utils.functional import allow_lazy
from django.utils.http import urlencode
from django.utils.six import text_type
from django.utils.text import Truncator
from userena import settings as userena_settings
from userena.compat impor... |
import time
from importlib import import_module
from django.conf import settings
from django.contrib.sessions.backends.base import UpdateError
from django.core.exceptions import SuspiciousOperation
from django.utils.cache import patch_vary_headers
from django.utils.deprecation import MiddlewareMixin
from django.utils.... |
# -*- coding: utf-8 -*-
import os
import shutil
from mutagen.trueaudio import TrueAudio, delete
from mutagen.id3 import TIT1
from tests import TestCase, DATA_DIR
from tempfile import mkstemp
class TTrueAudio(TestCase):
def setUp(self):
self.audio = TrueAudio(os.path.join(DATA_DIR, "empty.tta"))
def... |
"""
This package defines miscellaneous units. They are also
available in the `astropy.units` namespace.
"""
from . import si
from astropy.constants import si as _si
from .core import (UnitBase, def_unit, si_prefixes, binary_prefixes,
set_enabled_units)
# To ensure si units of the constants can be ... |
import numpy as np
import preprocess as pp
import os
from random import randint
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import csv
def validate_model(embedding, emb_model_dir, emb_model_fn):
print("Start validation. Loading model. \n")
# load config
config = embedding.confi... |
"""
SnpSift dbNSFP datatypes
"""
import gzip
import logging
import os
import os.path
import sys
import traceback
from galaxy.datatypes.data import Text
from galaxy.datatypes.metadata import MetadataElement
log = logging.getLogger(__name__)
class SnpSiftDbNSFP( Text ):
"""Class describing a dbNSFP database prepa... |
from oslo_config import cfg
from nova.tests.functional.api_sample_tests import api_sample_base
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3):
ADMIN_API = True
e... |
"""
========================================
Interpolation (:mod:`scipy.interpolate`)
========================================
.. currentmodule:: scipy.interpolate
Sub-package for objects used in interpolation.
As listed below, this sub-package contains spline functions and classes,
one-dimensional and mul... |
import py
import sys
builtin_repr = repr
reprlib = py.builtin._tryimport('repr', 'reprlib')
class SafeRepr(reprlib.Repr):
""" subclass of repr.Repr that limits the resulting size of repr()
and includes information on exceptions raised during the call.
"""
def repr(self, x):
return self._c... |
from test.test_support import verbose, have_unicode, TestFailed, is_jython
import sys
# test string formatting operator (I am not sure if this is being tested
# elsewhere but, surely, some of the given cases are *not* tested because
# they crash python)
# test on unicode strings as well
overflowok = 1
def testformat... |
# A ScrolledList widget feels like a list widget but also has a
# vertical scroll bar on its right. (Later, options may be added to
# add a horizontal bar as well, to make the bars disappear
# automatically when not needed, to move them to the other side of the
# window, etc.)
#
# Configuration options are passed to t... |
#!/usr/bin/env python
"""Prepare and download l10ns."""
import urllib, urllib2
import shutil
import os
import zipfile
import json
import sys
import math
if len(sys.argv) != 2:
print ''
print 'ERROR:'
print ''
print 'Please supply a crowd in API key, obtained on this page:'
print 'http://translate.t... |
from GameResource import *
class GameTrigger(GameResource):
if Class:
MomentMiddle=0
MomentBegin=1
MomentEnd=2
defaults={"id":-1,"name":"noname","condition":"","momentOfChecking":MomentBegin,"constantName":""}
def __init__(self, gameFile, id):
GameResource.__init__(self, gameFile, id)
def ReadGmk(self, ... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'SocialToken.token'
db.alter_column('socialaccount_socialtoken', 'token', self.gf('django.... |
"""Test the Ruckus Unleashed config flow."""
from unittest.mock import patch
from pyruckus.exceptions import AuthenticationError
from homeassistant.components.ruckus_unleashed import (
API_AP,
API_DEVICE_NAME,
API_ID,
API_MAC,
API_MODEL,
API_SYSTEM_OVERVIEW,
API_VERSION,
DOMAIN,
MA... |
#!/usr/bin/env python
from __future__ import print_function
from statsmodels.compat.python import reduce
import sys
from os.path import dirname
def safe_version(module, attr='__version__'):
if not isinstance(attr, list):
attr = [attr]
try:
return reduce(getattr, [module] + attr)
except Att... |
"""
Uploader workflow tasks.
Those are the main/common tasks that the uploader will use, they are used
inside the workflows defined in :py:mod:`~invenio.modules.uploader.workflows`.
See: `Simple workflows for Python <https://pypi.python.org/pypi/workflow/1.0>`_
"""
import os
from invenio.base.globals import cfg
fro... |
{
'name': 'Base',
'version': '1.3',
'category': 'Hidden',
'description': """
The kernel of OpenERP, needed for all installation.
===================================================
""",
'author': 'OpenERP SA',
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': []... |
from sympy import sin, cos, symbols, pi, ImmutableMatrix as Matrix, \
simplify
from sympy.vector import (CoordSysCartesian, Vector, Dyadic,
DyadicAdd, DyadicMul, DyadicZero,
BaseDyadic, express)
A = CoordSysCartesian('A')
def test_dyadic():
a, b = symbols... |
#importing the libraries I want, an sqlite interface, a url requester, and an XML parsing library
import sqlite3, urllib2, bs4 as BeautifulSoup
#sudo apt-get install python-bs4
#That's how I was able to install the latest beautiful soup
#this bit I have to google search everytime.
con = sqlite3.connect('bgg.sqlite')
... |
#!/usr/bin/env python
from __future__ import print_function, absolute_import, unicode_literals
__all__ = ["run"]
__version__ = "0.0.4"
__author__ = "Dan Foreman-Mackey (<EMAIL>)"
__copyright__ = "Copyright 2013 Daniel Foreman-Mackey"
__contributors__ = []
import os
import re
import json
import shutil
import subproc... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
import pytest
from ansible.parsing import metadata as md
LICENSE = b"""# some license text boilerplate
# That we have at the top of files
"""
FUTURE_IMPORTS = b"""
from __future__ import (absolute_import, division, ... |
"""
Socket server forwarding request to internal server
"""
import logging
try:
# we prefer to use bundles asyncio version, otherwise fallback to trollius
import asyncio
except ImportError:
import trollius as asyncio
from opcua import ua
from opcua.server.uaprocessor import UaProcessor
logger = logging.g... |
# coding: utf-8
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 39
PATCH_VERSION = '0.dev0'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 4, 2)
REQUIRED_PYTHON_VER_WIN = (3, 5... |
import survey_email_compose_message |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsRasterBandComboBox.
.. 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 python2
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 8 16:54:36 2011
@author: ProfMobius
@version: v1.0
"""
import sys
import logging
import json
from optparse import OptionParser
from commands import Commands, SERVER
def main():
parser = OptionParser(version='MCP %s' % Commands.fullversion()... |
import os
import tempfile
from django.test import TestCase
from django.conf import settings
from oscar.core import customisation
VALID_FOLDER_PATH = 'tests/_site/apps'
class TestUtilities(TestCase):
def test_subfolder_extraction(self):
folders = list(customisation.subfolders('/var/www/eggs'))
... |
# -*- coding: utf-8 -*-
"""
pygments.styles.vim
~~~~~~~~~~~~~~~~~~~
A highlighting style for Pygments, inspired by vim.
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keywor... |
import random
def get_fridge_language(language):
if (language == "EN"):
return EnglishFridgeLanguage()
class FridgeLanguage:
def _init_(self):
random.seed()
def get_random_letter(self):
value = random.random() * 100
total = 0
for letter_frequency i... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'cond_format07.xlsx'
... |
"""
Contains the :py:class:`NodeStateManager` class, which is an abstraction layer
for storing and communicating the status of EC2_ nodes.
"""
import urllib2
import datetime
import boto
from twisted.internet import reactor
from media_nommer.conf import settings
from media_nommer.utils import logger
from media_nommer.ut... |
{
'name': 'Point of Sale',
'version': '1.0.1',
'category': 'Point Of Sale',
'sequence': 6,
'summary': 'Touchscreen Interface for Shops',
'description': """
Quick and Easy sale process
===========================
This module allows you to manage your shop sales very easily with a fully web based... |
# shamelessly copied from pliExpertInfo (Vali, Mirakels, Littlesat)
from enigma import iServiceInformation, iPlayableService
from Components.Converter.Converter import Converter
from Components.Element import cached
from Components.config import config
from Tools.Transponder import ConvertToHumanReadable, getChannelNu... |
"""Support for Supla cover - curtains, rollershutters, entry gate etc."""
import logging
from pprint import pformat
from homeassistant.components.cover import (
ATTR_POSITION,
DEVICE_CLASS_GARAGE,
CoverEntity,
)
from homeassistant.components.supla import SuplaChannel
_LOGGER = logging.getLogger(__name__)
... |
import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_kmeans, h2o_browse as h2b, h2o_import as h2i
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(1, java_heap_GB=14)
@... |
"""Tests for subunit.TestResultFilter."""
from datetime import datetime
from subunit import iso8601
import unittest
from testtools import TestCase
from testtools.compat import _b, BytesIO, StringIO
from testtools.testresult.doubles import ExtendedTestResult
import subunit
from subunit.test_results import TestResultF... |
#!/usr/bin/env python
'''
Generates dumpers for the i965 state strucutures using pygccxml.
Run as
PYTHONPATH=/path/to/pygccxml-1.0.0 python brw_structs_dump.py
Jose Fonseca <<EMAIL>>
'''
copyright = '''
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
... |
from django.contrib.auth import get_user, get_user_model
from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import ImproperlyConfigured
from django.db import IntegrityError
from django.http import HttpRequest
from django.test import TestCase, override_settings
from django.utils impor... |
import numpy as np
from numpy.testing import assert_equal, assert_raises, assert_almost_equal
from skimage.measure import LineModelND, CircleModel, EllipseModel, ransac
from skimage.transform import AffineTransform
from skimage.measure.fit import _dynamic_max_trials
from skimage._shared._warnings import expected_warnin... |
# coding=utf-8
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext as _
from discipline.models import Discipline
class Session(models.Model):
#pool = models.ForeignKey(Pool)
user = models.ForeignKey(User)
date = models.DateField(verbose_na... |
DATE_FORMAT = 'l, j F, Y'
TIME_FORMAT = 'h:i:s a'
DATETIME_FORMAT = 'j F, Y h:i:s a'
YEAR_MONTH_FORMAT = 'F, Y'
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'j.M.Y'
SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # (Monday)
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://d... |
from unittest import mock
from heat.db.sqlalchemy import api as db_api
from heat.engine import check_resource
from heat.engine import stack as parser
from heat.engine import template as templatem
from heat.engine import worker
from heat.objects import stack as stack_objects
from heat.rpc import worker_client as wc
fro... |
import unittest
try:
from unittest.mock import *
except ImportError:
from mock import *
from msgpack import *
from cvra_bootloader.read_config import main
from cvra_bootloader.commands import *
import sys
import json
class ReadConfigToolTestCase(unittest.TestCase):
@patch('cvra_bootloader.utils.write_c... |
#!/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-02-22 23:17:13
import os
import sys
import logging
logger = logging.getLogger("webui")
from six import reraise
from six.moves import builtins
from six.moves.urllib.parse import ... |
{
"name": "Product pricelist partnerinfo - Purchase extension",
"version": "1.0",
"depends": [
"product_pricelist_partnerinfo",
"purchase",
],
"author": "OdooMRP team, "
"AvanzOSC, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"website": "http://www.od... |
from requester import make_request
from precache import apicache
from config import *
import re
def get_error_code(error):
return int(re.findall("\d{3}",error)[0]) #Find the error code by regular expression
# return int(error[11:14]) #Ugly
def get_command(verb, subject):
commandlist = apicache.get(verb... |
import re
from datetime import date
from ctypes import c_char, c_char_p, c_double, c_int, c_ubyte, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON
from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope
from... |
from opus_core.resources import Resources
from opus_core.storage_factory import StorageFactory
class ResourceFactory(object):
""" Class for creating a Resource object.
"""
def get_resources_for_dataset(self,
dataset_name,
in_storage,
out_storage,
... |
import datetime
import os
import resource
import select
import subprocess
import sys
import time
from stress_test_utils import BigQueryHelper
from stress_test_utils import EventType
def run_server():
"""This is a wrapper around the interop server and performs the following:
1) Create a 'Summary table' in Big... |
"""Gradients for operators defined in linalg_ops.py.
Useful reference for derivative formulas is
An extended collection of matrix derivative results for forward and reverse
mode algorithmic differentiation by Mike Giles:
http://eprints.maths.ox.ac.uk/1079/1/NA-08-01.pdf
"""
from __future__ import absolute_import
from ... |
"""Provides methods needed by installation script for OpenStack development
virtual environments.
Since this script is used to bootstrap a virtualenv from the system's Python
environment, it should be kept strictly compatible with Python 2.6.
Synced in from openstack-common
"""
from __future__ import print_function
... |
"""BibFormat element - Print photos of the record (if bibdoc file)
"""
import cgi
from invenio.bibdocfile import BibRecDocs
from invenio.urlutils import create_html_link
def format(bfo, separator=" ", style='', img_style='', text_style='font-size:small', print_links='yes', max_photos='',
show_comment='yes'... |
# -*- coding: utf-8 -*-
import unittest
import StringIO
import sys
import re
from modules.view import View
class TestView(unittest.TestCase):
def setUp(self):
self.view = View()
def testPrintInfoExpectsArgument(self):
with self.assertRaises(TypeError):
self.view.print_line()
... |
#!/usr/bin/env python2.7
import sys, os
'''smoother more informative version check'''
if sys.version_info >= (3, 0, 0):
sys.exit("You need to run this with python 2.7, exiting now so you can get your stuff together")
'''Run from ../scripts/ with `python -m utils.openproject.update`'''
import json
from .. impor... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community',
}
DOCUMENTATION = r'''
---
module: bitbucket_pipeline_key_pair
short_description: Manages Bitbucket pipeline SSH key pai... |
import json
from django.http import HttpResponse
from haystack.generic_views import FacetedSearchView
from hs_core.discovery_form import DiscoveryForm
# View class for generating JSON data format from Haystack
# returned JSON objects array is used for building the map view
class DiscoveryJsonView(FacetedSearchView):
... |
import json
import os
import unittest
from jsc_view import GetEventByNameFromEvents
from api_schema_graph import APISchemaGraph
from availability_finder import AvailabilityFinder, AvailabilityInfo
from branch_utility import BranchUtility, ChannelInfo
from compiled_file_system import CompiledFileSystem
from extensions_... |
import email
import re
from typing import List, Optional, Tuple
def lore_link(message_id: str) -> str:
# We store message ids enclosed in <>, so trim those off.
return 'https://lore.kernel.org/linux-kselftest/' + message_id[1:-1]
class Message(object):
def __init__(self, id, subject, from_, in_reply_to, c... |
import unittest
from app_yaml_helper import AppYamlHelper
from extensions_paths import SERVER2
from host_file_system_provider import HostFileSystemProvider
from mock_file_system import MockFileSystem
from object_store_creator import ObjectStoreCreator
from test_file_system import MoveTo, TestFileSystem
from test_util ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.