@@ -95,7 +95,11 @@ def __del__(self) -> None:
95
95
96
96
@property
97
97
def process_definition (self ) -> Dict [str , Any ]:
98
- return self ._payload .get ("process" , {})
98
+ process = self ._payload .get ("process" , {})
99
+ if isinstance (process , dict ):
100
+ return process
101
+ else :
102
+ raise ValueError (f"process is not a dict: { type (process )} " )
99
103
100
104
@property
101
105
def parameters (self ) -> Dict [str , Any ]:
@@ -111,19 +115,37 @@ def parameters(self) -> Dict[str, Any]:
111
115
return {}
112
116
else :
113
117
task_config : Dict [str , Any ] = task_config_list [0 ]
114
- return task_config .get ("parameters" , {})
118
+ parameters = task_config .get ("parameters" , {})
119
+ if isinstance (parameters , dict ):
120
+ return parameters
121
+ else :
122
+ raise ValueError (f"parameters is not a dict: { type (parameters )} " )
115
123
elif isinstance (task_configs , Dict ):
116
- return task_configs .get (self .name , {})
124
+ config = task_configs .get (self .name , {})
125
+ if isinstance (config , dict ):
126
+ return config
127
+ else :
128
+ raise ValueError (
129
+ f"task config for { self .name } is not a dict: { type (config )} "
130
+ )
117
131
else :
118
132
raise ValueError (f"unexpected value for 'tasks': { task_configs } " )
119
133
120
134
@property
121
135
def upload_options (self ) -> Dict [str , Any ]:
122
- return self .process_definition .get ("upload_options" , {})
136
+ upload_options = self .process_definition .get ("upload_options" , {})
137
+ if isinstance (upload_options , dict ):
138
+ return upload_options
139
+ else :
140
+ raise ValueError (f"upload_options is not a dict: { type (upload_options )} " )
123
141
124
142
@property
125
143
def items_as_dicts (self ) -> List [Dict [str , Any ]]:
126
- return self ._payload .get ("features" , [])
144
+ features = self ._payload .get ("features" , [])
145
+ if isinstance (features , list ):
146
+ return features
147
+ else :
148
+ raise ValueError (f"features is not a list: { type (features )} " )
127
149
128
150
@property
129
151
def items (self ) -> ItemCollection :
@@ -251,9 +273,7 @@ def process(self, **kwargs: Any) -> List[Dict[str, Any]]:
251
273
[type]: [description]
252
274
"""
253
275
# download assets of interest, this will update self.items
254
- # self.download_assets(['key1', 'key2'])
255
276
# do some stuff
256
- # self.upload_assets(['key1', 'key2'])
257
277
pass
258
278
259
279
def post_process_item (self , item : Dict [str , Any ]) -> Dict [str , Any ]:
0 commit comments