-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
266 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Change Log | ||
========== | ||
|
||
0.0.1 (19/04/2020) | ||
------------------- | ||
- First Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global-include *.txt *.py *.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
Bangladesh information like District, Division, Thana, post code etc. | ||
This package allows you to direct use those data into the python code. | ||
This package allows you to direct use those data into the python code. | ||
|
||
Under construction! Not ready for use yet! Currently experimenting and planning! | ||
Developed by Zahid Hasan (c) 2021 | ||
.. Note:: Under construction! ot ready for use yet! Currently experimenting and planning! | ||
|
||
Examples of How To Use (Alpha Version) | ||
Options | ||
- get_divisions() | ||
- get_districts() | ||
- get_upazilas() | ||
- get_postcodes() | ||
|
||
from bangladesh import get_districts, get_divisions, get_postcodes, get_upazilas | ||
|
||
print(get_districts()) | ||
print(get_divisions()) | ||
print(get_upazilas()) | ||
print(get_postcodes()) | ||
Developed by Zahid Hasan (c) 2021 (Alpha Version)(https://github.com/Druvo) | ||
|
||
|
||
Check out: https://github.com/Druvo/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Bangladesh information like District, Division, Thana, post code etc. This package allows you to direct use those data into the python code.Under construction! Not ready for use yet! Currently experimenting and planning! Developed by Zahid Hasan (c) 2021 (Alpha Version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from .main import get_districts, get_divisions, get_postcodes, get_upazilas | ||
|
||
__version__ = '0.0.7' | ||
__author__ = 'Zahid Hasan' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,73 @@ | ||
import json | ||
import os | ||
from types import SimpleNamespace | ||
from .models import DivisionList | ||
|
||
|
||
script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in | ||
|
||
|
||
def get_absolute_path(str): | ||
"""[Get a absolute path of a file] | ||
Args: | ||
str ([path]): [The file location/path] | ||
Returns: | ||
[str]: [full string fromate of the a path from the os] | ||
""" | ||
return os.path.join(script_dir, str) | ||
|
||
|
||
def get_file_data(str): | ||
"""[Get json file data] | ||
Args: | ||
str ([path]): [The file location/path] | ||
Returns: | ||
[dictionary]: [The data in the file] | ||
""" | ||
data = open(get_absolute_path(str), encoding="utf8") | ||
respons_dict = json.load(data) | ||
return respons_dict | ||
|
||
|
||
def get_divisions(): | ||
# with json load (file) | ||
info = open('./json/divisions.json', encoding="utf8") | ||
respons = json.load(info) | ||
return respons | ||
"""[Get divisions list] | ||
Returns: | ||
[dictionary]: [divisions list] | ||
""" | ||
info = get_file_data(r'data\divisions.json') | ||
return info | ||
|
||
|
||
def get_districts(): | ||
# with json load (file) | ||
import json | ||
info = open('./json/districts.json', encoding="utf8") | ||
respons = json.load(info) | ||
return respons | ||
"""[Get districts list] | ||
Returns: | ||
[dictionary]: [districts list] | ||
""" | ||
info = get_file_data(r'data/districts.json') | ||
return info | ||
|
||
|
||
def get_postcodes(): | ||
# with json load (file) | ||
info = open('./json/postcodes.json', encoding="utf8") | ||
respons = json.load(info) | ||
return respons | ||
"""[Get postcodes list] | ||
Returns: | ||
[dictionary]: [postcodes list] | ||
""" | ||
info = get_file_data(r'data/postcodes.json') | ||
return info | ||
|
||
|
||
def get_upazilas(): | ||
# with json load (file) | ||
info = open('./json/upazilas.json', encoding="utf8") | ||
respons = json.load(info) | ||
return respons | ||
"""[Get upazilas list] | ||
Returns: | ||
[dictionary]: [upazilas list] | ||
""" | ||
info = get_file_data(r'data/upazilas.json') | ||
return info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .district import * | ||
from .division import * | ||
from .districts_geo import * | ||
from .postcode import * | ||
from .udd import * | ||
from .upazila import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import List | ||
|
||
|
||
class District: | ||
id: int | ||
division_id: int | ||
name: str | ||
bn_name: str | ||
lat: str | ||
long: str | ||
|
||
def __init__(self, id: int, division_id: int, name: str, bn_name: str, lat: str, long: str) -> None: | ||
self.id = id | ||
self.division_id = division_id | ||
self.name = name | ||
self.bn_name = bn_name | ||
self.lat = lat | ||
self.long = long | ||
|
||
|
||
class Welcome6: | ||
districts: List[District] | ||
|
||
def __init__(self, districts: List[District]) -> None: | ||
self.districts = districts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from enum import Enum | ||
from typing import List | ||
|
||
|
||
class GeometryType(Enum): | ||
MULTI_POLYGON = "MultiPolygon" | ||
|
||
|
||
class Geometry: | ||
type: GeometryType | ||
coordinates: List[List[List[List[float]]]] | ||
|
||
def __init__(self, type: GeometryType, coordinates: List[List[List[List[float]]]]) -> None: | ||
self.type = type | ||
self.coordinates = coordinates | ||
|
||
|
||
class Properties: | ||
adm2_en: str | ||
adm1_en: str | ||
|
||
def __init__(self, adm2_en: str, adm1_en: str) -> None: | ||
self.adm2_en = adm2_en | ||
self.adm1_en = adm1_en | ||
|
||
|
||
class FeatureType(Enum): | ||
FEATURE = "Feature" | ||
|
||
|
||
class Feature: | ||
type: FeatureType | ||
properties: Properties | ||
geometry: Geometry | ||
|
||
def __init__(self, type: FeatureType, properties: Properties, geometry: Geometry) -> None: | ||
self.type = type | ||
self.properties = properties | ||
self.geometry = geometry | ||
|
||
|
||
class Welcome3: | ||
type: str | ||
name: str | ||
features: List[Feature] | ||
|
||
def __init__(self, type: str, name: str, features: List[Feature]) -> None: | ||
self.type = type | ||
self.name = name | ||
self.features = features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import List | ||
|
||
|
||
class Division: | ||
id: int | ||
name: str | ||
bn_name: str | ||
lat: str | ||
long: str | ||
|
||
def __init__(self, id: int, name: str, bn_name: str, lat: str, long: str) -> None: | ||
self.id = id | ||
self.name = name | ||
self.bn_name = bn_name | ||
self.lat = lat | ||
self.long = long | ||
|
||
|
||
class DivisionList: | ||
divisions: List[Division] | ||
|
||
def __init__(self, divisions: List[Division]) -> None: | ||
self.divisions = divisions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from enum import Enum | ||
from typing import Optional, List | ||
|
||
|
||
class District(Enum): | ||
CHAPINAWABGANJ = "Chapinawabganj" | ||
|
||
|
||
class Postcode: | ||
division_id: int | ||
district_id: Optional[int] | ||
upazila: str | ||
post_office: str | ||
post_code: int | ||
district: Optional[District] | ||
|
||
def __init__(self, division_id: int, district_id: Optional[int], upazila: str, post_office: str, post_code: int, district: Optional[District]) -> None: | ||
self.division_id = division_id | ||
self.district_id = district_id | ||
self.upazila = upazila | ||
self.post_office = post_office | ||
self.post_code = post_code | ||
self.district = district | ||
|
||
|
||
class Welcome8: | ||
postcodes: List[Postcode] | ||
|
||
def __init__(self, postcodes: List[Postcode]) -> None: | ||
self.postcodes = postcodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from enum import Enum | ||
|
||
|
||
class Division(Enum): | ||
BARISAL = "Barisal" | ||
CHITTAGONG = "Chittagong" | ||
DHAKA = "Dhaka" | ||
KHULNA = "Khulna" | ||
RAJSHAHI = "Rajshahi" | ||
RANGPUR = "Rangpur" | ||
SYLHET = "Sylhet" | ||
|
||
|
||
class Welcome1Element: | ||
upazila: str | ||
district: str | ||
division: Division | ||
|
||
def __init__(self, upazila: str, district: str, division: Division) -> None: | ||
self.upazila = upazila | ||
self.district = district | ||
self.division = division |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from typing import List | ||
|
||
|
||
class Upazila: | ||
id: int | ||
district_id: int | ||
name: str | ||
bn_name: str | ||
|
||
def __init__(self, id: int, district_id: int, name: str, bn_name: str) -> None: | ||
self.id = id | ||
self.district_id = district_id | ||
self.name = name | ||
self.bn_name = bn_name | ||
|
||
|
||
class Welcome10: | ||
upazilas: List[Upazila] | ||
|
||
def __init__(self, upazilas: List[Upazila]) -> None: | ||
self.upazilas = upazilas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from bangladesh import * | ||
|
||
|
||
print(get_divisions()) |