Commit Graph

5 Commits

Author SHA1 Message Date
wangzihao e954184693 Remove six usage and basestring check
Remove basestring check.
Remove six Replace the following items with Python 3 style code.

- six.string_types
- six.int2byte
- six.indexbytes
- six.add_metaclass
- six.StringIO
- six.text_type
- six.integer_types
- six.binary_type
- six.BytesIO
- six.reraise

Change-Id: I4fb9033d152963c504ceb4d5c4d08f934ee4accb
2020-10-16 10:40:22 +08:00
Zhao Chao 2fd8c66f64 Remove log translations
According to discussions on the ML, log messages should not be
translated any more. This patch also:
* removes all usage of _LI, _LW, _LE, _LC;
* updates log translation hacking rule.

ML discussions:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

The original commit messages are kept as following to make a historic
note:

remove unwanted log translations

recent discussions on the ML have led to the decision to eliminate all
translations for messages that are destined for log files but retain
them for messages that are going to be returned as exceptions and
potentially shown to end users via an API. see [1], [2].

This change does that as follows.

1. If a string is being used to generate an exception, it will still
be translated. Still Trove used both _LE and _ for these translations,
there are some cases where _LE has been simply changed to _, and not
removed.

2. If a string is used for a logging message, remove the use of _,
_LE, _LW, _LI.

Also, I have long felt that we have had a creep of checks in the pep8
tests that apparently make the code easier to read. I strongly believe
that these kinds of "easier to read" things make sense if they are
followed across all projects and not just gratuitously added one
project at a time.

I've taken this opportunity to reduce the merge mess caused by this
change, to sync up our ignore flags with a long list of ignores from
Nova. When they made the change for removing log translation, they
could do it in an automated-way like I have because they didn't have
to deal with under and overindented lines for visual edit (E127). Same
for Cinder.

Changes 448443 [3] and 447839 [4] were inadequate because they only
addressed a little part of the problem, namely removing the use of
_LE, _LI, and _LW, and I think this is a change we don't need to
dribble in a few files at a time. The changes are straightforward and
should be taken in a single lump to make it easy to deal with the
merges coming.

[1] http://lists.openstack.org/pipermail/openstack-operators/2017-March/012887.html
[2] http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html
[3] https://review.openstack.org/448443
[4] https://review.openstack.org/447839

Co-Authored-By: Amrith Kumar <amrith@amrith.org>
Co-Authored-By: Valencia Serrao <vserrao@us.ibm.com>
Change-Id: I5f86c982469e625997fc8bd15c6fae0fc77a8c64
2018-01-24 17:21:26 +00:00
Nguyen Van Trung abb3460b9e Add doc8 to pep8 check for trove project
This patch adds a doc8 check of .rst files to the current pep8 check.
It includes fixes to the .rst files that didn't pass the check.

Change-Id: I866ee72cfdd6067ae219a751aa7c2a0c391886f7
2017-11-30 08:28:55 +07:00
jiansong 285adb6c1b For Python 3 Common patterns-six string
Replace basestring with six.string_types and add a hacking rule
to check it. This modification refers to neutron and merge
translation_checks into checks .Follow-up will modify the other
on the python3 common

Change-Id: I66d58ecaf664705660bbeb85058ad3cd092ef82f
reference:https://github.com/openstack/neutron/tree/master/neutron/hacking
2017-11-12 22:37:02 -08:00
Trevor McCasland be5548cc3a Add translation_checks for i18n
This is the first patch to enable the translation checks.
These translation checks were taken from neutron_lib/hacking

Translation checks include:
 * validate_log_translation: Translate log messages
 * no_translate_debug_logs: Don't transate debug level logs
 * check_raised_localization_exception: Translate exception message

The pep8 tests will fail until all files meet the standards enforced
by these translaiton checks. So this patch is depenedent on the
following:

Depends-On: Ieb7e006de497c974756941608aea91f63e860dc5
Depends-On: I1d0649f240365b7f62b13af6edb1e8dbb5d06597
Depends-On: I48f95b3c090e9b6f91185c14113daae5bc621d0b
Depends-On: I5feafe8945960e34a8d0e038ad4617f39502f19b
Depends-On: If29f7b5df7f6958cec4b26f72babc47ca70f3706
Depends-On: Iddd738c2d9a7c9a57fcd445650d087123dbccfc4
Depends-On: Ifdf426684473fb05cae63877c334e6cf65aa5234
Depends-On: I94a341ba1fb4178e0c358c37ea31623d48938ec6
Depends-On: Ic8664bf105d601909c6efa5cf73db6c27adaf42e
Depends-On: I80f2ea6a20944cfbfdc79a8a71ad744f23aeaac1
Depends-On: If68b38ef5bdeba2fdc28f94d964ef8ce6d15c352
Depends-On: Ia54014fa8e44aacc7935bd73c1ee8d3139a19735
Depends-On: Iea58f4df337c79785dc7afe0e31bcfa7e231f374
Depends-On: I2b0313021fd9599bdaeb375358e8cf834581d493
Depends-On: I56972d16634654b8b71853d6aba10299cc9e2418
Depends-On: If632727fd29ec8d36c6890ebd156a46be70ba783
Depends-On: I1df8d4cba6a3a2ec23e8a1b2aa4ffc03c97b149e
Depends-On: I4070117b6335f4d85f35cc6473653c17d7c14bac
Depends-On: I83f2ccd623588af3fc5f94334b753cebcc3b6c18
Depends-On: I44ac13e9431018e18980e8ff7ff442c7fea68a13
Depends-On: I88284f61b5f37d78ad050a97c679f6bde23d832d
Depends-On: I6fb2bdcc4b83457e08b24599fb4a297ef6ec6c14

Change-Id: Ia2844799a2af8e020470d4c513ad55a51ec36ce1
2017-01-29 03:04:10 +00:00