File: utils.py

package info (click to toggle)
python-werkzeug 0.9.6%2Bdfsg-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 3,120 kB
  • ctags: 3,018
  • sloc: python: 17,930; makefile: 149; pascal: 60; xml: 16
file content (19 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# -*- coding: utf-8 -*-
"""
    cupoftee.utils
    ~~~~~~~~~~~~~~

    Various utilities.

    :copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
    :license: BSD, see LICENSE for more details.
"""
import re


_sort_re = re.compile(r'\w+(?u)')


def unicodecmp(a, b):
    x, y = map(_sort_re.search, [a, b])
    return cmp((x and x.group() or a).lower(), (y and y.group() or b).lower())