Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 committed Oct 6, 2024
1 parent 19474c6 commit 4728d17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion ccprompt/parser_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .parsers.python_parser import PythonParser
from .parsers.javascript_parser import JavaScriptParser


class ParserFactory:
@staticmethod
def get_parser(language, logger=None):
Expand All @@ -24,4 +25,4 @@ def get_parser(language, logger=None):
print(e)
sys.exit(1)
else:
raise ValueError(f"Unsupported language: {language}")
raise ValueError(f"Unsupported language: {language}")
12 changes: 7 additions & 5 deletions ccprompt/parsers/python_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def get_module_name(self, file_path, project_path):
module_parts = relative_path.with_suffix("").parts
return ".".join(module_parts)

def get_object_source_and_inheritance(self, target_name, visited_classes, directories, index):
def get_object_source_and_inheritance(
self, target_name, visited_classes, directories, index
):
source_codes = []

# Ensure the directories are in sys.path
Expand Down Expand Up @@ -86,12 +88,12 @@ def get_object_source_and_inheritance(self, target_name, visited_classes, direct
self.process_class(obj, visited_classes, directories)
)
elif inspect.isfunction(obj) or inspect.ismethod(obj):
source_codes.extend(
self.process_function(obj)
)
source_codes.extend(self.process_function(obj))
else:
if self.logger:
self.logger.warning(f"Object '{target_name}' is neither a class nor a function.")
self.logger.warning(
f"Object '{target_name}' is neither a class nor a function."
)
return source_codes

def process_class(self, obj, visited_classes, directories):
Expand Down
3 changes: 2 additions & 1 deletion ccprompt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@


def time_it(func):
""" Decorator to measure the time taken for a function to execute. """
"""Decorator to measure the time taken for a function to execute."""

def wrapper(*args, **kwargs):
start_time = time.time()
result = func(*args, **kwargs)
Expand Down

0 comments on commit 4728d17

Please sign in to comment.