Skip to content

Commit 9e8758d

Browse files
committed
Update app.py
Simplify docstrings.
1 parent ea1cc34 commit 9e8758d

File tree

1 file changed

+0
-72
lines changed

1 file changed

+0
-72
lines changed

app.py

-72
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@
2626
def get_deployments(user, pwd):
2727
"""
2828
Fetches deployments from the specified URL using the provided username and password for authentication.
29-
30-
Args:
31-
username (str): The username for authentication.
32-
password (str): The password for authentication.
33-
34-
Returns:
35-
list: A list of deployments if the request is successful, otherwise an empty list.
3629
"""
3730
try:
3831
url = "https://connect-apps.ceh.ac.uk/ami-data-upload/get-deployments/"
@@ -54,18 +47,6 @@ async def get_presigned_url(
5447
):
5548
"""
5649
Fetches a presigned URL for uploading a file using the provided details.
57-
58-
Args:
59-
username (str): The username for authentication.
60-
password (str): The password for authentication.
61-
name (str): The name associated with the upload.
62-
bucket (str): The S3 bucket name.
63-
dep_id (str): The deployment ID.
64-
data_type (str): The type of data being uploaded.
65-
file_name (str): The name of the file to be uploaded.
66-
67-
Returns:
68-
dict: The JSON response containing the presigned URL if the request is successful.
6950
"""
7051
url = "https://connect-apps.ceh.ac.uk/ami-data-upload/generate-presigned-url/"
7152

@@ -86,14 +67,6 @@ async def get_presigned_url(
8667
async def upload_file_to_s3(session, presigned_url, file_content, file_type):
8768
"""
8869
Uploads a file to S3 using a presigned URL.
89-
90-
Args:
91-
presigned_url (str): The presigned URL for uploading the file.
92-
file_content (bytes): The content of the file to be uploaded.
93-
file_type (str): The MIME type of the file.
94-
95-
Returns:
96-
None
9770
"""
9871
headers = {"Content-Type": file_type}
9972
async with session.put(
@@ -107,19 +80,6 @@ async def upload_files_in_batches(
10780
):
10881
"""
10982
Uploads files in batches to S3.
110-
111-
Args:
112-
username (str): The username for authentication.
113-
password (str): The password for authentication.
114-
name (str): The name associated with the upload.
115-
bucket (str): The S3 bucket name.
116-
dep_id (str): The deployment ID.
117-
data_type (str): The type of data being uploaded.
118-
files (list): A list of tuples containing file name, file content, and file type.
119-
batch_size (int, optional): The number of files to upload in each batch. Defaults to 50.
120-
121-
Returns:
122-
None
12383
"""
12484
async with aiohttp.ClientSession(timeout=ClientTimeout(total=1200)) as session:
12585
while True:
@@ -150,17 +110,6 @@ async def upload_files(session, user, pwd, name, bucket, dep_id, data_type, file
150110
"""
151111
Uploads multiple files to S3 by first obtaining presigned URLs and then uploading the files.
152112
153-
Args:
154-
username (str): The username for authentication.
155-
password (str): The password for authentication.
156-
name (str): The name associated with the upload.
157-
bucket (str): The S3 bucket name.
158-
dep_id (str): The deployment ID.
159-
data_type (str): The type of data being uploaded.
160-
files (list): A list of tuples containing file name, file content, and file type.
161-
162-
Returns:
163-
None
164113
"""
165114
tasks = []
166115
for file_name, file_content, file_type in files:
@@ -225,14 +174,6 @@ def get_file_info(file_path):
225174
def main(user, pwd, deployments):
226175
"""
227176
The main function to handle the user interface and interaction in the Streamlit app.
228-
229-
Args:
230-
username (str): The username for authentication.
231-
password (str): The password for authentication.
232-
deployments (list): A list of deployments fetched from the server.
233-
234-
Returns:
235-
None
236177
"""
237178
if not deployments:
238179
st.error(
@@ -318,19 +259,6 @@ def handle_upload(
318259
):
319260
"""
320261
Handles the file upload process by validating inputs and initiating the upload.
321-
322-
Args:
323-
username (str): The username for authentication.
324-
password (str): The password for authentication.
325-
full_name (str): The full name of the user.
326-
country (str): The selected country.
327-
deployment (str): The selected deployment.
328-
data_type (str): The type of data being uploaded.
329-
uploaded_files (list): A list of uploaded files.
330-
deployments (list): A list of deployments fetched from the server.
331-
332-
Returns:
333-
None
334262
"""
335263
if not full_name:
336264
st.warning("Please enter your full name.")

0 commit comments

Comments
 (0)