Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
activator.py51 linesDownload Raw Back to activation
1from __future__ import annotations2 3import os4from abc import ABC, abstractmethod5 6 7class Activator(ABC):8    """Generates activate script for the virtual environment."""9 10    def __init__(self, options) -> None:11        """12        Create a new activator generator.13 14        :param options: the parsed options as defined within :meth:`add_parser_arguments`15        """16        self.flag_prompt = os.path.basename(os.getcwd()) if options.prompt == "." else options.prompt17 18    @classmethod19    def supports(cls, interpreter):  # noqa: ARG00320        """21        Check if the activation script is supported in the given interpreter.22 23        :param interpreter: the interpreter we need to support24        :return: ``True`` if supported, ``False`` otherwise25        """26        return True27 28    @classmethod  # noqa: B02729    def add_parser_arguments(cls, parser, interpreter):30        """31        Add CLI arguments for this activation script.32 33        :param parser: the CLI parser34        :param interpreter: the interpreter this virtual environment is based of35        """36 37    @abstractmethod38    def generate(self, creator):39        """40        Generate activate script for the given creator.41 42        :param creator: the creator (based of :class:`virtualenv.create.creator.Creator`) we used to create this \43        virtual environment44        """45        raise NotImplementedError46 47 48__all__ = [49    "Activator",50]51 
codekingpro/portable-devtools · Team Ai