Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qmk.path.FileType: fix argument handling #16693

Merged
merged 3 commits into from
Mar 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better solution
  • Loading branch information
fauxpark committed Mar 19, 2022
commit 7d12a43469ba577fc863ab60c0fb41fc93116f62
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, mode='r', encoding='UTF-8'):
def __init__(self, *args, **kwargs):
# Use UTF8 by default for stdin
return super().__init__(mode=mode, encoding=encoding)
if not 'encoding' in kwargs:
kwargs['encoding'] = 'UTF-8'
return super().__init__(*args, **kwargs)

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