Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/mapdl_download #2147

Merged
merged 74 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
45d593c
Fixing mapdl.dowload for Windows OS
clatapie May 31, 2023
5a69cf8
Merge branch 'main' into fix/mapdl_download
clatapie May 31, 2023
61ed2b7
Using `shutil.copy` in `download` when `self._local`
clatapie May 31, 2023
92ace05
Merge branch 'main' into fix/mapdl_download
clatapie Jun 1, 2023
4f5f320
Update src/ansys/mapdl/core/mapdl_grpc.py
clatapie Jun 2, 2023
8c14518
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 2, 2023
009d843
Merge branch 'main' into fix/mapdl_download
clatapie Jun 2, 2023
8258b18
Fixing `FileNotFoundError`
clatapie Jun 2, 2023
594f1d7
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
clatapie Jun 2, 2023
4b22f84
Merge branch 'main' into fix/mapdl_download
clatapie Jun 2, 2023
6a11ffa
Merge branch 'main' into fix/mapdl_download
clatapie Jun 2, 2023
0b66bca
Adding local tests for `download`
clatapie Jun 2, 2023
09f3c19
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
clatapie Jun 2, 2023
f8dc655
Merge branch 'main' into fix/mapdl_download
clatapie Jun 2, 2023
d30cb76
Fixing localhost
clatapie Jun 5, 2023
62c6eef
Trying to fix an issue related to `self._local`
clatapie Jun 5, 2023
198d83b
Merge branch 'main' into fix/mapdl_download
clatapie Jun 6, 2023
3466d65
Merge branch 'main' into fix/mapdl_download
germa89 Jun 12, 2023
9a88d61
Merge branch 'main' into fix/mapdl_download
clatapie Jun 12, 2023
035a498
Merge branch 'main' into fix/mapdl_download
clatapie Jun 14, 2023
1d04a4a
Deleting test_local_download
clatapie Jun 14, 2023
b548396
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
clatapie Jun 14, 2023
ac30031
Merge branch 'main' into fix/mapdl_download
clatapie Jun 16, 2023
233c990
tests: trying to fix coverage issue
clatapie Jun 19, 2023
86f28eb
Merge branch 'main' into fix/mapdl_download
clatapie Jun 19, 2023
3733973
tests: adding tests
clatapie Jun 19, 2023
31f17fa
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
clatapie Jun 19, 2023
3c54a2b
Modifying `conftest.py`
clatapie Jun 19, 2023
243fb75
fixing test
germa89 Jun 19, 2023
b1c10a0
Adding test back
germa89 Jun 19, 2023
6c1bc56
fixing typo
germa89 Jun 19, 2023
e892ed1
fix: changing variable name for conflict issues
clatapie Jun 19, 2023
c24d174
Fixing test
germa89 Jun 19, 2023
b680a61
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
germa89 Jun 19, 2023
3430877
Fixing `mapdl.download`
clatapie Jun 20, 2023
7f22089
Fixing Codacy issue
clatapie Jun 20, 2023
7ed925b
Fixing tests
germa89 Jun 20, 2023
3783fab
Fixing `mapdl.download` and unit tests
clatapie Jun 20, 2023
8f5bad2
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
clatapie Jun 20, 2023
1a6c052
Revamping download function
germa89 Jun 20, 2023
2894ba2
Merge branch 'main' into fix/mapdl_download
clatapie Jun 20, 2023
7f2b936
Merge branch 'main' into fix/mapdl_download
clatapie Jun 20, 2023
22209c0
Fixing some issues - work in progress
clatapie Jun 20, 2023
77b4c93
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
clatapie Jun 20, 2023
282e0ee
fix: Fixing local download
clatapie Jun 21, 2023
4f6e218
fix: attempt to fix local and remote downloads
clatapie Jun 21, 2023
e61737c
fix: `mapdl.download()`
clatapie Jun 21, 2023
148089b
fix: `_download_on_local`
clatapie Jun 21, 2023
cfe58e9
fix: fixing recursive local download
clatapie Jun 22, 2023
5103dac
fix: fix list_files
clatapie Jun 22, 2023
f5caa5b
maint: removing unused lines of code and improving clarity
clatapie Jun 22, 2023
1802afe
tests: adding an assertion for `len(list_files)`
clatapie Jun 22, 2023
45fca2a
fix: codacy fixes
clatapie Jun 22, 2023
72431d2
Merge branch 'main' into fix/mapdl_download
clatapie Jun 22, 2023
2a31f33
Merge branch 'main' into fix/mapdl_download
clatapie Jun 23, 2023
54f137a
fix: unit test `test_download_recursive`
clatapie Jun 23, 2023
9ed9c50
Merge branch 'fix/mapdl_download' of https://github.com/pyansys/pymap…
clatapie Jun 23, 2023
61aef82
fix: unit tests
clatapie Jun 23, 2023
bd83658
tests: "input.inp'"
clatapie Jun 23, 2023
37372fc
fix: typo
clatapie Jun 23, 2023
65230a8
simplyfing function
germa89 Jun 26, 2023
3e82a64
uncommenting a test
germa89 Jun 26, 2023
63ea212
adding static typing
germa89 Jun 26, 2023
23cfc46
Removing weird typing
germa89 Jun 26, 2023
997e288
Fixing tests
germa89 Jun 26, 2023
de6c5ca
test
germa89 Jun 27, 2023
48cf104
Merge branch 'main' into fix/mapdl_download
RobPasMue Jun 28, 2023
82d0960
fixing tests
germa89 Jun 28, 2023
9e2a14b
remove redundant line
germa89 Jun 28, 2023
ae9df77
Update src/ansys/mapdl/core/mapdl_grpc.py
germa89 Jun 28, 2023
b06859b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 28, 2023
72f6cb9
Apply suggestions from code review
germa89 Jun 29, 2023
f03da97
Update src/ansys/mapdl/core/mapdl_grpc.py
germa89 Jun 29, 2023
f448437
fixing call
germa89 Jun 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/ansys/mapdl/core/common_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,19 @@
"RCON",
"TLAB",
]
VGET_ENTITY_TYPES_TYPING = Literal[tuple(VGET_ENTITY_TYPES)]
VGET_ENTITY_TYPES_TYPING = Literal[
"NODE",
"ELEM",
"KP",
"LINE",
"AREA",
"VOLU",
"CDSY",
"RCON",
"TLAB",
]

VGET_ENTITY_TYPES: List[str] = list(typing.get_args(VGET_ENTITY_TYPES_TYPING))

STRESS_TYPES = ["X", "Y", "Z", "XY", "YZ", "XZ", "1", "2", "3", "INT", "EQV"]
COMP_TYPE = ["X", "Y", "Z", "SUM"]
Expand Down
35 changes: 15 additions & 20 deletions src/ansys/mapdl/core/mapdl_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,15 @@ def save_chunks_to_file(


def copy_files_to_the_root(
folder: pathlib.Path, target_dir: pathlib.Path, recursive: bool
folder: Union[pathlib.Path, str], target_dir: pathlib.Path, recursive: bool
):
list_folder = os.listdir(folder)
for file in list_folder:
if os.path.isdir(file):
if recursive is True:
copy_files_to_the_root(file, target_dir, recursive)
else:
warn(
f"The copy of the folder {file} is ignored. Recursive needs to be set to True."
)
else:
shutil.copy(os.path.join(folder, file), target_dir)
if recursive:
shutil.copytree(folder, target_dir, dirs_exist_ok=True)
else:
list_folder = os.listdir(folder)
for file in list_folder:
if not os.path.isdir(file):
shutil.copy(os.path.join(folder, file), target_dir)


class RepeatingTimer(threading.Timer):
Expand Down Expand Up @@ -2079,7 +2075,6 @@ def download_project(
List of downloaded files.
"""
if not extensions:
# files = self.list_files()
list_of_files = self.download(
files="*", target_dir=target_dir, progress_bar=progress_bar
)
Expand All @@ -2100,7 +2095,7 @@ def download_project(

def download(
self,
files: Union[str, List[str], Tuple[str]],
files: Union[str, List[str], Tuple[str, ...]],
target_dir: Optional[str] = None,
extension: Optional[str] = None,
chunk_size: Optional[int] = None,
Expand Down Expand Up @@ -2208,8 +2203,8 @@ def download(

def _download_on_local(
self,
files: Union[str, List[str]],
target_dir: Optional[str] = None,
files: Union[str, List[str], Tuple[str, ...]],
target_dir: str,
extension: Optional[str] = None,
recursive: bool = False,
) -> List[str]:
Expand Down Expand Up @@ -2265,8 +2260,8 @@ def _download_on_local(

def _download_from_remote(
self,
files: Union[str, List[str]],
target_dir: Optional[str] = None,
files: Union[str, List[str], Tuple[str, ...],
germa89 marked this conversation as resolved.
Show resolved Hide resolved
target_dir: str,
extension: Optional[str] = None,
chunk_size: Optional[str] = None,
progress_bar: Optional[str] = None,
Expand Down Expand Up @@ -2308,7 +2303,7 @@ def _validate_files(
if not isinstance(extension, str):
raise TypeError(f"The extension {extension} must be a string.")

if extension[0] != ".":
if not extension.startswith("."):
extension = "." + extension

else:
Expand All @@ -2327,7 +2322,7 @@ def _validate_files(
list_files = fnmatch.filter(self_files, base_name)

# filtering by extension
list_files = [each for each in list_files if each.endswith(extension)]
list_files = [file for file in list_files if file.endswith(extension)]

if len(list_files) == 0:
raise FileNotFoundError(
Expand Down