From: Serhiy Storchaka <storchaka@gmail.com>
Date: Sun, 15 May 2016 09:27:16 +0000 (+0300)
Subject: Issue #26039: Document ZipInfo.is_dir() and make force_zip64 keyword-only.
X-Git-Tag: v3.6.0a1~18
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f47fc5553be1945d4d3ca1386c523fcf2ed28cef;p=python

Issue #26039: Document ZipInfo.is_dir() and make force_zip64 keyword-only.
Patch by Thomas Kluyver.
---

diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index cf8d54715f..f5e161e6f4 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -207,7 +207,7 @@ ZipFile Objects
 .. index::
    single: universal newlines; zipfile.ZipFile.open method
 
-.. method:: ZipFile.open(name, mode='r', pwd=None, force_zip64=False)
+.. method:: ZipFile.open(name, mode='r', pwd=None, *, force_zip64=False)
 
    Access a member of the archive as a file-like object.  *name*
    is the name of the file in the archive, or a :class:`ZipInfo` object.  The
@@ -490,7 +490,15 @@ file:
 
    .. versionadded:: 3.6
 
-Instances have the following attributes:
+Instances have the following methods and attributes:
+
+.. method:: ZipInfo.is_dir()
+
+   Return True if this archive member is a directory.
+
+   This uses the entry's name: directories should always end with ``/``.
+
+   .. versionadded:: 3.6
 
 
 .. attribute:: ZipInfo.filename
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 03dead5317..27a4c713e7 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -502,6 +502,7 @@ class ZipInfo (object):
         return zinfo
 
     def is_dir(self):
+        """Return True if this archive member is a directory."""
         return self.filename[-1] == '/'
 
 
@@ -1343,7 +1344,7 @@ class ZipFile:
         with self.open(name, "r", pwd) as fp:
             return fp.read()
 
-    def open(self, name, mode="r", pwd=None, force_zip64=False):
+    def open(self, name, mode="r", pwd=None, *, force_zip64=False):
         """Return file-like object for 'name'.
 
         name is a string for the file name within the ZIP file, or a ZipInfo