mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 23:10:29 +03:00
remove redundant open() arg: encoding='utf8'
By default, open() returns a str: https://docs.python.org/3/library/functions.html#open By default, str is UTF-8: https://docs.python.org/3/library/stdtypes.html#str This used to matter on Python 2.x, but this code is 3.x only now.
This commit is contained in:
parent
6e5d1a6cc3
commit
57556aceee
9 changed files with 27 additions and 27 deletions
|
|
@ -37,12 +37,12 @@ options = None
|
|||
|
||||
def disable_in_config(key, value):
|
||||
'''write a key/value to the local config.py, then comment it out'''
|
||||
with open('config.py', 'r', encoding='utf8') as f:
|
||||
with open('config.py', 'r') as f:
|
||||
data = f.read()
|
||||
pattern = r'\n[\s#]*' + key + r'\s*=\s*"[^"]*"'
|
||||
repl = '\n#' + key + ' = "' + value + '"'
|
||||
data = re.sub(pattern, repl, data)
|
||||
with open('config.py', 'w', encoding='utf8') as f:
|
||||
with open('config.py', 'w') as f:
|
||||
f.writelines(data)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue