metawards.WardInfos

class metawards.WardInfos(wards: List[metawards._wardinfo.WardInfo] = <factory>)[source]

Simple class that holds a list of WardInfo objects, and provides useful search functions over that list. This prevents me from cluttering up the interface of Network

__init__(wards: List[metawards._wardinfo.WardInfo] = <factory>) → None

Methods

__init__(wards)
find(name, authority, region, match, …) Generic search function that will search using any or all of the terms provided.
find(name: str = None, authority: str = None, region: str = None, match: bool = False, match_authority_and_region: bool = False, include_alternates: bool = True)[source]

Generic search function that will search using any or all of the terms provided. This returns a list of indicies of wards that match the search

Parameters:
  • name (str or regexp) – Name or code of the ward to search
  • authority (str or regexp) – Name or code of the authority to search
  • region (str or regexp) – Name or code of the region to search
  • match (bool (False)) – Use a regular expression match for the ward rather than a search. This forces the match to be at the start of the string
  • match_authority_and_region (bool (False)) – Use a regular expression match for the authority and region rather than a search. This forces the match to be at the start of the string
  • include_alternates (bool (True)) – Whether or not to include alternative names and codes when searching for the ward
wards = None

The list of WardInfo objects, one for each ward in order