-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow value rendering using renderers processor from API
- Loading branch information
Showing
11 changed files
with
108 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
jupyter-lib/api/src/main/kotlin/org/jetbrains/kotlinx/jupyter/api/TypeRenderersProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jetbrains.kotlinx.jupyter.api | ||
|
||
import org.jetbrains.kotlinx.jupyter.api.libraries.ExecutionHost | ||
|
||
/** | ||
* [TypeRenderersProcessor] is responsible for rendering objects. | ||
* You may use it to render values exactly like notebook renders results, | ||
* and also register new renderers in runtime. | ||
*/ | ||
interface TypeRenderersProcessor { | ||
/** | ||
* Renders [value] in context of this execution [host] | ||
*/ | ||
fun renderValue(host: ExecutionHost, value: Any?): Any? | ||
|
||
/** | ||
* Adds new [renderer] for this notebook. | ||
* Don't turn on the optimizations for [PrecompiledRendererTypeHandler] | ||
*/ | ||
fun registerWithoutOptimizing(renderer: RendererTypeHandler) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...er/src/main/kotlin/org/jetbrains/kotlinx/jupyter/codegen/ResultsTypeRenderersProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.jetbrains.kotlinx.jupyter.codegen | ||
|
||
import org.jetbrains.kotlinx.jupyter.api.Code | ||
import org.jetbrains.kotlinx.jupyter.api.FieldValue | ||
import org.jetbrains.kotlinx.jupyter.api.PrecompiledRendererTypeHandler | ||
import org.jetbrains.kotlinx.jupyter.api.RendererTypeHandler | ||
import org.jetbrains.kotlinx.jupyter.api.TypeRenderersProcessor | ||
import org.jetbrains.kotlinx.jupyter.api.libraries.ExecutionHost | ||
|
||
interface ResultsTypeRenderersProcessor : TypeRenderersProcessor { | ||
/** | ||
* Renders cell result [field] represented as [FieldValue] in the [host] context | ||
*/ | ||
fun renderResult(host: ExecutionHost, field: FieldValue): Any? | ||
|
||
/** | ||
* Adds new [renderer] for this notebook. | ||
* Returns code to be executed on execution host | ||
* for [PrecompiledRendererTypeHandler]'s. | ||
*/ | ||
fun register(renderer: RendererTypeHandler): Code? | ||
} |
13 changes: 0 additions & 13 deletions
13
...-compiler/src/main/kotlin/org/jetbrains/kotlinx/jupyter/codegen/TypeRenderersProcessor.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters