Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f498f4

Browse filesBrowse files
committed
Small cleanups to dviread.
Don't use variables whose name shadow builtins (`bytes`, `str` -- the latter is actually a bytes instance). Also use a slightly more idiomatic way to iterate over the bytestring.
1 parent db55918 commit 8f498f4
Copy full SHA for 8f498f4

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed

‎lib/matplotlib/dviread.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dviread.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ def _arg_raw(dvi, delta):
7373
return delta
7474

7575

76-
def _arg(bytes, signed, dvi, _):
76+
def _arg(nbytes, signed, dvi, _):
7777
"""
78-
Read *bytes* bytes, returning the bytes interpreted as a signed integer
78+
Read *nbytes* bytes, returning the bytes interpreted as a signed integer
7979
if *signed* is true, unsigned otherwise.
8080
"""
81-
return dvi._arg(bytes, signed)
81+
return dvi._arg(nbytes, signed)
8282

8383

8484
def _arg_slen(dvi, delta):
@@ -315,12 +315,12 @@ def _arg(self, nbytes, signed=False):
315315
Read and return an integer argument *nbytes* long.
316316
Signedness is determined by the *signed* keyword.
317317
"""
318-
str = self.file.read(nbytes)
319-
value = str[0]
318+
buf = self.file.read(nbytes)
319+
value = buf[0]
320320
if signed and value >= 0x80:
321321
value = value - 0x100
322-
for i in range(1, nbytes):
323-
value = 0x100*value + str[i]
322+
for b in buf[1:]:
323+
value = 0x100*value + b
324324
return value
325325

326326
@_dispatch(min=0, max=127, state=_dvistate.inpage)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.