From 48ac9c7fc159bae2e9f3b6d08fa7b553da75aa4f Mon Sep 17 00:00:00 2001 From: Saman Hushi Date: Fri, 28 Jun 2024 16:36:00 +0200 Subject: [PATCH 01/15] ur last aproach --- src/safeds/data/tabular/containers/_cell.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index f1482e1a3..039a468cd 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -692,6 +692,21 @@ def lt(self, other: Any) -> Cell[bool]: +---------+ """ return self.__lt__(other) + + @staticmethod + def first_not_none(cells: list[Cell])-> Cell: + """Return the first cell that is not None.""" + from polars import coalesce + + from ._column import Column + from ._lazy_cell import _LazyCell, _unwrap,_wrap + # we tryed lots of different aproaches and thats the last one + cell = coalesce([_unwrap(cell) for cell in cells]) + + return cell + + + # ------------------------------------------------------------------------------------------------------------------ # Internal From 0dd1daac201a00513aa33c54dfe6df0ad0e939ec Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Fri, 5 Jul 2024 14:31:26 +0200 Subject: [PATCH 02/15] feat: `Cell.first_not_none` --- src/safeds/data/tabular/containers/_cell.py | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index 039a468cd..757ae66c5 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -21,6 +21,19 @@ class Cell(ABC, Generic[T_co]): This class cannot be instantiated directly. It is only used for arguments of callbacks. """ + # ------------------------------------------------------------------------------------------------------------------ + # Static methods + # ------------------------------------------------------------------------------------------------------------------ + + @staticmethod + def first_not_none(cells: list[Cell]) -> Cell: + """Return the first cell that is not None.""" + import polars as pl + + from ._lazy_cell import _LazyCell # circular import + + return _LazyCell(pl.coalesce([cell._polars_expression for cell in cells])) + # ------------------------------------------------------------------------------------------------------------------ # Dunder methods # ------------------------------------------------------------------------------------------------------------------ @@ -692,21 +705,6 @@ def lt(self, other: Any) -> Cell[bool]: +---------+ """ return self.__lt__(other) - - @staticmethod - def first_not_none(cells: list[Cell])-> Cell: - """Return the first cell that is not None.""" - from polars import coalesce - - from ._column import Column - from ._lazy_cell import _LazyCell, _unwrap,_wrap - # we tryed lots of different aproaches and thats the last one - cell = coalesce([_unwrap(cell) for cell in cells]) - - return cell - - - # ------------------------------------------------------------------------------------------------------------------ # Internal From 2f70b66311e540289645316de595ad783a9ba043 Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:56:52 +0200 Subject: [PATCH 03/15] Tests do not get recognized yet --- .../containers/_cell/test_first_not_none.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/safeds/data/tabular/containers/_cell/test_first_not_none.py diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py new file mode 100644 index 000000000..a81ebeb31 --- /dev/null +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -0,0 +1,48 @@ +from datetime import date, time + +import pytest +from safeds.data.tabular.containers._cell import Cell +from safeds.data.tabular.containers._lazy_cell import _LazyCell + + +class TestFirstNotNone: + def test_should_return_none(): + to_eval = [_LazyCell(None) for i in range(5)] + res = Cell.first_not_none(to_eval) + assert(res.eq(_LazyCell(None))) + + @pytest.mark.parametrize( + ("list_of_cells", "expected"), + [ + ([_LazyCell(None), _LazyCell(1), _LazyCell(None), _LazyCell(4)], _LazyCell(1)), + ([_LazyCell(i) for i in range(5)], _LazyCell(1)), + ([_LazyCell(None), _LazyCell(None), _LazyCell("Hello, World!"), _LazyCell("Not returned")], _LazyCell("Hello, World!")), + ([_LazyCell(i) for i in ["a", "b", "c", "d"]], _LazyCell("a")), + ([_LazyCell(i) for i in [None, time(0,0,0,0), None, time(1, 1, 1, 1)]], _LazyCell(time(0,0,0,0))), + ([_LazyCell(time(i,i,i,i) for i in range(4))], _LazyCell(time(0,0,0,0))), + ([_LazyCell(i) for i in [None, date(2000, 1, 1), date(1098, 3, 4), None]], _LazyCell(date(2000, 1, 1))), + ([_LazyCell(date(2000, 3, i)) for i in range(5)], _LazyCell(date(2000, 3, 1))), + ([_LazyCell(i) for i in [None, "a", 1, time(0,0,0,0)]], _LazyCell("a")), + ([_LazyCell(i) for i in [time(1,1,1,1), 0, "c", date(2020, 1, 7)]], _LazyCell(time(1,1,1,1))), + ], + ids=[ + "numeric_with_null", + "numeric_no_null", + "strings_with_null", + "strings_no_null", + "times_with_null", + "times_no_null", + "dates_with_null", + "dates_no_null", + "mixed_with_null", + "mixed_no_null", + ], + ) + def test_should_not_return_none(self, list_of_cells: list[Cell], expected: Cell): + res = Cell.first_not_none(list_of_cells) + assert(res.eq(expected)) + + def test_given_empty_list(): + to_eval = [] + res = Cell.first_not_none(to_eval) + assert(res.eq(_LazyCell(None))) From aef68ca209423465943aa7edb23f7acdb5a686fb Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:03:46 +0200 Subject: [PATCH 04/15] added return types to tests --- .../data/tabular/containers/_cell/test_first_not_none.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index a81ebeb31..a3220c0e5 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -6,7 +6,7 @@ class TestFirstNotNone: - def test_should_return_none(): + def test_should_return_none() -> None: to_eval = [_LazyCell(None) for i in range(5)] res = Cell.first_not_none(to_eval) assert(res.eq(_LazyCell(None))) @@ -38,11 +38,11 @@ def test_should_return_none(): "mixed_no_null", ], ) - def test_should_not_return_none(self, list_of_cells: list[Cell], expected: Cell): + def test_should_not_return_none(self, list_of_cells: list[Cell], expected: Cell) -> None: res = Cell.first_not_none(list_of_cells) assert(res.eq(expected)) - def test_given_empty_list(): + def test_given_empty_list() -> None: to_eval = [] res = Cell.first_not_none(to_eval) assert(res.eq(_LazyCell(None))) From 03caaf69a5cb4937df25556cb09417ff8e2f102d Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:24:52 +0200 Subject: [PATCH 05/15] All tests passed --- .../data/tabular/containers/_cell/test_first_not_none.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index a3220c0e5..1f5c947cd 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -6,7 +6,7 @@ class TestFirstNotNone: - def test_should_return_none() -> None: + def test_should_return_none(self) -> None: to_eval = [_LazyCell(None) for i in range(5)] res = Cell.first_not_none(to_eval) assert(res.eq(_LazyCell(None))) @@ -19,9 +19,9 @@ def test_should_return_none() -> None: ([_LazyCell(None), _LazyCell(None), _LazyCell("Hello, World!"), _LazyCell("Not returned")], _LazyCell("Hello, World!")), ([_LazyCell(i) for i in ["a", "b", "c", "d"]], _LazyCell("a")), ([_LazyCell(i) for i in [None, time(0,0,0,0), None, time(1, 1, 1, 1)]], _LazyCell(time(0,0,0,0))), - ([_LazyCell(time(i,i,i,i) for i in range(4))], _LazyCell(time(0,0,0,0))), + ([_LazyCell(i) for i in [time(0,0,0,0), time(1,1,1,1), time(2,2,2,2), time(3,3,3,3)]], _LazyCell(time(0,0,0,0))), ([_LazyCell(i) for i in [None, date(2000, 1, 1), date(1098, 3, 4), None]], _LazyCell(date(2000, 1, 1))), - ([_LazyCell(date(2000, 3, i)) for i in range(5)], _LazyCell(date(2000, 3, 1))), + ([_LazyCell(date(2000, 3, i)) for i in range(1, 5)], _LazyCell(date(2000, 3, 1))), ([_LazyCell(i) for i in [None, "a", 1, time(0,0,0,0)]], _LazyCell("a")), ([_LazyCell(i) for i in [time(1,1,1,1), 0, "c", date(2020, 1, 7)]], _LazyCell(time(1,1,1,1))), ], @@ -42,7 +42,7 @@ def test_should_not_return_none(self, list_of_cells: list[Cell], expected: Cell) res = Cell.first_not_none(list_of_cells) assert(res.eq(expected)) - def test_given_empty_list() -> None: + def test_given_empty_list(self) -> None: to_eval = [] res = Cell.first_not_none(to_eval) assert(res.eq(_LazyCell(None))) From ea60232005fac9528991d681b6925a8845e6b880 Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:26:12 +0200 Subject: [PATCH 06/15] Improved clarity --- src/safeds/data/tabular/containers/_cell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index 757ae66c5..f1ed6361d 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -27,7 +27,7 @@ class Cell(ABC, Generic[T_co]): @staticmethod def first_not_none(cells: list[Cell]) -> Cell: - """Return the first cell that is not None.""" + """Return the first cell from the given list that is not None.""" import polars as pl from ._lazy_cell import _LazyCell # circular import From 21b913272d096a9bb86948f8ef80db7e3b898d1b Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:52:37 +0200 Subject: [PATCH 07/15] Added type-hinting for to_eval --- .../safeds/data/tabular/containers/_cell/test_first_not_none.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index 1f5c947cd..78e30e01b 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -7,7 +7,7 @@ class TestFirstNotNone: def test_should_return_none(self) -> None: - to_eval = [_LazyCell(None) for i in range(5)] + to_eval: list[Cell] = [_LazyCell(None) for i in range(5)] res = Cell.first_not_none(to_eval) assert(res.eq(_LazyCell(None))) From 589ab19056cedb88cc39d515632898a106194b5d Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:57:23 +0200 Subject: [PATCH 08/15] moar type-hinting --- .../safeds/data/tabular/containers/_cell/test_first_not_none.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index 78e30e01b..30d8ae0dd 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -43,6 +43,6 @@ def test_should_not_return_none(self, list_of_cells: list[Cell], expected: Cell) assert(res.eq(expected)) def test_given_empty_list(self) -> None: - to_eval = [] + to_eval: list[Cell] = [] res = Cell.first_not_none(to_eval) assert(res.eq(_LazyCell(None))) From a6f5b7b89965e81fcff248caca5956d55086f521 Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Fri, 12 Jul 2024 09:58:57 +0000 Subject: [PATCH 09/15] style: apply automated linter fixes --- .../containers/_cell/test_first_not_none.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index 30d8ae0dd..b582068e9 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -9,21 +9,27 @@ class TestFirstNotNone: def test_should_return_none(self) -> None: to_eval: list[Cell] = [_LazyCell(None) for i in range(5)] res = Cell.first_not_none(to_eval) - assert(res.eq(_LazyCell(None))) + assert res.eq(_LazyCell(None)) @pytest.mark.parametrize( ("list_of_cells", "expected"), [ ([_LazyCell(None), _LazyCell(1), _LazyCell(None), _LazyCell(4)], _LazyCell(1)), ([_LazyCell(i) for i in range(5)], _LazyCell(1)), - ([_LazyCell(None), _LazyCell(None), _LazyCell("Hello, World!"), _LazyCell("Not returned")], _LazyCell("Hello, World!")), + ( + [_LazyCell(None), _LazyCell(None), _LazyCell("Hello, World!"), _LazyCell("Not returned")], + _LazyCell("Hello, World!"), + ), ([_LazyCell(i) for i in ["a", "b", "c", "d"]], _LazyCell("a")), - ([_LazyCell(i) for i in [None, time(0,0,0,0), None, time(1, 1, 1, 1)]], _LazyCell(time(0,0,0,0))), - ([_LazyCell(i) for i in [time(0,0,0,0), time(1,1,1,1), time(2,2,2,2), time(3,3,3,3)]], _LazyCell(time(0,0,0,0))), + ([_LazyCell(i) for i in [None, time(0, 0, 0, 0), None, time(1, 1, 1, 1)]], _LazyCell(time(0, 0, 0, 0))), + ( + [_LazyCell(i) for i in [time(0, 0, 0, 0), time(1, 1, 1, 1), time(2, 2, 2, 2), time(3, 3, 3, 3)]], + _LazyCell(time(0, 0, 0, 0)), + ), ([_LazyCell(i) for i in [None, date(2000, 1, 1), date(1098, 3, 4), None]], _LazyCell(date(2000, 1, 1))), ([_LazyCell(date(2000, 3, i)) for i in range(1, 5)], _LazyCell(date(2000, 3, 1))), - ([_LazyCell(i) for i in [None, "a", 1, time(0,0,0,0)]], _LazyCell("a")), - ([_LazyCell(i) for i in [time(1,1,1,1), 0, "c", date(2020, 1, 7)]], _LazyCell(time(1,1,1,1))), + ([_LazyCell(i) for i in [None, "a", 1, time(0, 0, 0, 0)]], _LazyCell("a")), + ([_LazyCell(i) for i in [time(1, 1, 1, 1), 0, "c", date(2020, 1, 7)]], _LazyCell(time(1, 1, 1, 1))), ], ids=[ "numeric_with_null", @@ -40,9 +46,9 @@ def test_should_return_none(self) -> None: ) def test_should_not_return_none(self, list_of_cells: list[Cell], expected: Cell) -> None: res = Cell.first_not_none(list_of_cells) - assert(res.eq(expected)) + assert res.eq(expected) def test_given_empty_list(self) -> None: to_eval: list[Cell] = [] res = Cell.first_not_none(to_eval) - assert(res.eq(_LazyCell(None))) + assert res.eq(_LazyCell(None)) From ea99b24221f6fd333066c4b89dc1d40c8dcd393a Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Sun, 14 Jul 2024 13:51:51 +0200 Subject: [PATCH 10/15] Added requested changes --- src/safeds/data/tabular/containers/_cell.py | 14 +++++++++++++- .../containers/_cell/test_first_not_none.py | 18 ++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index f1ed6361d..313147710 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -27,7 +27,19 @@ class Cell(ABC, Generic[T_co]): @staticmethod def first_not_none(cells: list[Cell]) -> Cell: - """Return the first cell from the given list that is not None.""" + """ + Return the first cell from the given list that is not None. + + Parameters + ---------- + cells: The list of cells to be searched. + + Results + ------- + Returns the contents of the first cell that is not None. + If all cells in the list are None or the list is empty returns None. + + """ import polars as pl from ._lazy_cell import _LazyCell # circular import diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index b582068e9..2c99858e6 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -1,5 +1,6 @@ from datetime import date, time +import polars as pl import pytest from safeds.data.tabular.containers._cell import Cell from safeds.data.tabular.containers._lazy_cell import _LazyCell @@ -17,10 +18,10 @@ def test_should_return_none(self) -> None: ([_LazyCell(None), _LazyCell(1), _LazyCell(None), _LazyCell(4)], _LazyCell(1)), ([_LazyCell(i) for i in range(5)], _LazyCell(1)), ( - [_LazyCell(None), _LazyCell(None), _LazyCell("Hello, World!"), _LazyCell("Not returned")], + [_LazyCell(None), _LazyCell(None), _LazyCell(pl.lit("Hello, World!")), _LazyCell(pl.lit("Not returned"))], _LazyCell("Hello, World!"), ), - ([_LazyCell(i) for i in ["a", "b", "c", "d"]], _LazyCell("a")), + ([_LazyCell(pl.lit(i)) for i in ["a", "b", "c", "d"]], _LazyCell(pl.lit("a"))), ([_LazyCell(i) for i in [None, time(0, 0, 0, 0), None, time(1, 1, 1, 1)]], _LazyCell(time(0, 0, 0, 0))), ( [_LazyCell(i) for i in [time(0, 0, 0, 0), time(1, 1, 1, 1), time(2, 2, 2, 2), time(3, 3, 3, 3)]], @@ -28,8 +29,9 @@ def test_should_return_none(self) -> None: ), ([_LazyCell(i) for i in [None, date(2000, 1, 1), date(1098, 3, 4), None]], _LazyCell(date(2000, 1, 1))), ([_LazyCell(date(2000, 3, i)) for i in range(1, 5)], _LazyCell(date(2000, 3, 1))), - ([_LazyCell(i) for i in [None, "a", 1, time(0, 0, 0, 0)]], _LazyCell("a")), - ([_LazyCell(i) for i in [time(1, 1, 1, 1), 0, "c", date(2020, 1, 7)]], _LazyCell(time(1, 1, 1, 1))), + ([_LazyCell(i) for i in [None, pl.lit("a"), 1, time(0, 0, 0, 0)]], _LazyCell(pl.lit("a"))), + ([_LazyCell(i) for i in [time(1, 1, 1, 1), 0, pl.lit("c"), date(2020, 1, 7)]], _LazyCell(time(1, 1, 1, 1))), + ([], _LazyCell(None)), ], ids=[ "numeric_with_null", @@ -42,13 +44,9 @@ def test_should_return_none(self) -> None: "dates_no_null", "mixed_with_null", "mixed_no_null", + "empty_list", ], ) - def test_should_not_return_none(self, list_of_cells: list[Cell], expected: Cell) -> None: + def test_should_pass(self, list_of_cells: list[Cell], expected: Cell) -> None: res = Cell.first_not_none(list_of_cells) assert res.eq(expected) - - def test_given_empty_list(self) -> None: - to_eval: list[Cell] = [] - res = Cell.first_not_none(to_eval) - assert res.eq(_LazyCell(None)) From 3ac92782c001b877184784fde823f0db3037cabb Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Sun, 14 Jul 2024 11:55:20 +0000 Subject: [PATCH 11/15] style: apply automated linter fixes --- src/safeds/data/tabular/containers/_cell.py | 4 ++-- .../data/tabular/containers/_cell/test_first_not_none.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index 313147710..c4b3454b4 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -29,7 +29,7 @@ class Cell(ABC, Generic[T_co]): def first_not_none(cells: list[Cell]) -> Cell: """ Return the first cell from the given list that is not None. - + Parameters ---------- cells: The list of cells to be searched. @@ -38,7 +38,7 @@ def first_not_none(cells: list[Cell]) -> Cell: ------- Returns the contents of the first cell that is not None. If all cells in the list are None or the list is empty returns None. - + """ import polars as pl diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index 2c99858e6..6013d6806 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -18,7 +18,12 @@ def test_should_return_none(self) -> None: ([_LazyCell(None), _LazyCell(1), _LazyCell(None), _LazyCell(4)], _LazyCell(1)), ([_LazyCell(i) for i in range(5)], _LazyCell(1)), ( - [_LazyCell(None), _LazyCell(None), _LazyCell(pl.lit("Hello, World!")), _LazyCell(pl.lit("Not returned"))], + [ + _LazyCell(None), + _LazyCell(None), + _LazyCell(pl.lit("Hello, World!")), + _LazyCell(pl.lit("Not returned")), + ], _LazyCell("Hello, World!"), ), ([_LazyCell(pl.lit(i)) for i in ["a", "b", "c", "d"]], _LazyCell(pl.lit("a"))), From 9afa938e8568afe302177970092cab87d6c34744 Mon Sep 17 00:00:00 2001 From: srose <118634249+wastedareas@users.noreply.github.com> Date: Sun, 14 Jul 2024 16:07:11 +0200 Subject: [PATCH 12/15] fixes for "readthedocs" --- src/safeds/data/tabular/containers/_cell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index c4b3454b4..c70c420aa 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -32,10 +32,12 @@ def first_not_none(cells: list[Cell]) -> Cell: Parameters ---------- - cells: The list of cells to be searched. + cells: + The list of cells to be searched. Results ------- + cell: Returns the contents of the first cell that is not None. If all cells in the list are None or the list is empty returns None. From 947604917824e6da1587ee94c4875cbd4df6fbbb Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Sun, 14 Jul 2024 14:08:50 +0000 Subject: [PATCH 13/15] style: apply automated linter fixes --- src/safeds/data/tabular/containers/_cell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index c70c420aa..0a1a5c3c6 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -32,7 +32,7 @@ def first_not_none(cells: list[Cell]) -> Cell: Parameters ---------- - cells: + cells: The list of cells to be searched. Results From fc7e1d8153c5a57a36659e7b4d81a817de85dd11 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 18 Jul 2024 12:07:28 +0200 Subject: [PATCH 14/15] docs: fix invalid docstring section --- src/safeds/data/tabular/containers/_cell.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/safeds/data/tabular/containers/_cell.py b/src/safeds/data/tabular/containers/_cell.py index 0a1a5c3c6..a148a96a4 100644 --- a/src/safeds/data/tabular/containers/_cell.py +++ b/src/safeds/data/tabular/containers/_cell.py @@ -35,12 +35,11 @@ def first_not_none(cells: list[Cell]) -> Cell: cells: The list of cells to be searched. - Results + Returns ------- cell: Returns the contents of the first cell that is not None. If all cells in the list are None or the list is empty returns None. - """ import polars as pl From ebbdc541dec7bc53af9a4c53f253e07928a550ff Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 18 Jul 2024 12:09:55 +0200 Subject: [PATCH 15/15] refactor: rename test --- .../safeds/data/tabular/containers/_cell/test_first_not_none.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py index 6013d6806..de68cc994 100644 --- a/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py +++ b/tests/safeds/data/tabular/containers/_cell/test_first_not_none.py @@ -52,6 +52,6 @@ def test_should_return_none(self) -> None: "empty_list", ], ) - def test_should_pass(self, list_of_cells: list[Cell], expected: Cell) -> None: + def test_should_return_first_non_none_value(self, list_of_cells: list[Cell], expected: Cell) -> None: res = Cell.first_not_none(list_of_cells) assert res.eq(expected)