Skip to content

Commit

Permalink
It is faster to open files purely for creation, in append mode.
Browse files Browse the repository at this point in the history
Also don't bother with a context manager, that too is slow.
  • Loading branch information
eli-schwartz committed Jun 20, 2018
1 parent e86214c commit ba25d47
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/aurman/parsing_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def read_config() -> 'configparser.ConfigParser':

# create empty config if config does not exist
if not os.path.isfile(config_file):
with open(config_file, 'w') as configfile:
configfile.write("")
open(config_file, 'a').close()

config = configparser.ConfigParser(allow_no_value=True)
# make the config case sensitive
Expand Down

0 comments on commit ba25d47

Please sign in to comment.