Skip to content

Commit 8eef523

Browse files
amuellermfeurer
authored andcommitted
replace __str__ by __repr__ (#743)
* replace __str__ by __repr__ * try to make regex work on windows? * maybe now the windows regex matches newline with dot? * I have no idea how that passed
1 parent 59c806b commit 8eef523

File tree

11 files changed

+19
-17
lines changed

11 files changed

+19
-17
lines changed

openml/datasets/data_feature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, index, name, data_type, nominal_values,
3333
self.nominal_values = nominal_values
3434
self.number_missing_values = number_missing_values
3535

36-
def __str__(self):
36+
def __repr__(self):
3737
return "[%d - %s (%s)]" % (self.index, self.name, self.data_type)
3838

3939
def _repr_pretty_(self, pp, cycle):

openml/datasets/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def __init__(self, name, description, format=None,
173173
else:
174174
self.data_pickle_file = None
175175

176-
def __str__(self):
176+
def __repr__(self):
177177
header = "OpenML Dataset"
178178
header = '{}\n{}\n'.format(header, '=' * len(header))
179179

openml/evaluations/evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, run_id, task_id, setup_id, flow_id, flow_name,
5050
self.values = values
5151
self.array_data = array_data
5252

53-
def __str__(self):
53+
def __repr__(self):
5454
header = "OpenML Evaluation"
5555
header = '{}\n{}\n'.format(header, '=' * len(header))
5656

openml/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, message: str, code: str = None, additional: str = None, url:
2525
self.url = url
2626
super().__init__(message)
2727

28-
def __str__(self):
28+
def __repr__(self):
2929
return '%s returned code %s: %s' % (
3030
self.url, self.code, self.message,
3131
)

openml/flows/flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def extension(self):
142142
raise RuntimeError("No extension could be found for flow {}: {}"
143143
.format(self.flow_id, self.name))
144144

145-
def __str__(self):
145+
def __repr__(self):
146146
header = "OpenML Flow"
147147
header = '{}\n{}\n'.format(header, '=' * len(header))
148148

openml/runs/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self, task_id, flow_id, dataset_id, setup_string=None,
6767
self.tags = tags
6868
self.predictions_url = predictions_url
6969

70-
def __str__(self):
70+
def __repr__(self):
7171
header = "OpenML Run"
7272
header = '{}\n{}\n'.format(header, '=' * len(header))
7373

openml/runs/trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def merge_traces(cls, traces: List['OpenMLRunTrace']) -> 'OpenMLRunTrace':
380380

381381
return cls(None, merged_trace)
382382

383-
def __str__(self):
383+
def __repr__(self):
384384
return '[Run id: %d, %d trace iterations]'.format(
385385
-1 if self.run_id is None else self.run_id,
386386
len(self.trace_iterations),
@@ -471,7 +471,7 @@ def get_parameters(self):
471471
result[param[len(PREFIX):]] = value
472472
return result
473473

474-
def __str__(self):
474+
def __repr__(self):
475475
"""
476476
tmp string representation, will be changed in the near future
477477
"""

openml/setups/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, setup_id, flow_id, parameters):
2727
self.flow_id = flow_id
2828
self.parameters = parameters
2929

30-
def __str__(self):
30+
def __repr__(self):
3131
header = "OpenML Setup"
3232
header = '{}\n{}\n'.format(header, '=' * len(header))
3333

@@ -82,7 +82,7 @@ def __init__(self, input_id, flow_id, flow_name, full_name, parameter_name,
8282
self.default_value = default_value
8383
self.value = value
8484

85-
def __str__(self):
85+
def __repr__(self):
8686
header = "OpenML Parameter"
8787
header = '{}\n{}\n'.format(header, '=' * len(header))
8888

openml/study/study.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(
8989
self.runs = runs
9090
pass
9191

92-
def __str__(self):
92+
def __repr__(self):
9393
# header is provided by the sub classes
9494
base_url = "{}".format(openml.config.server[:-len('api/v1/xml')])
9595
fields = {"Name": self.name,
@@ -268,10 +268,10 @@ def __init__(
268268
setups=setups,
269269
)
270270

271-
def __str__(self):
271+
def __repr__(self):
272272
header = "OpenML Study"
273273
header = '{}\n{}\n'.format(header, '=' * len(header))
274-
body = super(OpenMLStudy, self).__str__()
274+
body = super(OpenMLStudy, self).__repr__()
275275
return header + body
276276

277277

@@ -346,8 +346,8 @@ def __init__(
346346
setups=None,
347347
)
348348

349-
def __str__(self):
349+
def __repr__(self):
350350
header = "OpenML Benchmark Suite"
351351
header = '{}\n{}\n'.format(header, '=' * len(header))
352-
body = super(OpenMLBenchmarkSuite, self).__str__()
352+
body = super(OpenMLBenchmarkSuite, self).__repr__()
353353
return header + body

openml/tasks/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(
5555
self.estimation_procedure_id = estimation_procedure_id
5656
self.split = None # type: Optional[OpenMLSplit]
5757

58-
def __str__(self):
58+
def __repr__(self):
5959
header = "OpenML Task"
6060
header = '{}\n{}\n'.format(header, '=' * len(header))
6161

0 commit comments

Comments
 (0)