From d0d7254c6acc7be4341618d231a5b166f640b287 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sun, 14 Jun 2020 17:23:10 -0700 Subject: [PATCH] add docstring --- docs/utils.md | 15 +++++++++++++++ jc/utils.py | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/docs/utils.md b/docs/utils.md index 0baa3879..9e8cb633 100644 --- a/docs/utils.md +++ b/docs/utils.md @@ -48,3 +48,18 @@ Returns: no return, just prints output to STDERR +## has_data +```python +has_data(data) +``` + +Checks if the input contains data. If there are any non-whitespace characters then return True, else return False + +Parameters: + + data: (string) input to check whether it contains data + +Returns: + + Boolean True if input string (data) contains non-whitespace characters, otherwise False + diff --git a/jc/utils.py b/jc/utils.py index 3695a0ee..b5f9a4f0 100644 --- a/jc/utils.py +++ b/jc/utils.py @@ -70,4 +70,15 @@ def compatibility(mod_name, compatible): def has_data(data): + """ + Checks if the input contains data. If there are any non-whitespace characters then return True, else return False + + Parameters: + + data: (string) input to check whether it contains data + + Returns: + + Boolean True if input string (data) contains non-whitespace characters, otherwise False + """ return True if data and not data.isspace() else False