Skip to content

Commit 8ef6b7e

Browse files
author
Erik Steringer
committed
add parameter checks for Graph objects (help with upgrading 1.1 -> 1.2)
1 parent 1a2c80f commit 8ef6b7e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

principalmapper/common/graphs.py

+10
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,18 @@ def __init__(self, nodes: list, edges: list, policies: list, groups: list, accou
5656
self.edges = edges
5757
self.policies = policies
5858
self.groups = groups
59+
5960
self.account = account
61+
if not isinstance(account, str):
62+
raise ValueError('Parameter `account` is expected to be str')
63+
6064
self.partition = partition
65+
if not isinstance(partition, str):
66+
raise ValueError('Parameter `partition` is expected to be str')
67+
68+
if not isinstance(metadata, dict):
69+
raise ValueError('Parameter `metadata` is expected to be dict')
70+
6171
if 'pmapper_version' not in metadata:
6272
raise ValueError('Incomplete metadata input, expected key: "pmapper_version"')
6373
self.metadata = metadata

0 commit comments

Comments
 (0)