Skip to content

Commit 0b197ad

Browse files
authored
Support for parsing folios without advisor (#8)
1 parent 33713cf commit 0b197ad

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,5 @@ dmypy.json
129129
.pyre/
130130

131131
.idea
132+
133+
tests/files/**

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.3.6 - 2020-12-21
4+
5+
- Support for parsing folios without advisor
6+
37
## 0.3.5 - 2020-11-13
48

59
- Support for parsing scheme's latest nav

casparser/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.5
1+
0.3.6

casparser/process.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ def process_cas_text(text):
5757
if curr_scheme_data.get("scheme") != scheme:
5858
if curr_scheme_data:
5959
folios[current_folio]["schemes"].append(curr_scheme_data)
60+
advisor = m.group(3)
61+
if advisor is not None:
62+
advisor = advisor.strip()
6063
curr_scheme_data = {
6164
"scheme": scheme,
62-
"advisor": m.group(3).strip(),
65+
"advisor": advisor,
6366
"rta_code": m.group(1).strip(),
6467
"rta": m.group(4).strip(),
6568
"open": Decimal(0.0),

casparser/regex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
r"KYC\s*:\s*(.+?)\s+PAN\s*:\s*(.+?)$"
66
)
77

8-
SCHEME_RE = r"([\s\w]+)-\s*\d*\s*(.+?)\s*\(Advisor\s*:\s*(.+?)\)\s+Registrar\s*:\s*(.*)\s*$"
8+
SCHEME_RE = r"([\s\w]+)-\s*\d*\s*(.+?)\s*(?:\(Advisor\s*:\s*(.+?)\))*\s+Registrar\s*:\s*(.*)\s*$"
99
OPEN_UNITS_RE = r"Opening\s+Unit\s+Balance.+?([\d,.]+)"
1010
CLOSE_UNITS_RE = r"Closing\s+Unit\s+Balance.+?([\d,.]+)"
1111
VALUATION_RE = r"Valuation\s+on\s+(\d{2}-[A-Za-z]{3}-\d{4})\s*:\s*INR\s*([\d,.]+)"

0 commit comments

Comments
 (0)