From c4e484669fd49a01e2b45e832562b615ec239d28 Mon Sep 17 00:00:00 2001 From: freddyaboulton Date: Thu, 2 May 2024 13:40:05 -0400 Subject: [PATCH 1/3] Add comment --- src/huggingface_hub/utils/_telemetry.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/huggingface_hub/utils/_telemetry.py b/src/huggingface_hub/utils/_telemetry.py index 5de988e279..886b8f5838 100644 --- a/src/huggingface_hub/utils/_telemetry.py +++ b/src/huggingface_hub/utils/_telemetry.py @@ -100,7 +100,12 @@ def _send_telemetry_in_thread( library_version: Optional[str] = None, user_agent: Union[Dict, str, None] = None, ) -> None: - """Contains the actual data sending data to the Hub.""" + """Contains the actual data sending data to the Hub. + + This function is called directly in gradio's analytics because + it is not possible to send telemetry from a daemon thread. + Please do not rename or remove this function. + """ path = "/".join(quote(part) for part in topic.split("/") if len(part) > 0) try: r = get_session().head( From 2cd869afe189a1081deb1d0cbc4565e387e75cd4 Mon Sep 17 00:00:00 2001 From: freddyaboulton Date: Thu, 2 May 2024 15:06:31 -0400 Subject: [PATCH 2/3] Add code --- src/huggingface_hub/utils/_telemetry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/huggingface_hub/utils/_telemetry.py b/src/huggingface_hub/utils/_telemetry.py index 886b8f5838..c74405a560 100644 --- a/src/huggingface_hub/utils/_telemetry.py +++ b/src/huggingface_hub/utils/_telemetry.py @@ -104,6 +104,9 @@ def _send_telemetry_in_thread( This function is called directly in gradio's analytics because it is not possible to send telemetry from a daemon thread. + + See here: https://github.com/gradio-app/gradio/pull/8180 + Please do not rename or remove this function. """ path = "/".join(quote(part) for part in topic.split("/") if len(part) > 0) From 41e8ccc0be8f58d423d6d440c5ac9cdfdfefb80b Mon Sep 17 00:00:00 2001 From: freddyaboulton Date: Thu, 2 May 2024 15:19:54 -0400 Subject: [PATCH 3/3] lint --- src/huggingface_hub/utils/_telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/huggingface_hub/utils/_telemetry.py b/src/huggingface_hub/utils/_telemetry.py index c74405a560..2ba4a6349a 100644 --- a/src/huggingface_hub/utils/_telemetry.py +++ b/src/huggingface_hub/utils/_telemetry.py @@ -101,7 +101,7 @@ def _send_telemetry_in_thread( user_agent: Union[Dict, str, None] = None, ) -> None: """Contains the actual data sending data to the Hub. - + This function is called directly in gradio's analytics because it is not possible to send telemetry from a daemon thread.