From 3075c5511d4f60061d3be2564bc3c37c336812a6 Mon Sep 17 00:00:00 2001 From: Khushiyant Date: Tue, 30 Jan 2024 20:41:54 +0530 Subject: [PATCH] docs: add docstring--enums --- quasar/__init__.py | 3 +-- quasar/algorithm/detector.py | 4 ++-- quasar/cli/__init__.py | 4 ++-- quasar/types.py | 10 ++++++++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/quasar/__init__.py b/quasar/__init__.py index cfbec48..5671c8f 100644 --- a/quasar/__init__.py +++ b/quasar/__init__.py @@ -4,13 +4,12 @@ from logging import ERROR, INFO, DEBUG -load_dotenv() +load_dotenv() # Load environment variables from .env file __version__ = '0.1.0' def main(): - import sys from quasar.cli import logger, cli try: diff --git a/quasar/algorithm/detector.py b/quasar/algorithm/detector.py index 8a0dbb5..a08d2b9 100644 --- a/quasar/algorithm/detector.py +++ b/quasar/algorithm/detector.py @@ -57,7 +57,7 @@ def _detect(self, data, model_type): return self.class_model.predict(data)[0] -def detect_smell(data, detector: Detector, model_type: str): +def detect_smell(data, detector: Detector, model_type: str) -> int: """ Detects smell in the given data using the specified detector and model type. @@ -67,7 +67,7 @@ def detect_smell(data, detector: Detector, model_type: str): model_type: The type of model used for smell detection. Returns: - The result of smell detection. + The result of smell detection (int). """ return detector._detect(data, model_type) diff --git a/quasar/cli/__init__.py b/quasar/cli/__init__.py index 280561f..6d3a88e 100644 --- a/quasar/cli/__init__.py +++ b/quasar/cli/__init__.py @@ -21,7 +21,7 @@ def get_help(self, ctx): @click.group(name='cli', cls=ASCIICommandClass) @click.version_option(__version__, prog_name='Quasar') @click.help_option('-h', '--help') -def cli(): +def cli() -> None: pass @@ -39,7 +39,7 @@ def train_model(type, dataset, output): @click.option('--path', '-p') @click.option('--format', '-f', type=click.Choice([t.value for t in FormatterType])) -def detect(type, path, format): +def detect(type, path, format) -> None: """ Detects the specified type of object in the given path and formats the output. diff --git a/quasar/types.py b/quasar/types.py index 7b793e9..8185643 100644 --- a/quasar/types.py +++ b/quasar/types.py @@ -2,15 +2,25 @@ class ModelType(Enum): + """ + Enum representing different types of models. + """ CLASS = 'CLASS' METHOD = 'METHOD' class SmellType(Enum): + """ + Enumeration representing different types of smells. + """ CLASS = 'CLASS' METHOD = 'METHOD' class FormatterType(Enum): + """ + Represents the available formatter types for data serialization. + """ + JSON = 'JSON' XML = 'XML'