From b360924646a9700d438cba4b3fdc0a2bf94afc32 Mon Sep 17 00:00:00 2001 From: Vardan Petrosyan Date: Wed, 5 Jun 2024 00:30:59 +0400 Subject: [PATCH 1/4] Added `help` function support for modules --- core/datatypes.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/datatypes.py b/core/datatypes.py index e3bbb26..3e92681 100755 --- a/core/datatypes.py +++ b/core/datatypes.py @@ -1455,6 +1455,20 @@ 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 From d926ca34627f2a916f39db7971222b573bf45e48 Mon Sep 17 00:00:00 2001 From: Vardan Petrosyan Date: Wed, 5 Jun 2024 00:34:02 +0400 Subject: [PATCH 2/4] fix ruff format --- core/datatypes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/datatypes.py b/core/datatypes.py index 3e92681..b0cfc6f 100755 --- a/core/datatypes.py +++ b/core/datatypes.py @@ -1460,10 +1460,12 @@ def __help_repr__(self) -> str: 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): + 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" From 1b411a9974046c717cf99c22e594bb737f6d121f Mon Sep 17 00:00:00 2001 From: "Md. Almas Ali" <57622296+Almas-Ali@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:37:48 +0600 Subject: [PATCH 3/4] fix: discord invitation link updated. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From c91e4834201b626007794c90322a70a051e71222 Mon Sep 17 00:00:00 2001 From: "Md. Almas Ali" Date: Wed, 24 Jul 2024 23:22:24 +0600 Subject: [PATCH 4/4] fixes: make format (ruff). --- test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.py b/test.py index ff3f4b8..0c18ebe 100755 --- a/test.py +++ b/test.py @@ -85,7 +85,7 @@ def run_tests(directory: str = "tests") -> int: return 1 -def record_tests(directory: str ="tests") -> int: +def record_tests(directory: str = "tests") -> int: for test in os.listdir(directory): if not test.endswith(".rn"): continue