Skip to content

Commit

Permalink
version 0.0.11 (#12)
Browse files Browse the repository at this point in the history
* add legal id module
* add phone number normalize function
* fix phone number operator data
* improve code coverage
* some minimal improvements
  • Loading branch information
mrunderline authored Mar 19, 2023
1 parent bba5f1b commit 17410de
Show file tree
Hide file tree
Showing 15 changed files with 472 additions and 262 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- name: Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ An anthology of a variety of tools for the Persian language in Python
1. [card number](#card-number)
2. [sheba](#sheba)
5. [national id](#national-id)
6. [economic national id](#economic-national-id)
6. [legal id](#legal-id)
7. [phone number](#phone-number)
8. [bill](#bill)
9. [plate](#plate)
Expand Down Expand Up @@ -197,21 +197,21 @@ national_id.find_place('0906582709') # {'code': ['089', '090'], 'city': 'کا
national_id.find_place('0643005846') # {'code': ['064', '065'], 'city': 'بیرجند', 'province': 'خراسان جنوبی'}
```

### economic national id
This module contains two functions to generate random iranian economic national id (shenas-e melli) and validate any given id.
### legal id
This module contains two functions to generate random iranian legal id (shenas-e melli) and validate any given id.

```python
from persian_tools import economic_national_id
from persian_tools import legal_id

economic_national_id.validate('10380284790') # True
economic_national_id.validate('11053639140') # False
legal_id.validate('10380284790') # True
legal_id.validate('11053639140') # False

economic_national_id.generate_random() # '10100387143'
economic_national_id.generate_random() # '77111986110'
legal_id.generate_random() # '10100387143'
legal_id.generate_random() # '77111986110'
```

### phone number
This module can validate and give you some data from a phone number.
This module can validate, normalize and give you some data from a phone number.

```python
from persian_tools import phone_number
Expand All @@ -221,6 +221,11 @@ phone_number.validate('+989123456789') # True
phone_number.validate('989123456789') # True
phone_number.validate('98912345678') # False

phone_number.normalize('00989022002580') # 09022002580
phone_number.normalize('+989022002580') # 09022002580
phone_number.normalize('9022002580') # 09022002580
phone_number.normalize('9022002580', '0') # 09022002580
phone_number.normalize('9022002580', '+98') # 09022002580

phone_number.operator_data('09123456789')
# {'province': ['البرز', 'زنجان', 'سمنان', 'قزوین', 'قم', 'برخی از شهرستان های استان مرکزی'], 'base': 'تهران', 'type': ['permanent'], 'operator': 'همراه اول'}
Expand Down
Loading

0 comments on commit 17410de

Please sign in to comment.