mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[PyCharm] PY-73511 Fix HF module error if the user is isolated from the internet by error catching
GitOrigin-RevId: 736943f685e7825b4547b13d4fee405f428b5fc0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1fd98673ae
commit
86ef0d5a0e
+2
-3
@@ -28,9 +28,8 @@ object HuggingFaceHttpClient {
|
||||
val linkHeader = connection.getHeaderField("Link")
|
||||
connection.disconnect()
|
||||
HfHttpResponseWithHeaders(content, linkHeader)
|
||||
}.onFailure {
|
||||
thisLogger().warn("Failed to download: $url", it)
|
||||
}
|
||||
//}.onFailure {
|
||||
// thisLogger().warn("Failed to download: $url", it)
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -3,6 +3,7 @@ package com.intellij.python.community.impl.huggingFace.service
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.editor.EditorFactory
|
||||
import com.intellij.openapi.editor.event.DocumentEvent
|
||||
import com.intellij.openapi.editor.event.DocumentListener
|
||||
@@ -122,9 +123,13 @@ private class HuggingFaceFileChangesListener(private val onThresholdReached: ()
|
||||
private var fileChangesCounter = 0
|
||||
|
||||
override fun after(events: List<VFileEvent>) {
|
||||
if (events.any { it.file?.extension in listOf("py", "ipynb") }) {
|
||||
fileChangesCounter++
|
||||
if (fileChangesCounter >= HuggingFaceLibrariesManagerConfig.CHANGES_NUM_THRESHOLD) onThresholdReached()
|
||||
try {
|
||||
if (events.any { it.file?.extension in listOf("py", "ipynb") }) {
|
||||
fileChangesCounter++
|
||||
if (fileChangesCounter >= HuggingFaceLibrariesManagerConfig.CHANGES_NUM_THRESHOLD) onThresholdReached()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
thisLogger().warn("Exception in HuggingFaceFileChangesListener.after", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user