Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare authored Nov 1, 2024
1 parent bd29ee5 commit 838d398
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions aw_notify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,22 +331,13 @@ def checkin(testing=False):
send_checkin()


def decode_unicode_escapes(s: str):
def decode_unicode_escapes(s: str) -> str:
"""
Decodes any Unicode escape sequences present in the input string
and returns the decoded result.
Args:
s (str): The input string which may contain Unicode escape sequences.
Returns:
str: The decoded string where Unicode escape sequences have been converted
to their corresponding characters.
Example:
Input: "\\u5de5\\u4f5c"
Output: "工作"
"""
# see https://github.com/ActivityWatch/aw-notify/pull/6#issue-2607074123
# assert "工作" == decode_unicode_escapes("\\u5de5\\u4f5c")
return s.encode('utf-8').decode('unicode_escape')


Expand Down

0 comments on commit 838d398

Please sign in to comment.