LINUX.ORG.RU

История изменений

Исправление steemandlinux, (текущая версия) :

Ну вот вроде ОК:

    def replace_arg(self, inplace, arg, args: Union[Dict, List, str]):
        """Replace template in arguments."""
        if isinstance(args, list):
            for index, value in enumerate(args):
                if self.replace_arg(
                    inplace=inplace, arg=arg, args=value) is not None:
                    args[index] = arg

        elif isinstance(args, dict):
            for key, value in args.items():
                if self.replace_arg(
                    inplace=inplace, arg=arg, args=value) is not None:
                    args[key] = arg

        if args == inplace:
            return arg

Исправление steemandlinux, :

Ну вот вроде ОК:

    def replace_arg(self, inplace, arg, args: Union[Dict, List, str]):
        """Replace template in arguments."""
        if isinstance(args, list):
            for index, value in enumerate(args):
                if self.replace_arg(
                    inplace=inplace, arg=arg, args=value) == arg:
                    args[index] = arg

        elif isinstance(args, dict):
            for key, value in args.items():
                if self.replace_arg(
                    inplace=inplace, arg=arg, args=value) == arg:
                    args[key] = arg

        if args == inplace:
            return arg

Исходная версия steemandlinux, :

Ну вот вроде ОК:

    def replace_arg(self, inplace, arg, args: Union[Dict, List, str]):
        """Replace template in arguments."""
        if isinstance(args, list):
            for index, value in enumerate(args):
                if self.replace_arg(
                    inplace=inplace, arg=arg, args=value) is not None:
                    args[index] = arg

        elif isinstance(args, dict):
            for key, value in args.items():
                if self.replace_arg(
                    inplace=inplace, arg=arg, args=value) is not None:
                    args[key] = arg

        if args == inplace:
            return arg