Skip to content

Commit d9f2a07

Browse files
committed
JSONReader constructor: more explicit docstring
1 parent 4e31557 commit d9f2a07

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

guidata/jsonio.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,13 @@ def write_object_list(self, seq, group_name):
156156
class JSONReader(JSONHandler):
157157
"""Class handling JSON deserialization"""
158158

159-
def __init__(self, filename):
160-
JSONHandler.__init__(self, filename)
161-
if filename is not None and not os.path.isfile(filename):
159+
def __init__(self, fname_or_jsontext):
160+
"""JSONReader constructor:
161+
* fname_or_jsontext: JSON filename or JSON text"""
162+
JSONHandler.__init__(self, fname_or_jsontext)
163+
if fname_or_jsontext is not None and not os.path.isfile(fname_or_jsontext):
162164
self.filename = None
163-
self.jsontext = filename
165+
self.jsontext = fname_or_jsontext
164166
self.load()
165167

166168
def read(self, group_name=None, func=None, instance=None):

0 commit comments

Comments
 (0)