Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7b3f1f2d09 | |||
8a5e1b68b7 | |||
dd00973bea | |||
0e5685d5ea | |||
6a2810f603 | |||
d5ac5cd427 |
@ -16,7 +16,11 @@
|
|||||||
"mdrsclient",
|
"mdrsclient",
|
||||||
"neurodata",
|
"neurodata",
|
||||||
"Neuroinformatics",
|
"Neuroinformatics",
|
||||||
|
"orcid",
|
||||||
"RIKEN"
|
"RIKEN"
|
||||||
],
|
],
|
||||||
"ignorePaths": [".env", "__pycache__"]
|
"ignorePaths": [
|
||||||
|
".env",
|
||||||
|
"__pycache__"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -160,4 +160,5 @@ cython_debug/
|
|||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
# mdrs-cli
|
# mdrs-cli
|
||||||
.neurodatacli.config
|
.neurodatacli.config
|
||||||
|
poetry.toml
|
@ -1 +1 @@
|
|||||||
1.3.7
|
1.3.11
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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):
|
||||||
|
@ -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'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user