Hi Leif,

Thank you for the addition cleanup.

Reviewed-by: Michael D Kinney <michael.d.kin...@intel.com>

Mike

> -----Original Message-----
> From: Leif Lindholm <quic_llind...@quicinc.com>
> Sent: Friday, November 10, 2023 11:31 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kin...@intel.com>; Rebecca Cran
> <rebe...@bsdio.com>; Gao, Liming <gaolim...@byosoft.com.cn>; Feng, Bob
> C <bob.c.f...@intel.com>; Chen, Christine <yuwei.c...@intel.com>
> Subject: [PATCH v3 3/5] BaseTools/Scripts/GetMaintainer: refactor
> internal returns as dicts
> 
> To clean up interfaces, change the lookup functions to return
> dictionaries
> rather than multiple values.
> 
> Cc: Rebecca Cran <rebe...@bsdio.com>
> Cc: Liming Gao <gaolim...@byosoft.com.cn>
> Cc: Bob Feng <bob.c.f...@intel.com>
> Cc: Yuwei Chen <yuwei.c...@intel.com>
> Cc: Michael D Kinney <michael.d.kin...@intel.com>
> Signed-off-by: Leif Lindholm <quic_llind...@quicinc.com>
> ---
>  BaseTools/Scripts/GetMaintainer.py | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/BaseTools/Scripts/GetMaintainer.py
> b/BaseTools/Scripts/GetMaintainer.py
> index cdcdff750635..cb3aadbbefb1 100644
> --- a/BaseTools/Scripts/GetMaintainer.py
> +++ b/BaseTools/Scripts/GetMaintainer.py
> @@ -96,7 +96,7 @@ def get_section_maintainers(path, section):
>              else:
>                  lists += [address]
> 
> -    return maintainers, lists
> +    return {'maintainers': maintainers, 'lists': lists}
> 
>  def get_maintainers(path, sections, level=0):
>      """For 'path', iterates over all sections, returning maintainers
> @@ -104,22 +104,24 @@ def get_maintainers(path, sections, level=0):
>      maintainers = []
>      lists = []
>      for section in sections:
> -        tmp_maint, tmp_lists = get_section_maintainers(path, section)
> -        maintainers += tmp_maint
> -        lists += tmp_lists
> +        recipients = get_section_maintainers(path, section)
> +        maintainers += recipients['maintainers']
> +        lists += recipients['lists']
> 
>      if not maintainers:
>          # If no match found, look for match for (nonexistent) file
>          # REPO.working_dir/<default>
>          print('"%s": no maintainers found, looking for default' %
> path)
>          if level == 0:
> -            maintainers = get_maintainers('<default>', sections,
> level=level + 1)
> +            recipients = get_maintainers('<default>', sections,
> level=level + 1)
> +            maintainers += recipients['maintainers']
> +            lists += recipients['lists']
>          else:
>              print("No <default> maintainers set for project.")
>          if not maintainers:
>              return None
> 
> -    return maintainers + lists
> +    return {'maintainers': maintainers, 'lists': lists}
> 
>  def parse_maintainers_line(line):
>      """Parse one line of Maintainers.txt, returning any match group
> and its key."""
> @@ -184,9 +186,8 @@ if __name__ == '__main__':
> 
>      for file in FILES:
>          print(file)
> -        addresslist = get_maintainers(file, SECTIONS)
> -        if addresslist:
> -            ADDRESSES += addresslist
> +        recipients = get_maintainers(file, SECTIONS)
> +        ADDRESSES += recipients['maintainers'] + recipients['lists']
> 
>      for address in list(OrderedDict.fromkeys(ADDRESSES)):
>          if '<' in address and '>' in address:
> --
> 2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111069): https://edk2.groups.io/g/devel/message/111069
Mute This Topic: https://groups.io/mt/102513771/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to