[PATCH blivet] Do not use type() in makebumpver.

David Lehman dlehman at redhat.com
Wed May 6 16:10:59 UTC 2015


On 05/05/2015 03:22 PM, Chris Lumens wrote:
> pylint has gotten pickier about this for whatever reason, so we should stop
> using it.  Thus, I'm just going to have _getCommitDetail always return a
> list and callers of it decide if they just want one element or what.
> ---
>   scripts/makebumpver | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/makebumpver b/scripts/makebumpver
> index 72714dd..01ff2a8 100755
> --- a/scripts/makebumpver
> +++ b/scripts/makebumpver
> @@ -126,9 +126,9 @@ class MakeBumpVer:
>           ret = proc[0].strip('\n').split('\n')
>
>           if len(ret) == 1 and ret[0].find('@') != -1:
> -            ret = ret[0].split('@')[0]
> +            ret = [ret[0].split('@')[0]]
>           elif len(ret) == 1:
> -            ret = ret[0]
> +            ret = [ret[0]]
>           else:
>               ret = [r for r in ret if r != '']
>
> @@ -254,11 +254,9 @@ class MakeBumpVer:
>               fields = line.split(' ')
>               commit = fields[0]
>
> -            summary = self._getCommitDetail(commit, "%s")
> +            summary = self._getCommitDetail(commit, "%s")[0]
>               body = self._getCommitDetail(commit, "%b")
> -            if type(body) is not list:
> -                body = [body]

You can also do isinstance(body, list) here. Either is fine with me.

> -            author = self._getCommitDetail(commit, "%aE")
> +            author = self._getCommitDetail(commit, "%aE")[0]
>
>               if self.rhel:
>                   rhbz = set()
>



More information about the anaconda-patches mailing list