378718624ca31e0311e9ad7522a9305104212ed7,beancount_import/amount_parsing.py,,parse_amount,#Any#,28

Before Change


    if not x:
        return None
    sign, amount_str = parse_possible_negative(x)
    if amount_str.startswith("$"):
        currency = "USD"
        number = D(amount_str[1:])
    else:
        raise ValueError("Unable to determine currency from %r" % amount_str)
    return Amount(number * sign, currency)

After Change


    if m is None:
        raise ValueError("Failed to parse amount from %r" % amount_str)
    if m.group(1):
        currency = {"$": "USD", "€": "EUR"}[m.group(1)]
    number = D(m.group(2))
    if m.group(3):
        currency = m.group(3)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: jbms/beancount-import
Commit Name: 378718624ca31e0311e9ad7522a9305104212ed7
Time: 2019-06-09
Author: jeremy@jeremyms.com
File Name: beancount_import/amount_parsing.py
Class Name:
Method Name: parse_amount


Project Name: vatlab/SoS
Commit Name: babbd4dd0adbc4a97e4e91671cae869c833b183b
Time: 2016-12-15
Author: ben.bob@gmail.com
File Name: sos/__main__.py
Class Name:
Method Name: cmd_run


Project Name: CyberReboot/NetworkML
Commit Name: d3babe1252d05f07e58a6602b47e1a09bbd56af5
Time: 2019-12-10
Author: josh@vandervecken.com
File Name: networkml/parsers/pcap/reader.py
Class Name:
Method Name: packetizer


Project Name: vatlab/SoS
Commit Name: f06063d65d47bf601dbab36513a2910a986e7698
Time: 2017-05-08
Author: ben.bog@gmail.com
File Name: sos/utils.py
Class Name:
Method Name: convert_age