Skip to main content

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 if validate_type is 'regex'.
    • Returns: bool: Returns True if valid, otherwise False.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flatwhite-0.4.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flatwhite-0.4.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file flatwhite-0.4.0.tar.gz.

File metadata

  • Download URL: flatwhite-0.4.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for flatwhite-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4e1efc176e81f6f526d0264789f558172542c8ee7f26673e79a356813713826c
MD5 ef9c15cbeccd80e0b870a281815f99da
BLAKE2b-256 b616d43a171f88f431c0f6461edb05095c4e35cd72f0b2b2d88d4847d6a07b28

See more details on using hashes here.

File details

Details for the file flatwhite-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: flatwhite-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for flatwhite-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9adfeb80fd1d66cf41a58518670837333f82d4ab2840400c32b642bafd3a0594
MD5 510979de8f89703795e3f3b1923e3c0b
BLAKE2b-256 b3b7ac4b3900ede81bacb40c13c260464394c3dbe1cfac2526cfde5a3c7b849c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page