A package for validating formats and handling files.
Project description
flatwhite
Overview
This project contains several modules designed to handle tasks such as file handling, format validation, and project structure creation. Below is a detailed description of each module and their respective functions.
Modules and Functions
file_handler.py
This module provides functions to manage files, including organizing and deleting them based on file types or extensions.
-
handle_files(directory, action='organize', types=None, additional_ext=None)- Description: Organizes or deletes files in a directory based on their types or additional extensions.
- Parameters:
directory (str): Path of the directory to process.action (str): Action to perform ('organize' or 'delete'). Default is 'organize'.types (list): List of file types to organize or delete (e.g.,['pics', 'sounds', 'docs']).additional_ext (str): Additional file extensions to include, provided as a comma-separated string.
- Returns: None.
-
list_directory_structure(root_dir, indent_level=0)- Description: Recursively lists the directory structure starting from the root directory.
- Parameters:
root_dir (str): The root directory to start listing from.indent_level (int): The current indentation level for pretty printing. Default is 0.
- Returns: None.
format_validator.py
This module contains a function to validate different formats such as email, phone number, password, and custom regex patterns.
validate_input(input_value, validate_type, regex_pattern=None)- Description: Validates an input based on the specified type (email, phone, password, or custom regex).
- Parameters:
input_value (str): The input to validate.validate_type (str): The type of validation ('email', 'phone', 'password', 'regex').regex_pattern (str): Custom regex pattern to use ifvalidate_typeis 'regex'.
- Returns:
bool: ReturnsTrueif valid, otherwiseFalse.
project_structure.py
This module helps in creating basic project folder structures based on project type.
create_project_structure(project_type='web')- Description: Creates a basic folder and file structure for a web project.
- Parameters:
project_type (str): The type of project. Default is 'web'.
- Returns: None.
Usage
Here are examples showing how to use the modules and their respective functions.
from flatwhite import create_project_structure, validate_input, handle_files
# Example usage for creating a web project structure
create_project_structure('web')
# Example usage for validating an email
is_valid_email = validate_input('example@example.com', validate_type='email')
# Example usage for organizing files in a directory
handle_files('/path/to/directory', action='organize', types=['pics', 'docs'])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flatwhite-0.4.0-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 9adfeb80fd1d66cf41a58518670837333f82d4ab2840400c32b642bafd3a0594 |
|
| MD5 | 510979de8f89703795e3f3b1923e3c0b |
|
| BLAKE2b-256 | b3b7ac4b3900ede81bacb40c13c260464394c3dbe1cfac2526cfde5a3c7b849c |