예제 #1
0
 def _reportParseFailure(self, topic):
     topic = topic.replace(newline, " ").replace(creturn, " ").strip()
     pm.warn(
         msg="Failed to parse the record \"" + topic + "\". " +
         "The structure of the report file appears to have been compromised. skipping... ",
         methodName=self._methodName,
         marginTop=0,
         marginBot=0)
예제 #2
0
def helpme(topic: _tp.Optional[str] = None):
    """

    .. py:function:: helpme(topic = None)

    Prints help on the input object.

        **Parameters**

            topic
                A string value that is the name of an object in ``paramonte``
                module for which help is needed. To see the list of possible
                objects. try: ``pm.helpme("helpme")``

        **Returns**

            None

    """

    topics = {
        "paradram": ParaDRAM,
        "version": version,
        "verify": verify,
        "helpme": helpme,
        "build": build
    }

    usage   = "    Usage:\n\n" \
            + "        import paramonte as pm\n" \
            + "        pm.helpme()      # to get help on paramonte module.\n" \
            + "        pm.helpme(topic) # to get help on topic.\n\n" \
            + "    where `topic` in the above can be one of the following string values:\n\n" \
            + "        " + str(list(topics.keys()))

    if topic is None:
        print(__doc__)
    elif isinstance(topic, str) and (topic.lower() in topics.keys()):
        print(topics[topic.lower()].__doc__ + "\n")
        if topic.lower() == "helpme":
            _pm.note(msg=usage,
                     methodName="helpme()",
                     marginTop=0,
                     marginBot=1)
    else:
        try:
            topic = "(" + str(topic) + ") "
        except:
            topic = ""
        _pm.warn(msg="The requested object " + topic +
                 "does not exist in paramonte module.\n\n" + usage,
                 methodName="helpme()",
                 marginTop=1,
                 marginBot=1)

    return None