Skip to content

Commit

Permalink
Removed omocodes argument from encode method
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed Nov 6, 2017
1 parent 8b56f61 commit e5f0d22
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 42 deletions.
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,6 @@ codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/

# 'CCCFBA85D03L219P'
```
```python
codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/1985', birthplace='Torino', omocodes=True)

# [
# 'CCCFBA85D03L219P',
# 'CCCFBA85D03L21VE',
# 'CCCFBA85D03L2MVP',
# 'CCCFBA85D03LNMVE',
# 'CCCFBA85D0PLNMVA',
# 'CCCFBA85DLPLNMVL',
# 'CCCFBA8RDLPLNMVX',
# 'CCCFBAURDLPLNMVU'
# ]
```
#### Decode
```python
Expand Down
15 changes: 0 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,6 @@ Encode
# 'CCCFBA85D03L219P'
.. code:: python
codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/1985', birthplace='Torino', omocodes=True)
# [
# 'CCCFBA85D03L219P',
# 'CCCFBA85D03L21VE',
# 'CCCFBA85D03L2MVP',
# 'CCCFBA85D03LNMVE',
# 'CCCFBA85D0PLNMVA',
# 'CCCFBA85DLPLNMVL',
# 'CCCFBA8RDLPLNMVX',
# 'CCCFBAURDLPLNMVU'
# ]
Decode
^^^^^^

Expand Down
8 changes: 2 additions & 6 deletions codicefiscale/codicefiscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def encode_cin(code):
return cin_code


def encode(surname, name, sex, birthdate, birthplace, omocodes=False):
def encode(surname, name, sex, birthdate, birthplace):

code = ''
code += encode_surname(surname)
Expand All @@ -224,11 +224,7 @@ def encode(surname, name, sex, birthdate, birthplace, omocodes=False):

# raise ValueError if code is not valid
data = decode(code)

if omocodes:
return data['omocodes']
else:
return data['code']
return data['code']


def decode_raw(code):
Expand Down
9 changes: 1 addition & 8 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,6 @@ def test_encode(self):
code = codicefiscale.encode(**obj['input'])
self.assertEqual(code, obj['result'])

for obj in data:
obj['input']['omocodes'] = True
# with self.subTest(obj=obj):
codes = codicefiscale.encode(**obj['input'])
self.assertEqual(8, len(codes))
self.assertEqual(codes[0], obj['result'])

def test_decode(self):

data = [
Expand Down Expand Up @@ -364,7 +357,7 @@ def test_decode(self):

result = obj['result']
obj_decoded = codicefiscale.decode(obj['input'])
# print(obj_decoded)
print(obj_decoded)

sex = obj_decoded.get('sex')
self.assertFalse(sex is None)
Expand Down

0 comments on commit e5f0d22

Please sign in to comment.