mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-14 22:44:45 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
72ad6dc953
commit
f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions
|
|
@ -1,11 +1,12 @@
|
|||
"""Stuff that differs in different Python versions and platform
|
||||
distributions."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
__all__ = ["get_path_uid", "stdlib_pkgs", "WINDOWS"]
|
||||
__all__ = ['get_path_uid', 'stdlib_pkgs', 'WINDOWS']
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -36,7 +37,7 @@ def get_path_uid(path: str) -> int:
|
|||
|
||||
:raises OSError: When path is a symlink or can't be read.
|
||||
"""
|
||||
if hasattr(os, "O_NOFOLLOW"):
|
||||
if hasattr(os, 'O_NOFOLLOW'):
|
||||
fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)
|
||||
file_uid = os.fstat(fd).st_uid
|
||||
os.close(fd)
|
||||
|
|
@ -47,7 +48,7 @@ def get_path_uid(path: str) -> int:
|
|||
file_uid = os.stat(path).st_uid
|
||||
else:
|
||||
# raise OSError for parity with os.O_NOFOLLOW above
|
||||
raise OSError(f"{path} is a symlink; Will not return uid for symlinks")
|
||||
raise OSError(f'{path} is a symlink; Will not return uid for symlinks')
|
||||
return file_uid
|
||||
|
||||
|
||||
|
|
@ -56,8 +57,8 @@ def get_path_uid(path: str) -> int:
|
|||
# dist.location (py27:`sysconfig.get_paths()['stdlib']`,
|
||||
# py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may
|
||||
# make this ineffective, so hard-coding
|
||||
stdlib_pkgs = {"python", "wsgiref", "argparse"}
|
||||
stdlib_pkgs = {'python', 'wsgiref', 'argparse'}
|
||||
|
||||
|
||||
# windows detection, covers cpython and ironpython
|
||||
WINDOWS = sys.platform.startswith("win") or (sys.platform == "cli" and os.name == "nt")
|
||||
WINDOWS = sys.platform.startswith('win') or (sys.platform == 'cli' and os.name == 'nt')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue