Use the code

Getting and parsing user data

archmap.get_users(url='https://wiki.archlinux.org/index.php/ArchMap/List', local='')[source]

This funtion parses the list of users from the ArchWiki and returns it as a string.

Parameters:
  • url (str) -- Link to a URL that points to a ArchWiki ArchMap list (default)
  • local (str) -- Path to a local copy of the ArchWiki ArchMap source
Returns:

The extracted raw-text list of users or None if not avaliable

Return type:

str or None

archmap.parse_users(users)[source]

This function parses the raw-text list (users) that has been extracted from the wiki page and splits it into a list of namedtuples containing the latitude, longitude, name and comment.

Parameters:users (str) -- raw-text list from the ArchWiki
Returns:A list of namedtuples, each namedtuple has 4 elements: (latitude, longitude, name, comment)
Return type:list of collections.namedtuple (decimal.Decimal, decimal.Decimal, str, str)

Output generators

archmap.make_text(parsed_users, output_file='', pretty=False)[source]

This function reads the user data supplied by parsed_users, it then generates a raw-text list according to the formatting specifications on the wiki and writes it to output_file.

Parameters:
  • parsed_users (list of collections.namedtuple (decimal.Decimal, decimal.Decimal, str, str)) -- A list of namedtuples, each namedtuple should have 4 elements: (latitude, longitude, name, comment)
  • output_file (str) -- Location to save the text output. If left empty, nothing will be output
  • pretty (bool) -- If set to True, the output "columns" will be aligned and expanded to match the longest element
Returns:

The text written to the output file

Return type:

str

archmap.make_geojson(parsed_users, output_file='')[source]

This function reads the user data supplied by parsed_users, it then generates GeoJSON output and writes it to output_file.

Parameters:
Returns:

The text written to the output file

Return type:

str

archmap.make_kml(parsed_users, output_file='')[source]

This function reads the user data supplied by parsed_users, it then generates KML output and writes it to output_file.

Parameters:
Returns:

The text written to the output file

Return type:

str

archmap.make_csv(parsed_users, output_file='')[source]

This function reads the user data supplied by parsed_users, it then generates CSV output and writes it to output_file.

Parameters:
Returns:

The text written to the output file

Return type:

str