From 7748b4b142a7b00a1606e3eaa98e3c7d5691db9e Mon Sep 17 00:00:00 2001 From: Tasha Upchurch Date: Fri, 7 Jul 2023 02:25:43 -0400 Subject: [PATCH] Added INPUT_TYPES class method to PublicGitRepo class to define required input types for the function, and modified validate_git_repo_url function to accept keyword arguments and return the git_url. --- git.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/git.py b/git.py index c0fdf44..daa3440 100644 --- a/git.py +++ b/git.py @@ -3,18 +3,21 @@ import giturlparse class PublicGitRepo: """replaces the text in the given text string with a given other text at some key positions""" + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "url": ("STRING", {"multiline": False}), # Added url input + "email": ("STRING", {"multiline": False}) # Added email input + } + } + CATEGORY = "text" RETURN_TYPES = ("STRING",) FUNCTION = "validate_git_repo_url" - def validate_git_repo_url(self, text: str, replacement, key1, **kwargs): - """ - >>> PublicGitRepo().validate_git_repo_url("hello world", "universe", "world", git_url="https://github.com/example/repo.git") - 'hello universe' - """ - git_url = kwargs.get("git_url") + def validate_git_repo_url(self,**kwargs): + git_url = kwargs.get("url", None) parsed_url = giturlparse.parse(git_url) - if not parsed_url.valid: - raise ValueError("Invalid Git repository URL") - return (text.replace(key1, replacement),) + return (git_url,)