# Path: birdy/utils.py
# def is_file(path):
#     """Return True if `path` is a valid file."""
#     if not path:
#         ok = False
#     elif isinstance(path, Path):
#         p = path
#     else:
#         p = Path(path[:255])
#     try:
#         ok = p.is_file()
#     except Exception:
#         ok = False
#     return ok
# 
# def sanitize(name):
#     """Lower-case name and replace all non-ascii chars by `_`.
# 
#     If name is a Python keyword (like `return`) then add a trailing `_`.
#     """
#     new_name = re.sub(r"\W|^(?=\d)", "_", name.lower())
#     if keyword.iskeyword(new_name):
#         new_name = new_name + "_"
#     return new_name


import datetime as dt
import dateutil.parser
from pathlib import Path
from urllib.parse import urlparse
from owslib.wps import ComplexDataInput
from ..utils import is_file, sanitize
        doc.append("")

    if not processes:
        doc.append("There aren't any available processes.")

    doc.append("\n")

    return "\n".join(doc)


def build_process_doc(process):
    """Create docstring from process metadata."""
    doc = [process.abstract or "", ""]

    # Inputs
    if process.dataInputs:
        doc.append("Parameters")
        doc.append("----------")
        for i in process.dataInputs:
            doc.append("{} : {}".format(sanitize(i.identifier), format_type(i)))
            doc.append("    {}".format(i.abstract or i.title))
            # if i.metadata:
            #    doc[-1] += " ({})".format(', '.join(['`{} <{}>`_'.format(m.title, m.href) for m in i.metadata]))
        doc.append("")

    # Outputs
    if process.processOutputs:
        doc.append("Returns")
        doc.append("-------")
        for i in process.processOutputs:

# Path: birdy/utils.py
# def is_file(path):
#     """Return True if `path` is a valid file."""
#     if not path:
#         ok = False
#     elif isinstance(path, Path):
#         p = path
#     else:
#         p = Path(path[:255])
#     try:
#         ok = p.is_file()
#     except Exception:
#         ok = False
#     return ok
# 
# def sanitize(name):
#     """Lower-case name and replace all non-ascii chars by `_`.
# 
#     If name is a Python keyword (like `return`) then add a trailing `_`.
#     """
#     new_name = re.sub(r"\W|^(?=\d)", "_", name.lower())
#     if keyword.iskeyword(new_name):
#         new_name = new_name + "_"
#     return new_name


# Path: birdy/client/utils.py
import datetime as dt
import dateutil.parser
from pathlib import Path
from urllib.parse import urlparse
from owslib.wps import ComplexDataInput
from ..utils import is_file, sanitize

        doc.append("")

    if not processes:
        doc.append("There aren't any available processes.")

    doc.append("\n")

    return "\n".join(doc)


def build_process_doc(process):
    """Create docstring from process metadata."""
    doc = [process.abstract or "", ""]

    # Inputs
    if process.dataInputs:
        doc.append("Parameters")
        doc.append("----------")
        for i in process.dataInputs:
            doc.append("{} : {}".format(sanitize(i.identifier), format_type(i)))
            doc.append("    {}".format(i.abstract or i.title))
            # if i.metadata:
            #    doc[-1] += " ({})".format(', '.join(['`{} <{}>`_'.format(m.title, m.href) for m in i.metadata]))
        doc.append("")

    # Outputs
    if process.processOutputs:
        doc.append("Returns")
        doc.append("-------")
        for i in process.processOutputs:

            doc.append("{} : {}".format(sanitize(i.identifier), format_type(i)))