Introduced changes:
- pre-commit config and rules.
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.
Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker
(check-byte-order-marker);
- Checks that non-binary executables have a proper
shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings
(check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)
For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks
Change-Id: I8c993d6ffaf869f67713bbbde8632a0143ed0c72
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
Switch to openstackdocstheme 2.2.0 and reno 3.1.0 versions. Using
these versions will allow especially:
* Linking from HTML to PDF document
* Allow parallel building of documents
* Fix some rendering problems
Update Sphinx version as well.
openstackdocstheme renames some variables, so follow the renames
before the next release removes them. A couple of variables are also
not needed anymore, remove them.
Set openstackdocs_auto_name to use 'project' as name.
Depends-On: https://review.opendev.org/728938
Change-Id: If90af1920749efd1b314884a4b366d6d2c939521
Sphinx 1.8 introduced [1] the '--keep-going' argument which, as its name
suggests, keeps the build running when it encounters non-fatal errors.
This is exceptionally useful in avoiding a continuous edit-build loop
when undertaking large doc reworks where multiple errors may be
introduced.
[1] https://github.com/sphinx-doc/sphinx/commit/e3483e9b045
Change-Id: Iace9acb9bcbc29760de5b5c12b0a92353edde80e
Writing a code using the base64 module (of the Python standard
library) working on Python 2.7 and 3.4 requires many checks on the
input and/or output type:
* base64.b64encode() only accepts byte string: text must be
explicitly encoded to ASCII
* base64.b64decode() returns bytes: output must be decoded from UTF-8
when text is expected
This change adds two pairs of encode/decode functions:
* encode_as_bytes(), decode_as_bytes(): always return the result as
a byte string
* encode_as_text(), decode_as_text(): always return the result as a
text string
Encode functions accept text: text is encoded to UTF-8 by default,
but the encoding is configurable.
Decode functions accept text: text is decoded from ASCII.
decode_as_text() decodes the result from UTF-8 by default, but again
the encoding is configurable.
The new submodule is called "base64" to be able to replace:
import base64
with:
from oslo_serialization import base64
If the base64 module of the stdlib is needed, it can be imported as a
different name. Example:
import base64 as std_base64
The encoding example:
if isinstance(text, six.text_type):
text = text.encode('utf-8')
text_b64 = base64.b64encode(text)
text_b64 = text_b64.decode('ascii')
can be replaced with:
text_b64 = base64.encode_as_text(text)
The decoding example:
if isinstance(encoded, six.text_type):
encoded = encoded.decode('ascii')
text = base64.b64decode(encoded)
text = text.decode('utf-8')
can be replaced with:
text = base64.decode_as_text(text)
Change-Id: Icf8df9c947bc0c5f4838508b756ed8f53efd9fc4
This seems to better match what the other oslo
libraries are calling this section, so we might as
well call it that to.
Change-Id: Id4c5809dbe9c536c14abf8a5b360bdcf4e4713a0
Also makes the docs look more like the other
oslo libraries so that the content is easily readable
across projects.
Change-Id: I2a3497bcbf72bc4a0e6fb12f7c2d508bb3a4e6bc
Move the public API out of oslo.serialization to
oslo_serialization. Retain the ability to import from the old namespace
package for backwards compatibility for this release cycle.
bp/drop-namespace-packages
Change-Id: Ic60f809ea00ac77b0753556c6fd00b97e64d57ff