Import Flights Tool¶
Implementation of the import-flights tool contained in sk.py.
-
class
pysk.tools.ImportFlights(parent)¶ Import flights from csv file
Parameters: parent (object) – Parent tool object -
createFlights(records)¶ Add flights to database
Iterates over all records and extracts the flights which are going to be added to the database. If a flight to be added is simlar to an existing flight, one of the following actions will be taken depending on the mode setting:
- If mode is ‘ignore’, the existing flights are kept and the new flight is ignored
- If mode is ‘interactive’, the user is promted for an action for each collision. This is the default.
- If mode is ‘replace’, existing flights are overwritten
Parameters: records (iterable) – Input records
-
db()¶ Access to parent database
Returns: self.parent.db
-
static
defaultConfiguration(config=Namespace(debug=False, force=False, logStream=<open file '<stderr>', mode 'w' at 0x7f9974baa1e0>, parseCommandLine=True, verbose=1))¶ Get Default Configuration Options
Parameters: - config (object) – Input configuration. Existing attributes will be
- overwritten. –
Returns: Default configuration object
-
importAliases(path)¶ Read alias names for planes, pilots or launch methods from file
TODO: Should be replaced by a general ini parser in utils Aliases are stored in dictionary
self.aliases[<string>]. The expected format is ASCII with one header followed by a number of key value pairs in the form[<category>] <key>: <alias> <key>: <alias> ...
<category>can be any field specified inself.aliases. If<key>is a person’s name, it should be provided in the form<last_name>, <first_name>.Parameters: path (str) – Path to text file containing aliases
-
importCsv(path)¶ Import records from csv file
Parameters: path (str) – Path to input file Returns: Iterable of imported records
-
msg(message)¶ Print message to standard out
Parameters: message (str) – Message to print
-