Fullscreen eingestellt.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
"""Stuff that differs in different Python versions and platform
|
||||
distributions."""
|
||||
|
||||
import importlib.resources
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from typing import IO
|
||||
|
||||
__all__ = ["get_path_uid", "stdlib_pkgs", "WINDOWS"]
|
||||
|
||||
@@ -51,6 +53,20 @@ def get_path_uid(path: str) -> int:
|
||||
return file_uid
|
||||
|
||||
|
||||
# The importlib.resources.open_text function was deprecated in 3.11 with suggested
|
||||
# replacement we use below.
|
||||
if sys.version_info < (3, 11):
|
||||
open_text_resource = importlib.resources.open_text
|
||||
else:
|
||||
|
||||
def open_text_resource(
|
||||
package: str, resource: str, encoding: str = "utf-8", errors: str = "strict"
|
||||
) -> IO[str]:
|
||||
return (importlib.resources.files(package) / resource).open(
|
||||
"r", encoding=encoding, errors=errors
|
||||
)
|
||||
|
||||
|
||||
# packages in the stdlib that may have installation metadata, but should not be
|
||||
# considered 'installed'. this theoretically could be determined based on
|
||||
# dist.location (py27:`sysconfig.get_paths()['stdlib']`,
|
||||
|
||||
Reference in New Issue
Block a user