Skip to content

Commit

Permalink
Add docstrings to __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
btorresgil committed Mar 17, 2016
1 parent d8e2d67 commit c1261fc
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion pandevice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

# Author: Brian Torres-Gil <btorres-gil@paloaltonetworks.com>

"""pandevice library is a framework for interacting with Palo Alto Networks devices
Documentation available at http://pandevice.readthedocs.org
"""

__author__ = 'Brian Torres-Gil'
__email__ = 'btorres-gil@paloaltonetworks.com'
Expand Down Expand Up @@ -113,7 +118,15 @@ def string_or_list(value):


def convert_if_int(string):
"""Convert a string to an int, only if it is an int"""
"""Convert a string to an int, only if it is an int
Args:
string (str): The string to convert if it's an integer
Returns:
int or str of the original value, dependin if it could be converted to an int
"""
try:
integer = int(string)
return integer
Expand All @@ -131,6 +144,7 @@ def xml_combine(root, elements):
root (Element): The Element that will contain the merger
elements (Element or list): If an Element, merge all subelements of this element into root.
If a list, merge all Elements in the list into root.
"""
for element in elements:
found_element = root.find(element.tag)
Expand All @@ -141,6 +155,15 @@ def xml_combine(root, elements):


def yesno(value):
"""Convert 'yes' or 'no' to True or False
Args:
value (str): The string containing 'yes' or 'no'
Returns:
bool: True if value is 'yes', False if value is 'no'
"""
if value is None:
return
convert = {
Expand Down

0 comments on commit c1261fc

Please sign in to comment.