#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # @Version : Python 3.11.4 # @Software : Sublime Text 4 # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/3 19:58 # @File : file.py # @Description : """ class FileHelper: """ FileHelper is a utility class that provides file-related operations. Currently, it only provides a method to get the configuration file name based on the environment. """ @classmethod def get_filename(cls, env: str) -> str: """ Get the configuration file name based on the environment. :param env: a string representing the environment. It should be 'PRODUCTION' or None. :return: a string representing the configuration file name. If env is 'PRODUCTION', return 'production_config.yaml'. Otherwise, return 'config.yaml'. """ if env == 'PRODUCTION': return f'{env.lower()}_config.yaml' else: return 'config.yaml' def __repr__(self): """ Return a string representing a valid Python expression that could be used to recreate the FileHelper object. """ return "FileHelper()" def __str__(self): """ Return a human-readable string representation of the FileHelper object. """ return "This is a FileHelper class that helps with file related operations."