Skip to content

Commit

Permalink
Fixes #18: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxence Guindon committed Apr 16, 2024
1 parent 90ac116 commit a9cb91d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
35 changes: 35 additions & 0 deletions nachet/datastore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from azure.storage.blob import BlobServiceClient, ContainerClient

Check failure on line 1 in nachet/datastore.py

View workflow job for this annotation

GitHub Actions / test-python / lint-test

Ruff (F401)

nachet/datastore.py:1:51: F401 `azure.storage.blob.ContainerClient` imported but unused
from azure.core.exceptions import ResourceNotFoundError

Check failure on line 2 in nachet/datastore.py

View workflow job for this annotation

GitHub Actions / test-python / lint-test

Ruff (F401)

nachet/datastore.py:2:35: F401 `azure.core.exceptions.ResourceNotFoundError` imported but unused

class DatastoreErrors(Exception):
pass

def get_blob_client(connection: str) -> BlobServiceClient:
"""
Returns a BlobServiceClient object initialized with the provided connection
string.
Args:
connection (str): The connection string for the Azure Blob Storage
account.
Returns:
BlobServiceClient: The initialized BlobServiceClient object.
Raises:
DatastoreErrors: If the blob client cannot be retrieved.
"""
try:
return BlobServiceClient.from_connection_string(connection)
except ValueError as error:
raise DatastoreErrors("could not retrieve the blob client") from error


def get_testing_image(amount: int, blob_path: str,
blob_service_client: BlobServiceClient) -> list[str]:
pass


def get_user_image(amount: int, blob_path: str | list,
blob_service_client: BlobServiceClient) -> list[str]:
pass
16 changes: 16 additions & 0 deletions nachet/todo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# TODO Createa connexion to azure storage that can eventually be switch to a
# datastore connection

# TODO Retrieve a user specified amount of testing image

# TODO Retrieve a user specified amount of user image

# TODO Have a datastructure for both image type

# TODO have a user message displaying the end of the loading image.

import os

# Environment variable
AZURE_STORAGE_CONNECTION_STRING = os.env("AZURE_STORAGE_CONNECTION_STRING")
SEEDS_NAME = os.env("SEEDS_NAME")
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
locust
python-dotenv
azure-cognitiveservices-search-websearch
azure-storage-blob
azure-identity
msrest
openpyxl
natsort
Expand Down

0 comments on commit a9cb91d

Please sign in to comment.