Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Small cleanups to dviread. #16876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/matplotlib/dviread.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ def _arg_raw(dvi, delta):
return delta


def _arg(bytes, signed, dvi, _):
def _arg(nbytes, signed, dvi, _):
"""
Read *bytes* bytes, returning the bytes interpreted as a signed integer
Read *nbytes* bytes, returning the bytes interpreted as a signed integer
if *signed* is true, unsigned otherwise.
"""
return dvi._arg(bytes, signed)
return dvi._arg(nbytes, signed)


def _arg_slen(dvi, delta):
Expand Down Expand Up @@ -315,12 +315,12 @@ def _arg(self, nbytes, signed=False):
Read and return an integer argument *nbytes* long.
Signedness is determined by the *signed* keyword.
"""
str = self.file.read(nbytes)
value = str[0]
buf = self.file.read(nbytes)
value = buf[0]
if signed and value >= 0x80:
value = value - 0x100
for i in range(1, nbytes):
value = 0x100*value + str[i]
for b in buf[1:]:
value = 0x100*value + b
return value

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