| Conditions | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/local/bin/python |
||
| 13 | def extract_unicode_characters(string: str) -> Generator: |
||
| 14 | """Escape all unicode characters and return a generator for the int values of the unicode characters |
||
| 15 | |||
| 16 | :type string: str |
||
| 17 | :return: |
||
| 18 | """ |
||
| 19 | unicode_characters = re.findall(b'\\\\u([a-f0-9]{4})', string.encode('unicode_escape')) |
||
| 20 | for x in unicode_characters: |
||
| 21 | s = binascii.unhexlify(x) |
||
| 22 | yield int.from_bytes(s, byteorder='big') |
||
| 23 | |||
| 43 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.