ctyparser

A CTY.DAT parser for modern amateur radio programs.

Installation

ctyparser requires Python 3.6 at minimum. Install by running:

$ pip install ctyparser

License

Copyright 2019-2020 classabbyamp, 0x5c

Released under the MIT License. See LICENSE for the full license text.

API

class ctyparser.BigCty(file_path: Union[str, os.PathLike, None] = None)

Class representing a BigCTY dataset. Can be initialised with data by passing the path to a valid cty.json file to the constructor.

Parameters:file_path (str or os.PathLike, optional) – Location of the cty.json file to load.
Variables:version (str) – the datestamp of the data, YYYYMMDD format.
dump(cty_file: Union[str, os.PathLike]) → None

Dumps the data of the instance to a cty.json file.

Parameters:cty_file (str or os.PathLike) – Path to the file to dump to.
Returns:None
formatted_version

Formatted representation of the version/date of the current BigCTY data.

Getter:Returns version in YYYY-MM-DD format, or 0000-00-00 (if invalid date)
Type:str
import_dat(dat_file: Union[str, os.PathLike]) → None

Imports CTY data from a CTY.DAT file.

Parameters:dat_file (str or os.PathLike) – Path to the file to import.
Returns:None
load(cty_file: Union[str, os.PathLike]) → None

Loads a cty.json file into the instance.

Parameters:cty_file (str or os.PathLike) – Path to the file to load.
Returns:None
update() → bool

Upates the instance’s data from the feed.

Raises:Exception – If there is no date in the feed.
Returns:True if an update was done, otherwise False.
Return type:bool
version

The version/date of the current BigCTY data.

Getter:Returns version in YYYYMMDD format
Type:str

CLI Usage

Note

CLI is a work in progress!

Currently, only updating/creating a file named cty.json in the current working directory is supported:

$ python3 -m ctyparser