Skip to content
Snippets Groups Projects
Commit 5d6ab2ec authored by Florian Obersteiner's avatar Florian Obersteiner
Browse files

__str__ and __repr__ for dataset and variable classes (unfinished)

parent 21672649
Branches
Tags
1 merge request!6code refactor
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
......@@ -308,7 +308,7 @@ class Variable:
:type miss: float, defaults to -99999.0
"""
def desc(self, splitChar=","):
def desc(self, splitChar=", "):
"""Variable description string as it appears in an ICARTT file
:return: description string
......@@ -361,10 +361,12 @@ class Variable:
self.scale = scale
self.miss = miss
# TODO: should this also get a __str__ ?
def __repr__(self):
# TODO: this sould be more meaningful
return "ICARTT Variable object repr"
def __repr__(self): # TODO: this could be more meaningful?
return "ICARTT Variable description"
def __str__(self):
return self.desc()
class Dataset:
......@@ -383,8 +385,6 @@ class Dataset:
:param format:
"""
# TODO: should this also get a __str__ and a __repr__ ?
@property
def nHeader(self):
"""Header line count
......@@ -875,6 +875,14 @@ class Dataset:
except:
pass
def __repr__(self):
# TODO: this could be more meaningful
return "ICARTT Dataset object repr"
def __str__(self):
# TODO: this could be more meaningful
return "ICARTT Dataset string representation"
def __init__(self, f=None, loadData=True, splitChar=",", format=Formats.FFI1001): # TODO: why is init comming last?
"""Constructor method"""
self.format = format
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment