Skip to content

Commit f4fdf2c

Browse files
committed
Add docstring to sentinel.
1 parent 209421c commit f4fdf2c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

shapefile.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,12 @@ class ShapefileException(Exception):
913913

914914

915915
class _NoShpSentinel(object):
916+
"""For use as a default value for shp to preserve the
917+
behaviour (from when all keyword args were gathered
918+
in the **kwargs dict) in case someone explictly
919+
called Reader(shp=None) to load self.shx.
920+
"""
921+
916922
pass
917923

918924

@@ -1106,15 +1112,14 @@ def __init__(
11061112
self.load(path)
11071113
return
11081114

1115+
self.shp = self._seek_0_on_file_obj_wrap_or_open_from_name("shp", shp)
1116+
self.dbf = self._seek_0_on_file_obj_wrap_or_open_from_name("dbf", dbf)
1117+
11091118
if shp is _NoShpSentinel:
1110-
self.shp = None
11111119
self.shx = None
11121120
else:
1113-
self.shp = self._seek_0_on_file_obj_wrap_or_open_from_name("shp", shp)
11141121
self.shx = self._seek_0_on_file_obj_wrap_or_open_from_name("shx", shx)
11151122

1116-
self.dbf = self._seek_0_on_file_obj_wrap_or_open_from_name("dbf", dbf)
1117-
11181123
# Load the files
11191124
if self.shp or self.dbf:
11201125
self._try_to_set_constituent_file_headers()

0 commit comments

Comments
 (0)