File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ lint.select = [
150150 " PERF102" , # perflint: incorrect-dict-iterator
151151 " PERF401" , # perflint: manual-list-comprehension
152152 " PERF402" , # perflint: manual-list-copy
153+ " PERF403" , # perflint: manual-dict-comprehension
153154 " PGH" , # pygrep-hooks
154155 " PIE" , # flake8-pie
155156 " PT" , # flake8-pytest-style
Original file line number Diff line number Diff line change @@ -185,13 +185,9 @@ def getiptcinfo(
185185
186186 data = None
187187
188- info : dict [tuple [int , int ], bytes | list [bytes ]] = {}
189188 if isinstance (im , IptcImageFile ):
190189 # return info dictionary right away
191- for k , v in im .info .items ():
192- if isinstance (k , tuple ):
193- info [k ] = v
194- return info
190+ return {k : v for k , v in im .info .items () if isinstance (k , tuple )}
195191
196192 elif isinstance (im , JpegImagePlugin .JpegImageFile ):
197193 # extract the IPTC/NAA resource
@@ -227,7 +223,4 @@ class FakeImage:
227223 except (IndexError , KeyError ):
228224 pass # expected failure
229225
230- for k , v in iptc_im .info .items ():
231- if isinstance (k , tuple ):
232- info [k ] = v
233- return info
226+ return {k : v for k , v in iptc_im .info .items () if isinstance (k , tuple )}
You can’t perform that action at this time.
0 commit comments