summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-04-06 21:08:40 +0000
committerGerrit Code Review <review@openstack.org>2021-04-06 21:08:40 +0000
commitf449c5937895354e56875967812b76850e2e8b86 (patch)
tree71bb81e1b5454b1f5f39bec4ab9ddbffd65661de
parent03e58a48864933f250ca914901c924984b91936e (diff)
parentf00e14f400193e35c8040bc93ac6c509fa2bb4dc (diff)
downloadpython-openstackclient-f449c5937895354e56875967812b76850e2e8b86.tar.gz
Merge "hacking: Remove references to encoding"
-rw-r--r--HACKING.rst48
1 files changed, 1 insertions, 47 deletions
diff --git a/HACKING.rst b/HACKING.rst
index b5fbad3c..432d19f4 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -32,7 +32,7 @@ use the alternate 4 space indent. With the first argument on the succeeding
line all arguments will then be vertically aligned. Use the same convention
used with other data structure literals and terminate the method call with
the last argument line ending with a comma and the closing paren on its own
-line indented to the starting line level.
+line indented to the starting line level. ::
unnecessarily_long_function_name(
'string one',
@@ -40,49 +40,3 @@ line indented to the starting line level.
kwarg1=constants.ACTIVE,
kwarg2=['a', 'b', 'c'],
)
-
-Text encoding
--------------
-
-Note: this section clearly has not been implemented in this project yet, it is
-the intention to do so.
-
-All text within python code should be of type 'unicode'.
-
- WRONG:
-
- >>> s = 'foo'
- >>> s
- 'foo'
- >>> type(s)
- <type 'str'>
-
- RIGHT:
-
- >>> u = u'foo'
- >>> u
- u'foo'
- >>> type(u)
- <type 'unicode'>
-
-Transitions between internal unicode and external strings should always
-be immediately and explicitly encoded or decoded.
-
-All external text that is not explicitly encoded (database storage,
-commandline arguments, etc.) should be presumed to be encoded as utf-8.
-
- WRONG:
-
- infile = open('testfile', 'r')
- mystring = infile.readline()
- myreturnstring = do_some_magic_with(mystring)
- outfile.write(myreturnstring)
-
- RIGHT:
-
- infile = open('testfile', 'r')
- mystring = infile.readline()
- mytext = mystring.decode('utf-8')
- returntext = do_some_magic_with(mytext)
- returnstring = returntext.encode('utf-8')
- outfile.write(returnstring)