30 lines
817 B
Python
30 lines
817 B
Python
import icu
|
|
import tempfile
|
|
import pathlib
|
|
|
|
dep = icu.UnicodeSet()
|
|
u = icu.UnicodeSet()
|
|
dep.applyIntPropertyValue(icu.UProperty.DEPRECATED, 1)
|
|
for C in ('L','M','N','P','S','Z','Cf'):
|
|
u.addAll(icu.UnicodeSet(f"[:{C}:]"))
|
|
u.removeAll(dep)
|
|
bad_characters = ''
|
|
pathlib_bad_characters = ''
|
|
with tempfile.TemporaryDirectory() as temp:
|
|
temp = pathlib.Path(temp)
|
|
for char in u:
|
|
try:
|
|
f = temp / f't_{char}_t'
|
|
except Exception:
|
|
pathlib_bad_characters += char
|
|
continue
|
|
try:
|
|
f.touch(exist_ok=False)
|
|
except Exception:
|
|
bad_characters += char
|
|
continue
|
|
finally:
|
|
f.unlink()
|
|
|
|
print("pathlib bad characters", repr(pathlib_bad_characters))
|
|
print("bad characters ", repr(pathlib_bad_characters)) |