MCPcopy Index your code
hub / github.com/secdev/scapy / _parsekwargs

Method _parsekwargs

scapy/utils.py:3641–3658  ·  view source on GitHub ↗

Internal function to parse CLI arguments of a function.

(
        func: DecoratorCallable,
        args: List[str]
    )

Source from the content-addressed store, hash-verified

3639
3640 @staticmethod
3641 def _parsekwargs(
3642 func: DecoratorCallable,
3643 args: List[str]
3644 ) -> Tuple[List[str], Dict[str, Literal[True]]]:
3645 """
3646 Internal function to parse CLI arguments of a function.
3647 """
3648 kwargs: Dict[str, Literal[True]] = {}
3649 if func._flags: # type: ignore
3650 i = 0
3651 for arg in args:
3652 if arg in func._flags: # type: ignore
3653 i += 1
3654 kwargs[func._flagnames[func._flags.index(arg)]] = True # type: ignore # noqa: E501
3655 continue
3656 break
3657 args = args[i:]
3658 return args, kwargs
3659
3660 @classmethod
3661 def _parseallargs(

Callers 1

_parseallargsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected