Skip to content

Commit

Permalink
Fixing syntax issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cityofcapetown-opm-bot committed Dec 11, 2024
1 parent 9683311 commit 3e31573
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cct_connector/ServiceAlertAugmenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@


@functools.lru_cache
def _load_gis_layer(area_type: str, layer_query: str | None = None):
def _load_gis_layer(area_type: str, layer_query: str or None = None):
if area_type in AREA_LOOKUP:
layer_name, _ = AREA_LOOKUP[area_type]
else:
Expand Down Expand Up @@ -117,7 +117,7 @@ def _get_overture_street_data() -> geopandas.GeoDataFrame:


def _geocode_location(address: str,
bounding_polygon: shapely.geometry.base) -> shapely.geometry.base | None:
bounding_polygon: shapely.geometry.base) -> shapely.geometry.base or None:
output_shape = None
logging.debug(f"Attempting to geocode '{address=}'")

Expand Down Expand Up @@ -198,7 +198,7 @@ def _geocode_location(address: str,
return output_shape


def _cptgpt_location_call_wrapper(location_dict: typing.Dict, http_session: requests.Session) -> typing.List | None:
def _cptgpt_location_call_wrapper(location_dict: typing.Dict, http_session: requests.Session) -> typing.List or None:
endpoint = PRIMARY_GPT_ENDPOINT
# ToDo move messages to standalone config file
params = {
Expand Down Expand Up @@ -510,7 +510,7 @@ def _cptgpt_location_call_wrapper(location_dict: typing.Dict, http_session: requ


def _cptgpt_summarise_call_wrapper(message_dict: typing.Dict, http_session: requests.Session,
max_post_length: int) -> str | None:
max_post_length: int) -> str or None:
system_prompt = (
f'Please reason step by step to draft {max_post_length} or less character social media posts about potential '
'City of Cape Town service outage or update, using the details in provided JSON objects. '
Expand Down Expand Up @@ -775,7 +775,7 @@ def _generate_screenshot_of_area(area_gdf: geopandas.GeoDataFrame, area_filename
return minio_utils.file_to_minio(local_image_path, AREA_IMAGE_BUCKET)


def _generate_image_link(area_type: str, area: str, location: str | None, wkt_str: str) -> str:
def _generate_image_link(area_type: str, area: str, location: str or None, wkt_str: str) -> str:
template_params = dict(
salt_str=base64.b64encode(bytes(AREA_IMAGE_SALT, 'utf-8')).decode(),
area_type_str=base64.b64encode(bytes(area_type, 'utf-8')).decode(),
Expand Down Expand Up @@ -947,7 +947,7 @@ def lookup_geospatial_image_link(self):
if not image_filename_lookup.empty:
self.data[IMAGE_COL] = image_filename_lookup

def infer_area(self, layer_name: str, layer_col: str, data_col_name: str, layer_query: str | None = None):
def infer_area(self, layer_name: str, layer_col: str, data_col_name: str, layer_query: str or None = None):
if self.data.empty:
logging.warning("No data, so skipping...")
return
Expand Down

0 comments on commit 3e31573

Please sign in to comment.