From 3bb34c60e493401ca9e6f5167bbce35be58d585e Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Tue, 6 Feb 2024 20:43:00 +0000 Subject: [PATCH] Update docstrings to show bytes being returned Only Python 3 is supported now, so this is way overdue. This addresses parts of issue #40. --- xattr.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/xattr.c b/xattr.c index 31ad87f..9aabf0a 100644 --- a/xattr.c +++ b/xattr.c @@ -469,16 +469,16 @@ static char __get_doc__[] = "\n" "Example:\n" " >>> xattr.get('/path/to/file', 'user.comment')\n" - " 'test'\n" + " b'test'\n" " >>> xattr.get('/path/to/file', 'comment', namespace=xattr.NS_USER)\n" - " 'test'\n" + " b'test'\n" "\n" ITEM_DOC NAME_GET_DOC NOFOLLOW_DOC NS_DOC ":return: the value of the extended attribute (can contain NULLs)\n" - ":rtype: string\n" + ":rtype: bytes\n" ":raises EnvironmentError: caused by any system errors\n" "\n" ".. versionadded:: 0.4\n" @@ -544,10 +544,10 @@ static char __get_all_doc__[] = "Example:\n" "\n" " >>> xattr.get_all('/path/to/file')\n" - " [('user.mime-type', 'plain/text'), ('user.comment', 'test'),\n" - " ('system.posix_acl_access', '\\x02\\x00...')]\n" + " [(b'user.mime-type', b'plain/text'), (b'user.comment', b'test'),\n" + " (b'system.posix_acl_access', b'\\x02\\x00...')]\n" " >>> xattr.get_all('/path/to/file', namespace=xattr.NS_USER)\n" - " [('mime-type', 'plain/text'), ('comment', 'test')]\n" + " [(b'mime-type', b'plain/text'), (b'comment', b'test')]\n" "\n" ITEM_DOC ":keyword namespace: an optional namespace for filtering the\n" @@ -558,7 +558,7 @@ static char __get_all_doc__[] = ":return: list of tuples (name, value); note that if a namespace\n" " argument was passed, it (and the separator) will be stripped from\n" " the names returned\n" - ":rtype: list\n" + ":rtype: list[(bytes, bytes)]\n" ":raises EnvironmentError: caused by any system errors\n" "\n" ".. note:: Since reading the whole attribute list is not an atomic\n" @@ -1018,9 +1018,9 @@ static char __list_doc__[] = "Example:\n" "\n" " >>> xattr.list('/path/to/file')\n" - " ['user.test', 'user.comment', 'system.posix_acl_access']\n" + " [b'user.test', b'user.comment', b'system.posix_acl_access']\n" " >>> xattr.list('/path/to/file', namespace=xattr.NS_USER)\n" - " ['test', 'comment']\n" + " [b'test', b'comment']\n" "\n" ITEM_DOC NOFOLLOW_DOC @@ -1029,7 +1029,7 @@ static char __list_doc__[] = " argument was passed, it (and the separator) will be stripped\n" " from the names\n" " returned\n" - ":rtype: list\n" + ":rtype: list[bytes]\n" ":raises EnvironmentError: caused by any system errors\n" "\n" ".. versionadded:: 0.4\n" @@ -1138,13 +1138,13 @@ static char __xattr_doc__[] = \ "Example: \n\n" " >>> import xattr\n" " >>> xattr.listxattr(\"file.txt\")\n" - " ['user.mime_type']\n" + " [b'user.mime_type']\n" " >>> xattr.getxattr(\"file.txt\", \"user.mime_type\")\n" - " 'text/plain'\n" + " b'text/plain'\n" " >>> xattr.setxattr(\"file.txt\", \"user.comment\", " "\"Simple text file\")\n" " >>> xattr.listxattr(\"file.txt\")\n" - " ['user.mime_type', 'user.comment']\n" + " [b'user.mime_type', b'user.comment']\n" " >>> xattr.removexattr (\"file.txt\", \"user.comment\")\n" "\n" ".. note:: Most or all errors reported by the system while using\n" @@ -1161,7 +1161,7 @@ static char __xattr_doc__[] = \ " - ``ENOSPC`` and ``EDQUOT`` are documented as meaning out of disk\n" " space or out of disk space because of quota limits\n" ".. note:: Under Python 3, the namespace argument is a byte string,\n" - " not a unicode string.\n" + " not a unicode string, and all return values are bytes, not strings.\n" "\n" ; -- 2.39.5