◐ Shell
clean mode source ↗

Revise comments, docstrings, some messages, and a bit of code by EliahKagan · Pull Request #1725 · gitpython-developers/GitPython

@@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- # config.py # compat.py # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: https://opensource.org/license/bsd-3-clause/ """utilities to help provide compatibility with python 3"""
"""Utilities to help provide compatibility with Python 3."""
# flake8: noqa
import locale Expand Down Expand Up @@ -50,7 +51,7 @@ def safe_decode(s: AnyStr) -> str:

def safe_decode(s: Union[AnyStr, None]) -> Optional[str]: """Safely decodes a binary string to unicode""" """Safely decode a binary string to Unicode.""" if isinstance(s, str): return s elif isinstance(s, bytes): Expand All @@ -72,7 +73,7 @@ def safe_encode(s: AnyStr) -> bytes:

def safe_encode(s: Optional[AnyStr]) -> Optional[bytes]: """Safely encodes a binary string to unicode""" """Safely encode a binary string to Unicode.""" if isinstance(s, str): return s.encode(defenc) elif isinstance(s, bytes): Expand All @@ -94,7 +95,7 @@ def win_encode(s: AnyStr) -> bytes:

def win_encode(s: Optional[AnyStr]) -> Optional[bytes]: """Encode unicodes for process arguments on Windows.""" """Encode Unicode strings for process arguments on Windows.""" if isinstance(s, str): return s.encode(locale.getpreferredencoding(False)) elif isinstance(s, bytes): Expand Down