Revision 4500
Added by Aaron Marcuse-Kubitza about 12 years ago
bin/join | ||
---|---|---|
16 | 16 |
import opts |
17 | 17 |
import util |
18 | 18 |
|
19 |
def simplify(str_): return re.sub(r'[\W_]+', r'', str_.lower()) |
|
20 |
|
|
21 | 19 |
def main(): |
22 | 20 |
env_names = [] |
23 | 21 |
def usage_err(): |
... | ... | |
39 | 37 |
map_1_cols = reader.next() |
40 | 38 |
for row in reader: |
41 | 39 |
if map_1_core_only: row = row[:2] |
42 |
if row[0] != '': map_1.setdefault(simplify(row[0]), []).append(row) |
|
40 |
if row[0] != '': map_1.setdefault(maps.simplify(row[0]), []).append(row)
|
|
43 | 41 |
stream.close() |
44 | 42 |
|
45 | 43 |
# Join map 1 to map 0 |
... | ... | |
66 | 64 |
suffix = '' |
67 | 65 |
while True: |
68 | 66 |
try: |
69 |
out_rows = map_1[simplify(row[1])] |
|
67 |
out_rows = map_1[maps.simplify(row[1])]
|
|
70 | 68 |
break |
71 | 69 |
except KeyError: |
72 | 70 |
# Heuristically look for a match on a parent path. |
Also available in: Unified diff
join: Use new maps.simplify()