(self)
Initialize the plugin reading settings from the config.
Initialize the plugin reading settings from the config.
Initialize the plugin reading settings from the config .
def initialize_plugin(self) -> None:
        """
        Initialize the plugin reading settings from the config.
        """
        if not self.initialized:
            try:
                human_package_size = self.configuration["size_project_metadata"][
                    "max_package_size"
                ]
            except KeyError:
                logger.warning(
                    f"Unable to initialise {self.name} plugin;"
                    f"must create max_package_size in configuration."
                )
                return
            try:
                self.max_package_size = parse_size(human_package_size, binary=True)
            except InvalidSize:
                logger.warning(
                    f"Unable to initialise {self.name} plugin;"
                    f'max_package_size of "{human_package_size}" is not valid.'
                )
                return
            if self.max_package_size > 0:
                if not self.allowlist_package_names:
                    self.allowlist_package_names = (
                        self._determine_unfiltered_package_names()
                    )

                log_msg = (
                    f"Initialized metadata plugin {self.name} to block projects "
                    + f"> {self.max_package_size} bytes"
                )
                if self.allowlist_package_names:
                    log_msg += (
                        "; except packages in the allowlist: "
                        + f"{self.allowlist_package_names}"
                    )
                logger.info(log_msg)

            self.initialized = True
def initialize_plugin ( self ) -> None : if not self . initialized : try : human_package_size = self . configuration [ "size_project_metadata" ] [ "max_package_size" ] except KeyError : logger . warning ( f"Unable to initialise {self.name} plugin;" f"must create max_package_size in configuration." ) return try : self . max_package_size = parse_size ( human_package_size , binary = True ) except InvalidSize : logger . warning ( f"Unable to initialise {self.name} plugin;" f'max_package_size of "{human_package_size}" is not valid.' ) return if self . max_package_size > 0 : if not self . allowlist_package_names : self . allowlist_package_names = ( self . _determine_unfiltered_package_names ( ) ) log_msg = ( f"Initialized metadata plugin {self.name} to block projects " + f"> {self.max_package_size} bytes" ) if self . allowlist_package_names : log_msg += ( "; except packages in the allowlist: " + f"{self.allowlist_package_names}" ) logger . info ( log_msg ) self . initialized = True