Skip to content

Commit

Permalink
bugfix: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
na.nadezhin committed Aug 27, 2019
1 parent 2155470 commit bc0518d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pygraphviz/agraph.py
Expand Up @@ -1742,8 +1742,7 @@ def __init__(self, handle, atype):
ghandle = gv.agraphof(handle)
root_handle = gv.agroot(ghandle) # get root graph
try:
ah = gv.agattr(root_handle, 0, b'charset', None)
item = gv.agattrdefval(ah)
item = gv.agattrdefval(gv.agattr(root_handle, 0, b'charset', None))
self.encoding = item if type(item) is not bytes else item.decode('utf-8')
except KeyError:
self.encoding = _DEFAULT_ENCODING
Expand Down Expand Up @@ -1835,8 +1834,7 @@ def __init__(self, handle, atype):
# get the encoding
root_handle = gv.agroot(self.ghandle) # get root graph
try:
ah = gv.agattr(root_handle, 0, b'charset', None)
item = gv.agattrdefval(ah)
item = gv.agattrdefval(gv.agattr(root_handle, 0, b'charset', None))
self.encoding = item if type(item) is not bytes else item.decode('utf-8')
except KeyError:
self.encoding = _DEFAULT_ENCODING
Expand Down

0 comments on commit bc0518d

Please sign in to comment.