From b42f0e36a5f231763fd8879c3e50f2e83ca000c4 Mon Sep 17 00:00:00 2001 From: mikeqfu Date: Mon, 9 Nov 2020 20:17:37 +0000 Subject: [PATCH] add print_conn_err() to utils.py --- pyrcs/utils.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pyrcs/utils.py b/pyrcs/utils.py index 1b84967..245d919 100644 --- a/pyrcs/utils.py +++ b/pyrcs/utils.py @@ -1203,6 +1203,26 @@ def print_connection_error(verbose=False): "The current instance relies on local backup.") +def print_conn_err(update=False, verbose=False): + """ + Print a message about unsuccessful attempts to establish a connection to the Internet + for an instance of a class. + + :param update: defaults to ``False`` + (mostly complies with ``update`` in a parent function that uses this function) + :type update: bool + :param verbose: whether to print relevant information in console as the function runs, + defaults to ``False`` + :type verbose: bool or int + """ + + msg = "The Internet connection is not available." + if update and verbose: + print(msg + " Failed to update the data.") + elif verbose: + print(msg) + + def is_str_float(str_val): """ Check if a string-type variable can express a float-type value.