Upload compat.py with huggingface_hub
Browse files
compat.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .core import *
|
| 2 |
+
from .codec import *
|
| 3 |
+
from typing import Any, Union
|
| 4 |
+
|
| 5 |
+
def ToASCII(label: str) -> bytes:
|
| 6 |
+
return encode(label)
|
| 7 |
+
|
| 8 |
+
def ToUnicode(label: Union[bytes, bytearray]) -> str:
|
| 9 |
+
return decode(label)
|
| 10 |
+
|
| 11 |
+
def nameprep(s: Any) -> None:
|
| 12 |
+
raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol')
|
| 13 |
+
|