From 0d90cb075e4de6aa4a4d6e976ba9b474f375b1e5 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Sun, 12 Oct 2025 20:51:59 +0000 Subject: [PATCH 1/9] [Sync Iteration] python/tisbury-treasure-hunt/1 --- .../python/tisbury-treasure-hunt/1/tuples.py | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 solutions/python/tisbury-treasure-hunt/1/tuples.py diff --git a/solutions/python/tisbury-treasure-hunt/1/tuples.py b/solutions/python/tisbury-treasure-hunt/1/tuples.py new file mode 100644 index 0000000..46cbaa8 --- /dev/null +++ b/solutions/python/tisbury-treasure-hunt/1/tuples.py @@ -0,0 +1,69 @@ +"""Functions to help Azara and Rui locate pirate treasure.""" + + +def get_coordinate(record: tuple) -> str: + """ + Return coordinate value from a tuple containing the treasure name, + and treasure coordinate. + + :param record: tuple - with a (treasure, coordinate) pair. + :return: str - the extracted map coordinate. + """ + return record[-1] + + +def convert_coordinate(coordinate: str) -> tuple: + """ + Split the given coordinate into tuple containing its individual + components. + + :param coordinate: str - a string map coordinate + :return: tuple - the string coordinate split into its individual + components. + """ + return tuple(char for char in coordinate) + + +def compare_records(azara_record: tuple, rui_record: tuple) -> bool: + """ + Compare two record types and determine if their coordinates match. + + :param azara_record: tuple - a (treasure, coordinate) pair. + :param rui_record: tuple - a + (location, tuple(coordinate_1, coordinate_2), + quadrant) + trio. + :return: bool - do the coordinates match? + """ + return azara_record[-1] == "".join(rui_record[1]) + + +def create_record(azara_record: tuple, rui_record: tuple) -> (tuple, str): + """ + Combine the two record types (if possible) and create a combined record group. + + :param azara_record: tuple - a (treasure, coordinate) pair. + :param rui_record: tuple - a (location, coordinate, quadrant) trio. + :return: tuple or str - the combined record (if compatible), or the string + "not a match" (if incompatible). + """ + if compare_records(azara_record, rui_record): + return azara_record + rui_record + return "not a match" + + +def clean_up(combined_record_group: tuple) -> str: + """ + Clean up a combined record group into a multi-line string of single records. + + :param combined_record_group: tuple - everything from both participants. + :return: str - everything "cleaned", excess coordinates and information + are removed. + + The return statement should be a multi-lined string with items separated + by newlines. (see HINTS.md for an example). + """ + result: str = "" + for line in combined_record_group: + result += f"{tuple([l for i, l in enumerate(line) if i != 1])}\n" + return result From a91d16bea8c45600ba980d17598d6607edf5d1ee Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Sun, 12 Oct 2025 21:01:48 +0000 Subject: [PATCH 2/9] [Sync Iteration] python/tisbury-treasure-hunt/2 --- .../python/tisbury-treasure-hunt/2/tuples.py | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 solutions/python/tisbury-treasure-hunt/2/tuples.py diff --git a/solutions/python/tisbury-treasure-hunt/2/tuples.py b/solutions/python/tisbury-treasure-hunt/2/tuples.py new file mode 100644 index 0000000..0da64ce --- /dev/null +++ b/solutions/python/tisbury-treasure-hunt/2/tuples.py @@ -0,0 +1,71 @@ +"""Functions to help Azara and Rui locate pirate treasure.""" + + +def get_coordinate(record: tuple) -> str: + """ + Return coordinate value from a tuple containing the treasure name, + and treasure coordinate. + + :param record: tuple - with a (treasure, coordinate) pair. + :return: str - the extracted map coordinate. + """ + return record[-1] + + +def convert_coordinate(coordinate: str) -> tuple: + """ + Split the given coordinate into tuple containing its individual + components. + + :param coordinate: str - a string map coordinate + :return: tuple - the string coordinate split into its individual + components. + """ + return tuple(char for char in coordinate) + + +def compare_records(azara_record: tuple, rui_record: tuple) -> bool: + """ + Compare two record types and determine if their coordinates match. + + :param azara_record: tuple - a (treasure, coordinate) pair. + :param rui_record: tuple - a + (location, tuple(coordinate_1, coordinate_2), + quadrant) + trio. + :return: bool - do the coordinates match? + """ + return azara_record[-1] == "".join(rui_record[1]) + + +def create_record(azara_record: tuple, rui_record: tuple) -> (tuple, str): + """ + Combine the two record types (if possible) and create a combined record + group. + + :param azara_record: tuple - a (treasure, coordinate) pair. + :param rui_record: tuple - a (location, coordinate, quadrant) trio. + :return: tuple or str - the combined record (if compatible), or the string + "not a match" (if incompatible). + """ + if compare_records(azara_record, rui_record): + return azara_record + rui_record + return "not a match" + + +def clean_up(combined_record_group: tuple) -> str: + """ + Clean up a combined record group into a multi-line string of single + records. + + :param combined_record_group: tuple - everything from both participants. + :return: str - everything "cleaned", excess coordinates and information + are removed. + + The return statement should be a multi-lined string with items separated + by newlines. (see HINTS.md for an example). + """ + result: str = "" + for line in combined_record_group: + result += f"{tuple(item for i, item in enumerate(line) if i != 1)}\n" + return result From a9b32a1515cedd6a5f2032adfbd146a96c49101d Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 12 Oct 2025 14:03:56 -0700 Subject: [PATCH 3/9] Update tuples.py --- tisbury-treasure-hunt/tuples.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tisbury-treasure-hunt/tuples.py b/tisbury-treasure-hunt/tuples.py index 0da64ce..55b1aef 100644 --- a/tisbury-treasure-hunt/tuples.py +++ b/tisbury-treasure-hunt/tuples.py @@ -67,5 +67,7 @@ def clean_up(combined_record_group: tuple) -> str: """ result: str = "" for line in combined_record_group: - result += f"{tuple(item for i, item in enumerate(line) if i != 1)}\n" + result += f"{tuple( + item for index, item in enumerate(line) if index != 1 + )}\n" return result From 095ddc42d9954ad600460c45a859226968f3c8f5 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 12 Oct 2025 14:05:02 -0700 Subject: [PATCH 4/9] Update tuples.py --- tisbury-treasure-hunt/tuples.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tisbury-treasure-hunt/tuples.py b/tisbury-treasure-hunt/tuples.py index 55b1aef..46e1848 100644 --- a/tisbury-treasure-hunt/tuples.py +++ b/tisbury-treasure-hunt/tuples.py @@ -67,7 +67,5 @@ def clean_up(combined_record_group: tuple) -> str: """ result: str = "" for line in combined_record_group: - result += f"{tuple( - item for index, item in enumerate(line) if index != 1 - )}\n" + result += f"{tuple(item for index, item in enumerate(line) if index != 1)}\n" return result From a771b3d68255e6b42af656fd8026ca28a6b9295a Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 12 Oct 2025 14:07:54 -0700 Subject: [PATCH 5/9] Update tuples.py --- tisbury-treasure-hunt/tuples.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tisbury-treasure-hunt/tuples.py b/tisbury-treasure-hunt/tuples.py index 46e1848..afb7aec 100644 --- a/tisbury-treasure-hunt/tuples.py +++ b/tisbury-treasure-hunt/tuples.py @@ -67,5 +67,7 @@ def clean_up(combined_record_group: tuple) -> str: """ result: str = "" for line in combined_record_group: - result += f"{tuple(item for index, item in enumerate(line) if index != 1)}\n" + result += ("" + f"{tuple(item for index, item in enumerate(line) if index != 1)}" + "\n") return result From 693e983bf42811b5467afc5e9c6356c7cace0e62 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 12 Oct 2025 14:08:24 -0700 Subject: [PATCH 6/9] Update tuples.py --- tisbury-treasure-hunt/tuples.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tisbury-treasure-hunt/tuples.py b/tisbury-treasure-hunt/tuples.py index afb7aec..7ea971e 100644 --- a/tisbury-treasure-hunt/tuples.py +++ b/tisbury-treasure-hunt/tuples.py @@ -67,7 +67,6 @@ def clean_up(combined_record_group: tuple) -> str: """ result: str = "" for line in combined_record_group: - result += ("" - f"{tuple(item for index, item in enumerate(line) if index != 1)}" + result += (f"{tuple(item for index, item in enumerate(line) if index != 1)}" "\n") return result From ed9879d155a6e231fca6b1689764b682693d4923 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 12 Oct 2025 14:09:16 -0700 Subject: [PATCH 7/9] Update tuples.py --- tisbury-treasure-hunt/tuples.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tisbury-treasure-hunt/tuples.py b/tisbury-treasure-hunt/tuples.py index 7ea971e..57deff5 100644 --- a/tisbury-treasure-hunt/tuples.py +++ b/tisbury-treasure-hunt/tuples.py @@ -67,6 +67,7 @@ def clean_up(combined_record_group: tuple) -> str: """ result: str = "" for line in combined_record_group: - result += (f"{tuple(item for index, item in enumerate(line) if index != 1)}" - "\n") + result += ( + f"{tuple(item for index, item in enumerate(line) if index != 1)}\n" + ) return result From c0753ecba548037cdf3dac07888d1a82220f9d00 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 12 Oct 2025 14:11:10 -0700 Subject: [PATCH 8/9] Update lint_test_report.yml --- .github/workflows/lint_test_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_test_report.yml b/.github/workflows/lint_test_report.yml index f822b8f..90b396e 100644 --- a/.github/workflows/lint_test_report.yml +++ b/.github/workflows/lint_test_report.yml @@ -46,6 +46,6 @@ jobs: name: "Codecov Coverage Report" needs: - "pytest" - uses: "./.github/workflows/codecov.yml" + uses: "./.github/workflows/codecov.yml@main" secrets: CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" From cf05d9581865d55df2f0d7fd0bf4527e7d845b72 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Sun, 12 Oct 2025 14:12:27 -0700 Subject: [PATCH 9/9] Update lint_test_report.yml --- .github/workflows/lint_test_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_test_report.yml b/.github/workflows/lint_test_report.yml index 90b396e..f822b8f 100644 --- a/.github/workflows/lint_test_report.yml +++ b/.github/workflows/lint_test_report.yml @@ -46,6 +46,6 @@ jobs: name: "Codecov Coverage Report" needs: - "pytest" - uses: "./.github/workflows/codecov.yml@main" + uses: "./.github/workflows/codecov.yml" secrets: CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"