diff --git a/README.md b/README.md index fefc39c..9641bbd 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ![GitHub Workflow Status](https://github.com/radon-project/radon/actions/workflows/ci.yaml/badge.svg "GitHub Workflow Status") ![GitHub license](https://img.shields.io/github/license/radon-project/radon?style=flat "License") ![Total hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fradon-project%2Fradon&count_bg=%2352B308&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false "Total hits") -[![Discord](https://img.shields.io/discord/1137834560290308306?style=flat&logo=discord&logoColor=%235865F2&label=join&link=https%3A%2F%2Fdiscord.gg%2Fy2x4CSX7DM "Discord")](https://discord.gg/y2x4CSX7DM) +[![Discord](https://img.shields.io/discord/1137834560290308306?style=flat&logo=discord&logoColor=%235865F2&label=join&link=https%3A%2F%2Fdiscord.gg%2FnNkQKfcxqa "Discord")](https://discord.com/invite/nNkQKfcxqa) diff --git a/core/datatypes.py b/core/datatypes.py index 0da6107..a14978a 100755 --- a/core/datatypes.py +++ b/core/datatypes.py @@ -1470,6 +1470,22 @@ class Module(Value): file_path: str symbol_table: SymbolTable + def __help_repr__(self) -> str: + result: str = f"Help on object {self.name}:\n\nmodule {self.name}\n|\n" + for k in self.symbol_table.symbols: + f = self.symbol_table.symbols[k] + + if (type(f).__name__ == "BuiltInClass") or (type(f).__name__ == "BuiltInFunction"): + continue + if k == "null" or k == "false" or k == "true": + continue + + if isinstance(f, Function): + result += f.__help_repr_method__() + elif isinstance(f, Value): + result += f"| {k} = {f!r}\n|\n" + return result + def __init__(self, name: str, file_path: str, symbol_table: SymbolTable) -> None: super().__init__() self.name = name