(original_string, scope="USA")
| 18 | from .utils.logging.sentry import capture_exception |
| 19 | |
| 20 | def replace_unsupported_localities(original_string, scope="USA"): |
| 21 | if scope == "USA": |
| 22 | new_string = re.sub(r'\bneighborhood\b', 'zipcode', original_string, flags=re.IGNORECASE) |
| 23 | new_string = re.sub(r'\bneighborhoods\b', 'zipcodes', new_string, flags=re.IGNORECASE) |
| 24 | new_string = re.sub(r'\barea\b', 'zipcode', new_string, flags=re.IGNORECASE) |
| 25 | new_string = re.sub(r'\bareas\b', 'zipcodes', new_string, flags=re.IGNORECASE) |
| 26 | new_string = re.sub(r'\bplace\b', 'zipcode', new_string, flags=re.IGNORECASE) |
| 27 | new_string = re.sub(r'\bplaces\b', 'zipcodes', new_string, flags=re.IGNORECASE) |
| 28 | new_string = re.sub(r'\bpart\b', 'zipcode', new_string, flags=re.IGNORECASE) |
| 29 | new_string = re.sub(r'\bparts\b', 'zipcodes', new_string, flags=re.IGNORECASE) |
| 30 | elif scope == "SF": |
| 31 | new_string = re.sub(r'\barea\b', 'neighborhood', original_string, flags=re.IGNORECASE) |
| 32 | new_string = re.sub(r'\bareas\b', 'neighborhoods', new_string, flags=re.IGNORECASE) |
| 33 | new_string = re.sub(r'\bplace\b', 'neighborhood', new_string, flags=re.IGNORECASE) |
| 34 | new_string = re.sub(r'\bplaces\b', 'neighborhoods', new_string, flags=re.IGNORECASE) |
| 35 | new_string = re.sub(r'\bpart\b', 'neighborhood', new_string, flags=re.IGNORECASE) |
| 36 | new_string = re.sub(r'\bparts\b', 'neighborhoods', new_string, flags=re.IGNORECASE) |
| 37 | return new_string |
| 38 | |
| 39 | |
| 40 | bp = Blueprint('api_bp', __name__) |
no outgoing calls
no test coverage detected