This class indicates that the object is defined in a regular python file. This can be used for the `defined_in` slot of the `PageInfo` objects.
| 1578 | |
| 1579 | |
| 1580 | class _PythonFile(object): |
| 1581 | """This class indicates that the object is defined in a regular python file. |
| 1582 | |
| 1583 | This can be used for the `defined_in` slot of the `PageInfo` objects. |
| 1584 | """ |
| 1585 | |
| 1586 | def __init__(self, path, parser_config): |
| 1587 | self.path = path |
| 1588 | self.path_prefix = parser_config.defined_in_prefix |
| 1589 | self.code_url_prefix = parser_config.code_url_prefix |
| 1590 | |
| 1591 | def is_builtin(self): |
| 1592 | return False |
| 1593 | |
| 1594 | def is_python_file(self): |
| 1595 | return True |
| 1596 | |
| 1597 | def is_generated_file(self): |
| 1598 | return False |
| 1599 | |
| 1600 | def __str__(self): |
| 1601 | return 'Defined in [`{prefix}{path}`]({code_prefix}{path}).\n\n'.format( |
| 1602 | path=self.path, prefix=self.path_prefix, |
| 1603 | code_prefix=self.code_url_prefix) |
| 1604 | |
| 1605 | |
| 1606 | class _ProtoFile(object): |