Compare commits

..

6 Commits
v1.3.8 ... main

7 changed files with 33 additions and 17 deletions

View File

@ -16,7 +16,11 @@
"mdrsclient", "mdrsclient",
"neurodata", "neurodata",
"Neuroinformatics", "Neuroinformatics",
"orcid",
"RIKEN" "RIKEN"
], ],
"ignorePaths": [".env", "__pycache__"] "ignorePaths": [
".env",
"__pycache__"
]
} }

3
.gitignore vendored
View File

@ -160,4 +160,5 @@ cython_debug/
.idea/ .idea/
# mdrs-cli # mdrs-cli
.neurodatacli.config .neurodatacli.config
poetry.toml

View File

@ -1 +1 @@
1.3.7 1.3.11

View File

@ -20,8 +20,10 @@ class UsersCurrentResponseLaboratory:
class UsersApiCurrentResponse: class UsersApiCurrentResponse:
id: int id: int
username: str username: str
full_name: str first_name: str
last_name: str
email: str email: str
orcid_id: str
laboratories: list[UsersCurrentResponseLaboratory] laboratories: list[UsersCurrentResponseLaboratory]
is_staff: bool is_staff: bool
is_active: bool is_active: bool

View File

@ -59,8 +59,13 @@ class DownloadCommand(BaseCommand):
@classmethod @classmethod
def download( def download(
cls, remote_path: str, local_path: str, is_recursive: bool, is_skip_if_exists: bool, password: str | None, cls,
excludes: list[str] remote_path: str,
local_path: str,
is_recursive: bool,
is_skip_if_exists: bool,
password: str | None,
excludes: list[str],
) -> None: ) -> None:
(remote, laboratory_name, r_path) = cls._parse_remote_host_with_path(remote_path) (remote, laboratory_name, r_path) = cls._parse_remote_host_with_path(remote_path)
r_path = r_path.rstrip("/") r_path = r_path.rstrip("/")
@ -100,7 +105,7 @@ class DownloadCommand(BaseCommand):
folder_id: str, folder_id: str,
basedir: str, basedir: str,
excludes: list[str], excludes: list[str],
is_skip_if_exists: bool is_skip_if_exists: bool,
) -> None: ) -> None:
context = DownloadContext(False, is_skip_if_exists, []) context = DownloadContext(False, is_skip_if_exists, [])
folder = folder_api.retrieve(folder_id) folder = folder_api.retrieve(folder_id)
@ -140,11 +145,14 @@ class DownloadCommand(BaseCommand):
try: try:
file_api.download(info.file, info.path) file_api.download(info.file, info.path)
except Exception: except Exception:
print(f"Failed: ${info.path}")
if os.path.isfile(info.path):
os.remove(info.path)
return False return False
print(info.path) print(info.path)
return True return True
@classmethod @classmethod
def __check_excludes(cls, excludes: list[str], laboratory: Laboratory, folder: Folder, file: File | None) -> bool: def __check_excludes(cls, excludes: list[str], laboratory: Laboratory, folder: Folder, file: File | None) -> bool:
path = f"/{laboratory.name}{folder.path}{file.name if file is not None else ""}".rstrip("/").lower() path = f"/{laboratory.name}{folder.path}{file.name if file is not None else ''}".rstrip("/").lower()
return path in excludes return path in excludes

View File

@ -2,7 +2,7 @@ import configparser
import os import os
from typing import Final from typing import Final
import validators # type: ignore import validators
from mdrsclient.exceptions import IllegalArgumentException from mdrsclient.exceptions import IllegalArgumentException
from mdrsclient.settings import CONFIG_DIRNAME from mdrsclient.settings import CONFIG_DIRNAME
@ -41,7 +41,7 @@ class ConfigFile:
@url.setter @url.setter
def url(self, url: str) -> None: def url(self, url: str) -> None:
if not validators.url(url): # type: ignore if not validators.url(url):
raise IllegalArgumentException("malformed URI sequence") raise IllegalArgumentException("malformed URI sequence")
self.__load() self.__load()
if self.__config.has_section(self.remote): if self.__config.has_section(self.remote):

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "mdrs-client-python" name = "mdrs-client-python"
version = "1.3.8" version = "1.3.11"
description = "The mdrs-client-python is python library and a command-line client for up- and downloading files to and from MDRS based repository." description = "The mdrs-client-python is python library and a command-line client for up- and downloading files to and from MDRS based repository."
authors = ["Yoshihiro OKUMURA <yoshihiro.okumura@riken.jp>"] authors = ["Yoshihiro OKUMURA <yoshihiro.okumura@riken.jp>"]
license = "MIT" license = "MIT"
@ -13,6 +13,7 @@ classifiers=[
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"OSI Approved :: MIT License", "OSI Approved :: MIT License",
"Topic :: Utilities", "Topic :: Utilities",
] ]
@ -25,17 +26,17 @@ python = "^3.10"
requests = "^2.32.3" requests = "^2.32.3"
requests-toolbelt = "^1.0.0" requests-toolbelt = "^1.0.0"
python-dotenv = "^1.0.1" python-dotenv = "^1.0.1"
pydantic = "^2.9.2" pydantic = "^2.10.5"
pydantic-settings = "^2.5.2" pydantic-settings = "^2.7.1"
PyJWT = "^2.9.0" PyJWT = "^2.10.1"
validators = "^0.33.0" validators = "^0.34.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = "^24.8.0" black = "^24.10.0"
flake8 = "^7.1.1" flake8 = "^7.1.1"
Flake8-pyproject = "^1.2.3" Flake8-pyproject = "^1.2.3"
isort = "^5.13.2" isort = "^5.13.2"
pyright = "^1.1.380" pyright = "^1.1.391"
[tool.poetry.scripts] [tool.poetry.scripts]
mdrs = 'mdrsclient.__main__:main' mdrs = 'mdrsclient.__main__:main'