Skip to content

Commit

Permalink
Fix issue with .json files not included in package
Browse files Browse the repository at this point in the history
  • Loading branch information
vividvilla committed Jul 9, 2017
1 parent 7fed747 commit ef319aa
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
recursive-include rbiparser *.json *.py
include LICENSE
include README.md
9 changes: 6 additions & 3 deletions rbiparser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@

HEADERS = ["BANK", "IFSC", "MICR", "BRANCH", "ADDRESS", "CONTACT", "CITY", "DISTRICT", "STATE"]

module_path = os.path.dirname(__file__)
module_path = os.path.dirname(os.path.abspath(__file__))
banks_list_filename = "banks.json"
filters_filename = "filters.json"

# Regex
alphanumeric = re.compile(r"[^a-z0-9]", re.IGNORECASE)
Expand Down Expand Up @@ -237,6 +239,7 @@ def combine_csvs(src, master, headers, filters=False):

files = glob.glob(src + "/*.csv")
for fname in files:
logging.info("processing file: {}".format(fname))
with open(fname, "r") as f:
reader = csv.reader(f)

Expand All @@ -250,7 +253,7 @@ def combine_csvs(src, master, headers, filters=False):
def clean_row(row, filters=False):
"""Clean a single row from the CSV."""
# Load map of bank abbrivations
bank_map = load_json("../banks.json")
bank_map = load_json(banks_list_filename)

row = [r.strip() for r in row]
row = [spaces.sub(" ", r) for r in row]
Expand Down Expand Up @@ -316,7 +319,7 @@ def clean_row(row, filters=False):

# clean fields
if filters:
filters_map = load_json("../filters.json")
filters_map = load_json(filters_filename)
# Apply replace filter
row = apply_replace_filter(row, filters_map["replace"])

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rbiparser/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ def convert(source, dest):
help="Apply advanced filters to clean the data")
def combine(source, dest, filters):
"""Combine and clean all the indivdual CSV files"""
rbi.combine_csvs(source, dest, rbi.HEADERS, filters)
rbi.combine_csvs(source, dest, rbi.HEADERS, filters)
File renamed without changes.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

setup(
name="rbiparser",
version="0.5",
version="0.6.0",
description="A utility for downloading, parsing and sanitizing bank database (IFSC, MICR, address etc.) Excel sheets from the RBI website.",
long_description=README,
author="Kailash Nadh",
author_email="kailash@nadh.in",
url="https://github.com/knadh/rbiparser",
packages=['rbiparser'],
include_package_data=True,
download_url="https://github.com/knadh/rbiparser",
license="MIT License",
entry_points={
Expand Down

0 comments on commit ef319aa

Please sign in to comment.