Mercurial > public > mercurial-scm > hg
comparison mercurial/pure/charencode.py @ 33761:f5fc54e7e467
encoding: drop circular import by proxying through '<policy>.charencode'
I decided not to split charencode.c to new C extension module because it
would duplicate binary codes unnecessarily.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 31 Jul 2017 23:13:47 +0900 |
parents | |
children | b9101467d88b |
comparison
equal
deleted
inserted
replaced
33760:cd2aca0808f8 | 33761:f5fc54e7e467 |
---|---|
1 # charencode.py - miscellaneous character encoding | |
2 # | |
3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others | |
4 # | |
5 # This software may be used and distributed according to the terms of the | |
6 # GNU General Public License version 2 or any later version. | |
7 | |
8 from __future__ import absolute_import | |
9 | |
10 def asciilower(s): | |
11 '''convert a string to lowercase if ASCII | |
12 | |
13 Raises UnicodeDecodeError if non-ASCII characters are found.''' | |
14 s.decode('ascii') | |
15 return s.lower() | |
16 | |
17 def asciiupper(s): | |
18 '''convert a string to uppercase if ASCII | |
19 | |
20 Raises UnicodeDecodeError if non-ASCII characters are found.''' | |
21 s.decode('ascii') | |
22 return s.upper() |