diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-02-27 20:44:52 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:27 +0200 |
commit | 0f3229a119e53054d98c5e878a9581403628cd08 (patch) | |
tree | e07ad2e91e2544f7b2d61e8f3f653fdda26bfd52 /archaeological_operations/utils.py | |
parent | cfabd636d0a6d84e8377be3e4d041b4e75ddda9a (diff) | |
download | Ishtar-0f3229a119e53054d98c5e878a9581403628cd08.tar.bz2 Ishtar-0f3229a119e53054d98c5e878a9581403628cd08.zip |
Migrate to python 3 - Clean old migrations and some old scripts
Diffstat (limited to 'archaeological_operations/utils.py')
-rw-r--r-- | archaeological_operations/utils.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/archaeological_operations/utils.py b/archaeological_operations/utils.py index 3a5057cd5..801cc6ea4 100644 --- a/archaeological_operations/utils.py +++ b/archaeological_operations/utils.py @@ -270,7 +270,7 @@ def parse_trunc_patriarche(value): int(value) except ValueError: return - return '18' + unicode(value) + return '18' + str(value) def parse_operation_code(value): @@ -468,11 +468,11 @@ def parse_insee(value): PARCEL_YEAR_REGEXP = re.compile(r"^([0-9]{4})[ :]+") PARCEL_SECTION_REGEXP = re.compile( - ur"(?: )*(?:[Ss]ection(?:s)?)?(?: )*([A-Z][A-Z0-9]{0,3})[ :]*" - ur"((?:(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*[0-9]+[p]?)+)") -PARCEL_NB_RANGE_REGEXP = re.compile(ur'([0-9]+[p]?) (?:à|to) ([0-9]+[p]?)') + r"(?: )*(?:[Ss]ection(?:s)?)?(?: )*([A-Z][A-Z0-9]{0,3})[ :]*" + r"((?:(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*[0-9]+[p]?)+)") +PARCEL_NB_RANGE_REGEXP = re.compile(r'([0-9]+[p]?) (?:à|to) ([0-9]+[p]?)') PARCEL_NB_REGEXP = re.compile( - ur'(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*([0-9]+[p]?)') + r'(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*([0-9]+[p]?)') def parse_parcels(parcel_str, insee_code=None, owner=None): @@ -492,7 +492,7 @@ def parse_parcels(parcel_str, insee_code=None, owner=None): for parcel in PARCEL_SECTION_REGEXP.findall(parcel_str): sector, nums = parcel[0], parcel[1] for num in PARCEL_NB_REGEXP.findall(nums): - if len(unicode(num)) > 6: + if len(str(num)) > 6: continue dct = {'year': year, 'section': sector, 'parcel_number': num} if town: @@ -508,9 +508,9 @@ def parse_parcels(parcel_str, insee_code=None, owner=None): higher_range = int(higher_range) except ValueError: continue - for num in xrange(lower_range, higher_range): + for num in range(lower_range, higher_range): dct = {'year': year, 'section': sector, - 'parcel_number': unicode(num)} + 'parcel_number': str(num)} if town: dct['town'] = town if owner: |