Path 1: 189 calls (0.42)

Call (189)

0 (144) 1 (43) 3 (1) 2 (1)

'mode' (55) None (46) 'iterable' (45) 'sep' (31) 'maxsize' (7) 'encoding' (5)

Const (101) Name (48) Call (21) List (6) Attribute (5) Dict (4) Tuple (2) Lambda (1) Subscript (1)

1def get_argument_from_call(
2    call_node: nodes.Call, position: int | None = None, keyword: str | None = None
3) -> nodes.Name:
4    """Returns the specified argument from a function call.
5
6    :param nodes.Call call_node: Node representing a function call to check.
7    :param int position: position of the argument.
8    :param str keyword: the keyword of the argument.
9
10    :returns: The node representing the argument, None if the argument is not found.
11    :rtype: nodes.Name
12    :raises ValueError: if both position and keyword are None.
13    :raises NoSuchArgumentError: if no argument at the provided position or with
14    the provided keyword.
15    """
16    if position is None and keyword is None:
17        raise ValueError("Must specify at least one of: position or keyword.")
18    if position is not None:
19        try:
20            return call_node.args[position]
21        except IndexError:
22            pass
23    if keyword and call_node.keywords:
24        for arg in call_node.keywords:
25            if arg.arg == keyword:
26                return arg.value
27
28    raise NoSuchArgumentError
            

Path 2: 121 calls (0.27)

Call (121)

3 (68) 0 (23) 1 (23) 2 (7)

'encoding' (82) 'sep' (11) 'maxsplit' (10) 'mode' (9) 'maxsize' (6) 'iterable' (2) 'this_one' (1)

Const (103) Name (13) Call (3) Attribute (2)

IndexError (121)

1def get_argument_from_call(
2    call_node: nodes.Call, position: int | None = None, keyword: str | None = None
3) -> nodes.Name:
4    """Returns the specified argument from a function call.
5
6    :param nodes.Call call_node: Node representing a function call to check.
7    :param int position: position of the argument.
8    :param str keyword: the keyword of the argument.
9
10    :returns: The node representing the argument, None if the argument is not found.
11    :rtype: nodes.Name
12    :raises ValueError: if both position and keyword are None.
13    :raises NoSuchArgumentError: if no argument at the provided position or with
14    the provided keyword.
15    """
16    if position is None and keyword is None:
17        raise ValueError("Must specify at least one of: position or keyword.")
18    if position is not None:
19        try:
20            return call_node.args[position]
21        except IndexError:
22            pass
23    if keyword and call_node.keywords:
24        for arg in call_node.keywords:
25            if arg.arg == keyword:
26                return arg.value
27
28    raise NoSuchArgumentError
            

Path 3: 76 calls (0.17)

Call (76)

1 (46) 3 (15) 0 (11) 2 (4)

'maxsplit' (31) 'encoding' (23) 'mode' (12) None (5) 'sep' (2) 'iterable' (2) 'maxsize' (1)

NoSuchArgumentError (76)

1def get_argument_from_call(
2    call_node: nodes.Call, position: int | None = None, keyword: str | None = None
3) -> nodes.Name:
4    """Returns the specified argument from a function call.
5
6    :param nodes.Call call_node: Node representing a function call to check.
7    :param int position: position of the argument.
8    :param str keyword: the keyword of the argument.
9
10    :returns: The node representing the argument, None if the argument is not found.
11    :rtype: nodes.Name
12    :raises ValueError: if both position and keyword are None.
13    :raises NoSuchArgumentError: if no argument at the provided position or with
14    the provided keyword.
15    """
16    if position is None and keyword is None:
17        raise ValueError("Must specify at least one of: position or keyword.")
18    if position is not None:
19        try:
20            return call_node.args[position]
21        except IndexError:
22            pass
23    if keyword and call_node.keywords:
24        for arg in call_node.keywords:
25            if arg.arg == keyword:
26                return arg.value
27
28    raise NoSuchArgumentError
            

Path 4: 64 calls (0.14)

Call (64)

1 (52) 0 (10) 3 (2)

'mode' (59) 'maxsize' (2) 'encoding' (2) 'maxsplit' (1)

NoSuchArgumentError (64)

1def get_argument_from_call(
2    call_node: nodes.Call, position: int | None = None, keyword: str | None = None
3) -> nodes.Name:
4    """Returns the specified argument from a function call.
5
6    :param nodes.Call call_node: Node representing a function call to check.
7    :param int position: position of the argument.
8    :param str keyword: the keyword of the argument.
9
10    :returns: The node representing the argument, None if the argument is not found.
11    :rtype: nodes.Name
12    :raises ValueError: if both position and keyword are None.
13    :raises NoSuchArgumentError: if no argument at the provided position or with
14    the provided keyword.
15    """
16    if position is None and keyword is None:
17        raise ValueError("Must specify at least one of: position or keyword.")
18    if position is not None:
19        try:
20            return call_node.args[position]
21        except IndexError:
22            pass
23    if keyword and call_node.keywords:
24        for arg in call_node.keywords:
25            if arg.arg == keyword:
26                return arg.value
27
28    raise NoSuchArgumentError
            

Path 5: 1 calls (0.0)

Call (1)

None (1)

'bar' (1)

NoSuchArgumentError (1)

1def get_argument_from_call(
2    call_node: nodes.Call, position: int | None = None, keyword: str | None = None
3) -> nodes.Name:
4    """Returns the specified argument from a function call.
5
6    :param nodes.Call call_node: Node representing a function call to check.
7    :param int position: position of the argument.
8    :param str keyword: the keyword of the argument.
9
10    :returns: The node representing the argument, None if the argument is not found.
11    :rtype: nodes.Name
12    :raises ValueError: if both position and keyword are None.
13    :raises NoSuchArgumentError: if no argument at the provided position or with
14    the provided keyword.
15    """
16    if position is None and keyword is None:
17        raise ValueError("Must specify at least one of: position or keyword.")
18    if position is not None:
19        try:
20            return call_node.args[position]
21        except IndexError:
22            pass
23    if keyword and call_node.keywords:
24        for arg in call_node.keywords:
25            if arg.arg == keyword:
26                return arg.value
27
28    raise NoSuchArgumentError
            

Path 6: 1 calls (0.0)

Call (1)

None (1)

'bar' (1)

Const (1)

1def get_argument_from_call(
2    call_node: nodes.Call, position: int | None = None, keyword: str | None = None
3) -> nodes.Name:
4    """Returns the specified argument from a function call.
5
6    :param nodes.Call call_node: Node representing a function call to check.
7    :param int position: position of the argument.
8    :param str keyword: the keyword of the argument.
9
10    :returns: The node representing the argument, None if the argument is not found.
11    :rtype: nodes.Name
12    :raises ValueError: if both position and keyword are None.
13    :raises NoSuchArgumentError: if no argument at the provided position or with
14    the provided keyword.
15    """
16    if position is None and keyword is None:
17        raise ValueError("Must specify at least one of: position or keyword.")
18    if position is not None:
19        try:
20            return call_node.args[position]
21        except IndexError:
22            pass
23    if keyword and call_node.keywords:
24        for arg in call_node.keywords:
25            if arg.arg == keyword:
26                return arg.value
27
28    raise NoSuchArgumentError
            

Path 7: 1 calls (0.0)

Call (1)

None (1)

None (1)

ValueError (1)

1def get_argument_from_call(
2    call_node: nodes.Call, position: int | None = None, keyword: str | None = None
3) -> nodes.Name:
4    """Returns the specified argument from a function call.
5
6    :param nodes.Call call_node: Node representing a function call to check.
7    :param int position: position of the argument.
8    :param str keyword: the keyword of the argument.
9
10    :returns: The node representing the argument, None if the argument is not found.
11    :rtype: nodes.Name
12    :raises ValueError: if both position and keyword are None.
13    :raises NoSuchArgumentError: if no argument at the provided position or with
14    the provided keyword.
15    """
16    if position is None and keyword is None:
17        raise ValueError("Must specify at least one of: position or keyword.")
18    if position is not None:
19        try:
20            return call_node.args[position]
21        except IndexError:
22            pass
23    if keyword and call_node.keywords:
24        for arg in call_node.keywords:
25            if arg.arg == keyword:
26                return arg.value
27
28    raise NoSuchArgumentError