Skip to content

Commit

Permalink
Merge pull request #184 from Thunno/fix-transpose
Browse files Browse the repository at this point in the history
Fix transpose
  • Loading branch information
nayakrujul authored Aug 17, 2023
2 parents 9252e3b + 8455a40 commit db6e393
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/thunno2/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1979,8 +1979,14 @@ def list_wrap(s):
return [[*s]]


def str_transpose(l):
return list(map("".join, zip(*l)))


def transpose(lst):
l = []
if all(isinstance(j, str) for j in lst):
return str_transpose(lst)
for i in lst:
if isinstance(i, (list, str)):
l.append(list(i))
Expand Down
2 changes: 1 addition & 1 deletion src/thunno2/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ def assert_eq(a, *b):

assert_eq(
call("Ṭ", ["abc", "defg", "hijkl"]),
[["a", "d", "h"], ["b", "e", "i"], ["c", "f", "j"]],
["adh", "bei", "cfj"],
)
assert_eq(call("Ṭ", ["abc", "", "defg", "hijkl"]), [])

Expand Down
2 changes: 1 addition & 1 deletion src/thunno2/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
That's it!
"""

THUNNO_VERSION = "2.2.25"
THUNNO_VERSION = "2.2.26"

0 comments on commit db6e393

Please sign in to comment.