alfred/Alfred.alfredpreferences/workflows/user.workflow.99DE3F5C-7CB4-4E0B-9195-7782AADC167B/converter/convert.py
def convert(self, query):
        '''Convert a query to a list of units with quantities

        :rtype: list of (Unit, decimal.Decimal, Unit)
        '''
        match = constants.FULL_RE.match(query)
        source_match = constants.SOURCE_RE.match(query)

        tos = None
        from_ = None
        quantity = parse_quantity('0')
        try:
            try:
                if match:
                    from_ = self.get(match.group('from'))
                    quantity = parse_quantity(match.group('quantity'))
                    tos = from_.others(match.group('to'))
                elif source_match:
                    from_ = self.get(source_match.group('from'))
                    quantity = parse_quantity(source_match.group('quantity'))
                    tos = from_.others()
                else:
                    raise UnknownUnit()

            except UnknownUnit:
                tos = None
                from_ = None
                quantity = parse_quantity(query)

        except:
            partial_query = ' '.join(query.split()[:-1])
            if partial_query:
                for from_, quantity, to in self.convert(partial_query):
                    yield from_, quantity, to
                return

        if tos:
            for to in tos:
                yield from_, quantity, to
        else:
            yield None, quantity, None
Convert a query to a list of units with quantities

        :rtype: list of (Unit, decimal.Decimal, Unit)
        
Convert a query to a list of units with quantities
Convert a query to a list of units with quantities
def convert(self, query):
        match = constants.FULL_RE.match(query)
        source_match = constants.SOURCE_RE.match(query)
        tos = None
        from_ = None
        quantity = parse_quantity('0')
        try:
            try:
                if match:
                    from_ = self.get(match.group('from'))
                    quantity = parse_quantity(match.group('quantity'))
                    tos = from_.others(match.group('to'))
                elif source_match:
                    from_ = self.get(source_match.group('from'))
                    quantity = parse_quantity(source_match.group('quantity'))
                    tos = from_.others()
                else:
                    raise UnknownUnit()
            except UnknownUnit:
                tos = None
                from_ = None
                quantity = parse_quantity(query)
        except:
            partial_query = ' '.join(query.split()[:-1])
            if partial_query:
                for from_, quantity, to in self.convert(partial_query):
                    yield from_, quantity, to
                return
        if tos:
            for to in tos:
                yield from_, quantity, to
        else:
            yield None, quantity, None
def convert ( self , query ) : match = constants . FULL_RE . match ( query ) source_match = constants . SOURCE_RE . match ( query ) tos = None from_ = None quantity = parse_quantity ( '0' ) try : try : if match : from_ = self . get ( match . group ( 'from' ) ) quantity = parse_quantity ( match . group ( 'quantity' ) ) tos = from_ . others ( match . group ( 'to' ) ) elif source_match : from_ = self . get ( source_match . group ( 'from' ) ) quantity = parse_quantity ( source_match . group ( 'quantity' ) ) tos = from_ . others ( ) else : raise UnknownUnit ( ) except UnknownUnit : tos = None from_ = None quantity = parse_quantity ( query ) except : partial_query = ' ' . join ( query . split ( ) [ : - 1 ] ) if partial_query : for from_ , quantity , to in self . convert ( partial_query ) : yield from_ , quantity , to return if tos : for to in tos : yield from_ , quantity , to else : yield None , quantity , None
Convert a query to a list of units with quantities
Convert a query to a list of units with quantities
'''Convert a query to a list of units with quantities

        :rtype: list of (Unit, decimal.Decimal, Unit)
        '''
None
list of (Unit, decimal.Decimal, Unit)
self
query