8000 Simplify `path` logic in error `__init__`. · yuan3y/plotly.py@b6419e8 · GitHub
[go: up one dir, main page]

Skip to content < 10000 script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_document-metadata_document-metadata_ts-ui_packages_hydro-analytics_hydro-analytic-f29230-07417997172c.js" defer="defer">

Commit b6419e8

Browse files
committed
Simplify path logic in error __init__.
1 parent 7a3e820 commit b6419e8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

plotly/exceptions.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ class PlotlyEmptyDataError(PlotlyError):
8181

8282
# Graph Objects Errors
8383
class PlotlyGraphObjectError(PlotlyError):
84-
def __init__(self, message='', path=None, notes=None, plain_message=''):
84+
def __init__(self, message='', path=(), notes=None, plain_message=''):
8585
self.message = message
8686
self.plain_message = plain_message
87-
if isinstance(path, list):
88-
self.path = path
89-
elif path is None:
90-
self.path = []
91-
else:
87+
if isinstance(path, (basestring, int)):
9288
self.path = [path]
89+
else:
90+
self.path = list(path)
9391
if isinstance(notes, list):
9492
self.notes = notes
9593
elif notes is None:

0 commit comments

Comments
 (0)
0