Check whether the source *src* contains the docstring *doc*. This is is helper function to skip displaying the docstring if the source already contains it, avoiding repetition of information.
(src, doc)
| 906 | |
| 907 | @staticmethod |
| 908 | def _source_contains_docstring(src, doc): |
| 909 | """ |
| 910 | Check whether the source *src* contains the docstring *doc*. |
| 911 | |
| 912 | This is is helper function to skip displaying the docstring if the |
| 913 | source already contains it, avoiding repetition of information. |
| 914 | """ |
| 915 | try: |
| 916 | def_node, = ast.parse(dedent(src)).body |
| 917 | return ast.get_docstring(def_node) == doc |
| 918 | except Exception: |
| 919 | # The source can become invalid or even non-existent (because it |
| 920 | # is re-fetched from the source file) so the above code fail in |
| 921 | # arbitrary ways. |
| 922 | return False |
| 923 | |
| 924 | def psearch(self,pattern,ns_table,ns_search=[], |
| 925 | ignore_case=False,show_all=False, *, list_types=False): |