Skip to content

Commit

Permalink
Merge pull request #32 from patiltrupti6105/docs
Browse files Browse the repository at this point in the history
Documentation files added to all packages in pysnippets
  • Loading branch information
UTSAVS26 authored Oct 6, 2024
2 parents 4853a05 + b7829e5 commit dc85dff
Show file tree
Hide file tree
Showing 6 changed files with 556 additions and 0 deletions.
65 changes: 65 additions & 0 deletions pysnippets/FileOrganizer/Oragnizer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# File Organizer - PySnippets

Welcome to the **File Organizer** module! This module provides functionality to organize files within a specified folder based on their file types. It helps in keeping your folders tidy and makes it easier to manage files.

## Table of Contents

- [Introduction](#introduction)
- [Functionality](#functionality)
- [Organize Files by Type](#organize-files-by-type)
- [Error Handling](#error-handling)
- [Usage Example](#usage-example)

---

## Introduction

The **File Organizer** module is designed to categorize files into subfolders based on their extensions. It can categorize files into different types such as images, documents, videos, music, archives, scripts, fonts, and system files. This allows users to maintain a cleaner and more organized file structure.

---

## Functionality

### Organize Files by Type

This function organizes files in the specified folder by type. It creates subfolders for each file category and moves the files into their respective folders based on their extensions.

```python
organize_files_by_type(folder_path)
```

- **Args**:
- `folder_path` (str): The path to the folder to organize.
- **Returns**: None.
- **Example**:
If you have a folder with mixed files like images, documents, and videos, this function will move them into subfolders named 'Images', 'Documents', 'Videos', etc., according to their file types.

---

## Error Handling

The function includes error handling to manage invalid paths. If the specified `folder_path` does not exist, a `ValueError` will be raised.

- **Raises**:
- `ValueError`: If the `folder_path` does not exist.

---

## Usage Example

To use the file organizing functionality, simply call the function by providing the path to your target folder:

```python
if __name__ == "__main__":
folder_to_organize = r"path_to_the_folder" # Replace with the actual folder path
try:
organize_files_by_type(folder_to_organize)
except ValueError as e:
print(e)
```

Replace `path_to_the_folder` with the path to the folder containing the files you want to organize. The function will then move files into categorized subfolders accordingly.

---

Feel free to reach out if you have any questions about how to use the File Organizer module!
56 changes: 56 additions & 0 deletions pysnippets/Files/reader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# File Reader - PySnippets

Welcome to the **File Reader** module! This simple module provides functionality to read and retrieve the contents of text files. It's useful for quickly accessing text data in your applications.

## Table of Contents

- [Introduction](#introduction)
- [Functionality](#functionality)
- [Read File](#read-file)
- [Usage Example](#usage-example)

---

## Introduction

The **File Reader** module allows users to read the contents of text files easily. This functionality is essential for applications that need to extract data from files or display file content to users.

---

## Functionality

### Read File

This function reads the contents of a specified text file and returns it as a string.

```python
read_file(file_path)
```

- **Args**:
- `file_path` (str): The path to the file you want to read.
- **Returns**:
- `str`: The contents of the file as a string.
- **Example**:
```python
>>> read_file('example.txt')
'File contents here...'
```

---

## Usage Example

To use the file reading functionality, simply call the `read_file` function with the path to the text file you want to read:

```python
if __name__ == "__main__":
content = read_file("example.txt")
print(content)
```

Make sure to replace `"example.txt"` with the actual path to your target text file. The function will read the file's content and print it to the console.

---

Feel free to reach out if you have any questions about how to use the File Reader module!
131 changes: 131 additions & 0 deletions pysnippets/Mathematics/mathematics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Mathematics - PySnippets

Wellcome To PySnippet's Mathematics Module Section, This Section Contains The Documatation Of Each And Every Function That Is Available In The Mathematics Module.

## Table of Contents

- [Introduction](#introduction)
- [Matrix Operations](#matrix-operations)
- [Matrix Addition](#matrix-addition)
- [Matrix Multiplication](#matrix-multiplication)
- [Matrix Transpose](#matrix-transpose)
- [Determinant](#determinant)
- [Determinant of a Matrix](#determinant-of-a-matrix)
- [Complex Numbers](#complex-numbers)
- [Complex Addition](#complex-addition)
- [Complex Conjugate](#complex-conjugate)

---

## Introduction

The **Mathematics Module** simplifies the handling of matrix operations and complex numbers. It is designed to be easy to use with clean syntax and built-in error handling for invalid inputs.

---

## Matrix Operations

### Matrix Addition

Performs element-wise addition of two matrices.

```python
matrix_addition(matrix_a, matrix_b)
```

- **Args**: Two matrices `matrix_a` and `matrix_b`.
- **Returns**: The resulting matrix after addition.
- **Example**:
```python
>>> matrix_addition([[1, 2], [3, 4]], [[5, 6], [7, 8]])
[[6, 8], [10, 12]]
```

### Matrix Multiplication

Multiplies two matrices using matrix multiplication rules.

```python
matrix_multiplication(matrix_a, matrix_b)
```

- **Args**: Two matrices `matrix_a` and `matrix_b`.
- **Returns**: The product matrix.
- **Example**:
```python
>>> matrix_multiplication([[1, 2], [3, 4]], [[5, 6], [7, 8]])
[[19, 22], [43, 50]]
```

### Matrix Transpose

Calculates the transpose of a given matrix.

```python
transpose(matrix)
```

- **Args**: A matrix `matrix`.
- **Returns**: The transposed matrix.
- **Example**:
```python
>>> transpose([[1, 2], [3, 4]])
[[1, 3], [2, 4]]
```

---
## Determinant

### Determinant of a Matrix

Calculates the determinant of a square matrix.

```python
determinant(matrix)
```

- **Args**: A square matrix `matrix`.
- **Returns**: The determinant of the matrix.
- **Example**:
```python
>>> determinant([[1, 2], [3, 4]])
-2
```

---

## Complex Numbers

### Complex Addition

Adds two complex numbers.

```python
complex_addition(complex_a, complex_b)
```

- **Args**: Two complex numbers `complex_a` and `complex_b`.
- **Returns**: The sum of the complex numbers.
- **Example**:
```python
>>> complex_addition(1 + 2j, 3 + 4j)
(4+6j)
```

### Complex Conjugate

Finds the conjugate of a complex number.

```python
complex_conjugate(complex_number)
```

- **Args**: A complex number `complex_number`.
- **Returns**: The conjugate of the complex number.
- **Example**:
```python
>>> complex_conjugate(3 + 4j)
(3-4j)
```

---
47 changes: 47 additions & 0 deletions pysnippets/Numbers/numbers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Number Formatting - PySnippets

Welcome to the **Number Formatting** module! This lightweight utility provides functionality to format numbers by adding commas as thousand separators, making large numbers easier to read.

## Table of Contents

- [Introduction](#introduction)
- [Functionality](#functionality)
- [Format Number](#format-number)
- [Usage Example](#usage-example)

---

## Introduction

The **Number Formatting** module is designed to enhance the readability of numerical values by formatting them with commas as thousand separators. This is particularly useful for displaying currency values, population counts, or any large numbers in a more user-friendly way.

---

## Functionality

### Format Number

This function takes a number as input and returns it as a formatted string with commas.

```python
format_number(num)
```

- **Args**:
- `num` (int, float): The number to format.

- **Returns**:
- `str`: The formatted number as a string.

- **Example**:
```python
>>> format_number(1234567)
'1,234,567'
```


You can replace `1234567` with any integer or float value that you wish to format with comma separators.

---

Feel free to reach out if you have any questions about how to use the Number Formatting module!
Loading

0 comments on commit dc85dff

Please sign in to comment.