1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ini_file: replace lambda with named function

Fixes #6876
This commit is contained in:
Andreas Fleig 2014-04-07 20:01:11 +02:00 committed by James Cammarata
parent 0da5996bb5
commit 30ad859fe0

View file

@ -95,6 +95,7 @@ def do_ini(module, filename, section=None, option=None, value=None, state='prese
changed = False
cp = ConfigParser.ConfigParser()
cp.optionxform = identity
try:
f = open(filename)
@ -150,6 +151,19 @@ def do_ini(module, filename, section=None, option=None, value=None, state='prese
return changed
# ==============================================================
# identity
def identity(arg):
"""
This function simply returns its argument. It serves as a
replacement for ConfigParser.optionxform, which by default
changes arguments to lower case. The identity function is a
better choice than str() or unicode(), because it is
encoding-agnostic.
"""
return arg
# ==============================================================
# main