File: utils.py

package info (click to toggle)
python-werkzeug 3.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,912 kB
  • sloc: python: 21,938; javascript: 292; makefile: 39; sh: 17; xml: 16
file content (11 lines) | stat: -rw-r--r-- 215 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
import re


_sort_re = re.compile(r"\w+")


def unicodecmp(a, b):
    x, y = map(_sort_re.search, [a, b])
    x = (x.group() if x else a).lower()
    y = (y.group() if y else b).lower()
    return (x > y) - (x < y)