Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Return the docstring for the given node or None if no docstring can
be found.  If the node provided does not have docstrings a TypeError
will be raised.

        def get_docstring(node, clean=True):
    """
    Return the docstring for the given node or None if no docstring can
    be found.  If the node provided does not have docstrings a TypeError
    will be raised.
    """
    if not isinstance(node, (FunctionDef, ClassDef, Module)):
        raise TypeError("%r can't have docstrings" % node.__class__.__name__)
    if node.body and isinstance(node.body[0], Expr) and \
       isinstance(node.body[0].value, Str):
        if clean:
            import inspect
            return inspect.cleandoc(node.body[0].value.s)
        return node.body[0].value.s
        


src/i/n/instrumental-0.5.1/instrumental/instrument.py   instrumental(Download)
def has_docstring(defn):
    return ast.get_docstring(defn) is not None
 
def has_future_import(module):
    if not module.body:

src/i/n/instrumental-0.5.1/instrumental/metadata.py   instrumental(Download)
def has_docstring(defn):
    return ast.get_docstring(defn) is not None
 
def gather_metadata(config, recorder, targets, ignores):
    finder = SourceFinder(sys.path)

src/a/s/astkit-0.5.4/astkit/render.py   astkit(Download)
    def _maybe_render_docstring(self, node):
        """ Render the node's docstring, if present """
        docstring = ast.get_docstring(node)
        if docstring:
            self.emit('""" ' + docstring + '\n"""')

src/i/n/instrumental-0.5.1/instrumental/test/test_instrument_nodes.py   instrumental(Download)
                return 'else'
        inst_module = self._instrument_module(test_module)
        assert ast.get_docstring(inst_module)
        self._assert_recorder_setup(inst_module, 1)