Skip to content

Commit

Permalink
📖 fix(docs): Utils() docstring placement
Browse files Browse the repository at this point in the history
  • Loading branch information
mxchinegod committed Dec 23, 2023
1 parent acfd5dc commit 6facd00
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions magnet/utils/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,40 +103,38 @@ def _f(
else:
print(f"😭 UNKNOWN TAG - `{tag}`")

class Utils:
"""
The `Utils` class provides various utility functions for tasks such as checking CUDA availability, normalizing text, and uploading files to Amazon S3.
"""
The `Utils` class provides various utility functions for tasks such as checking CUDA availability, normalizing text, and uploading files to Amazon S3.
Example Usage:
# Create an instance of the Utils class
utils = Utils()
# Check if CUDA is available
utils.check_cuda()
Example Usage:
# Create an instance of the Utils class
utils = Utils()
# Normalize a text string
normalized_text = utils.normalize_text(" This is a sample text. ")
# Check if CUDA is available
utils.check_cuda()
# Upload a file to Amazon S3
utils.upload_to_s3(file_or_dir="path/to/file.txt", keys=("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY"), bucket="my-bucket", bucket_path="data")
# Normalize a text string
normalized_text = utils.normalize_text(" This is a sample text. ")
Main functionalities:
- Checking if CUDA is available on the machine
- Normalizing text by performing various cleaning operations
- Uploading files to Amazon S3
# Upload a file to Amazon S3
utils.upload_to_s3(file_or_dir="path/to/file.txt", keys=("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY"), bucket="my-bucket", bucket_path="data")
Methods:
- __init__(): Initializes the Utils class and sets up the spaCy English language model with a sentence tokenizer.
- check_cuda(): Checks if CUDA is available on the machine and provides additional information if it is.
- normalize_text(_): Cleans a text string by removing whitespace, replacing characters, and removing curly braces.
- upload_to_s3(file_or_dir, keys, bucket, bucket_path): Uploads a file or directory to an Amazon S3 bucket using the provided access keys and bucket information.
Main functionalities:
- Checking if CUDA is available on the machine
- Normalizing text by performing various cleaning operations
- Uploading files to Amazon S3
Fields:
The Utils class does not have any fields.
"""
Methods:
- __init__(): Initializes the Utils class and sets up the spaCy English language model with a sentence tokenizer.
- check_cuda(): Checks if CUDA is available on the machine and provides additional information if it is.
- normalize_text(_): Cleans a text string by removing whitespace, replacing characters, and removing curly braces.
- upload_to_s3(file_or_dir, keys, bucket, bucket_path): Uploads a file or directory to an Amazon S3 bucket using the provided access keys and bucket information.
Fields:
The Utils class does not have any fields.
"""

class Utils:
def __init__(self):
nlp = English()
nlp.add_pipe("sentencizer")
Expand Down

0 comments on commit 6facd00

Please sign in to comment.