Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 33f198c

Browse files
committedSep 28, 2020
Rename KernelCfgFile to KernelJupyterParams
1 parent be989d1 commit 33f198c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/main/kotlin/org/jetbrains/kotlin/jupyter/config.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ class RuntimeKernelProperties(val map: Map<String, String>): ReplRuntimeProperti
8383
}
8484
}
8585

86-
data class KernelCfgFile(
86+
data class KernelJupyterParams(
8787
val sigScheme: String?,
8888
val key: String?,
8989
val ports: List<Int>,
9090
val transport: String?) {
9191
companion object {
92-
fun fromFile(cfgFile: File): KernelCfgFile {
92+
fun fromFile(cfgFile: File): KernelJupyterParams {
9393
val cfgJson = Parser.default().parse(cfgFile.canonicalPath) as JsonObject
9494
fun JsonObject.getInt(field: String): Int = int(field)
9595
?: throw RuntimeException("Cannot find $field in $cfgFile")
@@ -98,7 +98,7 @@ data class KernelCfgFile(
9898
val key = cfgJson.string("key")
9999
val ports = JupyterSockets.values().map { cfgJson.getInt("${it.name}_port") }
100100
val transport = cfgJson.string("transport") ?: "tcp"
101-
return KernelCfgFile(sigScheme, key, ports, transport)
101+
return KernelJupyterParams(sigScheme, key, ports, transport)
102102
}
103103
}
104104
}
@@ -134,11 +134,11 @@ data class KernelConfig(
134134
companion object {
135135
fun fromArgs(args: KernelArgs, libraryFactory: LibraryFactory): KernelConfig {
136136
val (cfgFile, scriptClasspath, homeDir) = args
137-
val cfg = KernelCfgFile.fromFile(cfgFile)
137+
val cfg = KernelJupyterParams.fromFile(cfgFile)
138138
return fromConfig(cfg, libraryFactory, scriptClasspath, homeDir)
139139
}
140140

141-
fun fromConfig(cfg: KernelCfgFile, libraryFactory: LibraryFactory, scriptClasspath: List<File>, homeDir: File?, embedded: Boolean = false): KernelConfig {
141+
fun fromConfig(cfg: KernelJupyterParams, libraryFactory: LibraryFactory, scriptClasspath: List<File>, homeDir: File?, embedded: Boolean = false): KernelConfig {
142142

143143
return KernelConfig(
144144
ports = cfg.ports,

‎src/main/kotlin/org/jetbrains/kotlin/jupyter/ikotlin.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fun main(vararg args: String) {
7878
fun embedKernel(cfgFile: File, libraryFactory: LibraryFactory?, scriptReceivers: List<Any>?) {
7979
val cp = System.getProperty("java.class.path").split(File.pathSeparator).toTypedArray().map { File(it) }
8080
val config = KernelConfig.fromConfig(
81-
KernelCfgFile.fromFile(cfgFile),
81+
KernelJupyterParams.fromFile(cfgFile),
8282
libraryFactory ?: LibraryFactory.EMPTY,
8383
cp, null, true)
8484
kernelServer(config, scriptReceivers = scriptReceivers ?: emptyList())

0 commit comments

Comments
 (0)