Skip to content

Commit

Permalink
qmk.path.FileType: fix argument handling (qmk#16693)
Browse files Browse the repository at this point in the history
* qmk.path.FileType: pass in mode as first argument

* Better solution

* Grammar...
  • Loading branch information
fauxpark authored Mar 19, 2022
1 parent 047ef3c commit 2f095b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/python/qmk/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ def normpath(path):


class FileType(argparse.FileType):
def __init__(self, encoding='UTF-8'):
def __init__(self, *args, **kwargs):
# Use UTF8 by default for stdin
return super().__init__(encoding=encoding)
if 'encoding' not in kwargs:
kwargs['encoding'] = 'UTF-8'
return super().__init__(*args, **kwargs)

def __call__(self, string):
"""normalize and check exists
Expand Down

0 comments on commit 2f095b8

Please sign in to comment.