PY-77275 Jupyter(task): Rework Jupyter Settings

GitOrigin-RevId: 23bfec771f48e3bdec14ef19ab6f07153b6861b2
This commit is contained in:
Nikita.Ashihmin
2024-12-01 21:20:36 +00:00
committed by intellij-monorepo-bot
parent c0845302be
commit 2ff093f583
@@ -13,6 +13,10 @@ fun getJupyterBaseUrl(scheme: String): URIBuilder =
fun URIBuilder.addPathSegment(string: String): URIBuilder = setPath("${path ?: ""}/${string.trimStart('/')}")
fun URIBuilder.addParameter(name: String, value: Boolean): URIBuilder = addParameter(name, value.toString())
fun URIBuilder.dropLastPathSegment(): URIBuilder {
val newPath = path.removeSuffix("/").dropLastWhile { it != '/' }.removeSuffix("/")
return setPath(newPath)
}
/**
* In contrast with [URI.resolve], this method resolves paths like it happens in filesystems.
@@ -24,4 +28,7 @@ fun URIBuilder.addParameter(name: String, value: Boolean): URIBuilder = addParam
* URI("http://example.com/foo").addPathSegment("bar/baz") == URI("http://example.com/foo/bar/baz")
* ```
*/
fun URI.addPathSegment(string: String): URI = URIBuilder(this).addPathSegment(string).build()
fun URI.addPathSegment(string: String): URI = URIBuilder(this).addPathSegment(string).build()
fun URI.getPathSegments(): List<String> = path.split("/")
fun URI.dropLastPathSegment(): URI = URIBuilder(this).dropLastPathSegment().build()
fun URI.addQuery(name: String, value: String): URI = URIBuilder(this).addParameter(name, value).build()