Reputation: 1760
This question is the same as Pylint false positive when unpacking sys.argv but it had no answer.
I have the following function:
def join(*paths_to_join: str) -> str:
"""Join and returns a normalized path
Args:
*paths_to_join (str): All paths to be joined, as an arbitrary number of strings
Returns:
The normalized joined path
"""
return os.path.normpath((os.path.join(*paths_to_join))
This triggers the following pylint
warning:
E1120: No value for argument 'a' in function call (no-value-for-parameter)
Is it a real warning or a false positive ? Can I do something else than disable it?
Upvotes: 0
Views: 355
Reputation: 782785
This is a valid warning. os.path.join()
requires at least one argument, but your function doesn't. So paths_to_join
could be empty.
Change your function to be similar to os.path.join()
def join(first: str, rest: List[str]): -> str:
return os.path.normpath(os.path.join(first, *rest))
Upvotes: 1