1 year ago

#379571

test-img

Demigas

Is there a way to handle case insensitivity for commands using difflib?

For my capstone project, our professor asked us to find an existing project and our job is to fix known issues on it. Our first issue is finding out why difflibs get_close_matches doesn't handle shell commands like pingg well in this program called thefuck on github: https://github.com/nvbn/thefuck/issues/1209

and currently I was working with an addition of it that ignores case seen here: https://github.com/python/cpython/pull/18983/commits/9953c6e9fa70228be12b361e38607196603177ac

But for the life of me I can't get this thing to work. I don't know if there's a better way to go about it or not but I'm at my wits end.

def get_close_matches(word, possibilities, n=None,cutoff=0.6, ignorecase=True):
    """Overrides `difflib.get_close_match` to control argument `n`."""
    if n is None:
        n = settings.num_close_matches
    return difflib_get_close_matches(word, possibilities, n, cutoff,ignorecase)

Tells me that there's an invalid argument

enter image description here

python

github

case-sensitive

difflib

invalid-argument

0 Answers

Your Answer

Accepted video resources