Skip to content

Commit 019d958

Browse files
committed
Move comments to docstrings in utils.py.
1 parent 0a48b2f commit 019d958

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

html5lib/utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,23 @@ def __getitem__(self, key):
3434
return dict.get(self, key, self.default)
3535

3636

37-
# Some utility functions to dal with weirdness around UCS2 vs UCS4
38-
# python builds
39-
4037
def isSurrogatePair(data):
38+
"""Check whether a string is a surrogate pair or not"""
4139
return (len(data) == 2 and
4240
ord(data[0]) >= 0xD800 and ord(data[0]) <= 0xDBFF and
4341
ord(data[1]) >= 0xDC00 and ord(data[1]) <= 0xDFFF)
4442

4543

4644
def surrogatePairToCodepoint(data):
45+
"""Convert a surrogate pair to a codepoint"""
4746
char_val = (0x10000 + (ord(data[0]) - 0xD800) * 0x400 +
4847
(ord(data[1]) - 0xDC00))
4948
return char_val
5049

51-
# Module Factory Factory (no, this isn't Java, I know)
52-
# Here to stop this being duplicated all over the place.
53-
5450

5551
def moduleFactoryFactory(factory):
52+
"""Module Factory Factory (no, this isn't Java, I know)
53+
Here to stop this being duplicated all over the place."""
5654
moduleCache = {}
5755

5856
def moduleFactory(baseModule, *args, **kwargs):

0 commit comments

Comments
 (0)