src/license_expression/__init__.py
def dedup(self, expression):
        """
        Return a deduplicated LicenseExpression given a license ``expression``
        string or LicenseExpression object.

        The deduplication process is similar to simplification but is
        specialized for working with license expressions. Simplification is
        otherwise a generic boolean operation that is not aware of the specifics
        of license expressions.

        The deduplication:

        - Does not sort the licenses of sub-expression in an expression. They
          stay in the same order as in the original expression.

        - Choices (as in "MIT or GPL") are kept as-is and not treated as
          simplifiable. This avoids droping important choice options in complex
          expressions which is never desirable.

        """
        exp = self.parse(expression)
        expressions = []
        for arg in exp.args:
            if isinstance(arg, (self.AND, self.OR,)):
                # Run this recursive function if there is another AND/OR
                # expression and add the expression to the expressions list.
                expressions.append(self.dedup(arg))
            else:
                expressions.append(arg)

        if isinstance(exp, BaseSymbol):
            deduped = exp
        elif isinstance(exp, (self.AND, self.OR,)):
            relation = exp.__class__.__name__
            deduped = combine_expressions(
                expressions,
                relation=relation,
                unique=True,
                licensing=self,
            )
        else:
            raise ExpressionError(f'Unknown expression type: {expression!r}')
        return deduped

        Return a deduplicated LicenseExpression given a license ``expression``
        string or LicenseExpression object.

        The deduplication process is similar to simplification but is
        specialized for working with license expressions. Simplification is
        otherwise a generic boolean operation that is not aware of the specifics
        of license expressions.

        The deduplication:

        - Does not sort the licenses of sub-expression in an expression. They
          stay in the same order as in the original expression.

        - Choices (as in "MIT or GPL") are kept as-is and not treated as
          simplifiable. This avoids droping important choice options in complex
          expressions which is never desirable.

        
Return a deduplicated LicenseExpression given a license ``expression``
string or LicenseExpression object.

The deduplication process is similar to simplification but is
specialized for working with license expressions. Simplification is
otherwise a generic boolean operation that is not aware of the specifics
of license expressions.

The deduplication.

Does not sort the licenses of sub-expression in an expression. They
stay in the same order as in the original expression.

Choices (as in "MIT or GPL") are kept as-is and not treated as
simplifiable. This avoids droping important choice options in complex
expressions which is never desirable.
Return a deduplicated LicenseExpression given a license ` ` expression ` ` string or LicenseExpression object . The deduplication process is similar to simplification but is specialized for working with license expressions . Simplification is otherwise a generic boolean operation that is not aware of the specifics of license expressions . The deduplication . Does not sort the licenses of sub - expression in an expression . They stay in the same order as in the original expression . Choices ( as in " MIT or GPL " ) are kept as - is and not treated as simplifiable . This avoids droping important choice options in complex expressions which is never desirable .
def dedup(self, expression):
        exp = self.parse(expression)
        expressions = []
        for arg in exp.args:
            if isinstance(arg, (self.AND, self.OR,)):
                expressions.append(self.dedup(arg))
            else:
                expressions.append(arg)
        if isinstance(exp, BaseSymbol):
            deduped = exp
        elif isinstance(exp, (self.AND, self.OR,)):
            relation = exp.__class__.__name__
            deduped = combine_expressions(
                expressions,
                relation=relation,
                unique=True,
                licensing=self,
            )
        else:
            raise ExpressionError(f'Unknown expression type: {expression!r}')
        return deduped
def dedup ( self , expression ) : exp = self . parse ( expression ) expressions = [ ] for arg in exp . args : if isinstance ( arg , ( self . AND , self . OR , ) ) : expressions . append ( self . dedup ( arg ) ) else : expressions . append ( arg ) if isinstance ( exp , BaseSymbol ) : deduped = exp elif isinstance ( exp , ( self . AND , self . OR , ) ) : relation = exp . __class__ . __name__ deduped = combine_expressions ( expressions , relation = relation , unique = True , licensing = self , ) else : raise ExpressionError ( f'Unknown expression type: {expression!r}' ) return deduped
Return a deduplicated LicenseExpression given a license ``expression``
string or LicenseExpression object.
Return a deduplicated LicenseExpression given a license ` ` expression ` ` string or LicenseExpression object .
"""
        Return a deduplicated LicenseExpression given a license ``expression``
        string or LicenseExpression object.

        The deduplication process is similar to simplification but is
        specialized for working with license expressions. Simplification is
        otherwise a generic boolean operation that is not aware of the specifics
        of license expressions.

        The deduplication:

        - Does not sort the licenses of sub-expression in an expression. They
          stay in the same order as in the original expression.

        - Choices (as in "MIT or GPL") are kept as-is and not treated as
          simplifiable. This avoids droping important choice options in complex
          expressions which is never desirable.

        """ # Run this recursive function if there is another AND/OR # expression and add the expression to the expressions list.
self
expression