Skip to content

Commit fc3c376

Browse files
committed
Rename function
1 parent d57ab1d commit fc3c376

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

python/model/base.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _validate(self, input):
137137
raise AttributeError("Missing key 'features' in model's metadata")
138138

139139
# Ensure input is lislike shaped
140-
_, input = self._is_listlike(input)
140+
input = self._get_list_from(input)
141141
# Get feature names in order
142142
feature_names = [f['name'] for f in self.metadata['features']]
143143
# Create an index to handle multiple samples input
@@ -192,13 +192,13 @@ def _is_regression(self):
192192

193193
# Private (static)
194194
@staticmethod
195-
def _is_listlike(data):
196-
_is_listlike = pd.api.types.is_list_like(data)
197-
is_dict = isinstance(data, dict)
198-
is_input_listlike = _is_listlike and not is_dict
199-
if not is_input_listlike:
200-
data = [data]
201-
return is_input_listlike, data
195+
def _get_list_from(data):
196+
if isinstance(data, dict):
197+
return [data]
198+
elif pd.api.types.is_list_like(data):
199+
return data
200+
else:
201+
return [data]
202202

203203
# Public
204204
def load(self):
@@ -284,7 +284,7 @@ def info(self):
284284
This function gives complete description of the model.
285285
The returned ibject contais the following keys:
286286
287-
metadata (:class:`dict`): Model metadata (see :func:`~model.Model.metadata`).
287+
metadata (:class:`dict`): Model metadata (see :func:`~python.model.base.BaseModel.metadata`).
288288
289289
model (:class:`dict`): Context information of the learnt model.
290290
type (:class:`str`):

0 commit comments

Comments
 (0)