1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/lib/ansible
Toshio Kuratomi 197a360977 Fix undefined vars on python3 and a whole bunch of other cleanup. (#27202)
* Fix undefined vars on python3 and a whole bunch of other cleanup.

References #27193

* No need to catch exception and reraise.  This just obfuscates the traceback
* Build up a list and then join at the end instead of building up a string. list.append() is faster than string concatenation
* No need to extract k, v pairs from one dict to make a second dict and then extract k, v pairs from the second dict.  Iterate over the k, v pairs extracted from the first dict directly instead of building the second dict.
* No need to check if the dict is empty before iterating on it.  Iterating on an empty dict will automatically go to the end of the loop
* Use isinstance instead of type(obj) is class, handles inheritance and is better style
* use to_native instead of v.encode().  We can use the surrogate_or_strict error handler to deal with more potential tracebacks.  Does the right conversion on both Py2 and Py3.
* Convert bool to string before combining it with the string we're building.
* Don't reference unicode directly as unicode does not exist in Python3
* The string resulting from this function will not have a trailing comma
* Simplify the conversion to string int and bool values are now used in string formatting which will use str to transform them without an explicit invocation.
2017-07-25 10:51:53 -07:00
..
cli Switch from map and filter to list comprehensions and generator expressions (#27198) 2017-07-22 19:12:35 -07:00
compat ansible/compat/: PEP8 compliancy (#24689) 2017-05-18 08:36:11 +01:00
config make yaml extensions configurable 2017-07-20 20:29:09 -04:00
errors correct, cleanup & simplify dwim stack (#25956) 2017-07-03 15:27:53 -04:00
executor include_role handlers bug fix (#26335) 2017-07-19 15:02:32 -05:00
galaxy Transition inventory into plugins (#23001) 2017-05-23 17:16:49 -04:00
inventory ensure all groups inherit from 'all' 2017-07-13 18:38:39 -04:00
module_utils Fix undefined vars on python3 and a whole bunch of other cleanup. (#27202) 2017-07-25 10:51:53 -07:00
modules cloud: cs_user: add feature keys handling (#27285) 2017-07-25 18:07:58 +02:00
parsing corrected precedence, added comments to each entry 2017-07-20 11:07:06 -04:00
playbook leftover from porting become to v2 that's unused 2017-07-24 10:12:17 -07:00
plugins endswith supports tuples, nicer 2017-07-24 16:49:01 -04:00
template Try to show original exception info for yaml (and other) errors (#24468) 2017-06-09 13:13:15 -04:00
utils Removing _cnos from all new devices added (#27101) 2017-07-20 12:34:08 -07:00
vars removed redundant loader 2017-07-17 09:03:39 -04:00
__init__.py
constants.py make yaml extensions configurable 2017-07-20 20:29:09 -04:00
release.py Collated PEP8 fixes (#25293) 2017-06-02 12:14:11 +01:00