Skip to content

Commit c8dce92

Browse files
committed
Add a gen exp and a contains test, and suppress weird yield next() issue
1 parent 7b07b56 commit c8dce92

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,29 @@ load-plugins=[
115115
[tool.pylint.'MESSAGES CONTROL']
116116
# Silence warning: shapefile.py:2076:20: W0212: Access to a protected
117117
# member _from_geojson of a client class (protected-access)
118-
#
118+
# Silence remarks:
119+
# src\shapefile.py:338:0: R0914: Too many local variables (21/15) (too-many-locals)
120+
# src\shapefile.py:338:0: R0912: Too many branches (24/12) (too-many-branches)
121+
# src\shapefile.py:338:0: R0915: Too many statements (52/50) (too-many-statements)
122+
# src\shapefile.py:470:0: R0902: Too many instance attributes (9/7) (too-many-instance-attributes)
123+
# src\shapefile.py:471:4: R0913: Too many arguments (6/5) (too-many-arguments)
124+
# src\shapefile.py:471:4: R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
125+
# src\shapefile.py:506:4: R0911: Too many return statements (10/6) (too-many-return-statements)
126+
# src\shapefile.py:878:0: R0903: Too few public methods (0/2) (too-few-public-methods)
119127
# Silence warnings: test_shapefile.py:{783,786,799,803,06,1195}:19:
120128
# W0212: Access to a protected member _offsets of a
121129
# client class (protected-access)
122130
#
123131
# Toml multi-line string used instead of array due to:
124132
# https://github.com/christopherpickering/pylint-per-file-ignores/issues/160
125-
per-file-ignores = """
126-
shapefile.py:W0212
127-
test_shapefile.py:W0212
128-
"""
133+
per-file-ignores = [
134+
"src/shapefile.py:W0212",
135+
"src/shapefile.py:R0902",
136+
"src/shapefile.py:R0903",
137+
"src/shapefile.py:R0911",
138+
"src/shapefile.py:R0912",
139+
"src/shapefile.py:R0914",
140+
"src/shapefile.py:R0915",
141+
"src/shapefile.py:R0917",
142+
"test_shapefile.py:W0212",
143+
]

src/shapefile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,7 +2314,7 @@ def __dbfHeader(self):
23142314
raise ShapefileException(
23152315
"Shapefile dbf header length exceeds maximum length."
23162316
)
2317-
recordLength = sum([int(field[2]) for field in fields]) + 1
2317+
recordLength = sum(int(field[2]) for field in fields) + 1
23182318
header = pack(
23192319
"<BBBBLHH20x",
23202320
version,
@@ -2371,7 +2371,7 @@ def __shpRecord(self, s):
23712371
# Shape Type
23722372
if self.shapeType is None and s.shapeType != NULL:
23732373
self.shapeType = s.shapeType
2374-
if s.shapeType != NULL and s.shapeType != self.shapeType:
2374+
if not s.shapeType in {NULL, self.shapeType}:
23752375
raise ShapefileException(
23762376
f"The shape's type ({s.shapeType}) must match "
23772377
f"the type of the shapefile ({self.shapeType})."
@@ -2883,7 +2883,7 @@ def _filter_network_doctests(
28832883

28842884
examples_it = iter(examples)
28852885

2886-
yield next(examples_it)
2886+
yield next(examples_it) # pylint: disable=stop-iteration-return
28872887

28882888
for example in examples_it:
28892889
# Track variables in doctest shell sessions defined from commands

0 commit comments

Comments
 (0)