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
return None
sign, amount_str = parse_possible_negative(x)
m = re.fullmatch(r"([\$€])?([0-9]+(?:,[0-9]+)*(?:\.[0-9]*)?)(?:\s+([A-Z]{3}))?", amount_str)
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)
return Amount(number * sign, currency)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
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: dask/distributed
Commit Name: 50dd21f71d763edd10146da4144a55f0ad48ca23
Time: 2019-04-02
Author: mrocklin@gmail.com
File Name: distributed/deploy/local.py
Class Name: LocalCluster
Method Name: _start
Project Name: WZBSocialScienceCenter/tmtoolkit
Commit Name: d25b926fead0bdc79364d7fae1b7b951714f4843
Time: 2017-06-14
Author: markus.konrad@wzb.eu
File Name: tmtoolkit/corpus.py
Class Name:
Method Name: paragraphs_from_lines