fun < T : Any , E : Any > logicalAnd ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( x1 , x2 ) )

/**
 * Compute the truth value of x1 AND x2 element-wise.
 */


fun < T : Any , E : Any > logicalOr ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Compute the truth value of x1 OR x2 element-wise.
 */


fun < T : Any > logicalNot ( x : KtNDArray < T > ) : KtNDArray < Boolean >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( x ) )

/**
 * Compute the truth value of NOT x element-wise.
 */


fun < T : Any , E : Any > logicalXor ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Compute the truth value of x1 XOR x2, element-wise.
 */


fun < T : Any , E : Any > allClose ( a : KtNDArray < T > , b : KtNDArray < E > , rtol : Double = <NUM_LIT> , atol : Double = <NUM_LIT> , equalNan : Boolean = false ) : Boolean

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( a , b , rtol , atol , equalNan ) , kClass = Boolean :: class )

/**
 * Returns *true* if two arrays are element-wise equal within a tolerance.
 */


fun < T : Any , E : Any > isClose ( a : KtNDArray < T > , b : KtNDArray < E > , rtol : Double = <NUM_LIT> , atol : Double = <NUM_LIT> , equalNan : Boolean = false ) : KtNDArray < Boolean >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( a , b , rtol , atol , equalNan ) )

/**
 * Returns a boolean array where two arrays are element-wise equal within a tolerance.
 */


fun < T : Any , E : Any > arrayEqual ( a1 : KtNDArray < T > , a2 : KtNDArray < E > ) : Boolean

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( a1 , a2 ) , kClass = Boolean :: class )

/**
 * *true* if two arrays have the same shape and elements, *false* otherwise.
 */


fun < T : Any , E : Any > arrayEquiv ( a1 : KtNDArray < T > , a2 : KtNDArray < E > ) : Boolean

/**
 * Returns *true* if input arrays are shape consistent and all elements equal.
 */


fun < T : Any , E : Any > greater ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Return the truth value of (x1 > x2) element-wise.
 */


fun < T : Any , E : Any > greaterEqual ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Return the truth value of (x1 >= x2) element-wise.
 */


fun < T : Any , E : Any > less ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Return the truth value of (x1 < x2) element-wise.
 */


fun < T : Any , E : Any > lessEqual ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Return the truth value of (x1 =< x2) element-wise.
 */


fun < T : Any , E : Any > equal ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Return (x1 == x2) element-wise.
 */


fun < T : Any , E : Any > notEqual ( x1 : KtNDArray < T > , x2 : KtNDArray < E > ) : KtNDArray < Boolean >

/**
 * Return (x1 != x2) element-wise.
 */


@ HtmlTagMarker <EOL> inline fun VIDEO . source ( classes : String ? = null , crossinline block : SOURCE . ( ) -> Unit = { } ) : Unit

= SOURCE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


public fun detectPose ( image : I ) : DetectedPose

= predict ( image )

/**
 * Detects a pose for the given [image].
 * @param [image] input image.
 */


private fun dfgNodeToConstraintNode ( function : Function , node : DataFlowIR . Node ) : Node

{ <EOL> fun edgeToConstraintNode ( edge : DataFlowIR . Edge ) : Node = <EOL> edgeToConstraintNode ( function , edge ) <EOL> fun doCall ( callee : DataFlowIR . FunctionSymbol , arguments : List < Node > , returnType : DataFlowIR . Type . Declared ) = <EOL> doCall ( function , callee , arguments , returnType ) <EOL> fun readField ( field : DataFlowIR . Field , actualType : DataFlowIR . Type . Declared ) : Node { <EOL> val fieldNode = fieldNode ( field ) <EOL> val expectedType = field . type . resolved ( ) <EOL> return if ( ! useTypes || actualType == expectedType ) <EOL> fieldNode <EOL> else <EOL> doCast ( function , fieldNode , actualType ) <EOL> } <EOL> fun writeField ( field : DataFlowIR . Field , value : Node ) = addEdge ( value , fieldNode ( field ) ) <EOL> if ( node is DataFlowIR . Node . Variable && node . kind != DataFlowIR . VariableKind . Temporary ) { <EOL> return variables . getOrPut ( node ) { <EOL> ordinaryNode { "<STR_LIT>" } <EOL> } <EOL> } <EOL> return functionNodesMap . getOrPut ( node ) { <EOL> when ( node ) { <EOL> is DataFlowIR . Node . Const -> { <EOL> val type = node . type . resolved ( ) <EOL> addInstantiatingClass ( type ) <EOL> sourceNode ( concreteType ( type ) ) { "<STR_LIT>" } <EOL> } <EOL> DataFlowIR . Node . Null -> constraintGraph . voidNode <EOL> is DataFlowIR . Node . Parameter -> <EOL> function . parameters [ node . index ] <EOL> is DataFlowIR . Node . StaticCall -> { <EOL> val arguments = node . arguments . map ( :: edgeToConstraintNode ) <EOL> doCall ( node . callee , arguments , node . returnType . resolved ( ) ) <EOL> } <EOL> is DataFlowIR . Node . NewObject -> { <EOL> val returnType = node . constructedType . resolved ( ) <EOL> addInstantiatingClass ( returnType ) <EOL> val instanceNode = concreteClass ( returnType ) <EOL> val arguments = listOf ( instanceNode ) + node . arguments . map ( :: edgeToConstraintNode ) <EOL> doCall ( node . callee , arguments , returnType ) <EOL> instanceNode <EOL> } <EOL> is DataFlowIR . Node . VirtualCall -> { <EOL> val callee = node . callee <EOL> val receiverType = node . receiverType . resolved ( ) <EOL> context . logMultiple { <EOL> + "<STR_LIT>" <EOL> + "<STR_LIT>" <EOL> + "<STR_LIT>" <EOL> + "<STR_LIT>" <EOL> + "<STR_LIT>" <EOL> forEachBitInBoth ( typeHierarchy . inheritorsOf ( receiverType ) , instantiatingClasses ) { <EOL> + allTypes [ it ] . calleeAt ( node ) . toString ( ) <EOL> } <EOL> + "<STR_LIT>" <EOL> } <EOL> val returnType = node . returnType . resolved ( ) <EOL> val arguments = node . arguments . map ( :: edgeToConstraintNode ) <EOL> val receiverNode = arguments [ <NUM_LIT:0> ] <EOL> if ( receiverType == DataFlowIR . Type . Virtual ) <EOL> addEdge ( constraintGraph . virtualNode , receiverNode ) <EOL> if ( entryPoint == null && returnType . isFinal ) { <EOL> addInstantiatingClass ( returnType ) <EOL> } <EOL> val returnsNode = ordinaryNode { "<STR_LIT>" } <EOL> if ( receiverType != DataFlowIR . Type . Virtual ) <EOL> typesVirtualCallSites [ receiverType . index ] . add ( ConstraintGraphVirtualCall ( function , node , arguments , returnsNode ) ) <EOL> forEachBitInBoth ( typeHierarchy . inheritorsOf ( receiverType ) , instantiatingClasses ) { <EOL> val actualCallee = allTypes [ it ] . calleeAt ( node ) <EOL> addEdge ( doCall ( actualCallee , arguments , actualCallee . returnParameter . type . resolved ( ) ) , returnsNode ) <EOL> } <EOL> if ( entryPoint == null ) { <EOL> if ( ! returnType . isFinal ) { <EOL> receiverNode . addCastEdge ( Node . CastEdge ( returnsNode , virtualTypeFilter ) ) <EOL> } else { <EOL> constraintGraph . externalVirtualCalls . add ( ExternalVirtualCall ( receiverNode , returnsNode , returnType ) ) <EOL> } <EOL> } <EOL> receiverNode . addCastEdge ( Node . CastEdge ( function . throws , virtualTypeFilter ) ) <EOL> constraintGraph . virtualCallSiteReceivers [ node ] = receiverNode <EOL> castIfNeeded ( function , returnsNode , node . callee . returnParameter . type . resolved ( ) , returnType ) <EOL> } <EOL> is DataFlowIR . Node . Singleton -> { <EOL> val type = node . type . resolved ( ) <EOL> addInstantiatingClass ( type ) <EOL> val instanceNode = concreteClass ( type ) <EOL> node . constructor ? . let { <EOL> doCall ( it , buildList { <EOL> add ( instanceNode ) <EOL> node . arguments ? . forEach { add ( edgeToConstraintNode ( it ) ) } <EOL> } , type ) <EOL> } <EOL> instanceNode <EOL> } <EOL> is DataFlowIR . Node . AllocInstance -> { <EOL> val type = node . type . resolved ( ) <EOL> addInstantiatingClass ( type ) <EOL> concreteClass ( type ) <EOL> } <EOL> is DataFlowIR . Node . FunctionReference -> { <EOL> concreteClass ( node . type . resolved ( ) ) <EOL> } <EOL> is DataFlowIR . Node . FieldRead -> { <EOL> val type = node . field . type . resolved ( ) <EOL> if ( entryPoint == null && type . isFinal ) <EOL> addInstantiatingClass ( type ) <EOL> readField ( node . field , node . type . resolved ( ) ) <EOL> } <EOL> is DataFlowIR . Node . FieldWrite -> { <EOL> val type = node . field . type . resolved ( ) <EOL> if ( entryPoint == null && type . isFinal ) <EOL> addInstantiatingClass ( type ) <EOL> writeField ( node . field , edgeToConstraintNode ( node . value ) ) <EOL> constraintGraph . voidNode <EOL> } <EOL> is DataFlowIR . Node . ArrayRead -> <EOL> readField ( constraintGraph . arrayItemField , node . type . resolved ( ) ) <EOL> is DataFlowIR . Node . ArrayWrite -> { <EOL> writeField ( constraintGraph . arrayItemField , edgeToConstraintNode ( node . value ) ) <EOL> constraintGraph . voidNode <EOL> } <EOL> is DataFlowIR . Node . Variable -> <EOL> node . values . map { edgeToConstraintNode ( it ) } . let { values -> <EOL> ordinaryNode { "<STR_LIT>" } . also { node -> <EOL> values . forEach { addEdge ( it , node ) } <EOL> } <EOL> } <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }

/**
 * Takes a function DFG's node and creates a constraint graph node corresponding to it.
 * Also creates all necessary edges, except for variable nodes.
 * For variable nodes edges must be created separately, otherwise recursion can be too deep.
 */


{ <EOL> _builder . clearExtras ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.IdeaExtrasProto extras = 1;
 */


{ <EOL> return _builder . hasExtras ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.IdeaExtrasProto extras = 1;
 * @return Whether the extras field is set.
 */


{ <EOL> _builder . clearCoordinates ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinBinaryCoordinatesProto coordinates = 2;
 */


fun hasCoordinates ( ) : kotlin . Boolean

{ <EOL> return _builder . hasCoordinates ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinBinaryCoordinatesProto coordinates = 2;
 * @return Whether the coordinates field is set.
 */


{ <EOL> _builder . clearCause ( ) <EOL> }


{ <EOL> return _builder . hasCause ( ) <EOL> }

/**
 * optional string cause = 3;
 * @return Whether the cause field is set.
 */


private fun collectClassCategories ( classCursor : CValue < CXCursor > , className : String ) : List < CValue < CXCursor > >

{ <EOL> assert ( classCursor . kind == CXCursorKind . CXCursor_ObjCInterfaceDecl ) { classCursor . kind } <EOL> val classFile = getContainingFile ( classCursor ) <EOL> val result = mutableListOf < CValue < CXCursor > > ( ) <EOL> val translationUnit = clang_getCursorLexicalParent ( classCursor ) <EOL> visitChildren ( translationUnit ) { childCursor , _ -> <EOL> if ( childCursor . kind == CXCursorKind . CXCursor_ObjCCategoryDecl ) { <EOL> val categoryClassCursor = getObjCCategoryClassCursor ( childCursor ) <EOL> val categoryClassName = clang_getCursorDisplayName ( categoryClassCursor ) . convertAndDispose ( ) <EOL> if ( className == categoryClassName ) { <EOL> val categoryFile = getContainingFile ( childCursor ) <EOL> if ( clang_File_isEqual ( categoryFile , classFile ) != <NUM_LIT:0> ) { <EOL> result += childCursor <EOL> } <EOL> } <EOL> } <EOL> CXChildVisitResult . CXChildVisit_Continue <EOL> } <EOL> return result <EOL> }

/**
 * Find all categories for a class that is pointed by [classCursor] in the same file.
 * NB: Current implementation is rather slow as it walks the whole translation unit.
 */


internal fun < C > TransformableColumnSet < C > . atAnyDepthImpl ( includeGroups : Boolean = true , includeTopLevel : Boolean = true , ) : ColumnSet < C >

= object : ColumnSet < C > { <EOL> override fun resolve ( context : ColumnResolutionContext ) : List < ColumnWithPath < C > > = <EOL> this@atAnyDepthImpl . transformResolve ( context = context , transformer = AtAnyDepthTransformer ( includeGroups = includeGroups , includeTopLevel = includeTopLevel , ) , ) <EOL> }

/**
 * AtAnyDepth implementation for [TransformableColumnSet].
 * This converts a [TransformableColumnSet] into a [ColumnSet] by redirecting [ColumnSet.resolve]
 * to [TransformableColumnSet.transformResolve] with a correctly configured [AtAnyDepthTransformer].
 */


internal fun < C > TransformableSingleColumn < C > . atAnyDepthImpl ( includeGroups : Boolean = true , includeTopLevel : Boolean = true , ) : SingleColumn < C >

= object : SingleColumn < C > { <EOL> override fun resolveSingle ( context : ColumnResolutionContext ) : ColumnWithPath < C > ? = <EOL> this@atAnyDepthImpl . transformResolveSingle ( context = context , transformer = AtAnyDepthTransformer ( includeGroups = includeGroups , includeTopLevel = includeTopLevel , ) , ) <EOL> }

/**
 * AtAnyDepth implementation for [TransformableSingleColumn].
 * This converts a [TransformableSingleColumn] into a [SingleColumn] by redirecting [SingleColumn.resolveSingle]
 * to [TransformableSingleColumn.transformResolveSingle] with a correctly configured [AtAnyDepthTransformer].
 */


internal fun ColumnsResolver < * > . flattenRecursively ( includeGroups : Boolean = true , includeTopLevel : Boolean = true , ) : ColumnsResolver < * >

= allColumnsInternal ( ) . transform { cols -> <EOL> if ( includeTopLevel ) { <EOL> cols . flattenRecursively ( ) <EOL> } else { <EOL> cols <EOL> . filter { it . isColumnGroup ( ) } <EOL> . flatMap { it . cols ( ) . flattenRecursively ( ) } <EOL> } . filter { includeGroups || ! it . isColumnGroup ( ) } <EOL> }

/**
 * Flattens a [ColumnsResolver] recursively.
 *
 * If [this] is a [SingleColumn] containing a single [ColumnGroup], the "top-level" is
 * considered to be the [ColumnGroup]'s children, otherwise, if this is a [ColumnsResolver],
 * the "top-level" is considered to be the columns in the [ColumnsResolver].
 *
 * @param includeGroups Whether to include [ColumnGroup]s in the result.
 * @param includeTopLevel Whether to include the "top-level" columns in the result.
 */


public fun write ( source : ByteArray , startIndex : Int = <NUM_LIT:0> , endIndex : Int = source . size )

/**
 * Writes bytes from [source] array or its subrange to this sink.
 *
 * @param source the array from which bytes will be written into this sink.
 * @param startIndex the start index (inclusive) of the [source] subrange to be written, 0 by default.
 * @param endIndex the endIndex (exclusive) of the [source] subrange to be written, size of the [source] by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [source] array indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeByteArrayToSink
 */


public fun transferFrom ( source : RawSource ) : Long

/**
 * Removes all bytes from [source] and write them to this sink.
 * Returns the number of bytes read which will be 0 if [source] is exhausted.
 *
 * @param source the source to consume data from.
 *
 * @throws IllegalStateException when the sink or [source] is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.transferFrom
 */


public fun write ( source : RawSource , byteCount : Long )

/**
 * Removes [byteCount] bytes from [source] and write them to this sink.
 *
 * If [source] will be exhausted before reading [byteCount] from it then an exception throws on
 * an attempt to read remaining bytes will be propagated to a caller of this method.
 *
 * @param source the source to consume data from.
 * @param byteCount the number of bytes to read from [source] and to write into this sink.
 *
 * @throws IllegalArgumentException when [byteCount] is negative.
 * @throws IllegalStateException when the sink or [source] is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeSourceToSink
 */


public fun writeByte ( byte : Byte )

/**
 * Writes a byte to this sink.
 *
 * @param byte the byte to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeByte
 */


public fun writeShort ( short : Short )

/**
 * Writes two bytes containing [short], in the big-endian order, to this sink.
 *
 * @param short the short integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeShort
 */


public fun writeInt ( int : Int )

/**
 * Writes four bytes containing [int], in the big-endian order, to this sink.
 *
 * @param int the integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeInt
 */


public fun writeLong ( long : Long )

/**
 * Writes eight bytes containing [long], in the big-endian order, to this sink.
 *
 * @param long the long integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeLong
 */


override fun flush ( )

/**
 * Writes all buffered data to the underlying sink, if one exists.
 * Then the underlying sink is explicitly flushed.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.flush
 */


public fun emit ( )

/**
 * Writes all buffered data to the underlying sink if one exists.
 * The underlying sink will not be explicitly flushed.
 *
 * This method behaves like [flush], but has weaker guarantees.
 * Call this method before a buffered sink goes out of scope so that its data can reach its destination.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.emit
 */


@ InternalIoApi <EOL> public fun hintEmit ( )

/**
 * Hints that the buffer may be *partially* emitted (see [emit]) to the underlying sink.
 * The underlying sink will not be explicitly flushed.
 * There are no guarantees that this call will cause emit of buffered data as well as
 * there are no guarantees how many bytes will be emitted.
 *
 * Typically, application code will not need to call this: it is only necessary when
 * application code writes directly to this [buffered].
 * Use this to limit the memory held in the buffer.
 *
 * Consider using [Sink.writeToInternalBuffer] for writes into [buffered] followed by [hintEmit] call.
 *
 * @throws IllegalStateException when the sink is closed.
 */


{ <EOL> val dot = node . findChildByType ( KtTokens . DOT ) <EOL> val textRange = textRange <EOL> val nameStart = if ( dot != null ) dot . textRange . endOffset - textRange . startOffset else <NUM_LIT:0> <EOL> return TextRange ( nameStart , textRange . length ) <EOL> }

/**
 * Returns the range within the element containing the name (in other words,
 * the range of the element excluding the qualifier and dot, if present).
 */


fun getLibraryLatestVersionInLocalRepo ( path : String ) : String

{ <EOL> val metadataFile = File ( props . tipOfTreeMavenRepoPath ) <EOL> . resolve ( path ) <EOL> . resolve ( "<STR_LIT>" ) <EOL> check ( metadataFile . exists ( ) ) { <EOL> "<STR_LIT>" <EOL> } <EOL> check ( metadataFile . isFile ) { <EOL> "<STR_LIT>" <EOL> } <EOL> val xmlDoc = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) <EOL> . parse ( metadataFile ) <EOL> val latestVersionNode = XPathFactory . newInstance ( ) . newXPath ( ) <EOL> . compile ( "<STR_LIT>" ) . evaluate ( xmlDoc , XPathConstants . STRING ) <EOL> check ( latestVersionNode is String ) { <EOL> """<STR_LIT>""" . trimIndent ( ) <EOL> } <EOL> return latestVersionNode <EOL> }

/**
 * Gets the latest version of a published library.
 *
 * Note that the library must have been locally published to locate its latest version, this
 * can be done in test by adding :publish as a test dependency, for example:
 * ```
 * tasks.findByPath("test")
 * .dependsOn(tasks.findByPath(":room:room-compiler:publish")
 * ```
 *
 * @param path - The library m2 path e.g. "androidx/room/room-compiler"
 */


public fun < T : Base > subclass ( subclass : KClass < T > , serializer : KSerializer < T > )

{ <EOL> subclasses . add ( subclass to serializer ) <EOL> }

/**
 * Registers a [subclass] [serializer] in the resulting module under the [base class][Base].
 */


public fun defaultDeserializer ( defaultDeserializerProvider : ( className : String ? ) -> DeserializationStrategy < Base > ? )

{ <EOL> require ( this . defaultDeserializerProvider == null ) { <EOL> "<STR_LIT>" <EOL> } <EOL> this . defaultDeserializerProvider = defaultDeserializerProvider <EOL> }

/**
 * Adds a default serializers provider associated with the given [baseClass] to the resulting module.
 * [defaultDeserializerProvider] is invoked when no polymorphic serializers associated with the `className`
 * were found. `className` could be `null` for formats that support nullable class discriminators
 * (currently only `Json` with `JsonBuilder.useArrayPolymorphism` set to `false`)
 *
 * Default deserializers provider affects only deserialization process. To affect serialization process, use
 * [SerializersModuleBuilder.polymorphicDefaultSerializer].
 *
 * [defaultDeserializerProvider] can be stateful and lookup a serializer for the missing type dynamically.
 *
 * Typically, if the class is not registered in advance, it is not possible to know the structure of the unknown
 * type and have a precise serializer, so the default serializer has limited capabilities.
 * If you're using `Json` format, you can get a structural access to the unknown data using `JsonContentPolymorphicSerializer`.
 *
 * @see SerializersModuleBuilder.polymorphicDefaultSerializer
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) , DeprecationLevel . WARNING ) <EOL> public fun default ( defaultSerializerProvider : ( className : String ? ) -> DeserializationStrategy < Base > ? )

{ <EOL> defaultDeserializer ( defaultSerializerProvider ) <EOL> }

/**
 * Adds a default deserializers provider associated with the given [baseClass] to the resulting module.
 * This function affect only deserialization process. To avoid confusion, it was deprecated and replaced with [defaultDeserializer].
 * To affect serialization process, use [SerializersModuleBuilder.polymorphicDefaultSerializer].
 *
 * [defaultSerializerProvider] is invoked when no polymorphic serializers associated with the `className`
 * were found. `className` could be `null` for formats that support nullable class discriminators
 * (currently only `Json` with `JsonBuilder.useArrayPolymorphism` set to `false`)
 *
 * [defaultSerializerProvider] can be stateful and lookup a serializer for the missing type dynamically.
 *
 * Typically, if the class is not registered in advance, it is not possible to know the structure of the unknown
 * type and have a precise serializer, so the default serializer has limited capabilities.
 * If you're using `Json` format, you can get a structural access to the unknown data using `JsonContentPolymorphicSerializer`.
 *
 * @see defaultDeserializer
 * @see SerializersModuleBuilder.polymorphicDefaultSerializer
 */


public inline fun < Base : Any , reified T : Base > PolymorphicModuleBuilder < Base > . subclass ( serializer : KSerializer < T > ) : Unit

= <EOL> subclass ( T :: class , serializer )


public inline fun < Base : Any , reified T : Base > PolymorphicModuleBuilder < Base > . subclass ( clazz : KClass < T > ) : Unit

= <EOL> subclass ( clazz , serializer ( ) )

/**
 * Registers a serializer for class [T] in the resulting module under the [base class][Base].
 */


fun invokeOnCancellation ( segment : Segment < * > , index : Int )

/**
 * When this waiter is cancelled, [Segment.onCancellation] with
 * the specified [segment] and [index] should be called.
 * This function installs the corresponding cancellation handler.
 */


fun findClasses ( request : Request ) : List < JavaClass >

/**
 * Finds all classes with the specified [ClassId]. This function should be used if the search space permits such ambiguities and if
 * [findClass] is not guaranteed to disambiguate by itself. For example, in an IDE context, a broad search scope might lead to multiple
 * valid candidates, which need to be disambiguated according to classpath order.
 *
 * [findClasses] may return a single [JavaClass], even if more could be found, if the resulting [JavaClass] is guaranteed to be the
 * first in the dependency order.
 */


fun canComputeKnownClassNamesInPackage ( ) : Boolean

/**
 * Whether [knownClassNamesInPackage] can be computed. When [canComputeKnownClassNamesInPackage] is `false`, [knownClassNamesInPackage]
 * will always return `null`.
 */


public open fun addOptionsTo ( sessionOptions : OrtSession . SessionOptions ) : Unit

= Unit

/**
 * Adds execution provider options to the [OrtSession.SessionOptions].
 */


operator fun provideDelegate ( thisRef : Any ? , prop : KProperty < * > ) : ArgumentValueDelegate < TResult >

{ <EOL> check ( ! delegateProvided ) { <EOL> "<STR_LIT>" <EOL> } <EOL> ( delegate as ParsingValue < * , * > ) . provideName ( prop . name ) <EOL> delegateProvided = true <EOL> return delegate <EOL> }

/**
 * Returns the delegate object for property delegation and initializes it with the name of the delegated property.
 *
 * This operator makes it possible to delegate a property to this instance. It returns [delegate] object
 * to be used as an actual delegate and uses the name of the delegated property to initialize the full name
 * of the option/argument if it wasn't done during construction of that option/argument.
 *
 * @throws IllegalStateException in case of trying to use same delegate several times.
 */


internal fun checkDescriptor ( descriptor : ArgDescriptor < * , * > )

{ <EOL> if ( descriptor . number == null || descriptor . number > <NUM_LIT:1> ) { <EOL> failAssertion ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Check descriptor for this kind of argument.
 */


fun < T : Any , TResult , DefaultRequired : DefaultRequiredType > <EOL> AbstractSingleArgument < T , TResult , DefaultRequired > . multiple ( number : Int ) : MultipleArgument < T , DefaultRequired >

{ <EOL> require ( number >= <NUM_LIT:2> ) { "<STR_LIT>" } <EOL> val newArgument = with ( ( delegate . cast < ParsingValue < T , T > > ( ) ) . descriptor as ArgDescriptor ) { <EOL> MultipleArgument < T , DefaultRequired > ( ArgDescriptor ( type , fullName , number , description , listOfNotNull ( defaultValue ) , required , deprecatedWarning ) , owner ) <EOL> } <EOL> owner . entity = newArgument <EOL> return newArgument <EOL> }

/**
 * Allows the argument to have several values specified in command line string.
 *
 * @param number the exact number of values expected for this argument, but at least 2.
 *
 * @throws IllegalArgumentException if number of values expected for this argument less than 2.
 */


fun < T : Any , TResult , DefaultRequired : DefaultRequiredType > AbstractSingleArgument < T , TResult , DefaultRequired > . vararg ( ) : <EOL> MultipleArgument < T , DefaultRequired >

{ <EOL> val newArgument = with ( ( delegate . cast < ParsingValue < T , T > > ( ) ) . descriptor as ArgDescriptor ) { <EOL> MultipleArgument < T , DefaultRequired > ( ArgDescriptor ( type , fullName , null , description , listOfNotNull ( defaultValue ) , required , deprecatedWarning ) , owner ) <EOL> } <EOL> owner . entity = newArgument <EOL> return newArgument <EOL> }

/**
 * Allows the last argument to take all the trailing values in command line string.
 */


fun < T : Any > SingleNullableArgument < T > . default ( value : T ) : SingleArgument < T , DefaultRequiredType . Default >

{ <EOL> val newArgument = with ( ( delegate . cast < ParsingValue < T , T > > ( ) ) . descriptor as ArgDescriptor ) { <EOL> SingleArgument < T , DefaultRequiredType . Default > ( ArgDescriptor ( type , fullName , number , description , value , false , deprecatedWarning ) , owner ) <EOL> } <EOL> owner . entity = newArgument <EOL> return newArgument <EOL> }

/**
 * Specifies the default value for the argument, that will be used when no value is provided for the argument
 * in command line string.
 *
 * Argument becomes optional, because value for it is set even if it isn't provided in command line.
 *
 * @param value the default value.
 */


fun < T : Any > MultipleArgument < T , DefaultRequiredType . None > . default ( value : Collection < T > ) : <EOL> MultipleArgument < T , DefaultRequiredType . Default >

{ <EOL> require ( value . isNotEmpty ( ) ) { "<STR_LIT>" } <EOL> val newArgument = with ( ( delegate . cast < ParsingValue < T , List < T > > > ( ) ) . descriptor as ArgDescriptor ) { <EOL> MultipleArgument < T , DefaultRequiredType . Default > ( ArgDescriptor ( type , fullName , number , description , value . toList ( ) , required , deprecatedWarning ) , owner ) <EOL> } <EOL> owner . entity = newArgument <EOL> return newArgument <EOL> }

/**
 * Specifies the default value for the argument with multiple values, that will be used when no values are provided
 * for the argument in command line string.
 *
 * Argument becomes optional, because value for it is set even if it isn't provided in command line.
 *
 * @param value the default value, must be a non-empty collection.
 */


fun < T : Any > SingleArgument < T , DefaultRequiredType . Required > . optional ( ) : SingleNullableArgument < T >

{ <EOL> val newArgument = with ( ( delegate . cast < ParsingValue < T , T > > ( ) ) . descriptor as ArgDescriptor ) { <EOL> SingleNullableArgument ( ArgDescriptor ( type , fullName , number , description , defaultValue , false , deprecatedWarning ) , owner ) <EOL> } <EOL> owner . entity = newArgument <EOL> return newArgument <EOL> }

/**
 * Allows the argument to have no value specified in command line string.
 *
 * The value of the argument is `null` in case if no value was specified in command line string.
 *
 * Note that only trailing arguments can be optional, i.e. no required arguments can follow optional ones.
 */


fun < T : Any > MultipleArgument < T , DefaultRequiredType . Required > . optional ( ) : MultipleArgument < T , DefaultRequiredType . None >

{ <EOL> val newArgument = with ( ( delegate . cast < ParsingValue < T , List < T > > > ( ) ) . descriptor as ArgDescriptor ) { <EOL> MultipleArgument < T , DefaultRequiredType . None > ( ArgDescriptor ( type , fullName , number , description , defaultValue ? . toList ( ) ? : listOf ( ) , false , deprecatedWarning ) , owner ) <EOL> } <EOL> owner . entity = newArgument <EOL> return newArgument <EOL> }

/**
 * Allows the argument with multiple values to have no values specified in command line string.
 *
 * The value of the argument is an empty list in case if no value was specified in command line string.
 *
 * Note that only trailing arguments can be optional: no required arguments can follow the optional ones.
 */


internal actual fun safeAdd ( a : Long , b : Long ) : Long

{ <EOL> val sum = a + b <EOL> if ( ( a xor sum ) < <NUM_LIT:0> && ( a xor b ) >= <NUM_LIT:0> ) { <EOL> throw ArithmeticException ( "<STR_LIT>" ) <EOL> } <EOL> return sum <EOL> }

/**
 * Safely adds two long values.
 * throws [ArithmeticException] if the result overflows a long
 */


internal actual fun safeAdd ( a : Int , b : Int ) : Int

/**
 * Safely adds two int values.
 * throws [ArithmeticException] if the result overflows an int
 */


internal actual fun safeMultiply ( a : Long , b : Long ) : Long

{ <EOL> if ( b == <NUM_LIT:1L> ) { <EOL> return a <EOL> } <EOL> if ( a == <NUM_LIT:1L> ) { <EOL> return b <EOL> } <EOL> if ( a == <NUM_LIT:0L> || b == <NUM_LIT:0L> ) { <EOL> return <NUM_LIT:0> <EOL> } <EOL> val total = a * b <EOL> if ( total / b != a || a == Long . MIN_VALUE && b == - <NUM_LIT:1L> || b == Long . MIN_VALUE && a == - <NUM_LIT:1L> ) { <EOL> throw ArithmeticException ( "<STR_LIT>" ) <EOL> } <EOL> return total <EOL> }

/**
 * Safely multiply a long by a long.
 *
 * @param a the first value
 * @param b the second value
 * @return the new total
 * @throws ArithmeticException if the result overflows a long
 */


internal actual fun safeMultiply ( a : Int , b : Int ) : Int

{ <EOL> val total = a . toLong ( ) * b . toLong ( ) <EOL> if ( total < Int . MIN_VALUE || total > Int . MAX_VALUE ) { <EOL> throw ArithmeticException ( "<STR_LIT>" ) <EOL> } <EOL> return total . toInt ( ) <EOL> }

/**
 * Safely multiply an int by an int.
 *
 * @param a the first value
 * @param b the second value
 * @return the new total
 * @throws ArithmeticException if the result overflows an int
 */


public suspend fun await ( ) : T

/**
 * Awaits for completion of this value without blocking the thread and returns the resulting value or throws
 * the exception if the deferred was cancelled.
 *
 * Unless the calling coroutine is cancelled, [await] will return the same result on each invocation:
 * if the [Deferred] completed successfully, [await] will return the same value every time;
 * if the [Deferred] completed exceptionally, [await] will rethrow the same exception.
 *
 * This suspending function is itself cancellable: if the [Job] of the current coroutine is cancelled or completed
 * while this suspending function is waiting, this function immediately resumes with [CancellationException].
 *
 * This means that [await] can throw [CancellationException] in two cases:
 * - if the coroutine in which [await] was called got cancelled,
 * - or if the [Deferred] itself got completed with a [CancellationException].
 *
 * In both cases, the [CancellationException] will cancel the coroutine calling [await], unless it's caught.
 * The following idiom may be helpful to avoid this:
 * ```
 * try {
 * deferred.await()
 * } catch (e: CancellationException) {
 * currentCoroutineContext().ensureActive() // throws if the current coroutine was cancelled
 * processException(e) // if this line executes, the exception is the result of `await` itself
 * }
 * ```
 *
 * There is a **prompt cancellation guarantee**: even if this function is ready to return the result, but was cancelled
 * while suspended, [CancellationException] will be thrown. See [suspendCancellableCoroutine] for low-level details.
 *
 * This function can be used in [select] invocations with an [onAwait] clause.
 * Use [isCompleted] to check for completion of this deferred value without waiting, and
 * [join] to wait for completion without returning the result.
 */


@ ExperimentalCoroutinesApi <EOL> public fun getCompleted ( ) : T

/**
 * Returns *completed* result or throws [IllegalStateException] if this deferred value has not
 * [completed][isCompleted] yet. It throws the corresponding exception if this deferred was [cancelled][isCancelled].
 *
 * This function is designed to be used from [invokeOnCompletion] handlers, when there is an absolute certainty that
 * the value is already complete. See also [getCompletionExceptionOrNull].
 *
 * **Note: This is an experimental api.** This function may be removed or renamed in the future.
 */


@ ExperimentalCoroutinesApi <EOL> public fun getCompletionExceptionOrNull ( ) : Throwable ?

/**
 * Returns *completion exception* result if this deferred was [cancelled][isCancelled] and has [completed][isCompleted],
 * `null` if it had completed normally, or throws [IllegalStateException] if this deferred value has not
 * [completed][isCompleted] yet.
 *
 * This function is designed to be used from [invokeOnCompletion] handlers, when there is an absolute certainty that
 * the value is already complete. See also [getCompleted].
 *
 * **Note: This is an experimental api.** This function may be removed or renamed in the future.
 */


public abstract fun clipGradient ( tf : Ops , gradient : Operand < Float > ) : Operand < Float >

/**
 * Clips [gradient].
 *
 * @param [tf] TensorFlow graph API for building operations.
 */


public abstract fun < T : Any > getRegisteredExtensions ( module : KtSourceModule , extensionType : ProjectExtensionDescriptor < T > ) : List < T >

/**
 * Returns a list of extensions of a base [extensionType] which are registered for [module]
 *
 * These extensions are used in addition to those provided by the extension descriptor's [ProjectExtensionDescriptor.getInstances].
 */


public abstract fun isPluginOfTypeRegistered ( module : KtSourceModule , pluginType : CompilerPluginType ) : Boolean

/**
 * Returns `true` if at least one plugin with requested `pluginType` is registered, `false` otherwise
 */


inline fun < reified T > extrasKeyOf ( name : String ? = null ) : Extras . Key < T >

= <EOL> Extras . Key ( extrasTypeOf ( ) , name )

/**
 * Creates a value based key for accessing any [Extras] container
 *
 * @param T The type of data that is stored in the extras container
 * ```kotlin
 * extrasKeyOf<Int>() == extrasKeyOf<Int>()
 * extrasKeyOf<Int>() != extrasKeyOf<String>()
 * extrasKeyOf<List<Int>>() == extrasKeyOf<List<Int>>()
 * extrasKeyOf<List<*>>() != extrasKeyOf<List<Int>>()
 * ```
 *
 * @param name This typed keys can also be distinguished with an additional name. In this case
 * ```kotlin
 * extrasKeyOf<Int>() != extrasKeyOf<Int>("a")
 * extrasKeyOf<Int>("a") == extrasKeyOf<Int>("a")
 * extrasKeyOf<Int>("b") != extrasKeyOf<Int>("a")
 * extrasKeyOf<String>("a") != extrasKeyOf<Int>("a")
 * ```
 */


fun removeDefaultInitializers ( arguments : List < JsExpression > , parameters : List < JsParameter > , body : JsBlock )

{ <EOL> val toRemove = getDefaultParamsNames ( arguments , parameters , initialized = true ) <EOL> val toExpand = getDefaultParamsNames ( arguments , parameters , initialized = false ) <EOL> val statements = body . statements <EOL> val newStatements = statements . flatMap { <EOL> val name = getNameFromInitializer ( it ) <EOL> if ( name != null && ! isNameInitialized ( name , it ) ) { <EOL> throw AssertionError ( "<STR_LIT>" ) <EOL> } <EOL> when { <EOL> name != null && name in toRemove -> <EOL> listOf < JsStatement > ( ) <EOL> name != null && name in toExpand -> { <EOL> val thenStatement = ( it as JsIf ) . thenStatement <EOL> markAssignmentAsStaticRef ( name , thenStatement ) <EOL> flattenStatement ( thenStatement ) <EOL> } <EOL> else -> <EOL> listOf ( it ) <EOL> } <EOL> } <EOL> statements . clear ( ) <EOL> statements . addAll ( newStatements ) <EOL> }

/**
 * Removes initializers for default parameters with defined arguments given
 * Expands initializers for default parameters with undefined arguments given
 */


private fun isNameInitialized ( name : JsName , initializer : JsStatement ) : Boolean

{ <EOL> val thenStmt = ( initializer as JsIf ) . thenStatement <EOL> val lastThenStmt = flattenStatement ( thenStmt ) . last ( ) <EOL> val expr = ( lastThenStmt as? JsExpressionStatement ) ? . expression <EOL> if ( expr !is JsBinaryOperation ) return false <EOL> val op = expr . operator <EOL> if ( ! op . isAssignment ) return false <EOL> val arg1 = expr . arg1 <EOL> if ( arg1 is HasName && arg1 . name === name ) return true <EOL> return false <EOL> }

/**
 * Tests if the last statement of initializer
 * is name assignment.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> fun KProperty1 < * , * > . getExtensionDelegate ( ) : Any ?

{ <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return ( this as KProperty1 < Any ? , * > ) . getDelegate ( KPropertyImpl . EXTENSION_PROPERTY_DELEGATE ) <EOL> }

/**
 * Returns the instance of a delegated **extension property**, or `null` if this property is not delegated.
 * Throws an exception if this is not an extension property.
 *
 * @see [KProperty1.getDelegate]
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> fun < D > KProperty2 < D , * , * > . getExtensionDelegate ( receiver : D ) : Any ?

{ <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return ( this as KProperty2 < D , Any ? , * > ) . getDelegate ( receiver , KPropertyImpl . EXTENSION_PROPERTY_DELEGATE ) <EOL> }

/**
 * Returns the instance of a delegated **member extension property**, or `null` if this property is not delegated.
 * Throws an exception if this is not an extension property.
 *
 * @param receiver the instance of the class used to retrieve the value of the property delegate.
 *
 * @see [KProperty2.getDelegate]
 */


internal fun BuildResult . assertTaskSuccess ( task : String )

{ <EOL> assertTaskOutcome ( TaskOutcome . SUCCESS , task ) <EOL> }

/**
 * Helper `fun` for asserting a [TaskOutcome] to be equal to [TaskOutcome.SUCCESS]
 */


internal fun BuildResult . assertTaskFailure ( task : String )

{ <EOL> assertTaskOutcome ( TaskOutcome . FAILED , task ) <EOL> }

/**
 * Helper `fun` for asserting a [TaskOutcome] to be equal to [TaskOutcome.FAILED]
 */


internal fun BuildResult . assertTaskSkipped ( task : String )

{ <EOL> assertTaskOutcome ( TaskOutcome . SKIPPED , task ) <EOL> }

/**
 * Helper `fun` for asserting a [TaskOutcome] to be equal to [TaskOutcome.SKIPPED]
 */


internal fun BuildResult . assertTaskUpToDate ( task : String )

{ <EOL> assertTaskOutcome ( TaskOutcome . UP_TO_DATE , task ) <EOL> }

/**
 * Helper `fun` for asserting a [TaskOutcome] to be equal to [TaskOutcome.UP_TO_DATE]
 */


internal fun BuildResult . assertTaskNotRun ( taskName : String )

{ <EOL> assertNull ( task ( taskName ) , "<STR_LIT>" ) <EOL> }

/**
 * Helper `fun` for asserting that a task was not run, which also happens if one of its dependencies failed before it
 * could be run.
 */


protected fun < CANDIDATE > selectFirstElementInClasspathOrder ( candidates : Collection < CANDIDATE > , getElement : ( CANDIDATE ) -> PsiElement ? , ) : Pair < CANDIDATE , PROVIDER > ?

{ <EOL> if ( candidates . isEmpty ( ) ) return null <EOL> var currentCandidate : CANDIDATE ? = null <EOL> var currentPrecedence : Int = Int . MAX_VALUE <EOL> var currentKtModule : KtModule ? = null <EOL> for ( candidate in candidates ) { <EOL> val element = getElement ( candidate ) ? : continue <EOL> val ktModule = getModule ( element ) <EOL> val precedence = modulePrecedenceMap [ ktModule ] ? : continue <EOL> if ( precedence < currentPrecedence ) { <EOL> currentCandidate = candidate <EOL> currentPrecedence = precedence <EOL> currentKtModule = ktModule <EOL> } <EOL> } <EOL> val candidate = currentCandidate ? : return null <EOL> val ktModule = currentKtModule ? : error ( "<STR_LIT>" ) <EOL> val provider = providersByKtModule . getValue ( ktModule ) <EOL> return Pair ( candidate , provider ) <EOL> }

/**
 * Selects the element with the highest module precedence in [candidates], returning the element and the provider to which resolution
 * should be delegated. This is a post-processing step that preserves classpath order when, for example, an index access with a combined
 * scope isn't guaranteed to return the first element in classpath order.
 */


override fun visitCall ( expression : IrCall ) : IrExpression

{ <EOL> recordCompanionObjectAsDispatchReceiver ( expression ) <EOL> expression . transformChildrenVoid ( this ) <EOL> val superQualifier : IrClassSymbol ? = expression . superQualifierSymbol <EOL> val callee = expression . symbol <EOL> if ( callee . isAccessible ( withSuper = superQualifier != null ) ) { <EOL> return expression <EOL> } <EOL> val isAccessToProperty = expression . symbol . owner . correspondingPropertySymbol != null <EOL> return if ( isAccessToProperty && expression . origin == IrStatementOrigin . GET_PROPERTY ) { <EOL> generateReflectiveAccessForGetter ( expression ) <EOL> } else if ( isAccessToProperty && expression . origin ? . isAssignmentOperator ( ) == true ) { <EOL> generateReflectiveAccessForSetter ( expression ) <EOL> } else if ( expression . dispatchReceiver == null && expression . extensionReceiver == null ) { <EOL> generateReflectiveStaticCall ( expression ) <EOL> } else if ( superQualifier != null ) { <EOL> generateInvokeSpecialForCall ( expression , superQualifier ) <EOL> } else { <EOL> generateReflectiveMethodInvocation ( expression ) <EOL> } <EOL> }


private fun generateReflectiveMethodInvocation ( declaringClass : IrType , methodName : String , parameterTypes : List < IrType > , receiver : IrExpression ? , arguments : List < IrExpression > , returnType : IrType , symbol : IrSymbol ) : IrExpression

= <EOL> context . createJvmIrBuilder ( symbol ) . irBlock ( resultType = returnType ) { <EOL> val methodVar = <EOL> createTmpVariable ( getDeclaredMethod ( javaClassObject ( declaringClass ) , methodName , parameterTypes ) , nameHint = "<STR_LIT>" , irType = reflectSymbols . javaLangReflectMethod . defaultType ) <EOL> + methodSetAccessible ( irGet ( methodVar ) ) <EOL> + methodInvoke ( irGet ( methodVar ) , receiver ? : irNull ( ) , arguments ) <EOL> }

/**
 * Specific reflective "patches"
 */


@ Suppress ( "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> private inline fun tryForbidNewElements ( ) : Int

{ <EOL> controlState . loop { <EOL> if ( it . isClosed ( ) ) return <NUM_LIT:0> <EOL> if ( controlState . compareAndSet ( it , it or IS_CLOSED_MASK ) ) return it <EOL> } <EOL> }

/**
 * Returns the number of elements that need to be cleaned up due to the pool being closed.
 */


{ <EOL> controlState . loop { ctl -> <EOL> if ( ctl . isClosed ( ) ) return false <EOL> if ( ctl >= maxCapacity ) return true <EOL> if ( controlState . compareAndSet ( ctl , ctl + <NUM_LIT:1> ) ) { <EOL> elements [ ctl ] . value = create ( ctl ) <EOL> return true <EOL> } <EOL> } <EOL> }

/**
 * Request that a new element is created.
 *
 * Returns `false` if the pool is closed.
 *
 * Note that it will still return `true` even if an element was not created due to reaching [maxCapacity].
 *
 * Rethrows the exceptions thrown from [create]. In this case, this operation has no effect.
 */


{ <EOL> val elementsExisting = tryForbidNewElements ( ) <EOL> return ( <NUM_LIT:0> until elementsExisting ) . map { i -> <EOL> loop { <EOL> val element = elements [ i ] . getAndSet ( null ) <EOL> if ( element != null ) { <EOL> return@map element <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Close the pool.
 *
 * This will prevent any new elements from being created.
 * All the elements present in the pool will be returned.
 *
 * The function is thread-safe.
 *
 * [close] can be called multiple times, but only a single call will return a non-empty list.
 * This is due to the elements being cleaned out from the pool on the first invocation to avoid memory leaks,
 * and no new elements being created after.
 */


fun configureAllExecutions ( configure : AggregatedExecutionType . ( ) -> Unit ) : Unit

/**
 * Configures all of the executions aggregated by this execution. If some of the executions are not yet created up to this point,
 * [configure] will be called on them later, once they are created.
 */


fun getConfiguredExecutions ( ) : Iterable < AggregatedExecutionType >

/**
 * Returns the aggregated executions that are already configured up to this moment.
 * Some test runs may be missing from the results if they are not yet configured.
 */


= runTest { <EOL> val x = <NUM_LIT:100> <EOL> val xSum = x * ( x + <NUM_LIT:1> ) / <NUM_LIT:2> <EOL> val publisher = Publisher < Int > { subscriber -> <EOL> var requested = <NUM_LIT:0L> <EOL> var lastOutput = <NUM_LIT:0> <EOL> subscriber . onSubscribe ( object : Subscription { <EOL> override fun request ( n : Long ) { <EOL> requested += n <EOL> if ( n <= <NUM_LIT:0> ) { <EOL> subscriber . onError ( IllegalArgumentException ( ) ) <EOL> return <EOL> } <EOL> while ( lastOutput < x && lastOutput < requested ) { <EOL> lastOutput += <NUM_LIT:1> <EOL> subscriber . onNext ( lastOutput ) <EOL> } <EOL> if ( lastOutput == x ) <EOL> subscriber . onComplete ( ) <EOL> } <EOL> override fun cancel ( ) { <EOL> } <EOL> } ) <EOL> } <EOL> var sum = <NUM_LIT:0> <EOL> publisher . collect { <EOL> sum += it <EOL> } <EOL> assertEquals ( xSum , sum ) <EOL> }

/** Tests the simple scenario where the publisher outputs a bounded stream of values to collect. */


@ Test <EOL> fun testCollectThrowingPublisher ( )

= runTest { <EOL> val errorString = "<STR_LIT>" <EOL> val x = <NUM_LIT:100> <EOL> val xSum = x * ( x + <NUM_LIT:1> ) / <NUM_LIT:2> <EOL> val publisher = Publisher < Int > { subscriber -> <EOL> var requested = <NUM_LIT:0L> <EOL> var lastOutput = <NUM_LIT:0> <EOL> subscriber . onSubscribe ( object : Subscription { <EOL> override fun request ( n : Long ) { <EOL> requested += n <EOL> if ( n <= <NUM_LIT:0> ) { <EOL> subscriber . onError ( IllegalArgumentException ( ) ) <EOL> return <EOL> } <EOL> while ( lastOutput < x && lastOutput < requested ) { <EOL> lastOutput += <NUM_LIT:1> <EOL> subscriber . onNext ( lastOutput ) <EOL> } <EOL> if ( lastOutput == x ) <EOL> subscriber . onError ( IllegalArgumentException ( errorString ) ) <EOL> } <EOL> override fun cancel ( ) { <EOL> } <EOL> } ) <EOL> } <EOL> var sum = <NUM_LIT:0> <EOL> try { <EOL> publisher . collect { <EOL> sum += it <EOL> } <EOL> } catch ( e : IllegalArgumentException ) { <EOL> assertEquals ( errorString , e . message ) <EOL> } <EOL> assertEquals ( xSum , sum ) <EOL> }

/** Tests the behavior of [collect] when the publisher raises an error. */


@ Test <EOL> fun testCollectThrowingAction ( )

= runTest { <EOL> val errorString = "<STR_LIT>" <EOL> val x = <NUM_LIT:100> <EOL> val xSum = x * ( x + <NUM_LIT:1> ) / <NUM_LIT:2> <EOL> val publisher = Publisher < Int > { subscriber -> <EOL> var requested = <NUM_LIT:0L> <EOL> var lastOutput = <NUM_LIT:0> <EOL> subscriber . onSubscribe ( object : Subscription { <EOL> override fun request ( n : Long ) { <EOL> requested += n <EOL> if ( n <= <NUM_LIT:0> ) { <EOL> subscriber . onError ( IllegalArgumentException ( ) ) <EOL> return <EOL> } <EOL> while ( lastOutput < x && lastOutput < requested ) { <EOL> lastOutput += <NUM_LIT:1> <EOL> subscriber . onNext ( lastOutput ) <EOL> } <EOL> } <EOL> override fun cancel ( ) { <EOL> assertEquals ( x , lastOutput ) <EOL> expect ( x + <NUM_LIT:2> ) <EOL> } <EOL> } ) <EOL> } <EOL> var sum = <NUM_LIT:0> <EOL> try { <EOL> expect ( <NUM_LIT:1> ) <EOL> var i = <NUM_LIT:1> <EOL> publisher . collect { <EOL> sum += it <EOL> i += <NUM_LIT:1> <EOL> expect ( i ) <EOL> if ( sum >= xSum ) { <EOL> throw IllegalArgumentException ( errorString ) <EOL> } <EOL> } <EOL> } catch ( e : IllegalArgumentException ) { <EOL> expect ( x + <NUM_LIT:3> ) <EOL> assertEquals ( errorString , e . message ) <EOL> } <EOL> finish ( x + <NUM_LIT:4> ) <EOL> }

/** Tests the behavior of [collect] when the action throws. */


public fun < R > InferenceModel < R > . predictLabel ( inputData : FloatData ) : Int

{ <EOL> return predictProbabilities ( inputData ) . argmax ( ) <EOL> }

/**
 * Predicts the class of [inputData].
 *
 * @param [inputData] The single example with unknown label.
 * @return Predicted class index.
 */


public fun < R > InferenceModel < R > . predictProbabilities ( inputData : FloatData ) : FloatArray

{ <EOL> return predict ( inputData ) { result -> <EOL> resultConverter . getFloatArray ( result , <NUM_LIT:0> ) <EOL> } <EOL> }

/**
 * Predicts vector of probabilities instead of specific class in [predictLabel] method.
 *
 * @param [inputData] The single example with unknown vector of probabilities.
 * @return Vector that represents the probability distributions of possible outcomes.
 */


public fun InferenceModel < * > . predictTopNLabels ( floatData : FloatData , labels : Map < Int , String > , n : Int = <NUM_LIT:5> ) : List < Pair < String , Float > >

{ <EOL> val prediction = predictProbabilities ( floatData ) <EOL> val topNIndexes = prediction . indexOfMaxN ( n ) <EOL> return topNIndexes . map { index -> labels [ index ] ! ! to prediction [ index ] } <EOL> }

/** Returns top-N labels for the given [floatData] encoded with mapping [labels]. */


public fun InferenceModel < * > . predictTop5Labels ( data : FloatData , classLabels : Map < Int , String > , ) : List < Pair < String , Float > >

{ <EOL> return predictTopNLabels ( data , classLabels , n = <NUM_LIT:5> ) <EOL> }

/** Returns top-5 labels for the given [data] encoded with mapping [classLabels]. */


operator fun invoke ( refName : String ) : MarkerResult

/** Produces a [MarkerResult] (either [MarkerResult.CannotFindRefMarker] or [MarkerResult.OpenApiMarker]) for the
 * given [refName] representing a query to find a marker with that given name. */


operator fun invoke ( validName : ValidFieldName , marker : OpenApiMarker , isTopLevelObject : Boolean , ) : String

/**
 * Produces an additional Marker with the given [validName].
 *
 * @param isTopLevelObject only used in `allOf` cases. If true, the additionally produced marker is a top-level object
 * that is to be merged with another object.
 * @param marker the marker to produce.
 * @param validName the name of the marker.
 * @return the name of the produced marker. This name is guaranteed to be unique and might not be the same as the
 * provided [validName].
 */


operator fun invoke ( getRefMarker : GetRefMarker , produceAdditionalMarker : ProduceAdditionalMarker , ) : MarkerResult

/**
 * Represents a call to [toMarker] that can be repeated until it returns a [MarkerResult.OpenApiMarker].
 *
 * @param getRefMarker A function that returns a [Marker] for a given reference name if successful.
 * @param produceAdditionalMarker A function that produces an additional [Marker] for a given name.
 * This is used for `object` types not present in the root of `components/schemas`.
 *
 * @return A [MarkerResult.OpenApiMarker] if successful, otherwise [MarkerResult.CannotFindRefMarker].
 */


fun Project . intellijRuntimeAnnotations ( )

= "<STR_LIT>"

/**
 * Runtime version of annotations that are already in Kotlin stdlib (historically Kotlin has older version of this one).
 *
 * SHOULD NOT BE USED IN COMPILE CLASSPATH!
 *
 * `@NonNull`, `@Nullabe` from `idea/annotations.jar` has `TYPE` target which leads to different types treatment in Kotlin compiler.
 * On the other hand, `idea/annotations.jar` contains org/jetbrains/annotations/Async annations which is required for IDEA debugger.
 *
 * So, we are excluding `annotaions.jar` from all other `kotlin.build` and using this one for runtime only
 * to avoid accidentally including `annotations.jar` by calling `intellijDep()`.
 */


internal fun IrClass . requiresRtti ( ) : Boolean

= when { <EOL> this . isExternalObjCClass ( ) -> false <EOL> else -> true <EOL> }

/**
 * We don't need to generate RTTI in some cases, e.g. Objective-C external classes.
 */


@ Test <EOL> fun `test - custom compilation` ( )

= buildProjectWithMPP ( ) . runLifecycleAwareTest { <EOL> multiplatformExtension . jvm ( ) . apply { <EOL> withJava ( ) <EOL> var instanceUsedForConfigureBlock : KotlinJvmCompilation ? = null <EOL> val instanceReturnedFromCreate = compilations . create ( "<STR_LIT>" ) { instance -> <EOL> assertNull ( instanceUsedForConfigureBlock ) <EOL> instanceUsedForConfigureBlock = instance <EOL> } <EOL> val instanceReturnedFromGet = compilations . getByName ( "<STR_LIT>" ) <EOL> assertSame ( instanceReturnedFromCreate , instanceUsedForConfigureBlock ) <EOL> assertSame ( instanceReturnedFromGet , instanceUsedForConfigureBlock ) <EOL> } <EOL> }

/**
 * Regression was introduced by:
 *
 * ```
 * [Gradle] Ensure java source sets being created eagerly for 'withJava' Sebastian Sellmair* 07.07.23, 20:49
 * 817e3de8f546e34974b89fef0f4f93b425e7e607
 * ```
 *
 * The commit was ensuring that jvm compilations will create their associated java source sets
 * as eager as possible. The solution chosen in the commit was that already the construction of the compilation
 * will spawn a coroutine that waits for the `withJavaEnabled` callback to create the java source set.
 *
 * However, a buildscript like
 *
 * ```kotlin
 * kotlin {
 * jvm().withJava()
 * val customCompilation = jvm().compilations.create("custom")
 * // ^
 * // Zombie
 * }
 * ```
 *
 * would therefore try to create the java source set right in the constructor call of the 'custom' compilation.
 * This would have triggered a listener on `javaSourceSets.all {}` which would ensure that all
 * java source sets have a corresponding kotlin compilation created.
 *
 * Since the current stack is currently inside the constructor of the first compilation, the
 * used `compilations.maybeCreate` would trigger the creation of another custom compilation.
 *
 * The initial buildscript call creating the initial custom compilation will therefore return a Zombie instance
 * ```kotlin
 * kotlin {
 * val customCompilation = jvm().compilations.create("custom")
 * customCompilation != jvm().compilations.getByName("custom")
 * // ^ ^
 * // Zombie Real instance created by the javaSourceSets.all listener
 * }
 * ```
 */


private fun < T : FunctionDescriptor > addNonExistent ( result : MutableCollection < T > , toAdd : List < T > )

{ <EOL> toAdd . forEach { f -> <EOL> if ( result . none { sameSignature ( it , f ) } ) { <EOL> result += f <EOL> } <EOL> } <EOL> }

/**
 * Deduplicates generated functions using name and argument counts, as lombok does
 */


private fun sameSignature ( a : FunctionDescriptor , b : FunctionDescriptor ) : Boolean

{ <EOL> val aVararg = a . valueParameters . any { it . varargElementType != null } <EOL> val bVararg = b . valueParameters . any { it . varargElementType != null } <EOL> return aVararg && bVararg || <EOL> aVararg && b . valueParameters . size >= ( a . valueParameters . size - <NUM_LIT:1> ) || <EOL> bVararg && a . valueParameters . size >= ( b . valueParameters . size - <NUM_LIT:1> ) || <EOL> a . valueParameters . size == b . valueParameters . size <EOL> }

/**
 * Lombok treat functions as having the same signature by arguments count only
 * Corresponding code in lombok - https://github.com/projectlombok/lombok/blob/v1.18.20/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L752
 */


internal fun soundBlock ( filters : Int , kernelSize : Int , poolStride : Int ) : Array < Layer >

= <EOL> arrayOf ( Conv1D ( filters = filters , kernelLength = kernelSize , strides = intArrayOf ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , activation = Activations . Relu , kernelInitializer = HeNormal ( SEED ) , biasInitializer = HeNormal ( SEED ) , padding = ConvPadding . SAME ) , Conv1D ( filters = filters , kernelLength = kernelSize , strides = intArrayOf ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , activation = Activations . Relu , kernelInitializer = HeNormal ( SEED ) , biasInitializer = HeNormal ( SEED ) , padding = ConvPadding . SAME ) , MaxPool1D ( poolSize = intArrayOf ( <NUM_LIT:1> , poolStride , <NUM_LIT:1> ) , strides = intArrayOf ( <NUM_LIT:1> , poolStride , <NUM_LIT:1> ) , padding = ConvPadding . SAME ) )

/**
 * Create a single building block for the SoundNet to simplify its structure.
 * Single block consists of two identical [Conv1D] layers followed by [MaxPool1D].
 *
 * @param filters number of filters in conv layers
 * @param kernelSize in conv layers
 * @param poolStride stride for poolSize and stride in maxpooling layer
 * @return array of layers to be registered in [Sequential] as vararg
 */


{ <EOL> val ( train , test ) = freeSpokenDigits ( ) <EOL> train . shuffle ( ) <EOL> soundNet . use { <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . init ( ) <EOL> var accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This example shows how to do audio classification from scratch using only Conv1D layers (without Conv2D)
 * and dense layers on the example of some toy network.
 * We demonstrate the workflow on the Free Spoken Digits Dataset.
 *
 * It includes:
 * - dataset loading from S3
 * - model compilation
 * - model training
 * - model evaluation
 */


abstract fun visitInlineLambda ( argument : IrFunctionReference , callee : IrFunction , parameter : IrValueParameter , scope : IrDeclaration )

/**
 * Called by this visitor whenever a lambda is passed to an inline function.
 *
 * @param argument The lambda expression passed as an argument to [callee].
 * @param callee The inline function.
 * @param parameter The parameter of [callee] to which the lambda is passed.
 * @param scope The declaration in scope of which [callee] is being called.
 */


fun findContainer ( scope : IrElement ) : IrDeclarationContainer ?

= <EOL> findContainer ( scope , approximateToPackage = false )

/**
 * The class from which all accesses in [scope] will be done after bytecode generation.
 * If [scope] is a crossinline lambda, this is not possible, as the lambda may be inlined
 * into some other class; in that case, return at least the package fragment.
 *
 * @param scope [IrDeclaration] or [IrDeclarationParent].
 * @return [IrClass] or at least [IrPackageFragment] from which all accesses in the current scope will be done after bytecode
 * generation, or `null` if the space of potential call sites is unconstrained, e.g. if [scope] is referenced from an internal inline
 * function.
 */


private tailrec fun findContainer ( scope : IrElement ? , approximateToPackage : Boolean ) : IrDeclarationContainer ?

{ <EOL> val callSite = inlineCallSites [ scope ] <EOL> return when { <EOL> callSite != null -> findContainer ( callSite . scope , approximateToPackage || callSite . approximateToPackage ) <EOL> scope is IrFunction && scope . isInline -> { <EOL> val callSites = privateInlineFunctionCallSites [ scope ] ? : return null <EOL> inlineCallSites [ scope ] = CallSite ( scope = null , approximateToPackage = false ) <EOL> val commonCallSite = when { <EOL> callSites . isEmpty ( ) -> CallSite ( scope . parent , approximateToPackage = false ) <EOL> callSites . size == <NUM_LIT:1> -> CallSite ( callSites . single ( ) , approximateToPackage = false ) <EOL> else -> { <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> val results = callSites . map { findContainer ( it , approximateToPackage = false ) ? : return null } <EOL> val single = results . first ( ) . takeIf { results . all { other -> it === other } } <EOL> CallSite ( single ? : scope . parent , approximateToPackage = single == null ) <EOL> } <EOL> } <EOL> inlineCallSites [ scope ] = commonCallSite <EOL> findContainer ( commonCallSite . scope , approximateToPackage || commonCallSite . approximateToPackage ) <EOL> } <EOL> scope is IrClass && ! approximateToPackage -> scope <EOL> scope is IrDeclaration -> findContainer ( scope . parent , approximateToPackage ) <EOL> else -> scope as? IrPackageFragment <EOL> } <EOL> }

/**
 * The class from which all accesses in [scope] will be done after bytecode generation.
 * If [scope] is a crossinline lambda, this is not possible, as the lambda may be inlined
 * into some other class; in that case, return at least the package fragment.
 *
 * @param scope [IrDeclaration] or [IrDeclarationParent]
 * @param approximateToPackage Whether the inline function being called can be inlined into some other class in the same package,
 * for example, if it's a crossinline lambda.
 * @return [IrClass] or at least [IrPackageFragment] from which all accesses in the current scope will be done after bytecode
 * generation, or `null` if the space of potential call sites is unconstrained, e.g. if [scope] is referenced from an internal inline
 * function.
 */


inline fun IrFile . findInlineLambdas ( context : JvmBackendContext , crossinline onLambda : ( IrFunctionReference , IrFunction , IrValueParameter , IrDeclaration ) -> Unit , )

= accept ( object : IrInlineReferenceLocator ( context ) { <EOL> override fun visitInlineLambda ( argument : IrFunctionReference , callee : IrFunction , parameter : IrValueParameter , scope : IrDeclaration , ) = onLambda ( argument , callee , parameter , scope ) <EOL> } , null , )

/**
 * Calls [onLambda] for each place in the IR subtree where a lambda is passed to an inline function.
 *
 * @param context The backend context
 * @param onLambda The closure to execute for each such lambda. Accepts the lambda expression, the inline function being called,
 * the parameter of that inline function to which the lambda is passed, and the scope in which the inline function is called.
 */


fun IrFile . findInlineCallSites ( context : JvmBackendContext )

= <EOL> IrInlineScopeResolver ( context ) . apply { accept ( this , null ) }

/**
 * Runs [IrInlineScopeResolver] on this [IrFile] and returns the scope resolver instance.
 */


private fun compareStringsAsVersions ( version1 : String , version2 : String ) : Int

{ <EOL> val splitVersion1 = version1 . split ( '<CHAR_LIT:.>' ) . map { it . toInt ( ) } <EOL> val splitVersion2 = version2 . split ( '<CHAR_LIT:.>' ) . map { it . toInt ( ) } <EOL> val minimalLength = min ( splitVersion1 . size , splitVersion2 . size ) <EOL> for ( index in <NUM_LIT:0> until minimalLength ) { <EOL> if ( splitVersion1 [ index ] < splitVersion2 [ index ] ) return - <NUM_LIT:1> <EOL> if ( splitVersion1 [ index ] > splitVersion2 [ index ] ) return <NUM_LIT:1> <EOL> } <EOL> return splitVersion1 . size . compareTo ( splitVersion2 . size ) <EOL> }

/**
 * Compares two strings assuming that both are representing numeric version strings.
 * Examples of numeric version strings: "12.4.1.2", "9", "0.5".
 */


private fun Xcode . getSimulatorRuntimeDescriptors ( ) : List < SimulatorRuntimeDescriptor >

= <EOL> gson . fromJson ( simulatorRuntimes , ListRuntimesReport :: class . java ) . runtimes

/**
 * Returns parsed output of `xcrun simctl list runtimes -j`.
 */


fun Xcode . getLatestSimulatorRuntimeFor ( family : Family , osMinVersion : String ) : SimulatorRuntimeDescriptor ?

= <EOL> getLatestSimulatorRuntimeFor ( getSimulatorRuntimeDescriptors ( ) , family , osMinVersion )

/**
 * Returns first available simulator runtime for [target] with at least [osMinVersion] OS version.
 * */


{ <EOL> if ( isAvailable == true ) return true <EOL> if ( availability ? . contains ( "<STR_LIT>" ) == true ) return false <EOL> return false <EOL> }

/**
 * Different Xcode/macOS combinations give different fields that checks
 * runtime availability. This method is an umbrella for these fields.
 */


fun getSimulatorDevices ( json : String ) : Map < String , List < SimulatorDeviceDescriptor > >

= <EOL> gson . fromJson ( json , ListDevicesReport :: class . java ) . devices

/**
 * Returns map of simulator devices from the json input
 */


internal inline fun < T > atomicfu_getValue ( `atomicfu$getter` : ( ) -> T , `atomicfu$setter` : ( T ) -> Unit ) : T

{ <EOL> return `atomicfu$getter` ( ) <EOL> }

/**
 * Inline functions that are substituted instead of the corresponding atomic functions defined in `kotlinx.atomicfu`
 * during Js/Ir transformation.
 *
 * Example of transformation:
 * ```
 * val a = atomic(0)
 * a.compareAndSet(expect, update)
 * ```
 * is transformed to:
 * ```
 * var a = 0
 * atomicfu_compareAndSet(expect, update, { return a }, { v: Int -> a.value = v })
 * ```
 */


fun setExecutionSourceFrom ( compilation : T )

/**
 * Select a compilation to run the execution from.
 *
 * The [compilation]'s [KotlinCompilationToRunnableFiles.runtimeDependencyFiles]
 * will be treated as runtime dependencies, and its [output] as runnable files.
 *
 * This overrides other [KotlinExecution.executionSource] selection options.
 */


private fun Map < ResolvedDependencyId , ResolvedDependency > . findMatchingModule ( moduleId : ResolvedDependencyId ) : ResolvedDependency

{ <EOL> this [ moduleId ] ? . let { module -> <EOL> return module <EOL> } <EOL> return values . first { moduleId in it . id } <EOL> }

/**
 * Do the best effort to find a module that matches the given [moduleId]:
 * - If there is a node in the map with such [ResolvedDependencyId] as [moduleId], then return the value from this node.
 * - If not, then try to find a [ResolvedDependency] which contains all unique names from the given [moduleId]. This makes sense
 * for such cases when the map contains a node for "org.jetbrains.kotlinx:kotlinx-coroutines-core (org.jetbrains.kotlinx:kotlinx-coroutines-core-macosx64)"
 * but we are looking just for "org.jetbrains.kotlinx:kotlinx-coroutines-core".
 */


private fun findPotentiallyConflictingOutgoingDependencies ( problemModuleId : ResolvedDependencyId , allModules : Map < ResolvedDependencyId , ResolvedDependency > ) : Map < ResolvedDependencyId , PotentialConflictDescription >

{ <EOL> data class OutgoingDependency ( val id : ResolvedDependencyId , val requestedVersion : ResolvedDependencyVersion , val selectedVersion : ResolvedDependencyVersion ) <EOL> val outgoingDependenciesIndex : MutableMap < ResolvedDependencyId , MutableList < OutgoingDependency > > = hashMapOf ( ) <EOL> allModules . values . forEach { module -> <EOL> module . requestedVersionsByIncomingDependencies . forEach { ( incomingDependencyId , requestedVersion ) -> <EOL> outgoingDependenciesIndex . getOrPut ( incomingDependencyId ) { mutableListOf ( ) } += OutgoingDependency ( id = module . id , requestedVersion = requestedVersion , selectedVersion = module . selectedVersion ) <EOL> } <EOL> } <EOL> val dependencyStatesMap : MutableMap < ResolvedDependencyId , MutableSet < DependencyState > > = mutableMapOf ( ) <EOL> fun recurse ( moduleId : ResolvedDependencyId , underConflictingDependency : Boolean ) { <EOL> val outgoingDependencies : List < OutgoingDependency > = outgoingDependenciesIndex [ moduleId ] . orEmpty ( ) <EOL> outgoingDependencies . forEach { outgoingDependency -> <EOL> val dependencyState : DependencyState = when { <EOL> underConflictingDependency -> { <EOL> DependencyState ( conflictReason = PotentialConflictReason ( kind = BEHIND_CONFLICTING_DEPENDENCY , conflictingModuleId = outgoingDependency . id ) ) <EOL> } <EOL> outgoingDependency . selectedVersion . isEmpty ( ) -> { <EOL> DependencyState ( conflictReason = PotentialConflictReason ( kind = UNKNOWN_SELECTED_VERSION , conflictingModuleId = outgoingDependency . id , requestedVersion = outgoingDependency . requestedVersion ) ) <EOL> } <EOL> outgoingDependency . requestedVersion != outgoingDependency . selectedVersion -> { <EOL> DependencyState ( conflictReason = PotentialConflictReason ( kind = REQUESTED_SELECTED_VERSIONS_MISMATCH , conflictingModuleId = outgoingDependency . id , requestedVersion = outgoingDependency . requestedVersion , selectedVersion = outgoingDependency . selectedVersion ) ) <EOL> } <EOL> else -> DependencyState . SUCCESS <EOL> } <EOL> val dependencyStates : MutableSet < DependencyState > = dependencyStatesMap . getOrPut ( outgoingDependency . id ) { mutableSetOf ( ) } <EOL> val notBeenHereYet = dependencyStates . add ( dependencyState ) <EOL> if ( notBeenHereYet ) { <EOL> recurse ( moduleId = outgoingDependency . id , underConflictingDependency = dependencyState . conflictReason != null ) <EOL> } <EOL> } <EOL> } <EOL> recurse ( moduleId = problemModuleId , underConflictingDependency = false ) <EOL> return dependencyStatesMap . describeDependencyStates { potentialConflictReason -> <EOL> when ( potentialConflictReason . kind ) { <EOL> UNKNOWN_SELECTED_VERSION -> { <EOL> "<STR_LIT>" <EOL> } <EOL> REQUESTED_SELECTED_VERSIONS_MISMATCH -> { <EOL> val requested = potentialConflictReason . conflictingModuleId . withVersion ( potentialConflictReason . requestedVersion ) <EOL> "<STR_LIT>" <EOL> } <EOL> BEHIND_CONFLICTING_DEPENDENCY -> { <EOL> "<STR_LIT>" <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Find all outgoing dependencies of [problemModuleId] that might conflict with [problemModuleId] because they have
 * different (overridden) selected version then the version that [problemModuleId] was initially compiled with.
 */


private fun findPotentiallyConflictingIncomingDependencies ( problemModuleId : ResolvedDependencyId , allModules : Map < ResolvedDependencyId , ResolvedDependency > , sourceCodeModuleId : ResolvedDependencyId ) : Map < ResolvedDependencyId , PotentialConflictDescription >

{ <EOL> val dependencyStatesMap : MutableMap < ResolvedDependencyId , MutableSet < DependencyState > > = mutableMapOf ( ) <EOL> fun recurse ( moduleId : ResolvedDependencyId , aboveConflictingDependency : Boolean ) { <EOL> val module = allModules . findMatchingModule ( moduleId ) <EOL> module . requestedVersionsByIncomingDependencies . forEach { ( incomingDependencyId , requestedVersion ) -> <EOL> if ( incomingDependencyId == sourceCodeModuleId ) return@forEach <EOL> val dependencyState : DependencyState = when { <EOL> aboveConflictingDependency -> { <EOL> DependencyState ( conflictReason = PotentialConflictReason ( kind = BEHIND_CONFLICTING_DEPENDENCY , conflictingModuleId = module . id ) ) <EOL> } <EOL> module . selectedVersion . isEmpty ( ) -> { <EOL> DependencyState ( conflictReason = PotentialConflictReason ( kind = UNKNOWN_SELECTED_VERSION , conflictingModuleId = module . id , requestedVersion = requestedVersion ) ) <EOL> } <EOL> requestedVersion != module . selectedVersion -> { <EOL> DependencyState ( conflictReason = PotentialConflictReason ( kind = REQUESTED_SELECTED_VERSIONS_MISMATCH , conflictingModuleId = module . id , requestedVersion = requestedVersion , selectedVersion = module . selectedVersion ) ) <EOL> } <EOL> else -> DependencyState . SUCCESS <EOL> } <EOL> val dependencyStates : MutableSet < DependencyState > = dependencyStatesMap . getOrPut ( incomingDependencyId ) { mutableSetOf ( ) } <EOL> val notBeenHereYet = dependencyStates . add ( dependencyState ) <EOL> if ( notBeenHereYet ) { <EOL> recurse ( moduleId = incomingDependencyId , aboveConflictingDependency = dependencyState . isConflicting ) <EOL> } <EOL> } <EOL> } <EOL> recurse ( moduleId = problemModuleId , aboveConflictingDependency = false ) <EOL> return dependencyStatesMap . describeDependencyStates { potentialConflictReason -> <EOL> when ( potentialConflictReason . kind ) { <EOL> UNKNOWN_SELECTED_VERSION -> { <EOL> "<STR_LIT>" <EOL> } <EOL> REQUESTED_SELECTED_VERSIONS_MISMATCH -> { <EOL> val requested = potentialConflictReason . conflictingModuleId . withVersion ( potentialConflictReason . requestedVersion ) <EOL> val selected = potentialConflictReason . conflictingModuleId . withVersion ( potentialConflictReason . selectedVersion ) <EOL> "<STR_LIT>" <EOL> } <EOL> BEHIND_CONFLICTING_DEPENDENCY -> { <EOL> "<STR_LIT>" <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Find all incoming dependencies of [problemModuleId] that might conflict with [problemModuleId] because they were
 * initially compiled with the different version of [problemModuleId] than the one used in the project.
 */


public fun ColumnSet < * > . frameCols ( filter : Predicate < FrameColumn < * > > = { true } ) : TransformableColumnSet < DataFrame < * > >

= <EOL> frameColumnsInternal ( filter )

/**
 * @include [CommonFrameColsDocs]
 * @set [CommonFrameColsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") }.`[frameCols][ColumnSet.frameCols]`() }`
 *
 * `// NOTE: This can be shortened to just:`
 *
 * `df.`[select][DataFrame.select]` { `[frameCols][ColumnsSelectionDsl.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun ColumnsSelectionDsl < * > . frameCols ( filter : Predicate < FrameColumn < * > > = { true } ) : TransformableColumnSet < DataFrame < * > >

= <EOL> asSingleColumn ( ) . frameColumnsInternal ( filter )

/**
 * @include [CommonFrameColsDocs]
 * @set [CommonFrameColsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[frameCols][ColumnsSelectionDsl.frameCols]`() }`
 *
 * `df.`[select][DataFrame.select]` { `[frameCols][ColumnsSelectionDsl.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun SingleColumn < DataRow < * > > . frameCols ( filter : Predicate < FrameColumn < * > > = { true } ) : TransformableColumnSet < DataFrame < * > >

= <EOL> this . ensureIsColumnGroup ( ) . frameColumnsInternal ( filter )

/**
 * @include [CommonFrameColsDocs]
 * @set [CommonFrameColsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { myColGroup.`[frameCols][SingleColumn.frameCols]`() }`
 *
 * `df.`[select][DataFrame.select]` { myColGroup.`[frameCols][SingleColumn.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun String . frameCols ( filter : Predicate < FrameColumn < * > > = { true } ) : TransformableColumnSet < DataFrame < * > >

= <EOL> columnGroup ( this ) . frameCols ( filter )

/**
 * @include [CommonFrameColsDocs]
 * @set [CommonFrameColsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "myColGroup".`[frameCols][String.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 *
 * `df.`[select][DataFrame.select]` { "myColGroup".`[frameCols][String.frameCols]`() }`
 */


public fun KProperty < * > . frameCols ( filter : Predicate < FrameColumn < * > > = { true } ) : TransformableColumnSet < DataFrame < * > >

/**
 * @include [CommonFrameColsDocs]
 * @set [CommonFrameColsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[colGroup][ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[frameCols][SingleColumn.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }`
 *
 * `df.`[select][DataFrame.select]` { Type::myColGroup.`[frameCols][SingleColumn.frameCols]`() }`
 *
 * `df.`[select][DataFrame.select]` { DataSchemaType::myColGroup.`[frameCols][KProperty.frameCols]`() }`
 */


public fun ColumnPath . frameCols ( filter : Predicate < FrameColumn < * > > = { true } ) : TransformableColumnSet < DataFrame < * > >

/**
 * @include [CommonFrameColsDocs]
 * @set [CommonFrameColsDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "pathTo"["myGroupCol"].`[frameCols][ColumnPath.frameCols]`() }`
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> internal fun ColumnsResolver < * > . frameColumnsInternal ( filter : ( FrameColumn < * > ) -> Boolean ) : TransformableColumnSet < AnyFrame >

= <EOL> colsInternal { it . isFrameColumn ( ) && filter ( it . asFrameColumn ( ) ) } as TransformableColumnSet < AnyFrame >

/**
 * Returns a TransformableColumnSet containing the frame columns that satisfy the given filter.
 *
 * @param filter The filter function to apply on each frame column. Must accept a FrameColumn object and return a Boolean.
 * @return A [TransformableColumnSet] containing the frame columns that satisfy the filter.
 */


public fun < T > DataFrame < T > . renameToCamelCase ( ) : DataFrame < T >

= this <EOL> . rename { <EOL> colsAtAnyDepth { it . name ( ) matches DELIMITED_STRING_REGEX || it . name [ <NUM_LIT:0> ] . isUpperCase ( ) } <EOL> } . toCamelCase ( ) <EOL> . update { <EOL> colsAtAnyDepth ( ) . colsOf < AnyFrame > ( ) <EOL> } . with { it . renameToCamelCase ( ) }

/**
 * ## Rename to camelCase
 *
 * This function renames all columns to `camelCase` by replacing all [delimiters][DELIMITERS_REGEX]
 * and converting the first char to lowercase.
 * Even [DataFrames][DataFrame] inside [FrameColumns][FrameColumn] are traversed recursively.
 */


public fun < T , C > RenameClause < T , C > . toCamelCase ( ) : DataFrame < T >

= into { <EOL> it . name ( ) <EOL> . toCamelCaseByDelimiters ( DELIMITERS_REGEX ) <EOL> . replaceFirstChar { it . lowercaseChar ( ) } <EOL> }

/**
 * ## Rename to camelCase
 *
 * Renames the selected columns to `camelCase` by replacing all [delimiters][DELIMITERS_REGEX]
 * and converting the first char to lowercase.
 */


public infix fun < C > ColumnReference < C > . named ( newName : String ) : ColumnReference < C >

= renamedReference ( newName )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.ColumnReferenceReceiver]
 * @include [CommonRenameDocs.StringParam]
 */


public infix fun < C > ColumnReference < C > . named ( nameOf : ColumnReference < * > ) : ColumnReference < C >

= <EOL> named ( nameOf . name )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.ColumnReferenceReceiver]
 * @include [CommonRenameDocs.ColumnReferenceParam]
 */


public infix fun < C > ColumnReference < C > . named ( nameOf : KProperty < * > ) : ColumnReference < C >

= <EOL> named ( nameOf . columnName )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.ColumnReferenceReceiver]
 * @include [CommonRenameDocs.KPropertyParam]
 */


public infix fun String . named ( newName : String ) : ColumnReference < * >

= toColumnAccessor ( ) . named ( newName )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.StringReceiver]
 * @include [CommonRenameDocs.StringParam]
 */


public infix fun String . named ( nameOf : ColumnReference < * > ) : ColumnReference < * >

= <EOL> toColumnAccessor ( ) . named ( nameOf . name )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.StringReceiver]
 * @include [CommonRenameDocs.ColumnReferenceParam]
 */


public infix fun String . named ( nameOf : KProperty < * > ) : ColumnReference < * >

= <EOL> toColumnAccessor ( ) . named ( nameOf . columnName )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.StringReceiver]
 * @include [CommonRenameDocs.KPropertyParam]
 */


public infix fun < C > KProperty < C > . named ( newName : String ) : ColumnReference < C >

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.KPropertyReceiver]
 * @include [CommonRenameDocs.StringParam]
 */


public infix fun < C > KProperty < C > . named ( nameOf : ColumnReference < * > ) : ColumnReference < C >

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.KPropertyReceiver]
 * @include [CommonRenameDocs.ColumnReferenceParam]
 */


public infix fun < C > KProperty < C > . named ( nameOf : KProperty < * > ) : ColumnReference < C >

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.NamedFunctionName]
 * @include [CommonRenameDocs.KPropertyReceiver]
 * @include [CommonRenameDocs.KPropertyParam]
 */


public infix fun < C > ColumnReference < C > . into ( newName : String ) : ColumnReference < C >

= named ( newName )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.ColumnReferenceReceiver]
 * @include [CommonRenameDocs.StringParam]
 */


public infix fun < C > ColumnReference < C > . into ( nameOf : ColumnReference < * > ) : ColumnReference < C >

= named ( nameOf )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.ColumnReferenceReceiver]
 * @include [CommonRenameDocs.ColumnReferenceParam]
 */


public infix fun < C > ColumnReference < C > . into ( nameOf : KProperty < * > ) : ColumnReference < C >

= named ( nameOf )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.ColumnReferenceReceiver]
 * @include [CommonRenameDocs.KPropertyParam]
 */


public infix fun String . into ( newName : String ) : ColumnReference < * >

= named ( newName )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.StringReceiver]
 * @include [CommonRenameDocs.StringParam]
 */


public infix fun String . into ( nameOf : ColumnReference < * > ) : ColumnReference < * >

= named ( nameOf )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.StringReceiver]
 * @include [CommonRenameDocs.ColumnReferenceParam]
 */


public infix fun String . into ( nameOf : KProperty < * > ) : ColumnReference < * >

= named ( nameOf )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.StringReceiver]
 * @include [CommonRenameDocs.KPropertyParam]
 */


public infix fun < C > KProperty < C > . into ( newName : String ) : ColumnReference < C >

= named ( newName )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.KPropertyReceiver]
 * @include [CommonRenameDocs.StringParam]
 */


public infix fun < C > KProperty < C > . into ( nameOf : ColumnReference < * > ) : ColumnReference < C >

= named ( nameOf )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.KPropertyReceiver]
 * @include [CommonRenameDocs.ColumnReferenceParam]
 */


public infix fun < C > KProperty < C > . into ( nameOf : KProperty < * > ) : ColumnReference < C >

= named ( nameOf )

/**
 * @include [CommonRenameDocs]
 * @include [CommonRenameDocs.IntoFunctionName]
 * @include [CommonRenameDocs.KPropertyReceiver]
 * @include [CommonRenameDocs.KPropertyParam]
 */


public fun KtClassOrObject . calculateMetadata ( mapping : Multimap < KtElement , PsiElement > ) : Metadata

= <EOL> withValidityAssertion { analysisSession . metadataCalculator . calculateMetadata ( this , mapping ) }

/**
 * Calculates metadata that would be generated by the compiler in case this class was compiled to the JVM class file.
 *
 * @param mapping map containing the light elements ([KtLightElement]) for each callable declaration in this class.
 */


public fun KtFile . calculateMetadata ( mapping : Multimap < KtElement , PsiElement > ) : Metadata

/**
 * Calculates metadata that would be generated by the compiler in case this file was compiled to the JVM class file.
 *
 * @param mapping map containing the light elements ([KtLightElement]) for each callable declaration in this file.
 */


{ <EOL> fun readLines ( url : String ) : List < String > { <EOL> return URL ( url ) . openStream ( ) . reader ( ) . readLines ( ) <EOL> } <EOL> val unicodeDataLines = readLines ( unicodeDataUrl ) . map { line -> UnicodeDataLine ( line . split ( "<STR_LIT:;>" ) ) } <EOL> val bmpUnicodeDataLines = unicodeDataLines . filter { line -> line . char . length <= <NUM_LIT:4> } <EOL> fun String . isEmptyOrComment ( ) : Boolean = isEmpty ( ) || startsWith ( "<STR_LIT:#>" ) <EOL> val specialCasingLines = readLines ( specialCasingUrl ) . filterNot ( String :: isEmptyOrComment ) . map { line -> <EOL> SpecialCasingLine ( line . split ( "<STR_LIT>" ) ) <EOL> } <EOL> val propListLines = readLines ( propListUrl ) . filterNot ( String :: isEmptyOrComment ) . map { line -> <EOL> PropertyLine ( line . split ( "<STR_LIT>" ) . map { it . trim ( ) } ) <EOL> } <EOL> val wordBreakPropertyLines = readLines ( wordBreakPropertyUrl ) . filterNot ( String :: isEmptyOrComment ) . map { line -> <EOL> PropertyLine ( line . split ( "<STR_LIT>" ) . map { it . trim ( ) } ) <EOL> } <EOL> val derivedCorePropertiesLines = readLines ( derivedCorePropertiesUrl ) . filterNot ( String :: isEmptyOrComment ) . map { line -> <EOL> PropertyLine ( line . split ( "<STR_LIT>" ) . map { it . trim ( ) } ) <EOL> } <EOL> val categoryRangesGenerators = mutableListOf < RangesGenerator > ( ) <EOL> val otherLowercaseGenerators = mutableListOf < OtherLowercaseRangesGenerator > ( ) <EOL> val otherUppercaseGenerators = mutableListOf < OtherUppercaseRangesGenerator > ( ) <EOL> fun addRangesGenerators ( generatedDir : File , target : KotlinTarget ) { <EOL> val category = RangesGenerator . forCharCategory ( generatedDir . resolve ( "<STR_LIT>" ) , target ) <EOL> val digit = RangesGenerator . forDigit ( generatedDir . resolve ( "<STR_LIT>" ) , target ) <EOL> val letter = RangesGenerator . forLetter ( generatedDir . resolve ( "<STR_LIT>" ) , target ) <EOL> val whitespace = RangesGenerator . forWhitespace ( generatedDir . resolve ( "<STR_LIT>" ) ) <EOL> categoryRangesGenerators . add ( category ) <EOL> categoryRangesGenerators . add ( digit ) <EOL> categoryRangesGenerators . add ( letter ) <EOL> categoryRangesGenerators . add ( whitespace ) <EOL> otherLowercaseGenerators . add ( OtherLowercaseRangesGenerator ( generatedDir . resolve ( "<STR_LIT>" ) , target ) ) <EOL> otherUppercaseGenerators . add ( OtherUppercaseRangesGenerator ( generatedDir . resolve ( "<STR_LIT>" ) , target ) ) <EOL> } <EOL> val oneToOneMappingsGenerators = mutableListOf < MappingsGenerator > ( ) <EOL> fun addOneToOneMappingsGenerators ( generatedDir : File , target : KotlinTarget ) { <EOL> val uppercase = MappingsGenerator . forUppercase ( generatedDir . resolve ( "<STR_LIT>" ) , target ) <EOL> val lowercase = MappingsGenerator . forLowercase ( generatedDir . resolve ( "<STR_LIT>" ) , target ) <EOL> val titlecase = MappingsGenerator . forTitlecase ( generatedDir . resolve ( "<STR_LIT>" ) ) <EOL> oneToOneMappingsGenerators . add ( uppercase ) <EOL> oneToOneMappingsGenerators . add ( lowercase ) <EOL> oneToOneMappingsGenerators . add ( titlecase ) <EOL> } <EOL> val oneToManyMappingsGenerators = mutableListOf < OneToManyMappingsGenerator > ( ) <EOL> fun addOneToManyMappingsGenerators ( generatedDir : File , target : KotlinTarget ) { <EOL> val uppercase = OneToManyMappingsGenerator . forUppercase ( generatedDir . resolve ( "<STR_LIT>" ) , target , bmpUnicodeDataLines ) <EOL> val lowercase = OneToManyMappingsGenerator . forLowercase ( generatedDir . resolve ( "<STR_LIT>" ) , target , bmpUnicodeDataLines ) <EOL> oneToManyMappingsGenerators . add ( uppercase ) <EOL> oneToManyMappingsGenerators . add ( lowercase ) <EOL> } <EOL> val stringUppercaseGenerators = mutableListOf < StringUppercaseGenerator > ( ) <EOL> val stringLowercaseGenerators = mutableListOf < StringLowercaseGenerator > ( ) <EOL> val categoryTestGenerator : CharCategoryTestGenerator <EOL> val stringCasingTestGenerator : StringCasingTestGenerator <EOL> when ( args . size ) { <EOL> <NUM_LIT:1> -> { <EOL> val baseDir = File ( args . first ( ) ) <EOL> val categoryTestFile = baseDir . resolve ( "<STR_LIT>" ) <EOL> categoryTestGenerator = CharCategoryTestGenerator ( categoryTestFile ) <EOL> val commonGeneratedDir = baseDir . resolve ( "<STR_LIT>" ) <EOL> oneToManyMappingsGenerators . add ( OneToManyMappingsGenerator . forTitlecase ( commonGeneratedDir . resolve ( "<STR_LIT>" ) , bmpUnicodeDataLines ) ) <EOL> val jsGeneratedDir = baseDir . resolve ( "<STR_LIT>" ) <EOL> addRangesGenerators ( jsGeneratedDir , KotlinTarget . JS ) <EOL> oneToOneMappingsGenerators . add ( MappingsGenerator . forTitlecase ( jsGeneratedDir . resolve ( "<STR_LIT>" ) ) ) <EOL> val nativeGeneratedDir = baseDir . resolve ( "<STR_LIT>" ) <EOL> addRangesGenerators ( nativeGeneratedDir , KotlinTarget . Native ) <EOL> addOneToOneMappingsGenerators ( nativeGeneratedDir , KotlinTarget . Native ) <EOL> addOneToManyMappingsGenerators ( nativeGeneratedDir , KotlinTarget . Native ) <EOL> stringUppercaseGenerators . add ( StringUppercaseGenerator ( nativeGeneratedDir . resolve ( "<STR_LIT>" ) , unicodeDataLines , KotlinTarget . Native ) ) <EOL> stringLowercaseGenerators . add ( StringLowercaseGenerator ( nativeGeneratedDir . resolve ( "<STR_LIT>" ) , unicodeDataLines , KotlinTarget . Native ) ) <EOL> val wasmGeneratedDir = baseDir . resolve ( "<STR_LIT>" ) <EOL> addRangesGenerators ( wasmGeneratedDir , KotlinTarget . WASM ) <EOL> addOneToOneMappingsGenerators ( wasmGeneratedDir , KotlinTarget . WASM ) <EOL> addOneToManyMappingsGenerators ( wasmGeneratedDir , KotlinTarget . WASM ) <EOL> stringUppercaseGenerators . add ( StringUppercaseGenerator ( wasmGeneratedDir . resolve ( "<STR_LIT>" ) , unicodeDataLines , KotlinTarget . WASM ) ) <EOL> stringLowercaseGenerators . add ( StringLowercaseGenerator ( wasmGeneratedDir . resolve ( "<STR_LIT>" ) , unicodeDataLines , KotlinTarget . WASM ) ) <EOL> val nativeTestDir = baseDir . resolve ( "<STR_LIT>" ) <EOL> stringCasingTestGenerator = StringCasingTestGenerator ( nativeTestDir ) <EOL> fun downloadFile ( fromUrl : String ) { <EOL> val fileName = File ( fromUrl ) . name <EOL> val dest = baseDir . resolve ( "<STR_LIT>" ) <EOL> dest . writeText ( readLines ( fromUrl ) . joinToString ( separator = "<STR_LIT:\n>" ) ) <EOL> } <EOL> downloadFile ( unicodeDataUrl ) <EOL> downloadFile ( specialCasingUrl ) <EOL> } <EOL> else -> { <EOL> println ( """<STR_LIT>""" ) <EOL> exitProcess ( <NUM_LIT:1> ) <EOL> } <EOL> } <EOL> categoryRangesGenerators . forEach { <EOL> bmpUnicodeDataLines . forEach { line -> it . appendLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> otherLowercaseGenerators . forEach { <EOL> propListLines . forEach { line -> it . appendLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> otherUppercaseGenerators . forEach { <EOL> propListLines . forEach { line -> it . appendLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> categoryTestGenerator . let { <EOL> bmpUnicodeDataLines . forEach { line -> it . appendLine ( line ) } <EOL> propListLines . forEach { line -> it . appendPropertyLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> oneToOneMappingsGenerators . forEach { <EOL> unicodeDataLines . forEach { line -> it . appendLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> oneToManyMappingsGenerators . forEach { <EOL> specialCasingLines . forEach { line -> it . appendLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> stringUppercaseGenerators . forEach { <EOL> specialCasingLines . forEach { line -> it . appendSpecialCasingLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> stringLowercaseGenerators . forEach { <EOL> specialCasingLines . forEach { line -> it . appendSpecialCasingLine ( line ) } <EOL> wordBreakPropertyLines . forEach { line -> it . appendWordBreakPropertyLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> stringCasingTestGenerator . let { <EOL> derivedCorePropertiesLines . forEach { line -> it . appendDerivedCorePropertiesLine ( line ) } <EOL> it . generate ( ) <EOL> } <EOL> }

/**
 * This program generates sources related to UnicodeData.txt and SpecialCasing.txt.
 * Pass the root directory of the project to generate sources for js, js-ir and native.
 * _CharCategoryTest.kt and supporting files are also generated to test the generated sources.
 * The generated test is meant to be run after updating Unicode version and should not be merged to master.
 */


fun applyChanges ( )

/**
 * Applies in-memory changes to the underlying [PersistentStorage], then calls [clearChanges].
 *
 * Note that the changes are only propagated to the underlying [PersistentStorage], they may not be written to [storageFile] yet. If
 * you want to propagate the changes to [storageFile], call [flush] instead.
 */


fun clearChanges ( )


public override fun < T : InferenceModel < * > , U > loadModel ( modelType : ModelType < T , U > , loadingMode : LoadingMode ) : T

{ <EOL> val jsonConfigFile = getJSONConfigFile ( modelType , loadingMode ) <EOL> return ( modelType as TFModelType ) . loadModelConfiguration ( jsonConfigFile ) <EOL> }

/**
 * Loads model configuration without weights.
 *
 * @param [modelType] This unique identifier defines the way to the S3 bucket with the model and its weights and the local directory for the model and its weights.
 * @param [loadingMode] Strategy of existing model use-case handling.
 * @return Raw model without weights. Needs in compilation and weights loading via [loadWeights] before usage.
 */


public fun loadClassLabels ( ) : Map < Int , String >

{ <EOL> return Imagenet . V1k . labels ( ) <EOL> }

/** Forms mapping of class label to class name for the ImageNet dataset. */


public fun loadWeights ( modelType : ModelType < * , * > , loadingMode : LoadingMode = LoadingMode . SKIP_LOADING_IF_EXISTS ) : HdfFile

{ <EOL> val modelDirectory = "<STR_LIT:/>" + modelType . modelRelativePath <EOL> val relativeWeightsPath = modelDirectory + WEIGHTS_FILE_NAME <EOL> val weightsURL = awsS3Url + modelDirectory + WEIGHTS_FILE_NAME <EOL> val fileName = cacheDirectory . absolutePath + relativeWeightsPath <EOL> val file = File ( fileName ) <EOL> if ( ! file . exists ( ) || loadingMode == LoadingMode . OVERRIDE_IF_EXISTS ) { <EOL> val inputStream = URL ( weightsURL ) . openStream ( ) <EOL> logger . info { "<STR_LIT>" } <EOL> Files . copy ( inputStream , Paths . get ( fileName ) , StandardCopyOption . REPLACE_EXISTING ) <EOL> logger . info { "<STR_LIT>" } <EOL> } <EOL> return HdfFile ( File ( fileName ) ) <EOL> }

/**
 * Loads model weights.
 *
 * @param [modelType] This unique identifier defines the way to the S3 bucket with the model and its weights and the local directory for the model and its weights.
 * @param [loadingMode] Strategy of existing model use-case handling.
 * @return Compiled model with initialized weights.
 */


private fun getJSONConfigFile ( modelType : ModelType < * , * > , loadingMode : LoadingMode ) : File

{ <EOL> val modelDirectory = "<STR_LIT:/>" + modelType . modelRelativePath <EOL> val relativeConfigPath = modelDirectory + MODEL_CONFIG_FILE_NAME <EOL> val configURL = awsS3Url + modelDirectory + MODEL_CONFIG_FILE_NAME <EOL> val dir = File ( cacheDirectory . absolutePath + modelDirectory ) <EOL> if ( ! dir . exists ( ) ) Files . createDirectories ( dir . toPath ( ) ) <EOL> val fileName = cacheDirectory . absolutePath + relativeConfigPath <EOL> val file = File ( fileName ) <EOL> if ( ! file . exists ( ) || loadingMode == LoadingMode . OVERRIDE_IF_EXISTS ) { <EOL> val inputStream = URL ( configURL ) . openStream ( ) <EOL> logger . debug { "<STR_LIT>" } <EOL> Files . copy ( inputStream , Paths . get ( fileName ) , StandardCopyOption . REPLACE_EXISTING ) <EOL> logger . debug { "<STR_LIT>" } <EOL> } <EOL> return File ( fileName ) <EOL> }

/** Returns JSON file with model configuration, saved from Keras 2.x. */


public fun onModification ( )

/**
 * [onModification] is invoked in a write action before or after global module state modification.
 *
 * The module structure, source code, and binary content of all [KtModule]s in the project should be considered modified when this event
 * is received. This includes source files being moved or removed, binary content being added, removed, or changed, and modules possibly
 * being removed. Thus, all caches related to module structure, source code, and binaries should be invalidated.
 *
 * @see KotlinTopics
 */


private fun getFunctionTypeArity ( kotlinType : KotlinType ) : Int

= getFunctionTypeArityByRegex ( kotlinType , KOTLIN_FUNCTION_INTERFACE_REGEX )

/**
 * @return function type arity (non-negative), or -1 if the given type is not a function type
 */


private fun getSuspendFunctionTypeArity ( kotlinType : KotlinType ) : Int

= <EOL> getFunctionTypeArityByRegex ( kotlinType , KOTLIN_SUSPEND_FUNCTION_INTERFACE_REGEX )

/**
 * @return function type arity (non-negative, not counting continuation), or -1 if the given type is not a function type
 */


fun createImagePanel ( bufferedImage : BufferedImage , draw : Graphics2D . ( ) -> Unit ) : JPanel

{ <EOL> return object : ImagePanel ( bufferedImage ) { <EOL> override fun paint ( graphics : Graphics ) { <EOL> super . paint ( graphics ) <EOL> ( graphics as Graphics2D ) . draw ( ) <EOL> } <EOL> } <EOL> }

/**
 * Creates an [ImagePanel] instance which displays given [bufferedImage]
 * and allows to draw on it using the given [draw] function.
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT:this>" ) ) <EOL> public fun < T > SharedFlow < T > . cancellable ( ) : Flow < T >

= noImpl ( )

/**
 * Applying [cancellable][Flow.cancellable] to a [SharedFlow] has no effect.
 * See the [SharedFlow] documentation on Operator Fusion.
 * @suppress
 */