Skip to content

Commit

Permalink
Fix a few more lint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaak-Malers committed Feb 22, 2024
1 parent 8cb925a commit aa4f4e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CliFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,18 @@ def execute(self, *, args: [str]) -> bool:
return False

def has_target(self, to_add):
"""
Returns true if the current object already has a function named similarly as 'to_add'
"""
for function in self.targets:
if function.__name__ == to_add.__name__:
return True
return False

def add_target(self, to_add):
"""
Tries to add a target to this object. Fails out if there is a problem or if the target to add isn't sufficiently annotated.
"""
for func in self.targets:
if func.__name__ == to_add.__name__:
raise FunctionCliException(f"duplicate target names: {func.__name__}")
Expand All @@ -207,6 +213,7 @@ def add_target(self, to_add):

def function_help(self, func, pad: str = "") -> str:
header = f"{pad}{func.__name__} -- {func.__doc__.strip()}"
# pylint: disable=unused-variable
names, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations = inspect.getfullargspec(func)
if kwonlydefaults is None:
kwonlydefaults = {}
Expand Down

0 comments on commit aa4f4e0

Please sign in to comment.