Skip to content

Commit

Permalink
Merge pull request #6 from unbekanntes-pferd/bugs/0.3.4
Browse files Browse the repository at this point in the history
fixed imports and bulk upload display bug
  • Loading branch information
unbekanntes-pferd authored Jul 18, 2022
2 parents 1ae0e40 + aee67b3 commit a5bdd91
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 39 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ test*
__pycache__

# builds
/dist
/dist

#virtual environment
.venv
30 changes: 10 additions & 20 deletions dccmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
"""

__version__ = "0.3.3"
__version__ = "0.3.4"

# std imports
import sys
import platform
import asyncio
from datetime import datetime

# external imports
from dracoon import DRACOON, OAuth2ConnectionType
from dracoon.nodes.models import NodeType
from dracoon.errors import (
DRACOONHttpError,
Expand All @@ -22,47 +19,37 @@
InvalidPathError,
InvalidFileError,
FileConflictError,
HTTPNotFoundError,
HTTPUnauthorizedError
)
import typer


# internal imports
from dccmd.main.util import (
parse_base_url,
parse_file_name,
parse_path,
parse_new_path,
format_error_message,
format_success_message,
format_and_print_node,
graceful_exit,
to_readable_size,
)
from dccmd.main.auth import auth_app
from dccmd.main.auth.client import client_app, register_client, remove_client
from dccmd.main.auth.util import init_dracoon, is_dracoon_url
from dccmd.main.auth.client import client_app
from dccmd.main.auth.util import init_dracoon
from dccmd.main.auth.credentials import (
get_credentials,
get_crypto_credentials,
store_crypto_credentials,
store_client_credentials,
get_client_credentials,
delete_client_credentials,
delete_credentials,
delete_crypto_credentials,
delete_credentials
)

from dccmd.main.crypto import crypto_app
from dccmd.main.users import users_app
from dccmd.main.crypto.keys import distribute_missing_keys
from dccmd.main.crypto.util import get_keypair, init_keypair
from dccmd.main.crypto.util import init_keypair
from dccmd.main.upload import create_folder_struct, bulk_upload, is_directory, is_file
from dccmd.main.download import create_download_list, bulk_download
from dccmd.main.models import DCTransfer, DCTransferList
from dccmd.main.models.errors import (DCPathParseError, DCClientParseError,
ConnectError)
from dccmd.main.models.errors import (DCPathParseError, ConnectError)

# initialize CLI app
app = typer.Typer()
Expand Down Expand Up @@ -176,7 +163,10 @@ async def _upload():
resolution_strategy=resolution_strategy,
velocity=velocity,
)
folder_name = parse_file_name(full_path=source_dir_path)
try:
folder_name = parse_file_name(full_path=source_dir_path)
except DCPathParseError:
folder_name = source_dir_path
typer.echo(f'{format_success_message(f"Folder {folder_name} uploaded.")}')
# upload a single file
elif is_file_path:
Expand Down
3 changes: 0 additions & 3 deletions dccmd/main/download/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import sys
import asyncio
from pathlib import Path
from enum import Enum
from dataclasses import dataclass


import typer
from tqdm import tqdm
Expand Down
10 changes: 4 additions & 6 deletions dccmd/main/upload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
DRACOONHttpError,
)
from ..models import DCTransfer, DCTransferList
from ..util import format_error_message, to_readable_size
from ..auth.credentials import get_crypto_credentials, store_crypto_credentials

from ..util import format_error_message

class DirectoryItem:
"""object representing a directory with all required path elements"""
Expand Down Expand Up @@ -192,8 +190,8 @@ async def process_batch(batch):
for reqs in dracoon.batch_process(coro_list=folder_reqs, batch_size=10):
try:
await asyncio.gather(*reqs)
except HTTPConflictError:
continue
except HTTPConflictError:
pass
except HTTPForbiddenError:
await dracoon.logout()
typer.echo(
Expand Down Expand Up @@ -271,7 +269,7 @@ async def bulk_upload(
await asyncio.gather(*batch)
except HTTPConflictError:
# ignore file already exists error
pass
continue
except HTTPForbiddenError:
await dracoon.logout()
typer.echo(
Expand Down
5 changes: 0 additions & 5 deletions dccmd/main/users/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
"""

# std import
import sys
import asyncio
import logging

# external imports
import typer
import httpx

from dracoon import DRACOON

from dccmd.main.auth.util import init_dracoon

Expand Down
5 changes: 2 additions & 3 deletions dccmd/main/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"""


from pathlib import Path
import asyncio
import math


import math
import typer

from dracoon import DRACOON
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dccmd"
version = "0.3.3"
version = "0.3.4"
description = "DRACOON Commander – CLI client for DRACOON Cloud (dracoon.com)"
authors = ["Octavio Simone <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit a5bdd91

Please sign in to comment.