text:
from copy import deepcopy

from django.test.testcases import TestCase

from djstripe.models import Coupon

from . import FAKE_COUPON

class TransferTest(TestCase):
    def test_retrieve_coupon(self):
        coupon_data = deepcopy(FAKE_COUPON)
        coupon = Coupon.sync_from_stripe_data(coupon_data)
        self.assertEqual(coupon.id, FAKE_COUPON["id"])

class HumanReadableCouponTest(TestCase):
    def test___str__(self):
        coupon = Coupon.objects.create(
            id="coupon-test-amount-off-forever",
            amount_off=10,
            currency="usd",
            duration="forever",
            name="Test coupon",
        )
        self.assertEqual(str(coupon), "Test coupon")

    def test_human_readable_usd_off_forever(self):
        coupon = Coupon.objects.create(
            id="coupon-test-amount-off-forever",
            amount_off=10,
            currency="usd",
            duration="forever",
        )
        self.assertEqual(coupon.human_readable, "$10.00 USD off forever")
        self.assertEqual(str(coupon), coupon.human_readable)

    def test_human_readable_eur_off_forever(self):
        coupon = Coupon.objects.create(
            id="coupon-test-amount-off-forever",
            amount_off=10,
            currency="eur",
            duration="forever",
        )
        self.assertEqual(coupon.human_readable, "€10.00 EUR off forever")
        self.assertEqual(str(coupon), coupon.human_readable)

    def test_human_readable_percent_off_forever(self):
        coupon = Coupon.objects.create(
            id="coupon-test-percent-off-forever",
            percent_off=10.25,
            currency="usd",
            duration="forever",
        )
        self.assertEqual(coupon.human_readable, "10.25% off forever")
        self.assertEqual(str(coupon), coupon.human_readable)

    def test_human_readable_percent_off_once(self):
        coupon = Coupon.objects.create(
            id="coupon-test-percent-off-once",
            percent_off=10.25,
            currency="usd",
            duration="once",
        )
        self.assertEqual(coupon.human_readable, "10.25% off once")
        self.assertEqual(str(coupon), coupon.human_readable)

    def test_human_readable_percent_off_one_month(self):
        coupon = Coupon.objects.create(
            id="coupon-test-percent-off-1month",
            percent_off=10.25,
            currency="usd",
            duration="repeating",
            duration_in_months=1,
        )
        self.assertEqual(coupon.human_readable, "10.25% off for 1 month")
        self.assertEqual(str(coupon), coupon.human_readable)

    def test_human_readable_percent_off_three_months(self):
        coupon = Coupon.objects.create(
            id="coupon-test-percent-off-3month",
            percent_off=10.25,
            currency="usd",
            duration="repeating",
            duration_in_months=3,
        )
        self.assertEqual(coupon.human_readable, "10.25% off for 3 months")
        self.assertEqual(str(coupon), coupon.human_readable)

    def test_human_readable_integer_percent_off_forever(self):
        coupon = Coupon.objects.create(
            id="coupon-test-percent-off-forever",
            percent_off=10,
            currency="usd",
            duration="forever",
        )
        self.assertEqual(coupon.human_readable, "10% off forever")
        self.assertEqual(str(coupon), coupon.human_readable)

def test_blank_coupon_str():
    coupon = Coupon()
    assert str(coupon).strip() == "(invalid amount) off"

redpajama_set_name: RedPajamaGithub


text:
class HSTaskRouter(object):

    def route_for_task(self, task, args=None, kwargs=None):

        if task == 'hs_core.tasks.check_doi_activation':
            return {
                'exchange': 'default',
                'exchange_type': 'topic',
                'routing_key': 'task.default',
            }

        return None


text:
#!/usr/common/bin/python

# apiutil.py
#
# This file defines a bunch of utility functions for OpenGL API code
# generation.

import sys, string, re

#======================================================================

def CopyrightC( ):
	print """
	"""

def CopyrightDef( ):
	print """; Copyright (c) 2001, Stanford University
	; All rights reserved.
	;
	; See the file LICENSE.txt for information on redistributing this software.
	"""

#======================================================================

class APIFunction:
	"""Class to represent a GL API function (name, return type,
	parameters, etc)."""
	def __init__(self):
		self.name = ''
		self.returnType = ''
		self.category = ''
		self.offset = -1
		self.alias = ''
		self.vectoralias = ''
		self.params = []
		self.paramlist = []
		self.paramvec = []
		self.paramaction = []
		self.paramprop = []
		self.paramset = []
		self.props = []
		self.chromium = []
		self.chrelopcode = -1

def ProcessSpecFile(filename, userFunc):
	"""Open the named API spec file and call userFunc(record) for each record
	processed."""
	specFile = open(filename, "r")
	if not specFile:
		print "Error: couldn't open %s file!" % filename
		sys.exit()

	record = APIFunction()

	for line in specFile.readlines():

		# split line into tokens
		tokens = string.split(line)

		if len(tokens) > 0 and line[0] != '#':

			if tokens[0] == 'name':
				if record.name != '':
					# process the function now
					userFunc(record)
					# reset the record
					record = APIFunction()

				record.name = tokens[1]

			elif tokens[0] == 'return':
				record.returnType = string.join(tokens[1:], ' ')

			elif tokens[0] == 'param':
				name = tokens[1]
				type = string.join(tokens[2:], ' ')
				vecSize = 0
				record.params.append((name, type, vecSize))

			elif tokens[0] == 'paramprop':
				name = tokens[1]
				str = tokens[2:]
				enums = []
				for i in range(len(str)):
					enums.append(str[i])
				record.paramprop.append((name, enums))

			elif tokens[0] == 'paramlist':
				name = tokens[1]
				str = tokens[2:]
				list = []
				for i in range(len(str)):
					list.append(str[i])
				record.paramlist.append((name,list))

			elif tokens[0] == 'paramvec':
				name = tokens[1]
				str = tokens[2:]
				vec = []
				for i in range(len(str)):
					vec.append(str[i])
				record.paramvec.append((name,vec))

			elif tokens[0] == 'paramset':
				line = tokens[1:]
				result = []
				for i in range(len(line)):
					tset = line[i]
					if tset == '[':
						nlist = []
					elif tset == ']':
						result.append(nlist)
						nlist = []
					else:
						nlist.append(tset)
				if result != []:
					record.paramset.append(result)

			elif tokens[0] == 'paramaction':
				name = tokens[1]
				str = tokens[2:]
				list = []
				for i in range(len(str)):
					list.append(str[i])
				record.paramaction.append((name,list))

			elif tokens[0] == 'category':
				record.category = tokens[1]

			elif tokens[0] == 'offset':
				if tokens[1] == '?':
					record.offset = -2
				else:
					record.offset = int(tokens[1])

			elif tokens[0] == 'alias':
				record.alias = tokens[1]

			elif tokens[0] == 'vectoralias':
				record.vectoralias = tokens[1]

			elif tokens[0] == 'props':
				record.props = tokens[1:]

			elif tokens[0] == 'chromium':
				record.chromium = tokens[1:]

			elif tokens[0] == 'vector':
				vecName = tokens[1]
				vecSize = int(tokens[2])
				for i in range(len(record.params)):
					(name, type, oldSize) = record.params[i]
					if name == vecName:
						record.params[i] = (name, type, vecSize)
						break

			elif tokens[0] == 'chrelopcode':
				record.chrelopcode = int(tokens[1])

			else:
				print 'Invalid token %s after function %s' % (tokens[0], record.name)
			#endif
		#endif
	#endfor
	specFile.close()
#enddef

# Dictionary [name] of APIFunction:
__FunctionDict = {}

# Dictionary [name] of name
__VectorVersion = {}

# Reverse mapping of function name aliases
__ReverseAliases = {}

def AddFunction(record):
	assert not __FunctionDict.has_key(record.name)
	#if not "omit" in record.chromium:
	__FunctionDict[record.name] = record

def GetFunctionDict(specFile = ""):
	if not specFile:
		specFile = sys.argv[1]+"/APIspec.txt"
	if len(__FunctionDict) == 0:
		ProcessSpecFile(specFile, AddFunction)
		# Look for vector aliased functions
		for func in __FunctionDict.keys():
			va = __FunctionDict[func].vectoralias
			if va != '':
				__VectorVersion[va] = func
			#endif

			# and look for regular aliases (for glloader)
			a = __FunctionDict[func].alias
			if a:
				__ReverseAliases[a] = func
			#endif
		#endfor
	#endif
	return __FunctionDict

def GetAllFunctions(specFile = ""):
	"""Return sorted list of all functions known to Chromium."""
	d = GetFunctionDict(specFile)
	funcs = []
	for func in d.keys():
		rec = d[func]
		if not "omit" in rec.chromium:
			funcs.append(func)
	funcs.sort()
	return funcs

def GetAllFunctionsAndOmittedAliases(specFile = ""):
	"""Return sorted list of all functions known to Chromium."""
	d = GetFunctionDict(specFile)
	funcs = []
	for func in d.keys():
		rec = d[func]
		if (not "omit" in rec.chromium or
			rec.alias != ''):
			funcs.append(func)
	funcs.sort()
	return funcs

def GetDispatchedFunctions(specFile = ""):
	"""Return sorted list of all functions handled by SPU dispatch table."""
	d = GetFunctionDict(specFile)
	funcs = []
	for func in d.keys():
		rec = d[func]
		if (not "omit" in rec.chromium and
			not "stub" in rec.chromium and
			rec.alias == ''):
			funcs.append(func)
	funcs.sort()
	return funcs

#======================================================================

def ReturnType(funcName):
	"""Return the C return type of named function.
	Examples: "void" or "const GLubyte *". """
	d = GetFunctionDict()
	return d[funcName].returnType

def Parameters(funcName):
	"""Return list of tuples (name, type, vecSize) of function parameters.
	Example: if funcName=="ClipPlane" return
	[ ("plane", "GLenum", 0), ("equation", "const GLdouble *", 4) ] """
	d = GetFunctionDict()
	return d[funcName].params

def ParamAction(funcName):
	"""Return list of names of actions for testing.
	For PackerTest only."""
	d = GetFunctionDict()
	return d[funcName].paramaction

def ParamList(funcName):
	"""Return list of tuples (name, list of values) of function parameters.
	For PackerTest only."""
	d = GetFunctionDict()
	return d[funcName].paramlist

def ParamVec(funcName):
	"""Return list of tuples (name, vector of values) of function parameters.
	For PackerTest only."""
	d = GetFunctionDict()
	return d[funcName].paramvec

def ParamSet(funcName):
	"""Return list of tuples (name, list of values) of function parameters.
	For PackerTest only."""
	d = GetFunctionDict()
	return d[funcName].paramset

def Properties(funcName):
	"""Return list of properties of the named GL function."""
	d = GetFunctionDict()
	return d[funcName].props

def AllWithProperty(property):
	"""Return list of functions that have the named property."""
	funcs = []
	for funcName in GetDispatchedFunctions():
		if property in Properties(funcName):
			funcs.append(funcName)
	return funcs

def Category(funcName):
	"""Return the category of the named GL function."""
	d = GetFunctionDict()
	return d[funcName].category

def ChromiumProps(funcName):
	"""Return list of Chromium-specific properties of the named GL function."""
	d = GetFunctionDict()
	return d[funcName].chromium

def ChromiumRelOpCode(funcName):
	"""Return list of Chromium-specific properties of the named GL function."""
	d = GetFunctionDict()
	return d[funcName].chrelopcode

def ParamProps(funcName):
	"""Return list of Parameter-specific properties of the named GL function."""
	d = GetFunctionDict()
	return d[funcName].paramprop

def Alias(funcName):
	"""Return the function that the named function is an alias of.
	Ex: Alias('DrawArraysEXT') = 'DrawArrays'.
	"""
	d = GetFunctionDict()
	return d[funcName].alias

def ReverseAlias(funcName):
	"""Like Alias(), but the inverse."""
	d = GetFunctionDict()
	if funcName in __ReverseAliases.keys():
		return __ReverseAliases[funcName]
	else:
		return ''

def NonVectorFunction(funcName):
	"""Return the non-vector version of the given function, or ''.
	For example: NonVectorFunction("Color3fv") = "Color3f"."""
	d = GetFunctionDict()
	return d[funcName].vectoralias

def VectorFunction(funcName):
	"""Return the vector version of the given non-vector-valued function,
	or ''.
	For example: VectorVersion("Color3f") = "Color3fv"."""
	d = GetFunctionDict()
	if funcName in __VectorVersion.keys():
		return __VectorVersion[funcName]
	else:
		return ''

def GetCategoryWrapper(func_name):
	"""Return a C preprocessor token to test in order to wrap code.
	This handles extensions.
	Example: GetTestWrapper("glActiveTextureARB") = "CR_multitexture"
	Example: GetTestWrapper("glBegin") = ""
	"""
	cat = Category(func_name)
	if (cat == "1.0" or
		cat == "1.1" or
		cat == "1.2" or
		cat == "Chromium" or
		cat == "GL_chromium" or
		cat == "VBox"):
		return ''
	elif (cat == '1.3' or
		  cat == '1.4' or
		  cat == '1.5' or
		  cat == '2.0' or
		  cat == '2.1'):
		# i.e. OpenGL 1.3 or 1.4 or 1.5
		return "OPENGL_VERSION_" + string.replace(cat, ".", "_")
	else:
		assert cat != ''
		return string.replace(cat, "GL_", "")

def CanCompile(funcName):
	"""Return 1 if the function can be compiled into display lists, else 0."""
	props = Properties(funcName)
	if ("nolist" in props or
		"get" in props or
		"setclient" in props):
		return 0
	else:
		return 1

def HasChromiumProperty(funcName, propertyList):
	"""Return 1 if the function or any alias has any property in the
	propertyList"""
	for funcAlias in [funcName, NonVectorFunction(funcName), VectorFunction(funcName)]:
		if funcAlias:
			props = ChromiumProps(funcAlias)
			for p in propertyList:
				if p in props:
					return 1
	return 0

def CanPack(funcName):
	"""Return 1 if the function can be packed, else 0."""
	return HasChromiumProperty(funcName, ['pack', 'extpack', 'expandpack'])

def HasPackOpcode(funcName):
	"""Return 1 if the function has a true pack opcode"""
	return HasChromiumProperty(funcName, ['pack', 'extpack'])

def SetsState(funcName):
	"""Return 1 if the function sets server-side state, else 0."""
	props = Properties(funcName)

	# Exceptions.  The first set of these functions *do* have
	# server-side state-changing  effects, but will be missed
	# by the general query, because they either render (e.g.
	# Bitmap) or do not compile into display lists (e.g. all the others).
	#
	# The second set do *not* have server-side state-changing
	# effects, despite the fact that they do not render
	# and can be compiled.  They are control functions
	# that are not trackable via state.
	if funcName in ['Bitmap', 'DeleteTextures', 'FeedbackBuffer',
		'RenderMode', 'BindBufferARB', 'DeleteFencesNV']:
		return 1
	elif funcName in ['ExecuteProgramNV']:
		return 0

	# All compilable functions that do not render and that do
	# not set or use client-side state (e.g. DrawArrays, et al.), set
	# server-side state.
	if CanCompile(funcName) and "render" not in props and "useclient" not in props and "setclient" not in props:
		return 1

	# All others don't set server-side state.
	return 0

def SetsClientState(funcName):
	"""Return 1 if the function sets client-side state, else 0."""
	props = Properties(funcName)
	if "setclient" in props:
		return 1
	return 0

def SetsTrackedState(funcName):
	"""Return 1 if the function sets state that is tracked by
	the state tracker, else 0."""
	# These functions set state, but aren't tracked by the state
	# tracker for various reasons:
	# - because the state tracker doesn't manage display lists
	#   (e.g. CallList and CallLists)
	# - because the client doesn't have information about what
	#   the server supports, so the function has to go to the
	#   server (e.g. CompressedTexImage calls)
	# - because they require a round-trip to the server (e.g.
	#   the CopyTexImage calls, SetFenceNV, TrackMatrixNV)
	if funcName in [
		'CopyTexImage1D', 'CopyTexImage2D',
		'CopyTexSubImage1D', 'CopyTexSubImage2D', 'CopyTexSubImage3D',
		'CallList', 'CallLists',
		'CompressedTexImage1DARB', 'CompressedTexSubImage1DARB',
		'CompressedTexImage2DARB', 'CompressedTexSubImage2DARB',
		'CompressedTexImage3DARB', 'CompressedTexSubImage3DARB',
		'SetFenceNV'
		]:
		return 0

	# Anything else that affects client-side state is trackable.
	if SetsClientState(funcName):
		return 1

	# Anything else that doesn't set state at all is certainly
	# not trackable.
	if not SetsState(funcName):
		return 0

	# Per-vertex state isn't tracked the way other state is
	# tracked, so it is specifically excluded.
	if "pervertex" in Properties(funcName):
		return 0

	# Everything else is fine
	return 1

def UsesClientState(funcName):
	"""Return 1 if the function uses client-side state, else 0."""
	props = Properties(funcName)
	if "pixelstore" in props or "useclient" in props:
		return 1
	return 0

def IsQuery(funcName):
	"""Return 1 if the function returns information to the user, else 0."""
	props = Properties(funcName)
	if "get" in props:
		return 1
	return 0

def FuncGetsState(funcName):
	"""Return 1 if the function gets GL state, else 0."""
	d = GetFunctionDict()
	props = Properties(funcName)
	if "get" in props:
		return 1
	else:
		return 0

def IsPointer(dataType):
	"""Determine if the datatype is a pointer.  Return 1 or 0."""
	if string.find(dataType, "*") == -1:
		return 0
	else:
		return 1

def PointerType(pointerType):
	"""Return the type of a pointer.
	Ex: PointerType('const GLubyte *') = 'GLubyte'
	"""
	t = string.split(pointerType, ' ')
	if t[0] == "const":
		t[0] = t[1]
	return t[0]

def OpcodeName(funcName):
	"""Return the C token for the opcode for the given function."""
	return "CR_" + string.upper(funcName) + "_OPCODE"

def ExtendedOpcodeName(funcName):
	"""Return the C token for the extended opcode for the given function."""
	return "CR_" + string.upper(funcName) + "_EXTEND_OPCODE"

#======================================================================

def MakeCallString(params):
	"""Given a list of (name, type, vectorSize) parameters, make a C-style
	formal parameter string.
	Ex return: 'index, x, y, z'.
	"""
	result = ''
	i = 1
	n = len(params)
	for (name, type, vecSize) in params:
		result += name
		if i < n:
			result = result + ', '
		i += 1
	#endfor
	return result
#enddef

def MakeDeclarationString(params):
	"""Given a list of (name, type, vectorSize) parameters, make a C-style
	parameter declaration string.
	Ex return: 'GLuint index, GLfloat x, GLfloat y, GLfloat z'.
	"""
	n = len(params)
	if n == 0:
		return 'void'
	else:
		result = ''
		i = 1
		for (name, type, vecSize) in params:
			result = result + type + ' ' + name
			if i < n:
				result = result + ', '
			i += 1
		#endfor
		return result
	#endif
#enddef

def MakeDeclarationStringWithContext(ctx_macro_prefix, params):
	"""Same as MakeDeclarationString, but adds a context macro
	"""

	n = len(params)
	if n == 0:
		return ctx_macro_prefix + '_ARGSINGLEDECL'
	else:
		result = MakeDeclarationString(params)
		return ctx_macro_prefix + '_ARGDECL ' + result
	#endif
#enddef

def MakePrototypeString(params):
	"""Given a list of (name, type, vectorSize) parameters, make a C-style
	parameter prototype string (types only).
	Ex return: 'GLuint, GLfloat, GLfloat, GLfloat'.
	"""
	n = len(params)
	if n == 0:
		return 'void'
	else:
		result = ''
		i = 1
		for (name, type, vecSize) in params:
			result = result + type
			# see if we need a comma separator
			if i < n:
				result = result + ', '
			i += 1
		#endfor
		return result
	#endif
#enddef

#======================================================================

__lengths = {
	'GLbyte': 1,
	'GLubyte': 1,
	'GLshort': 2,
	'GLushort': 2,
	'GLint': 4,
	'GLuint': 4,
	'GLfloat': 4,
	'GLclampf': 4,
	'GLdouble': 8,
	'GLclampd': 8,
	'GLenum': 4,
	'GLboolean': 1,
	'GLsizei': 4,
	'GLbitfield': 4,
	'void': 0,  # XXX why?
	'int': 4,
	'GLintptrARB': 4,   # XXX or 8 bytes?
	'GLsizeiptrARB': 4, # XXX or 8 bytes?
	'VBoxGLhandleARB': 4,
	'GLcharARB': 1,
	'uintptr_t': 4
}

def sizeof(type):
	"""Return size of C datatype, in bytes."""
	if not type in __lengths.keys():
		print >>sys.stderr, "%s not in lengths!" % type
	return __lengths[type]

#======================================================================
align_types = 1

def FixAlignment( pos, alignment ):
	# if we want double-alignment take word-alignment instead,
	# yes, this is super-lame, but we know what we are doing
	if alignment > 4:
		alignment = 4
	if align_types and alignment and ( pos % alignment ):
		pos += alignment - ( pos % alignment )
	return pos

def WordAlign( pos ):
	return FixAlignment( pos, 4 )

def PointerSize():
	return 8 # Leave room for a 64 bit pointer

def PacketLength( params ):
	len = 0
	for (name, type, vecSize) in params:
		if IsPointer(type):
			size = PointerSize()
		else:
			assert string.find(type, "const") == -1
			size = sizeof(type)
		len = FixAlignment( len, size ) + size
	len = WordAlign( len )
	return len

#======================================================================

__specials = {}

def LoadSpecials( filename ):
	table = {}
	try:
		f = open( filename, "r" )
	except:
#		try:
		f = open( sys.argv[2]+"/"+filename, "r")
#		except:
#			__specials[filename] = {}
#			print "%s not present" % filename
#			return {}

	for line in f.readlines():
		line = string.strip(line)
		if line == "" or line[0] == '#':
			continue
		table[line] = 1

	__specials[filename] = table
	return table

def FindSpecial( table_file, glName ):
	table = {}
	filename = table_file + "_special"
	try:
		table = __specials[filename]
	except KeyError:
		table = LoadSpecials( filename )

	try:
		if (table[glName] == 1):
			return 1
		else:
			return 0 #should never happen
	except KeyError:
		return 0

def AllSpecials( table_file ):
	table = {}
	filename = table_file + "_special"
	try:
		table = __specials[filename]
	except KeyError:
		table = LoadSpecials( filename )

	keys = table.keys()
	keys.sort()
	return keys

def AllSpecials( table_file ):
	filename = table_file + "_special"
	table = {}
	try:
		table = __specials[filename]
	except KeyError:
		table = LoadSpecials(filename)

	ret = table.keys()
	ret.sort()
	return ret

def NumSpecials( table_file ):
	filename = table_file + "_special"
	table = {}
	try:
		table = __specials[filename]
	except KeyError:
		table = LoadSpecials(filename)
	return len(table.keys())

def PrintRecord(record):
	argList = MakeDeclarationString(record.params)
	if record.category == "Chromium":
		prefix = "cr"
	else:
		prefix = "gl"
	print '%s %s%s(%s);' % (record.returnType, prefix, record.name, argList )
	if len(record.props) > 0:
		print '   /* %s */' % string.join(record.props, ' ')

#ProcessSpecFile("APIspec.txt", PrintRecord)


text:
import argparse
import ConfigParser

import json
import copy
from netaddr import IPNetwork

from vnc_api.vnc_api import *

def get_ip(ip_w_pfx):
    return str(IPNetwork(ip_w_pfx).ip)
# end get_ip

class VncProvisioner(object):

    def __init__(self, args_str=None):
        self._args = None
        if not args_str:
            args_str = ' '.join(sys.argv[1:])
        self._parse_args(args_str)

        self._vnc_lib = VncApi(self._args.admin_user,
                               self._args.admin_password,
                               self._args.admin_tenant_name,
                               self._args.api_server_ip,
                               self._args.api_server_port, '/')
        vnc_lib = self._vnc_lib

        if self._args.op is None or self._args.op == 'add_basic':
            router_external = False
            if self._args.public_vrf_test is not None and self._args.public_vrf_test == 'True':
                router_external = True
            vxlan = None
            if self._args.vxlan is not None:
                vxlan = self._args.vxlan
            self.add_physical_router_config(router_external, vxlan)
        elif self._args.op == 'delete_basic':
            print 'calling delete_physical_router_config\n'
            self.delete_physical_router_config()
        elif self._args.op == 'delete_fip_test':
            print 'calling delete_physical_router_config: fip_test\n'
            self.delete_bms_config()
        elif self._args.op == 'fip_test':
            print 'calling add_physical_router_config: fip_test\n'
            self.add_bms_config()
    # end __init__

    def _get_ip_fabric_ri_obj(self):
        # TODO pick fqname hardcode from common
        rt_inst_obj = self._vnc_lib.routing_instance_read(
            fq_name=['default-domain', 'default-project',
                     'ip-fabric', '__default__'])

        return rt_inst_obj
    # end _get_ip_fabric_ri_obj

    def create_router(self, name, mgmt_ip):
        bgp_router = BgpRouter(name, parent_obj=self._get_ip_fabric_ri_obj())
        params = BgpRouterParams()
        params.address = mgmt_ip
        params.address_families = AddressFamilies(['route-target', 'inet-vpn', 'e-vpn',
                                             'inet6-vpn'])
        params.autonomous_system = 64512
        params.vendor = 'mx'
        params.identifier = mgmt_ip
        bgp_router.set_bgp_router_parameters(params)
        self._vnc_lib.bgp_router_create(bgp_router)

        pr = PhysicalRouter(name)
        pr.physical_router_management_ip = mgmt_ip
        pr.physical_router_vendor_name = 'juniper'
        pr.physical_router_product_name = 'mx'
        pr.physical_router_vnc_managed = True
        uc = UserCredentials('root', 'Embe1mpls')
        pr.set_physical_router_user_credentials(uc)
        pr.set_bgp_router(bgp_router)
        pr_id = self._vnc_lib.physical_router_create(pr)
        return bgp_router, pr

    def add_physical_router_config(self, router_external = False, vxlan = None):

        ipam_obj = None
        try:
            ipam_obj = self._vnc_lib.network_ipam_read(fq_name=[u'default-domain', u'default-project', u'ipam1'])
        except NoIdError:
            pass
        if ipam_obj is None:
            ipam_obj = NetworkIpam('ipam1')
            self._vnc_lib.network_ipam_create(ipam_obj)

        vn1_obj = None
        try:
            vn1_obj = self._vnc_lib.virtual_network_read(fq_name=[u'default-domain', u'default-project', u'vn1'])
        except NoIdError:
            pass

        if vn1_obj is None:
            vn1_obj = VirtualNetwork('vn1')
            if router_external == True:
                vn1_obj.set_router_external(True)

            if vxlan is not None:
                vn1_obj_properties = VirtualNetworkType()
                vn1_obj_properties.set_vxlan_network_identifier(int(vxlan))
                vn1_obj.set_virtual_network_properties(vn1_obj_properties)

            vn1_obj.add_network_ipam(ipam_obj, VnSubnetsType([IpamSubnetType(SubnetType("10.0.0.0", 24))]))
            vn1_uuid = self._vnc_lib.virtual_network_create(vn1_obj)

        pr = None
        try:
            pr = self._vnc_lib.physical_router_read(fq_name=[u'default-global-system-config', u'a7-mx-80'])
        except NoIdError:
            pass

        if pr is None:
            bgp_router, pr = self.create_router('a7-mx-80', '10.84.63.133')
            pr.set_virtual_network(vn1_obj)
            self._vnc_lib.physical_router_update(pr)

        pi = None
        try:
            pi = self._vnc_lib.physical_interface_read(fq_name=[u'default-global-system-config', u'a7-mx-80', u'ge-1/0/5'])
        except NoIdError:
            pass
        if pi is None:
            pi = PhysicalInterface('ge-1/0/5', parent_obj = pr)
            pi_id = self._vnc_lib.physical_interface_create(pi)

        fq_name = ['default-domain', 'default-project', 'vmi1']
        default_project = self._vnc_lib.project_read(fq_name=[u'default-domain', u'default-project'])
        vmi = None
        try:
            vmi = self._vnc_lib.virtual_machine_interface_read(fq_name=[u'default-domain', u'default-project', u'vmi1'])
        except NoIdError:
            pass
        if vmi is None:
            vmi = VirtualMachineInterface(fq_name=fq_name, parent_type='project')
            vmi.set_virtual_network(vn1_obj)
            self._vnc_lib.virtual_machine_interface_create(vmi)

        li = None
        try:
            li = self._vnc_lib.logical_interface_read(fq_name=[u'default-global-system-config', u'a7-mx-80', u'ge-1/0/5', u'ge-1/0/5.0'])
        except NoIdError:
            pass

        if li is None:
            li = LogicalInterface('ge-1/0/5.0', parent_obj = pi)
            li.vlan_tag = 100
            li.set_virtual_machine_interface(vmi)
            li_id = self._vnc_lib.logical_interface_create(li)

    # end

    def delete_physical_router_config(self):

        print 'delete_physical_router_config\n'
        li = None
        try:
            li = self._vnc_lib.logical_interface_read(fq_name=[u'default-global-system-config', u'a7-mx-80', u'ge-1/0/5', u'ge-1/0/5.0'])
        except NoIdError:
            pass

        if li is not None:
            self._vnc_lib.logical_interface_delete(li.get_fq_name())

        vmi = None
        try:
            vmi = self._vnc_lib.virtual_machine_interface_read(fq_name=[u'default-domain', u'default-project', u'vmi1'])
        except NoIdError:
            pass
        if vmi is not None:
            self._vnc_lib.virtual_machine_interface_delete(vmi.get_fq_name())

        pi = None
        try:
            pi = self._vnc_lib.physical_interface_read(fq_name=[u'default-global-system-config', u'a7-mx-80', u'ge-1/0/5'])
        except NoIdError:
            pass
        if pi is not None:
            pi_id = self._vnc_lib.physical_interface_delete(pi.get_fq_name())

        pr = None
        try:
            pr = self._vnc_lib.physical_router_read(fq_name=[u'default-global-system-config', u'a7-mx-80'])
        except NoIdError:
            pass

        if pr is not None:
            self._vnc_lib.physical_router_delete(pr.get_fq_name())

        br = None
        try:
            br = self._vnc_lib.bgp_router_read(fq_name=[u'default-domain', u'default-project', u'ip-fabric', u'__default__', u'a7-mx-80'])
        except NoIdError:
            pass

        if br is not None:
            self._vnc_lib.bgp_router_delete(br.get_fq_name())

        vn1_obj = None
        try:
            vn1_obj = self._vnc_lib.virtual_network_read(fq_name=[u'default-domain', u'default-project', u'vn1'])
        except NoIdError:
            pass

        if vn1_obj is not None:
            vn1_uuid = self._vnc_lib.virtual_network_delete(vn1_obj.get_fq_name())

        ipam_obj = None
        try:
            ipam_obj = self._vnc_lib.network_ipam_read(fq_name=[u'default-domain', u'default-project', u'ipam1'])
        except NoIdError:
            pass
        if ipam_obj is not None:
            self._vnc_lib.network_ipam_delete(ipam_obj.get_fq_name())

    # end

    #python provision_physical_router.py --api_server_ip 127.0.0.1 --api_server_port 8082 --admin_user admin --admin_password c0ntrail123 --admin_tenant_name default-domain --op delete_fip_test
    def delete_bms_config(self):

        pr = None
        try:
            pr = self._vnc_lib.physical_router_read(fq_name=[u'default-global-system-config', u'a2-mx-80'])
        except NoIdError:
            pass

        if pr is not None:
            self._vnc_lib.physical_router_delete(pr.get_fq_name())

        br = None
        try:
            br = self._vnc_lib.bgp_router_read(fq_name=[u'default-domain', u'default-project', u'ip-fabric', u'__default__', u'a2-mx-80'])
        except NoIdError:
            pass

        if br is not None:
            self._vnc_lib.bgp_router_delete(br.get_fq_name())

        #TOR
        li = None
        try:
            li = self._vnc_lib.logical_interface_read(fq_name=[u'default-global-system-config', u'qfx-1', u'xe-0/0/0', u'xe-0/0/0.0'])
        except NoIdError:
            pass
        if li is not None:
            li_id = self._vnc_lib.logical_interface_delete(li.get_fq_name())

        ip_obj1 = None
        try:
            ip_obj1 = self._vnc_lib.instance_ip_read(fq_name=[u'inst-ip-1'])
        except NoIdError:
            pass

        if ip_obj1 is not None:
            self._vnc_lib.instance_ip_delete(ip_obj1.get_fq_name())

        fip_obj = None
        try:
            fip_obj = self._vnc_lib.floating_ip_read(fq_name=[u'default-domain', u'default-project', u'vn-public', u'vn_public_fip_pool', u'fip-1'])
        except NoIdError:
            pass

        if fip_obj is not None:
            self._vnc_lib.floating_ip_delete(fip_obj.get_fq_name())

        fip_pool = None
        try:
            fip_pool = self._vnc_lib.floating_ip_pool_read(fq_name=[u'default-domain', u'default-project', u'vn-public', u'vn_public_fip_pool'])
        except NoIdError:
            pass

        if fip_pool is not None:
            self._vnc_lib.floating_ip_pool_delete(fip_pool.get_fq_name())

        pi_tor = None
        try:
            pi_tor = self._vnc_lib.physical_interface_read(fq_name=[u'default-global-system-config', u'qfx-1', u'xe-0/0/0'])
        except NoIdError:
            pass
        if pi_tor is not None:
            pi_tor_id = self._vnc_lib.physical_interface_delete(pi_tor.get_fq_name())

        vmi = None
        try:
            vmi = self._vnc_lib.virtual_machine_interface_read(fq_name=[u'default-domain', u'default-project', u'vmi1'])
        except NoIdError:
            pass
        if vmi is not None:
            self._vnc_lib.virtual_machine_interface_delete(vmi.get_fq_name())

        pr_tor = None
        try:
            pr_tor = self._vnc_lib.physical_router_read(fq_name=[u'default-global-system-config', u'qfx-1'])
        except NoIdError:
            pass
        if pr_tor is not None:
            self._vnc_lib.physical_router_delete(pr_tor.get_fq_name())

        br = None
        try:
            br = self._vnc_lib.bgp_router_read(fq_name=[u'default-domain', u'default-project', u'ip-fabric', u'__default__', u'qfx-1'])
        except NoIdError:
            pass

        if br is not None:
            self._vnc_lib.bgp_router_delete(br.get_fq_name())

        vn2_obj = None
        try:
            vn2_obj = self._vnc_lib.virtual_network_read(fq_name=[u'default-domain', u'default-project', u'vn-public'])
        except NoIdError:
            pass

        if vn2_obj is not None:
            self._vnc_lib.virtual_network_delete(vn2_obj.get_fq_name())

        ipam2_obj = None
        try:
            ipam2_obj = self._vnc_lib.network_ipam_read(fq_name=[u'default-domain', u'default-project', u'ipam2'])
        except NoIdError:
            pass
        if ipam2_obj is not None:
            self._vnc_lib.network_ipam_delete(ipam2_obj.get_fq_name())

        vn1_obj = None
        try:
            vn1_obj = self._vnc_lib.virtual_network_read(fq_name=[u'default-domain', u'default-project', u'vn-private'])
        except NoIdError:
            pass

        if vn1_obj is not None:
            vn1_uuid = self._vnc_lib.virtual_network_delete(vn1_obj.get_fq_name())

        ipam_obj = None
        try:
            ipam_obj = self._vnc_lib.network_ipam_read(fq_name=[u'default-domain', u'default-project', u'ipam1'])
        except NoIdError:
            pass
        if ipam_obj is not None:
            self._vnc_lib.network_ipam_delete(ipam_obj.get_fq_name())

    # end

    # python provision_physical_router.py --api_server_ip 127.0.0.1 --api_server_port 8082 --admin_user admin --admin_password c0ntrail123 --admin_tenant_name default-domain --op fip_test
    def add_bms_config(self):

        ipam_obj = None
        try:
            ipam_obj = self._vnc_lib.network_ipam_read(fq_name=[u'default-domain', u'default-project', u'ipam1'])
        except NoIdError:
            pass
        if ipam_obj is None:
            ipam_obj = NetworkIpam('ipam1')
            self._vnc_lib.network_ipam_create(ipam_obj)

        vn1_obj = None
        try:
            vn1_obj = self._vnc_lib.virtual_network_read(fq_name=[u'default-domain', u'default-project', u'vn-private'])
        except NoIdError:
            pass

        if vn1_obj is None:
            vn1_obj = VirtualNetwork('vn-private')
            vn1_obj.add_network_ipam(ipam_obj, VnSubnetsType([IpamSubnetType(SubnetType("10.0.0.0", 24))]))
            vn1_uuid = self._vnc_lib.virtual_network_create(vn1_obj)

        pr = None
        try:
            pr = self._vnc_lib.physical_router_read(fq_name=[u'default-global-system-config', u'a2-mx-80'])
        except NoIdError:
            pass

        if pr is None:
            bgp_router, pr = self.create_router('a2-mx-80', '10.84.7.253')
        pr.add_virtual_network(vn1_obj)
        junos_service_ports = JunosServicePorts()
        junos_service_ports.service_port.append("si-0/0/0")
        pr.set_physical_router_junos_service_ports(junos_service_ports)
        pr.physical_router_vendor_name = 'juniper'
        pr.physical_router_product_name = 'mx'
        pr.physical_router_vnc_managed = True
        self._vnc_lib.physical_router_update(pr)

        #TOR
        pr_tor = None
        try:
            pr_tor = self._vnc_lib.physical_router_read(fq_name=[u'default-global-system-config', u'qfx-1'])
        except NoIdError:
            pass
        if pr_tor is None:
            bgp_router2, pr_tor = self.create_router('qfx-1', '2.2.2.2')
        pr_tor.set_virtual_network(vn1_obj)
        pr_tor.physical_router_vendor_name = 'juniper'
        pr_tor.physical_router_product_name = 'qfx'
        pr_tor.physical_router_vnc_managed = False
        self._vnc_lib.physical_router_update(pr_tor)
        pi_tor = None
        try:
            pi_tor = self._vnc_lib.physical_interface_read(fq_name=[u'default-global-system-config', u'qfx-1', u'xe-0/0/0'])
        except NoIdError:
            pass
        if pi_tor is None:
            pi_tor = PhysicalInterface('xe-0/0/0', parent_obj = pr_tor)
            pi_tor_id = self._vnc_lib.physical_interface_create(pi_tor)

        fq_name = ['default-domain', 'default-project', 'vmi1']
        default_project = self._vnc_lib.project_read(fq_name=[u'default-domain', u'default-project'])
        vmi = None
        try:
            vmi = self._vnc_lib.virtual_machine_interface_read(fq_name=[u'default-domain', u'default-project', u'vmi1'])
        except NoIdError:
            pass
        if vmi is None:
            vmi = VirtualMachineInterface(fq_name=fq_name, parent_type='project')
            vmi.set_virtual_network(vn1_obj)
            self._vnc_lib.virtual_machine_interface_create(vmi)

        li = None
        try:
            li = self._vnc_lib.logical_interface_read(fq_name=[u'default-global-system-config', u'qfx-1', u'xe-0/0/0', u'xe-0/0/0.0'])
        except NoIdError:
            pass

        if li is None:
            li = LogicalInterface('xe-0/0/0.0', parent_obj = pi_tor)
            li.set_virtual_machine_interface(vmi)
            li_id = self._vnc_lib.logical_interface_create(li)

        ip_obj1 = None
        try:
            ip_obj1 = self._vnc_lib.instance_ip_read(fq_name=[u'inst-ip-1'])
        except NoIdError:
            pass
        if ip_obj1 is None:
            ip_obj1 = InstanceIp(name='inst-ip-1')
            ip_obj1.set_virtual_machine_interface(vmi)
            ip_obj1.set_virtual_network(vn1_obj)
            ip_id1 = self._vnc_lib.instance_ip_create(ip_obj1)
            ip_obj1 = self._vnc_lib.instance_ip_read(id=ip_id1)
            ip_addr1 = ip_obj1.get_instance_ip_address()

        ipam2_obj = None
        try:
            ipam2_obj = self._vnc_lib.network_ipam_read(fq_name=[u'default-domain', u'default-project', u'ipam2'])
        except NoIdError:
            pass
        if ipam2_obj is None:
            ipam2_obj = NetworkIpam('ipam2')
            self._vnc_lib.network_ipam_create(ipam2_obj)

        vn2_obj = None
        try:
            vn2_obj = self._vnc_lib.virtual_network_read(fq_name=[u'default-domain', u'default-project', u'vn-public'])
        except NoIdError:
            pass

        if vn2_obj is None:
            vn2_obj = VirtualNetwork('vn-public')
            vn2_obj.set_router_external(True)
            vn2_obj.add_network_ipam(ipam_obj, VnSubnetsType([IpamSubnetType(SubnetType("192.168.7.0", 24))]))
            vn2_uuid = self._vnc_lib.virtual_network_create(vn2_obj)
            pr.add_virtual_network(vn2_obj)
            self._vnc_lib.physical_router_update(pr)

        fip_pool = None
        try:
            fip_pool = self._vnc_lib.floating_ip_pool_read(fq_name=[u'default-domain', u'default-project', u'vn-public', u'vn_public_fip_pool'])
        except NoIdError:
            pass
        if fip_pool is None:
            fip_pool_name = 'vn_public_fip_pool'
            fip_pool = FloatingIpPool(fip_pool_name, vn2_obj)
            self._vnc_lib.floating_ip_pool_create(fip_pool)

        fip_obj = None
        try:
            fip_obj = self._vnc_lib.floating_ip_read(fq_name=[u'default-domain', u'default-project', u'vn-public', u'vn_public_fip_pool', 'fip-1'])
        except NoIdError:
            pass
        if fip_obj is None:
            fip_obj = FloatingIp("fip-1", fip_pool)
            fip_obj.set_virtual_machine_interface(vmi)
            default_project = self._vnc_lib.project_read(fq_name=[u'default-domain', u'default-project'])
            fip_obj.set_project(default_project)
            fip_uuid = self._vnc_lib.floating_ip_create(fip_obj)

    # end

    def _parse_args(self, args_str):
        '''
        Eg. python provision_physical_router.py
                                   --api_server_ip 127.0.0.1
                                   --api_server_port 8082
        '''

        # Source any specified config/ini file
        # Turn off help, so we print all options in response to -h
        conf_parser = argparse.ArgumentParser(add_help=False)

        conf_parser.add_argument("-c", "--conf_file",
                                 help="Specify config file", metavar="FILE")
        args, remaining_argv = conf_parser.parse_known_args(args_str.split())

        defaults = {
            #'public_vn_name': 'default-domain:'
            #'default-project:default-virtual-network',
            'api_server_ip': '127.0.0.1',
            'api_server_port': '8082',
        }
        ksopts = {
            'admin_user': 'admin',
            'admin_password': 'c0ntrail123',
            'admin_tenant_name': 'default-domain'
        }

        if args.conf_file:
            config = ConfigParser.SafeConfigParser()
            config.read([args.conf_file])
            defaults.update(dict(config.items("DEFAULTS")))
            if 'KEYSTONE' in config.sections():
                ksopts.update(dict(config.items("KEYSTONE")))

        # Override with CLI options
        # Don't surpress add_help here so it will handle -h
        parser = argparse.ArgumentParser(
            # Inherit options from config_parser
            parents=[conf_parser],
            # print script description with -h/--help
            description=__doc__,
            # Don't mess with format of description
            formatter_class=argparse.RawDescriptionHelpFormatter,
        )
        defaults.update(ksopts)
        parser.set_defaults(**defaults)

        parser.add_argument(
            "--api_server_ip", help="IP address of api server", required=True)
        parser.add_argument("--api_server_port", help="Port of api server", required=True)
        parser.add_argument(
            "--admin_user", help="Name of keystone admin user", required=True)
        parser.add_argument(
            "--admin_password", help="Password of keystone admin user", required=True)
        parser.add_argument(
            "--admin_tenant_name", help="Tenamt name for keystone admin user", required=True)

        parser.add_argument(
            "--op", help="operation (add_basic, delete_basic, fip_test)", required=True)

        parser.add_argument(
            "--public_vrf_test", help="operation (False, True)", required=False)
        parser.add_argument(
            "--vxlan", help="vxlan identifier", required=False)

        self._args = parser.parse_args(remaining_argv)

    # end _parse_args

# end class VncProvisioner

def main(args_str=None):
    VncProvisioner(args_str)
# end main

if __name__ == "__main__":
    main()


text:
// Algorithm details and publications: http://www.golems.org/node/1570

#ifndef DART_PLANNING_PATH_HPP_
#define DART_PLANNING_PATH_HPP_

#include <list>
#include <Eigen/Core>

namespace dart {
namespace planning {

class PathSegment
{
public:
  PathSegment(double length = 0.0) : position(0.0), length(length)
  {
  }

  virtual ~PathSegment()
  {
  }

  double getLength() const
  {
    return length;
  }
  virtual Eigen::VectorXd getConfig(double s) const = 0;
  virtual Eigen::VectorXd getTangent(double s) const = 0;
  virtual Eigen::VectorXd getCurvature(double s) const = 0;
  virtual std::list<double> getSwitchingPoints() const = 0;
  virtual PathSegment* clone() const = 0;

  double position;

protected:
  double length;
};

class Path
{
public:
  Path(const std::list<Eigen::VectorXd>& path, double maxDeviation = 0.0);
  Path(const Path& path);
  ~Path();
  double getLength() const;
  Eigen::VectorXd getConfig(double s) const;
  Eigen::VectorXd getTangent(double s) const;
  Eigen::VectorXd getCurvature(double s) const;
  double getNextSwitchingPoint(double s, bool& discontinuity) const;
  std::list<std::pair<double, bool> > getSwitchingPoints() const;

private:
  PathSegment* getPathSegment(double& s) const;
  double length;
  std::list<std::pair<double, bool> > switchingPoints;
  std::list<PathSegment*> pathSegments;
};

} // namespace planning
} // namespace dart

#endif // DART_PLANNING_PATH_HPP_


text:
<?php declare(strict_types=1);

namespace SebastianBergmann\Invoker;

use RuntimeException;

final class TimeoutException extends RuntimeException implements Exception
{
}


text:
#include "press_altitude.h"

namespace {

/** ISA_LAYER - atmospheric layer parameters */
typedef struct {
	scalar height_bottom;    /**< Height above sea level @ bottom of layer */
	scalar static_press;     /**< Static pressure at layer base */
	scalar standard_temp;    /**< Standard temperature at layer base */
	scalar lapse_rate;       /**< Layer lapse rate -dT/dz (T temp, z height) */
} ISA_LAYER;

const int layer_min (0);
const int layer_max (6);

const ISA_LAYER layer_table [] =
	{
	// International Standard Atmosphere, Mean Sea Level Conditions
	//
	// height above    static pressure    standard          temperature lapse
	// sea level (m)   (pascals)          temperature (K)   rate (K/m)
	//------------------------------------------------------------------------
	//
	{  0,              101325,            288.15,          -0.0065  },
	{  11000,          22632.1,           216.65,           0.0     },
	{  20000,          5474.89,           216.65,           0.001   },
	{  32000,          868.019,           228.65,           0.0028  },
	{  47000,          110.906,           270.65,           0.0     },
	{  51000,          66.9389,           270.65,          -0.0028  },
	{  71000,          3.95642,           214.65,          -0.002   }
	};

/** Barometric calculations use the layer table entry selected by this index. */
int layer = 0;

/** \name Layer table access convenience macros */
/** @{ */
#define Pb      (layer_table [(layer)].static_press)
#define Tb      (layer_table [(layer)].standard_temp)
#define Lb      (layer_table [(layer)].lapse_rate)
#define Hb      (layer_table [(layer)].height_bottom)
/** @} */

/** \name ISA pressure altitude precalculated constants */
/** @{ */
#define R_g0    (-1 * CONST_REAL_GAS / CONST_STANDARD_GRAVITY)

scalar RL_g0    (R_g0 * Lb);
scalar RT_g0    (R_g0 * Tb);

scalar P_bias   (0 /* current SL pressure(Pa) - 1 atm */);
/** @} */

}

/** \brief Specify the (corrected) pressure-altitude sea level pressure.
 *
 * This routine will calculate a bias to correct the ISA standard pressure
 * at sea level (1 atm. = 101 325 Pa) for local variations in barometric
 * pressure at mean sea level (MSL).
 *
 * \param   P           The current local pressure (pascals) at sea level.
 * \return  Nothing.
 */
void pressure_sea_level(scalar P)
{
	P_bias = P - Pb;
}

/** \brief Specify a pressure-altitude layer
 *
 * The routine sets the pressure_altitude() function to use a specified
 * "layer" in domain [0, 6].  By default layer 0 is assumed.  Calling
 * this routine without arguments will set the pressure_altitude() to
 * calculate barometric altitude assuming a pressure domain within ISA
 * layer zero (P < 22 632 pascals).
 *
 * \param   index   The atmospheric layer index, zero by default.
 *
 * \return  bool    True if a valid layer index is specified.
 */
bool pressure_isa_layer(int index)
{
	if ((layer_min <= index) && (index <= layer_max)) {

		layer = index;

		RL_g0 = (R_g0 * Lb);
		RT_g0 = (R_g0 * Tb);

		return true;
	}

	return false;
}

/** \brief Get an ISA pressure altitude
 *
 * Given atmospheric pressure "P" in pascals, this routine returns the
 * associated barometric altitude ("pressure altitude") using
 * International Standard Atmosphere (ISA) pressure model coefficients
 * and equations.
 *
 * \param   P       The current atmospheric pressure in pascals.
 *
 * \return  scalar  The altitude in meters.
 */
scalar pressure_altitude(scalar P)
{
	const scalar del ((P - P_bias) / Pb);  // pressure ratio

	if (Lb) {
		return (Hb + ((Tb / Lb) * (pow(del, RL_g0) - 1)));
	} else {
		return (Hb + (RT_g0 * log(del)));
	}
}


text:
<?php

/* CoreSphereConsoleBundle:Console:index.html.twig */
class __TwigTemplate_de8c0e04fd0bd5b5507ed714f4d430fe extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("CoreSphereConsoleBundle:Console:layout.html.twig");

        $this->blocks = array(
            'title' => array($this, 'block_title'),
            'stylesheets' => array($this, 'block_stylesheets'),
            'content' => array($this, 'block_content'),
            'javascripts' => array($this, 'block_javascripts'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "CoreSphereConsoleBundle:Console:layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_title($context, array $blocks = array())
    {
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("coresphere_console.headline.index"), "html", null, true);
    }

    // line 5
    public function block_stylesheets($context, array $blocks = array())
    {
        // line 6
        echo "    ";
        $this->displayParentBlock("stylesheets", $context, $blocks);
        echo "
    <link rel=\"stylesheet\" href=\"";
        // line 7
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/coresphereconsole/css/console.css"), "html", null, true);
        echo "\" type=\"text/css\" />
";
    }

    // line 10
    public function block_content($context, array $blocks = array())
    {
        // line 11
        echo "
";
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("coresphere_console.headline.index"), "html", null, true);
        echo "

            ";
        // line 14
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("coresphere_console.working_directory"), "html", null, true);
        echo ": ";
        echo twig_escape_filter($this->env, $this->getContext($context, "working_dir"), "html", null, true);
        echo "
            ";
        // line 15
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("coresphere_console.environment"), "html", null, true);
        echo ": ";
        echo twig_escape_filter($this->env, $this->getContext($context, "environment"), "html", null, true);
        echo "

";
    }

    // line 29
    public function block_javascripts($context, array $blocks = array())
    {
        // line 30
        $this->displayParentBlock("javascripts", $context, $blocks);
        echo "

";
    }

    public function getTemplateName()
    {
        return "CoreSphereConsoleBundle:Console:index.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  136 => 49,  130 => 45,  126 => 44,  122 => 43,  118 => 42,  114 => 41,  109 => 39,  105 => 38,  101 => 37,  97 => 35,  91 => 31,  87 => 30,  84 => 29,  65 => 15,  59 => 14,  52 => 11,  49 => 10,  43 => 7,  38 => 6,  35 => 5,  29 => 3,);
    }
}


text:
#ifndef fhiclcpp_types_detail_ParameterBase_h
#define fhiclcpp_types_detail_ParameterBase_h

/*
  ParameterBase is the most fundamental base class for all fhiclcpp
  types.  The taxonomy is:

          ParameterBase
         /      |    \ \_____________________________________
        /       |     \____________________                  \
       /        |                          \                  \
      /         |                           \                  \
  AtomBase   TableBase                  SequenceBase      DelegateBase
     |          |                      /     |      \            \___
     |          |                     /      |       \            \  \
     |          |        SeqVectorBase       |        \            \  DelegatedParameter
     |          |              |             |         \            \___
     |          |              |             |          \               \
  Atom<T>    Table<T>     Sequence<T>   Sequence<T,SZ>   Tuple<T...>  OptionalDelegatedParameter

  The design is meant to closely follow the classification of FHiCL
  values, as described in the FHiCL language quick start guide.
*/

#include "fhiclcpp/types/ConfigPredicate.h"
#include "fhiclcpp/types/detail/ParameterArgumentTypes.h"
#include "fhiclcpp/types/detail/ParameterMetadata.h"

#include <string>

namespace fhicl {

  class ParameterSet;

  namespace detail {

    //========================================================
    class ParameterBase {
    public:

      std::string key()            const { return mdata_.key(); }
      std::string name()           const { return mdata_.name(); }
      std::string comment()        const { return mdata_.comment(); }
      bool        has_default()    const { return mdata_.has_default(); }
      bool        is_optional()    const { return mdata_.is_optional(); }
      bool        is_conditional() const { return mdata_.is_conditional(); }
      par_type    parameter_type() const { return mdata_.type(); }
      bool        should_use()     const { return maybeUse_(); }

      ParameterBase(Name const& name,
                    Comment const& comment,
                    value_type const vt,
                    par_type const type,
                    std::function<bool()> maybeUse = AlwaysUse())
        : mdata_{name, comment, vt, type}
        , maybeUse_{maybeUse}
      {}

      virtual ~ParameterBase() = default;

      // Modifiers
      void set_value(fhicl::ParameterSet const& ps, bool trimParents)
      {
        do_set_value(ps, trimParents);
      }
      void set_value_type(value_type const vt) { mdata_.set_value_type(vt); }
      void set_key(std::string const& key) { mdata_.set_key(key); }

    private:

      virtual void do_set_value(fhicl::ParameterSet const&, bool trimParents) = 0;

      ParameterMetadata mdata_;
      std::function<bool()> maybeUse_;
    };

  }
}

#endif /* fhiclcpp_types_detail_ParameterBase_h */

// Local variables:
// mode: c++
// End:


text:
export const handle = action => {
    const [ controllerName, methodName ] = action.split('@', 2);
    const controller = require('./controller/' + controllerName);
    return controller[methodName].bind(controller);
};


text:
  do {                                                \
    if (!this->is_thread_safe())                      \
      DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); \
  } while (false)
#else
#define CALLED_ON_VALID_THREAD()
#endif

namespace gpu {
// Overrides for flat_set lookups:
bool operator<(const std::unique_ptr<SharedImageBacking>& lhs,
               const std::unique_ptr<SharedImageBacking>& rhs) {
  return lhs->mailbox() < rhs->mailbox();
}

bool operator<(const Mailbox& lhs,
               const std::unique_ptr<SharedImageBacking>& rhs) {
  return lhs < rhs->mailbox();
}

bool operator<(const std::unique_ptr<SharedImageBacking>& lhs,
               const Mailbox& rhs) {
  return lhs->mailbox() < rhs;
}

class SCOPED_LOCKABLE SharedImageManager::AutoLock {
 public:
  explicit AutoLock(SharedImageManager* manager)
      EXCLUSIVE_LOCK_FUNCTION(manager->lock_)
      : start_time_(base::TimeTicks::Now()),
        auto_lock_(manager->is_thread_safe() ? &manager->lock_.value()
                                             : nullptr) {
    if (manager->is_thread_safe()) {
      UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
          "GPU.SharedImageManager.TimeToAcquireLock",
          base::TimeTicks::Now() - start_time_, base::Microseconds(1),
          base::Seconds(1), 50);
    }
  }

  AutoLock(const AutoLock&) = delete;
  AutoLock& operator=(const AutoLock&) = delete;

  ~AutoLock() UNLOCK_FUNCTION() = default;

 private:
  base::TimeTicks start_time_;
  base::AutoLockMaybe auto_lock_;
};

SharedImageManager::SharedImageManager(bool thread_safe,
                                       bool display_context_on_another_thread)
    : display_context_on_another_thread_(display_context_on_another_thread) {
  DCHECK(!display_context_on_another_thread || thread_safe);
  if (thread_safe)
    lock_.emplace();
#if BUILDFLAG(IS_ANDROID)
  batch_access_manager_ = std::make_unique<SharedImageBatchAccessManager>();
#endif
#if BUILDFLAG(IS_WIN)
  auto d3d11_device = gl::QueryD3D11DeviceObjectFromANGLE();
  if (d3d11_device) {
    dxgi_shared_handle_manager_ =
        base::MakeRefCounted<DXGISharedHandleManager>(std::move(d3d11_device));
  }
#endif
  CALLED_ON_VALID_THREAD();
}

SharedImageManager::~SharedImageManager() {
  CALLED_ON_VALID_THREAD();
#if DCHECK_IS_ON()
  AutoLock auto_lock(this);
#endif
  DCHECK(images_.empty());
}

std::unique_ptr<SharedImageRepresentationFactoryRef>
SharedImageManager::Register(std::unique_ptr<SharedImageBacking> backing,
                             MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();
  DCHECK(backing->mailbox().IsSharedImage());

  AutoLock autolock(this);
  if (images_.find(backing->mailbox()) != images_.end()) {
    LOG(ERROR) << "SharedImageManager::Register: Trying to register an "
                  "already registered mailbox.";
    return nullptr;
  }

  // TODO(jonross): Determine how the direct destruction of a
  // SharedImageRepresentationFactoryRef leads to ref-counting issues as
  // well as thread-checking failures in tests.
  auto factory_ref = std::make_unique<SharedImageRepresentationFactoryRef>(
      this, backing.get(), tracker);
  images_.emplace(std::move(backing));

  return factory_ref;
}

void SharedImageManager::OnContextLost(const Mailbox& mailbox) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::OnContextLost: Trying to mark constext "
                  "lost on a non existent mailbox.";
    return;
  }
  (*found)->OnContextLost();
}

std::unique_ptr<SharedImageRepresentationGLTexture>
SharedImageManager::ProduceGLTexture(const Mailbox& mailbox,
                                     MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceGLTexture: Trying to produce a "
                  "representation from a non-existent mailbox. "
               << mailbox.ToDebugString();
    return nullptr;
  }

  auto representation = (*found)->ProduceGLTexture(this, tracker);
  if (!representation) {
    LOG(ERROR) << "SharedImageManager::ProduceGLTexture: Trying to produce a "
                  "representation from an incompatible mailbox.";
    return nullptr;
  }

  return representation;
}

std::unique_ptr<SharedImageRepresentationGLTexture>
SharedImageManager::ProduceRGBEmulationGLTexture(const Mailbox& mailbox,
                                                 MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceRGBEmulationGLTexture: Trying to "
                  "produce a representation from a non-existent mailbox.";
    return nullptr;
  }

  auto representation = (*found)->ProduceRGBEmulationGLTexture(this, tracker);
  if (!representation) {
    LOG(ERROR) << "SharedImageManager::ProduceRGBEmulationGLTexture: Trying to "
                  "produce a representation from an incompatible mailbox.";
    return nullptr;
  }

  return representation;
}

std::unique_ptr<SharedImageRepresentationGLTexturePassthrough>
SharedImageManager::ProduceGLTexturePassthrough(const Mailbox& mailbox,
                                                MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceGLTexturePassthrough: Trying to "
                  "produce a representation from a non-existent mailbox.";
    return nullptr;
  }

  auto representation = (*found)->ProduceGLTexturePassthrough(this, tracker);
  if (!representation) {
    LOG(ERROR) << "SharedImageManager::ProduceGLTexturePassthrough: Trying to "
                  "produce a representation from an incompatible mailbox.";
    return nullptr;
  }

  return representation;
}

std::unique_ptr<SharedImageRepresentationSkia> SharedImageManager::ProduceSkia(
    const Mailbox& mailbox,
    MemoryTypeTracker* tracker,
    scoped_refptr<SharedContextState> context_state) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceSkia: Trying to Produce a "
                  "Skia representation from a non-existent mailbox.";
    return nullptr;
  }

  auto representation = (*found)->ProduceSkia(this, tracker, context_state);
  if (!representation) {
    LOG(ERROR) << "SharedImageManager::ProduceSkia: Trying to produce a "
                  "Skia representation from an incompatible mailbox.";
    return nullptr;
  }

  return representation;
}

std::unique_ptr<SharedImageRepresentationDawn> SharedImageManager::ProduceDawn(
    const Mailbox& mailbox,
    MemoryTypeTracker* tracker,
    WGPUDevice device,
    WGPUBackendType backend_type) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceDawn: Trying to Produce a "
                  "Dawn representation from a non-existent mailbox.";
    return nullptr;
  }

  auto representation =
      (*found)->ProduceDawn(this, tracker, device, backend_type);
  if (!representation) {
    LOG(ERROR) << "SharedImageManager::ProduceDawn: Trying to produce a "
                  "Dawn representation from an incompatible mailbox.";
    return nullptr;
  }

  return representation;
}

std::unique_ptr<SharedImageRepresentationOverlay>
SharedImageManager::ProduceOverlay(const gpu::Mailbox& mailbox,
                                   gpu::MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceOverlay: Trying to Produce a "
                  "Overlay representation from a non-existent mailbox.";
    return nullptr;
  }

  auto representation = (*found)->ProduceOverlay(this, tracker);
  if (!representation) {
    LOG(ERROR) << "SharedImageManager::ProduceOverlay: Trying to produce a "
                  "Overlay representation from an incompatible mailbox.";
    return nullptr;
  }

  return representation;
}

std::unique_ptr<SharedImageRepresentationVaapi>
SharedImageManager::ProduceVASurface(const Mailbox& mailbox,
                                     MemoryTypeTracker* tracker,
                                     VaapiDependenciesFactory* dep_factory) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceVASurface: Trying to produce a "
                  "VA-API representation from a non-existent mailbox.";
    return nullptr;
  }

  auto representation = (*found)->ProduceVASurface(this, tracker, dep_factory);

  if (!representation) {
    LOG(ERROR) << "SharedImageManager::ProduceVASurface: Trying to produce a "
                  "VA-API representation from an incompatible mailbox.";
    return nullptr;
  }
  return representation;
}

std::unique_ptr<SharedImageRepresentationMemory>
SharedImageManager::ProduceMemory(const Mailbox& mailbox,
                                  MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceMemory: Trying to Produce a "
                  "Memory representation from a non-existent mailbox.";
    return nullptr;
  }

  // This is expected to fail based on the SharedImageBacking type, so don't log
  // error here. Caller is expected to handle nullptr.
  return (*found)->ProduceMemory(this, tracker);
}

std::unique_ptr<SharedImageRepresentationRaster>
SharedImageManager::ProduceRaster(const Mailbox& mailbox,
                                  MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::ProduceRaster: Trying to Produce a "
                  "Raster representation from a non-existent mailbox.";
    return nullptr;
  }

  // This is expected to fail based on the SharedImageBacking type, so don't log
  // error here. Caller is expected to handle nullptr.
  return (*found)->ProduceRaster(this, tracker);
}

#if BUILDFLAG(IS_ANDROID)
std::unique_ptr<SharedImageRepresentationLegacyOverlay>
SharedImageManager::ProduceLegacyOverlay(const Mailbox& mailbox,
                                         MemoryTypeTracker* tracker) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR)
        << "SharedImageManager::ProduceLegacyOverlay: Trying to Produce a "
           "Legacy Overlay representation from a non-existent mailbox.";
    return nullptr;
  }

  auto representation = (*found)->ProduceLegacyOverlay(this, tracker);
  if (!representation) {
    LOG(ERROR)
        << "SharedImageManager::ProduceLegacyOverlay: Trying to produce a "
           "Legacy Overlay representation from an incompatible mailbox.";
    return nullptr;
  }

  return representation;
}
#endif

void SharedImageManager::OnRepresentationDestroyed(
    const Mailbox& mailbox,
    SharedImageRepresentation* representation) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);

  {
    auto found = images_.find(mailbox);
    if (found == images_.end()) {
      LOG(ERROR) << "SharedImageManager::OnRepresentationDestroyed: Trying to "
                    "destroy a non existent mailbox.";
      return;
    }

    // TODO(piman): When the original (factory) representation is destroyed, we
    // should treat the backing as pending destruction and prevent additional
    // representations from being created. This will help avoid races due to a
    // consumer getting lucky with timing due to a representation inadvertently
    // extending a backing's lifetime.
    (*found)->ReleaseRef(representation);
  }

  {
    // TODO(jonross): Once the pending destruction TODO above is addressed then
    // this block can be removed, and the deletion can occur directly. Currently
    // SharedImageManager::OnRepresentationDestroyed can be nested, so we need
    // to get the iterator again.
    auto found = images_.find(mailbox);
    if (found != images_.end() && (!(*found)->HasAnyRefs()))
      images_.erase(found);
  }
}

void SharedImageManager::OnMemoryDump(const Mailbox& mailbox,
                                      base::trace_event::ProcessMemoryDump* pmd,
                                      int client_id,
                                      uint64_t client_tracing_id) {
  CALLED_ON_VALID_THREAD();

  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end()) {
    LOG(ERROR) << "SharedImageManager::OnMemoryDump: Trying to dump memory for "
                  "a non existent mailbox.";
    return;
  }

  auto* backing = found->get();
  size_t estimated_size = backing->EstimatedSizeForMemTracking();
  if (estimated_size == 0)
    return;

  // Unique name in the process.
  std::string dump_name =
      base::StringPrintf("gpu/shared_images/client_0x%" PRIX32 "/mailbox_%s",
                         client_id, mailbox.ToDebugString().c_str());

  base::trace_event::MemoryAllocatorDump* dump =
      pmd->CreateAllocatorDump(dump_name);
  dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
                  base::trace_event::MemoryAllocatorDump::kUnitsBytes,
                  estimated_size);
  // Add a mailbox guid which expresses shared ownership with the client
  // process.
  // This must match the client-side.
  auto client_guid = GetSharedImageGUIDForTracing(mailbox);
  pmd->CreateSharedGlobalAllocatorDump(client_guid);
  pmd->AddOwnershipEdge(dump->guid(), client_guid);

  // Allow the SharedImageBacking to attach additional data to the dump
  // or dump additional sub-paths.
  backing->OnMemoryDump(dump_name, dump, pmd, client_tracing_id);
}

scoped_refptr<gfx::NativePixmap> SharedImageManager::GetNativePixmap(
    const gpu::Mailbox& mailbox) {
  AutoLock autolock(this);
  auto found = images_.find(mailbox);
  if (found == images_.end())
    return nullptr;
  return (*found)->GetNativePixmap();
}

bool SharedImageManager::BeginBatchReadAccess() {
#if BUILDFLAG(IS_ANDROID)
  return batch_access_manager_->BeginBatchReadAccess();
#else
  return true;
#endif
}

bool SharedImageManager::EndBatchReadAccess() {
#if BUILDFLAG(IS_ANDROID)
  return batch_access_manager_->EndBatchReadAccess();
#else
  return true;
#endif
}

}  // namespace gpu


text:
package de.zib.gndms.logic.model.gorfx.taskflow;

/**
 * @author try ma ik jo rr a zib
 * @date 14.02.11  16:48
 * @brief An exception which signals an order which can't be satisfied.
 *
 * @note This is only used on the server side.
 */
public class UnsatisfiableOrderException extends RuntimeException {

    private static final long serialVersionUID = -3285859503083289382L;

    public UnsatisfiableOrderException() {
    }

    public UnsatisfiableOrderException( String message ) {
        super( message );
    }

    public UnsatisfiableOrderException( String message, Throwable cause ) {
        super( message, cause );
    }

    public UnsatisfiableOrderException( Throwable cause ) {
        super( cause );
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Coq bench</title>
    <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
    <link href="../../../../../bootstrap.min.css" rel="stylesheet">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              Toggle navigation

            </button>
             Coq bench

Unstable

8.4.5 / contrib:finger-tree 8.4.dev

2015-02-04 13:50:20

About

            « Up

              contrib:finger-tree

                8.4.dev
                Error

 (2015-02-04 13:50:20 UTC)

Lint

Command

ruby lint.rb unstable ../unstable/packages/coq:contrib:finger-tree/coq:contrib:finger-tree.8.4.dev

Return code

0

Duration

0 s

Dry install

Dry install with the current Coq version:

Command

opam install -y --dry-run coq:contrib:finger-tree.8.4.dev coq.8.4.5

Return code

0

Duration

2 s

Dry install without Coq, to test if the problem was incompatibility with the current Coq version:

Command

true

Return code

0

Duration

0 s

Install dependencies

Command

ulimit -Sv 2000000; timeout 5m opam install -y --deps-only coq:contrib:finger-tree.8.4.dev

Return code

0

Duration

2 s

Install

Command

ulimit -Sv 2000000; timeout 5m opam install -y --verbose coq:contrib:finger-tree.8.4.dev

Return code

1024

Duration

1 m 54 s

Output

The following actions will be performed:
 - install   coq:contrib:finger-tree.8.4.dev
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[coq:contrib:finger-tree] Fetching https://gforge.inria.fr/git/coq-contribs/finger-tree.git#v8.4
Initialized empty Git repository in /home/bench/.opam/packages.dev/coq:contrib:finger-tree.8.4.dev/.git/
[master (root-commit) dc6fc5f] opam-git-init
From https://gforge.inria.fr/git/coq-contribs/finger-tree
 * [new branch]      v8.4       -> opam-ref
 * [new branch]      v8.4       -> origin/v8.4
DependentFingerTree.v
DependentFingerTreeModule.v
DependentSequence.v
Digit.v
DigitModule.v
FingerTree.v
FingerTreeModule.v
KeyMonoid.v
ListMonoid.v
Make
Makefile
Modules.v
Monoid.v
MonoidExample.v
Notations.v
OrdSequence.v
OrderedType.v
PlusMonoid.v
PrioQueue.v
Reduce.v
RopeModule.v
Sequence.v
StringInterface.v
description
examples.v
extraction/Make
extraction/Makefile
extraction/extract.sh
extraction/hs/Extract.v
extraction/hs/Makefile
extraction/ml/.depend
extraction/ml/.gitignore
extraction/ml/Extract.v
extraction/ml/ICFP/Makefile
extraction/ml/META
extraction/ml/Makefile
extraction/ml/OCamlMakefile
extraction/ml/README
index.v
makedoc.sh
HEAD is now at 4f5874e bench.log file removed
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq:contrib:finger-tree.8.4.dev:
  make
  make install
coqdep -c -slash -R . FingerTree "RopeModule.v" > "RopeModule.v.d" || ( RV=$?; rm -f "RopeModule.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "FingerTreeModule.v" > "FingerTreeModule.v.d" || ( RV=$?; rm -f "FingerTreeModule.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "DependentFingerTreeModule.v" > "DependentFingerTreeModule.v.d" || ( RV=$?; rm -f "DependentFingerTreeModule.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "DigitModule.v" > "DigitModule.v.d" || ( RV=$?; rm -f "DigitModule.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "Modules.v" > "Modules.v.d" || ( RV=$?; rm -f "Modules.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "DependentSequence.v" > "DependentSequence.v.d" || ( RV=$?; rm -f "DependentSequence.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "OrdSequence.v" > "OrdSequence.v.d" || ( RV=$?; rm -f "OrdSequence.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "OrderedType.v" > "OrderedType.v.d" || ( RV=$?; rm -f "OrderedType.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "PrioQueue.v" > "PrioQueue.v.d" || ( RV=$?; rm -f "PrioQueue.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "KeyMonoid.v" > "KeyMonoid.v.d" || ( RV=$?; rm -f "KeyMonoid.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "Sequence.v" > "Sequence.v.d" || ( RV=$?; rm -f "Sequence.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "FingerTree.v" > "FingerTree.v.d" || ( RV=$?; rm -f "FingerTree.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "DependentFingerTree.v" > "DependentFingerTree.v.d" || ( RV=$?; rm -f "DependentFingerTree.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "Digit.v" > "Digit.v.d" || ( RV=$?; rm -f "Digit.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "Notations.v" > "Notations.v.d" || ( RV=$?; rm -f "Notations.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "Monoid.v" > "Monoid.v.d" || ( RV=$?; rm -f "Monoid.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "Reduce.v" > "Reduce.v.d" || ( RV=$?; rm -f "Reduce.v.d"; exit ${RV} )
coqdep -c -slash -R . FingerTree "StringInterface.v" > "StringInterface.v.d" || ( RV=$?; rm -f "StringInterface.v.d"; exit ${RV} )
coqc  -q  -R . FingerTree   StringInterface
coqc  -q  -R . FingerTree   Reduce
coqc  -q  -R . FingerTree   Monoid
Identifier 'ε' now a keyword
Identifier 'lparr' now a keyword
coqc  -q  -R . FingerTree   Notations
coqc  -q  -R . FingerTree   Digit
coqc  -q  -R . FingerTree   DependentFingerTree
Finished transaction in 28. secs (27.01017u,0.156311s)
coqc  -q  -R . FingerTree   FingerTree
coqc  -q  -R . FingerTree   Sequence
coqc  -q  -R . FingerTree   OrderedType
coqc  -q  -R . FingerTree   KeyMonoid
coqc  -q  -R . FingerTree   PrioQueue
Identifier 'maxi' now a keyword
coqc  -q  -R . FingerTree   OrdSequence
coqc  -q  -R . FingerTree   DependentSequence
coqc  -q  -R . FingerTree   Modules
Identifier 'cdot' now a keyword
coqc  -q  -R . FingerTree   DigitModule
coqc  -q  -R . FingerTree   DependentFingerTreeModule
coqc  -q  -R . FingerTree   FingerTreeModule
Inductive tree_split (p : Digits.v -> bool) (A : Type)
          (measure : A -> Digits.v) (i : Digits.v) :
          Digits.v -> Type :=
    mkTreeSplit : forall xsm : Digits.v,
                  {xs : fingertree measure xsm |
                  isEmpty xs \/ p (i cdot xsm) = false} ->
                  forall (x : A) (ysm : Digits.v),
                  {ys : fingertree measure ysm |
                  isEmpty ys \/ p (i cdot xsm cdot measure x) = true} ->
                  tree_split p measure i (xsm cdot measure x cdot ysm)
For tree_split: Argument A is implicit
For mkTreeSplit: Arguments A, measure, xsm, ysm are implicit
For tree_split: Argument scopes are [_ type_scope _ _ _]
For mkTreeSplit: Argument scopes are [_ type_scope _ _ _ _ _ _ _]
coqc  -q  -R . FingerTree   RopeModule
cd extraction/ml/; rm -f *.ml *.mli *.cm* *.o; coqc -q -opt -R ../.. FingerTree Extract.v
Warning: Extract.v has been found in
[ /home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction/hs ;
  /home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction/ml ];
loading /home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction/hs/Extract.v
Warning: The extraction is currently set to bypass opacity,
the following opaque constant bodies have been accessed :
 List.destruct_list List.exists_last List.nth_in_or_default.
Warning: The following logical axiom was encountered:
 DependentSequence.subsetT_eq_compat.
Having invalid logical axiom in the environment when extracting
may lead to incorrect or non-terminating ML terms.
Warning: The extraction is currently set to bypass opacity,
the following opaque constant bodies have been accessed :
 List.destruct_list List.exists_last List.nth_in_or_default.
Warning: The following logical axioms were encountered:
 split_size view_right_size.
Having invalid logical axiom in the environment when extracting
may lead to incorrect or non-terminating ML terms.
cd extraction ; make all
make[1]: Entering directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction'
cd ml ; make all
make[2]: Entering directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction/ml'
make[2]: *** No rule to make target 'Datatypes.mli', needed by 'depend'.  Stop.
make[2]: Leaving directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction/ml'
Makefile:95: recipe for target 'ml' failed
make[1]: Leaving directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction'
make[1]: *** [ml] Error 2
Makefile:168: recipe for target 'extraction' failed
make: *** [extraction] Error 2
[ERROR] The compilation of coq:contrib:finger-tree.8.4.dev failed.
Removing coq:contrib:finger-tree.8.4.dev.
  rm -R /home/bench/.opam/system/lib/coq/user-contrib/finger-tree
rm: cannot remove '/home/bench/.opam/system/lib/coq/user-contrib/finger-tree': No such file or directory
#=== ERROR while installing coq:contrib:finger-tree.8.4.dev ===================#
# opam-version         1.2.0
# os                   linux
# command              make
# path                 /home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev
# compiler             system (4.02.1)
# exit-code            2
# env-file             /home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/coq:contrib:finger-tree-14286-d2c37b.env
# stdout-file          /home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/coq:contrib:finger-tree-14286-d2c37b.out
# stderr-file          /home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/coq:contrib:finger-tree-14286-d2c37b.err
### stdout ###
# ...[truncated]
# coqc  -q  -R . FingerTree   RopeModule
# cd extraction/ml/; rm -f *.ml *.mli *.cm* *.o; coqc -q -opt -R ../.. FingerTree Extract.v
# cd extraction ; make all
# make[1]: Entering directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction'
# cd ml ; make all
# make[2]: Entering directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction/ml'
# make[2]: Leaving directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction/ml'
# Makefile:95: recipe for target 'ml' failed
# make[1]: Leaving directory '/home/bench/.opam/system/build/coq:contrib:finger-tree.8.4.dev/extraction'
# Makefile:168: recipe for target 'extraction' failed
### stderr ###
# ...[truncated]
#  List.destruct_list List.exists_last List.nth_in_or_default.
#
# Warning: The following logical axioms were encountered:
#  split_size view_right_size.
# Having invalid logical axiom in the environment when extracting
# may lead to incorrect or non-terminating ML terms.
#
# make[2]: *** No rule to make target 'Datatypes.mli', needed by 'depend'.  Stop.
# make[1]: *** [ml] Error 2
# make: *** [extraction] Error 2
'opam install -y --verbose coq:contrib:finger-tree.8.4.dev' failed.

Installation size

No files were installed.

Uninstall

Command

true

Return code

0

Duration

0 s

Missing removes

                none

Wrong removes

                none

          Sources are on GitHub. © Guillaume Claret.


text:
title := FindTheDistanceValueBetweenTwoArrays
all: $(title).class

$(title).class: *.java
	javac *.java

again:
	javac *.java

edit:
	emacs $(title).java

run: $(title).class
	java $(title)


text:
package org.apache.accumulo.core.client.replication;

/**
 * The peer already exists
 */
@Deprecated(since = "2.1.0")
public class PeerNotFoundException extends Exception {
  private static final long serialVersionUID = 1L;

  public PeerNotFoundException(String peer) {
    this(peer, (String) null);
  }

  public PeerNotFoundException(String peer, String message) {
    super("Peer '" + peer + "' not found " + (message == null || message.isEmpty() ? "" : message));
  }

  public PeerNotFoundException(String message, Throwable cause) {
    super(message, cause);
  }

  public PeerNotFoundException(String peer, String message, Throwable cause) {
    super("Peer '" + peer + "' not found " + message, cause);
  }
}


text:
package org.camunda.bpm.engine.impl.cmd;

import static org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull;
import static org.camunda.bpm.engine.impl.util.EnsureUtil.ensureWhitelistedResourceId;

import java.io.Serializable;

import org.camunda.bpm.engine.identity.Tenant;
import org.camunda.bpm.engine.impl.interceptor.Command;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;

public class SaveTenantCmd extends AbstractWritableIdentityServiceCmd<Void> implements Command<Void>, Serializable {

  private static final long serialVersionUID = 1L;
  protected Tenant tenant;

  public SaveTenantCmd(Tenant tenant) {
    this.tenant = tenant;
  }

  @Override
  protected Void executeCmd(CommandContext commandContext) {
    ensureNotNull("tenant", tenant);
    ensureWhitelistedResourceId(commandContext, "Tenant", tenant.getId());

    commandContext
      .getWritableIdentityProvider()
      .saveTenant(tenant);

    return null;
  }

}


text:
require 'test_helper'

class WelcomeControllerTest < ActionController::TestCase
  test "should get index" do
    skip("Not ready to test")
    sign_in Users(:one)
    get :index
    assert_response :success
  end

end


text:
import Vue from 'vue'
import { BvPlugin, BvComponent } from '../../'

// Plugin
export declare const JumbotronPlugin: BvPlugin

// Component: b-jumbotron
export declare class BJumbotron extends BvComponent {}


text:
from __future__ import unicode_literals

from django.db.transaction import atomic
from django.utils.encoding import python_2_unicode_compatible

@python_2_unicode_compatible
class Migration(object):
    """
    The base class for all migrations.

    Migration files will import this from django.db.migrations.Migration
    and subclass it as a class called Migration. It will have one or more
    of the following attributes:

     - operations: A list of Operation instances, probably from django.db.migrations.operations
     - dependencies: A list of tuples of (app_path, migration_name)
     - run_before: A list of tuples of (app_path, migration_name)
     - replaces: A list of migration_names

    Note that all migrations come out of migrations and into the Loader or
    Graph as instances, having been initialized with their app label and name.
    """

    # Operations to apply during this migration, in order.
    operations = []

    # Other migrations that should be run before this migration.
    # Should be a list of (app, migration_name).
    dependencies = []

    # Other migrations that should be run after this one (i.e. have
    # this migration added to their dependencies). Useful to make third-party
    # apps' migrations run after your AUTH_USER replacement, for example.
    run_before = []

    # Migration names in this app that this migration replaces. If this is
    # non-empty, this migration will only be applied if all these migrations
    # are not applied.
    replaces = []

    # Error class which is raised when a migration is irreversible
    class IrreversibleError(RuntimeError):
        pass

    def __init__(self, name, app_label):
        self.name = name
        self.app_label = app_label
        # Copy dependencies & other attrs as we might mutate them at runtime
        self.operations = list(self.__class__.operations)
        self.dependencies = list(self.__class__.dependencies)
        self.run_before = list(self.__class__.run_before)
        self.replaces = list(self.__class__.replaces)

    def __eq__(self, other):
        if not isinstance(other, Migration):
            return False
        return (self.name == other.name) and (self.app_label == other.app_label)

    def __ne__(self, other):
        return not (self == other)

    def __repr__(self):
        return "<Migration %s.%s>" % (self.app_label, self.name)

    def __str__(self):
        return "%s.%s" % (self.app_label, self.name)

    def __hash__(self):
        return hash("%s.%s" % (self.app_label, self.name))

    def mutate_state(self, project_state):
        """
        Takes a ProjectState and returns a new one with the migration's
        operations applied to it.
        """
        new_state = project_state.clone()
        for operation in self.operations:
            operation.state_forwards(self.app_label, new_state)
        return new_state

    def apply(self, project_state, schema_editor, collect_sql=False):
        """
        Takes a project_state representing all migrations prior to this one
        and a schema_editor for a live database and applies the migration
        in a forwards order.

        Returns the resulting project state for efficient re-use by following
        Migrations.
        """
        for operation in self.operations:
            # If this operation cannot be represented as SQL, place a comment
            # there instead
            if collect_sql:
                schema_editor.collected_sql.append("--")
                if not operation.reduces_to_sql:
                    schema_editor.collected_sql.append(
                        "-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:"
                    )
                schema_editor.collected_sql.append("-- %s" % operation.describe())
                schema_editor.collected_sql.append("--")
                if not operation.reduces_to_sql:
                    continue
            # Save the state before the operation has run
            old_state = project_state.clone()
            operation.state_forwards(self.app_label, project_state)
            # Run the operation
            if not schema_editor.connection.features.can_rollback_ddl and operation.atomic:
                # We're forcing a transaction on a non-transactional-DDL backend
                with atomic(schema_editor.connection.alias):
                    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
            else:
                # Normal behaviour
                operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
        return project_state

    def unapply(self, project_state, schema_editor, collect_sql=False):
        """
        Takes a project_state representing all migrations prior to this one
        and a schema_editor for a live database and applies the migration
        in a reverse order.

        The backwards migration process consists of two phases:

        1. The intermediate states from right before the first until right
           after the last operation inside this migration are preserved.
        2. The operations are applied in reverse order using the states
           recorded in step 1.
        """
        # Construct all the intermediate states we need for a reverse migration
        to_run = []
        new_state = project_state
        # Phase 1
        for operation in self.operations:
            # If it's irreversible, error out
            if not operation.reversible:
                raise Migration.IrreversibleError("Operation %s in %s is not reversible" % (operation, self))
            # Preserve new state from previous run to not tamper the same state
            # over all operations
            new_state = new_state.clone()
            old_state = new_state.clone()
            operation.state_forwards(self.app_label, new_state)
            to_run.insert(0, (operation, old_state, new_state))

        # Phase 2
        for operation, to_state, from_state in to_run:
            if collect_sql:
                schema_editor.collected_sql.append("--")
                if not operation.reduces_to_sql:
                    schema_editor.collected_sql.append(
                        "-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:"
                    )
                schema_editor.collected_sql.append("-- %s" % operation.describe())
                schema_editor.collected_sql.append("--")
                if not operation.reduces_to_sql:
                    continue
            if not schema_editor.connection.features.can_rollback_ddl and operation.atomic:
                # We're forcing a transaction on a non-transactional-DDL backend
                with atomic(schema_editor.connection.alias):
                    operation.database_backwards(self.app_label, schema_editor, from_state, to_state)
            else:
                # Normal behaviour
                operation.database_backwards(self.app_label, schema_editor, from_state, to_state)
        return project_state

class SwappableTuple(tuple):
    """
    Subclass of tuple so Django can tell this was originally a swappable
    dependency when it reads the migration file.
    """

    def __new__(cls, value, setting):
        self = tuple.__new__(cls, value)
        self.setting = setting
        return self

def swappable_dependency(value):
    """
    Turns a setting value into a dependency.
    """
    return SwappableTuple((value.split(".", 1)[0], "__first__"), value)


text:
from datetime import date, datetime

from typing import List, Dict, Type

from openapi_server.models.base_model_ import Model
from openapi_server import util

class PipelineFolderImpl(Model):
    """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

    Do not edit the class manually.
    """

    def __init__(self, _class: str=None, display_name: str=None, full_name: str=None, name: str=None, organization: str=None, number_of_folders: int=None, number_of_pipelines: int=None):
        """PipelineFolderImpl - a model defined in OpenAPI

        :param _class: The _class of this PipelineFolderImpl.
        :param display_name: The display_name of this PipelineFolderImpl.
        :param full_name: The full_name of this PipelineFolderImpl.
        :param name: The name of this PipelineFolderImpl.
        :param organization: The organization of this PipelineFolderImpl.
        :param number_of_folders: The number_of_folders of this PipelineFolderImpl.
        :param number_of_pipelines: The number_of_pipelines of this PipelineFolderImpl.
        """
        self.openapi_types = {
            '_class': str,
            'display_name': str,
            'full_name': str,
            'name': str,
            'organization': str,
            'number_of_folders': int,
            'number_of_pipelines': int
        }

        self.attribute_map = {
            '_class': '_class',
            'display_name': 'displayName',
            'full_name': 'fullName',
            'name': 'name',
            'organization': 'organization',
            'number_of_folders': 'numberOfFolders',
            'number_of_pipelines': 'numberOfPipelines'
        }

        self.__class = _class
        self._display_name = display_name
        self._full_name = full_name
        self._name = name
        self._organization = organization
        self._number_of_folders = number_of_folders
        self._number_of_pipelines = number_of_pipelines

    @classmethod
    def from_dict(cls, dikt: dict) -> 'PipelineFolderImpl':
        """Returns the dict as a model

        :param dikt: A dict.
        :return: The PipelineFolderImpl of this PipelineFolderImpl.
        """
        return util.deserialize_model(dikt, cls)

    @property
    def _class(self):
        """Gets the _class of this PipelineFolderImpl.

        :return: The _class of this PipelineFolderImpl.
        :rtype: str
        """
        return self.__class

    @_class.setter
    def _class(self, _class):
        """Sets the _class of this PipelineFolderImpl.

        :param _class: The _class of this PipelineFolderImpl.
        :type _class: str
        """

        self.__class = _class

    @property
    def display_name(self):
        """Gets the display_name of this PipelineFolderImpl.

        :return: The display_name of this PipelineFolderImpl.
        :rtype: str
        """
        return self._display_name

    @display_name.setter
    def display_name(self, display_name):
        """Sets the display_name of this PipelineFolderImpl.

        :param display_name: The display_name of this PipelineFolderImpl.
        :type display_name: str
        """

        self._display_name = display_name

    @property
    def full_name(self):
        """Gets the full_name of this PipelineFolderImpl.

        :return: The full_name of this PipelineFolderImpl.
        :rtype: str
        """
        return self._full_name

    @full_name.setter
    def full_name(self, full_name):
        """Sets the full_name of this PipelineFolderImpl.

        :param full_name: The full_name of this PipelineFolderImpl.
        :type full_name: str
        """

        self._full_name = full_name

    @property
    def name(self):
        """Gets the name of this PipelineFolderImpl.

        :return: The name of this PipelineFolderImpl.
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this PipelineFolderImpl.

        :param name: The name of this PipelineFolderImpl.
        :type name: str
        """

        self._name = name

    @property
    def organization(self):
        """Gets the organization of this PipelineFolderImpl.

        :return: The organization of this PipelineFolderImpl.
        :rtype: str
        """
        return self._organization

    @organization.setter
    def organization(self, organization):
        """Sets the organization of this PipelineFolderImpl.

        :param organization: The organization of this PipelineFolderImpl.
        :type organization: str
        """

        self._organization = organization

    @property
    def number_of_folders(self):
        """Gets the number_of_folders of this PipelineFolderImpl.

        :return: The number_of_folders of this PipelineFolderImpl.
        :rtype: int
        """
        return self._number_of_folders

    @number_of_folders.setter
    def number_of_folders(self, number_of_folders):
        """Sets the number_of_folders of this PipelineFolderImpl.

        :param number_of_folders: The number_of_folders of this PipelineFolderImpl.
        :type number_of_folders: int
        """

        self._number_of_folders = number_of_folders

    @property
    def number_of_pipelines(self):
        """Gets the number_of_pipelines of this PipelineFolderImpl.

        :return: The number_of_pipelines of this PipelineFolderImpl.
        :rtype: int
        """
        return self._number_of_pipelines

    @number_of_pipelines.setter
    def number_of_pipelines(self, number_of_pipelines):
        """Sets the number_of_pipelines of this PipelineFolderImpl.

        :param number_of_pipelines: The number_of_pipelines of this PipelineFolderImpl.
        :type number_of_pipelines: int
        """

        self._number_of_pipelines = number_of_pipelines