Skip to content

Commit 1bb2e38

Browse files
committed
Restore self.shp = None etc. Replace *args with a kwarg: shapefile_path
1 parent f4fdf2c commit 1bb2e38

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

shapefile.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -951,31 +951,32 @@ def _assert_ext_is_supported(self, ext: str):
951951

952952
def __init__(
953953
self,
954-
*args,
954+
shapefile_path: str = "",
955+
*,
955956
encoding="utf-8",
956957
encodingErrors="strict",
957958
shp=_NoShpSentinel,
958959
shx=None,
959960
dbf=None,
960961
**kwargs,
961962
):
962-
# self.shp = None
963-
# self.shx = None
964-
# self.dbf = None
963+
self.shp = None
964+
self.shx = None
965+
self.dbf = None
965966
self._files_to_close = []
966967
self.shapeName = "Not specified"
967-
self._offsets = []
968+
self._offsets: list[int] = []
968969
self.shpLength = None
969970
self.numRecords = None
970971
self.numShapes = None
971-
self.fields = []
972+
self.fields: list[list[str]] = []
972973
self.__dbfHdrLength = 0
973-
self.__fieldLookup = {}
974+
self.__fieldLookup: dict[str, int] = {}
974975
self.encoding = encoding
975976
self.encodingErrors = encodingErrors
976977
# See if a shapefile name was passed as the first argument
977-
if len(args) > 0:
978-
path = pathlike_obj(args[0])
978+
if shapefile_path:
979+
path = pathlike_obj(shapefile_path)
979980
if is_string(path):
980981
if ".zip" in path:
981982
# Shapefile is inside a zipfile
@@ -992,6 +993,8 @@ def __init__(
992993
else:
993994
zpath = path[: path.find(".zip") + 4]
994995
shapefile = path[path.find(".zip") + 4 + 1 :]
996+
997+
zipfileobj: Union[tempfile._TemporaryFileWrapper, io.BufferedReader]
995998
# Create a zip file handle
996999
if zpath.startswith("http"):
9971000
# Zipfile is from a url

0 commit comments

Comments
 (0)