-
-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make all the docstrings PEP 257 compliant #2028
Changes from all commits
469750e
ba13137
f076a71
e30d3ee
0295e06
208880d
c8ade18
980af9b
8373831
fe8867d
368a913
e04421e
dc9271d
73619fa
b681368
4418bb9
c3421b4
3d83e72
f04daa0
9eb06d7
2c0688d
6962e42
8182840
ea6e6c9
83f2735
d8ece8b
8e184c9
342b01a
25a1bef
ae3e9df
dde7887
4dabb1b
b616cc1
af4f8a5
b588aa5
c262c0e
18d8f71
9a9c743
7ec3fd7
c0d3e28
b68ca43
1285fa4
5a12861
bab8974
d0c0d6d
cca0410
c0cff17
4244c61
4dfd6f9
7deb828
3a20d16
e1bf5b8
9305612
6f9436d
2da3f53
0242ec4
c4f3906
8a7d37d
d90ca1d
43b172c
4a82cbb
19528b1
2b1280a
5ea0c97
248331e
71951cb
98175fb
b0b70a9
a234f69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,17 +22,19 @@ | |
|
||
|
||
def ntob(n, encoding='ISO-8859-1'): | ||
"""Return the given native string as a byte string in the given | ||
encoding. | ||
"""Convert a native :class:`str` to a :class:`bytes` instance. | ||
|
||
The encoding can be changed to non-ASCII optionally. | ||
""" | ||
assert_native(n) | ||
# In Python 3, the native string type is unicode | ||
return n.encode(encoding) | ||
|
||
|
||
def ntou(n, encoding='ISO-8859-1'): | ||
"""Return the given native string as a unicode string with the given | ||
encoding. | ||
"""Convert a native :class:`str` to a :class:`str` instance. | ||
|
||
This doesn't actually do anything. | ||
Comment on lines
+35
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we want to lose the context around the intended purpose of this function. If someone came to this docstring before the change, they could pretty easily infer what the purpose of this function was on Python 2. Following the change, it looks like this function never intended to do anything, so that context is lost. |
||
""" | ||
assert_native(n) | ||
# In Python 3, the native string type is unicode | ||
|
@@ -48,6 +50,7 @@ def tonative(n, encoding='ISO-8859-1'): | |
|
||
|
||
def assert_native(n): | ||
"""Ensure that input is a native :class:`str`.""" | ||
if not isinstance(n, str): | ||
raise TypeError('n must be a native str (got %s)' % type(n).__name__) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment implies that the default encoding is ASCII, but it is not. It's
latin-1
akaISO-8859-1
.