def extract(self):
        """Extract a common dependency.

        Note that conflict dependencies are never extracted, they are always
        resolved via reduction.
        """
        if not self.extractable:
            return self, None

        extractable = self.common_fams - self.extracted_fams

        # the sort is necessary to ensure solves are deterministic
        fam = sorted(extractable)[0]

        last_range = None
        ranges = set()

        for variant in self.iter_variants():
            req = variant.get(fam)
            if req.range != last_range:  # will match often, avoids set search
                ranges.add(req.range)
                last_range = req.range

        slice_ = copy.copy(self)
        slice_.extracted_fams = self.extracted_fams | set([fam])

        ranges = list(ranges)
        range_ = ranges[0].union(ranges[1:])
        common_req = Requirement.construct(fam, range_)
        return slice_, common_req
def extract ( self ) : if not self . extractable : return self , None extractable = self . common_fams - self . extracted_fams fam = sorted ( extractable ) [ 0 ] last_range = None ranges = set ( ) for variant in self . iter_variants ( ) : req = variant . get ( fam ) if req . range != last_range : ranges . add ( req . range ) last_range = req . range slice_ = copy . copy ( self ) slice_ . extracted_fams = self . extracted_fams | set ( [ fam ] ) ranges = list ( ranges ) range_ = ranges [ 0 ] . union ( ranges [ 1 : ] ) common_req = Requirement . construct ( fam , range_ ) return slice_ , common_req
Extract a common dependency.

        Note that conflict dependencies are never extracted, they are always
        resolved via reduction.