Skip to content

Commit

Permalink
Some initial typing and misc
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Aug 29, 2024
1 parent daa260a commit 0337de7
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 80 deletions.
6 changes: 3 additions & 3 deletions python/resdata/geometry/cpolyline.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def createFromXYZFile(cls, filename, name=None):
polyline._set_name(name)
return polyline

def __str__(self):
def __str__(self) -> str:
name = self.getName()
str = f"{name} [" if name else "["

Expand All @@ -65,10 +65,10 @@ def __str__(self):
str += "]"
return str

def __repr__(self):
def __repr__(self) -> str:
return str(self)

def __len__(self):
def __len__(self) -> int:
return self._size()

def __getitem__(self, index):
Expand Down
2 changes: 1 addition & 1 deletion python/resdata/geometry/cpolyline_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self):
def __contains__(self, name):
return self._has_polyline(name)

def __len__(self):
def __len__(self) -> int:
return self._size()

def __iter__(self):
Expand Down
2 changes: 1 addition & 1 deletion python/resdata/geometry/geo_pointset.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __getitem__(self, key):
# TODO implement slicing?
raise ValueError(f"Index must be int, not {type(key)}.")

def __len__(self):
def __len__(self) -> int:
return self._get_size()

def __repr__(self):
Expand Down
Loading

0 comments on commit 0337de7

Please sign in to comment.