On 7/9/20 12:03 AM, Chun-Yu Shei wrote:
> +def use_reduce(depstr, uselist=(), masklist=(), matchall=False, 
> excludeall=(), is_src_uri=False, \
> +     eapi=None, opconvert=False, flat=False, is_valid_flag=None, 
> token_class=None, matchnone=False,
> +     subset=None):
> +     """
> +     Takes a dep string and reduces the use? conditionals out, leaving an 
> array
> +     with subarrays. All redundant brackets are removed.
> +
> +     @param depstr: depstring
> +     @type depstr: String
> +     @param uselist: Sequence of use enabled flags
> +     @type uselist: Sequence
> +     @param masklist: Sequence of masked flags (always treated as disabled)
> +     @type masklist: Sequence
> +     @param matchall: Treat all conditionals as active. Used by repoman.
> +     @type matchall: Bool
> +     @param excludeall: Sequence of flags for which negated conditionals are 
> always treated as inactive.
> +     @type excludeall: Sequence
> +     @param is_src_uri: Indicates if depstr represents a SRC_URI
> +     @type is_src_uri: Bool
> +     @param eapi: Indicates the EAPI the dep string has to comply to
> +     @type eapi: String
> +     @param opconvert: Put every operator as first element into it's 
> argument list
> +     @type opconvert: Bool
> +     @param flat: Create a flat list of all tokens
> +     @type flat: Bool
> +     @param is_valid_flag: Function that decides if a given use flag might 
> be used in use conditionals
> +     @type is_valid_flag: Function
> +     @param token_class: Convert all non operator tokens into this class
> +     @type token_class: Class
> +     @param matchnone: Treat all conditionals as inactive. Used by 
> digestgen().
> +     @type matchnone: Bool
> +     @param subset: Select a subset of dependencies conditional on the given 
> flags
> +     @type subset: Sequence
> +     @rtype: List
> +     @return: The use reduced depend array
> +     """
> +     if isinstance(depstr, list):
> +             if portage._internal_caller:
> +                     warnings.warn(_("Passing paren_reduced dep arrays to %s 
> is deprecated. " + \
> +                             "Pass the original dep string instead.") % \
> +                             ('portage.dep.use_reduce',), 
> DeprecationWarning, stacklevel=2)
> +             depstr = paren_enclose(depstr)
> +
> +     if uselist is not None:
> +             uselist = tuple(uselist)
> +     if masklist is not None:
> +             masklist = tuple(masklist)
> +     if excludeall is not None:
> +             excludeall = tuple(excludeall)
> +     if subset is not None:
> +             subset = tuple(subset)

The patch looks great, but maybe it's better if we use frozenset instead
of tuple for these.
-- 
Thanks,
Zac

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to