ansys-systemcoupling-core 0.7.0__py3-none-any.whl → 0.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ansys-systemcoupling-core might be problematic. Click here for more details.

@@ -148,9 +148,10 @@ def _wrap_add_participant(
148
148
  )
149
149
 
150
150
  if input_file := kwargs.get("input_file", None):
151
- session.upload_file(input_file)
152
- if os.path.dirname(input_file):
153
- kwargs["input_file"] = os.path.basename(input_file)
151
+ # In PIM-like scenario, the returned file name is what
152
+ # the container sees. Otherwise input_file should be
153
+ # unchanged by the upload call.
154
+ kwargs["input_file"] = session.upload_file(input_file)
154
155
 
155
156
  return setup._add_participant(**kwargs)
156
157
 
@@ -177,12 +177,12 @@ class SycGrpc(object):
177
177
  if start_output:
178
178
  self.start_output()
179
179
 
180
- def upload_file(self, *args, **kwargs):
180
+ def upload_file(self, *args, **kwargs) -> str:
181
181
  """Supports file upload to remote instance.
182
182
 
183
183
  Currently for internal use only.
184
184
  """
185
- file_transfer_service(self.__pim_instance).upload_file(*args, **kwargs)
185
+ return file_transfer_service(self.__pim_instance).upload_file(*args, **kwargs)
186
186
 
187
187
  def download_file(self, *args, **kwargs):
188
188
  """Supports file download from remote instance.
@@ -233,7 +233,8 @@ class Session:
233
233
 
234
234
  Reduces to a no-op if the System Coupling instance is not managed by PIM.
235
235
 
236
- The remote file may optionally be given a different name from the local one.
236
+ The remote file may optionally be given a different name from the local one
237
+ and, if not, any directory prefix is stripped in the PIM case.
237
238
 
238
239
  Unless ``overwrite`` is ``True``, a ``FileExistsError`` will be raised if
239
240
  the remote file already exists.
@@ -246,8 +247,14 @@ class Session:
246
247
  remote file name - default is None
247
248
  overwrite: bool, optional
248
249
  whether to overwrite the remote file if it already exists - default is False
250
+
251
+ Returns
252
+ -------
253
+ str
254
+ The remote file name, excluding any directory prefix that might have been
255
+ present in ``file_name``.
249
256
  """
250
- self.__rpc.upload_file(file_name, remote_file_name, overwrite)
257
+ return self.__rpc.upload_file(file_name, remote_file_name, overwrite)
251
258
 
252
259
  def download_file(
253
260
  self, file_name: str, local_file_dir: str = ".", overwrite: bool = False
@@ -29,15 +29,22 @@ from typing import Any, Optional, Protocol
29
29
  class FileTransferService(Protocol): # pragma: no cover
30
30
  def upload_file(
31
31
  self, file_name: str, remote_file_name: Optional[str], overwrite: bool
32
- ): ...
32
+ ) -> str: ...
33
33
 
34
34
  def download_file(self, file_name: str, local_file_dir: str, overwrite: bool): ...
35
35
 
36
36
 
37
37
  class NullFileTransferService(FileTransferService): # pragma: no cover
38
- """A do-nothing implementation of file upload/download service."""
38
+ """An essentially do-nothing implementation of file upload/download
39
+ service (with a minimal ``upload_file`` implementation)."""
39
40
 
40
- ...
41
+ def upload_file(
42
+ self, file_name: str, remote_file_name: Optional[str], overwrite: bool
43
+ ) -> str:
44
+ # TODO - what should the behaviour be if remote_file_name is not None?
45
+ # It is not obvious that it would even make sense to call the Null
46
+ # implementation in that case.
47
+ return file_name
41
48
 
42
49
 
43
50
  class PimFileTransferService: # pragma: no cover
@@ -70,11 +77,14 @@ class PimFileTransferService: # pragma: no cover
70
77
 
71
78
  def upload_file(
72
79
  self, file_name: str, remote_file_name: Optional[str], overwrite: bool
73
- ):
80
+ ) -> str:
74
81
  """Upload a file to the PIM-managed instance.
75
82
 
76
83
  The remote file may optionally be given a different name from the local one.
77
84
 
85
+ If the local file name includes a directory path, this is stripped and the
86
+ remote file is always placed in the "working directory" of the container.
87
+
78
88
  Unless ``overwrite`` is ``True``, a ``FileExistsError`` will be raised if
79
89
  the remote file already exists.
80
90
 
@@ -86,6 +96,12 @@ class PimFileTransferService: # pragma: no cover
86
96
  remote file name (or use local file name if None)
87
97
  overwrite: bool
88
98
  whether to overwrite the remote file if it already exists
99
+
100
+ Returns
101
+ -------
102
+ str
103
+ The name assigned to the remote file name. If ``file_name`` included
104
+ a directory prefix, this is stripped from the returned name.
89
105
  """
90
106
  if os.path.isfile(file_name):
91
107
  remote_file_name = remote_file_name or os.path.basename(file_name)
@@ -105,6 +121,7 @@ class PimFileTransferService: # pragma: no cover
105
121
  self.file_service.upload_file(file_name, remote_file_name)
106
122
  if delete_copy:
107
123
  os.remove(file_name)
124
+ return remote_file_name
108
125
  else:
109
126
  raise FileNotFoundError(f"Local file {file_name} does not exist.")
110
127
 
@@ -1,13 +1,13 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 ANSYS, Inc. All rights reserved.
3
+ Copyright (c) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ansys-systemcoupling-core
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: A Python wrapper for Ansys System Coupling.
5
5
  Author-email: "ANSYS, Inc." <pyansys.support@ansys.com>
6
6
  Maintainer-email: PyAnsys developers <pyansys.maintainers@ansys.com>
@@ -29,21 +29,21 @@ Requires-Dist: matplotlib>=3.8.2
29
29
  Requires-Dist: build ; extra == "build"
30
30
  Requires-Dist: black==24.8.0 ; extra == "classesgen"
31
31
  Requires-Dist: isort==5.13.2 ; extra == "classesgen"
32
- Requires-Dist: ansys-sphinx-theme==1.0.7 ; extra == "doc"
32
+ Requires-Dist: ansys-sphinx-theme==1.0.11 ; extra == "doc"
33
33
  Requires-Dist: jupyter_sphinx==0.5.3 ; extra == "doc"
34
34
  Requires-Dist: matplotlib ; extra == "doc"
35
35
  Requires-Dist: numpydoc==1.8.0 ; extra == "doc"
36
36
  Requires-Dist: pypandoc==1.13 ; extra == "doc"
37
37
  Requires-Dist: pytest-sphinx==0.6.3 ; extra == "doc"
38
38
  Requires-Dist: Sphinx==8.0.2 ; extra == "doc"
39
- Requires-Dist: sphinx-autobuild==2024.4.16 ; extra == "doc"
40
- Requires-Dist: sphinx-autodoc-typehints==2.3.0 ; extra == "doc"
39
+ Requires-Dist: sphinx-autobuild==2024.9.19 ; extra == "doc"
40
+ Requires-Dist: sphinx-autodoc-typehints==2.4.4 ; extra == "doc"
41
41
  Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "doc"
42
42
  Requires-Dist: sphinx-gallery==0.17.1 ; extra == "doc"
43
43
  Requires-Dist: sphinx-notfound-page==1.0.4 ; extra == "doc"
44
44
  Requires-Dist: sphinxcontrib-websupport==2.0.0 ; extra == "doc"
45
45
  Requires-Dist: sphinxemoji==0.3.1 ; extra == "doc"
46
- Requires-Dist: ansys-fluent-core==0.24.2 ; extra == "doc"
46
+ Requires-Dist: ansys-fluent-core==0.26.0 ; extra == "doc"
47
47
  Requires-Dist: ansys-dpf-core==0.13.0 ; extra == "doc"
48
48
  Requires-Dist: ansys-mapdl-core==0.68.4 ; extra == "doc"
49
49
  Requires-Dist: codespell==2.3.0 ; extra == "style"
@@ -1,6 +1,6 @@
1
1
  ansys/systemcoupling/core/__init__.py,sha256=9dek5li8pDDRA5oBI3mPeOwu784_qzwzse3lTNLyUWU,7404
2
2
  ansys/systemcoupling/core/_version.py,sha256=WDT4Te1BIWgZU3Gt3WrwVwiGFs4nolWZXbwX-Ubj_r4,1579
3
- ansys/systemcoupling/core/session.py,sha256=HKXmPBGv-netx4CHr3PNMWXYQO8lsp0n99V20Um-jgo,10737
3
+ ansys/systemcoupling/core/session.py,sha256=yjnZI-OFKLjnooVRg5e0M9MIJGV38Cm041mcdb6nMCs,10983
4
4
  ansys/systemcoupling/core/syc_version.py,sha256=dn1BRe9hzGD2QAsuk6OLjxNcznJlpyiPIZh9Zjrwdqc,3783
5
5
  ansys/systemcoupling/core/adaptor/api_23_1/_add_participant.py,sha256=_Wbmc-g3FyEyFodFjklI8IBJ3lLIWEIMHsMdAFlddsM,1198
6
6
  ansys/systemcoupling/core/adaptor/api_23_1/_clear_state.py,sha256=z13uOkk8M-Ue1_znQXEyGvYOYW1zHSV-MpZgEMDPlTg,215
@@ -516,7 +516,7 @@ ansys/systemcoupling/core/adaptor/api_25_1/write_csv_chart_files.py,sha256=32YlQ
516
516
  ansys/systemcoupling/core/adaptor/api_25_1/write_ensight.py,sha256=cy1ZUL2Td2WCfuuWWIUigMmPdxwRKqV9msH0pJI624Y,1278
517
517
  ansys/systemcoupling/core/adaptor/impl/get_status_messages.py,sha256=3wSnWTUS3q4VdufmHZ7jxyVCZONITFtP_tUB-8NnQuU,4210
518
518
  ansys/systemcoupling/core/adaptor/impl/get_syc_version.py,sha256=CIq2J8h8Eapq_jrXpMMHAa9oqSSaNR5G7NAYZseVgJg,2489
519
- ansys/systemcoupling/core/adaptor/impl/injected_commands.py,sha256=EqSCqXUEGf-cLKLeQvA4oVA1zVkvrpWDeMPtlPe5b4s,19094
519
+ ansys/systemcoupling/core/adaptor/impl/injected_commands.py,sha256=5FlUQUr0fuPvUh1YPaU38eh_duRHeg6NzpvyxCND5SI,19177
520
520
  ansys/systemcoupling/core/adaptor/impl/root_source.py,sha256=d-NSP104VjR65qTiqp1rlST6VYJRUPf9YHcpR8ABssQ,12828
521
521
  ansys/systemcoupling/core/adaptor/impl/static_info.py,sha256=5U1CYNASPl4zNGjIw3Slwkhq-8v7GVKrih0HO_bIjSk,15691
522
522
  ansys/systemcoupling/core/adaptor/impl/syc_proxy.py,sha256=-jF5zSwwiyJXLxocWK01v5AYDDtLyZRiMPfcqeOvim8,4906
@@ -529,7 +529,7 @@ ansys/systemcoupling/core/charts/message_dispatcher.py,sha256=zuNY3NthWag1yf7Rkj
529
529
  ansys/systemcoupling/core/charts/plot_functions.py,sha256=Li5HYCWkRTAvFGqnI6p636qayTPqphHLOtWI861vtgA,3276
530
530
  ansys/systemcoupling/core/charts/plotdefinition_manager.py,sha256=UFQjYei3gk3GYVUksSPYbtcxFbcfepZscGg55ok5OQg,12446
531
531
  ansys/systemcoupling/core/charts/plotter.py,sha256=L_hIanq5sV6LVSu3dn3yjoeCPBpEccyxXk2fFCt85_s,11833
532
- ansys/systemcoupling/core/client/grpc_client.py,sha256=KxVzj--kLOL6ij0YlgxG3t8YgvLK2sHqjeDJuQtbAtc,14933
532
+ ansys/systemcoupling/core/client/grpc_client.py,sha256=8g7oASjQ2FEfnxDJ6K4Wl9EOkUUAqq_fMuGVC3zxTXk,14947
533
533
  ansys/systemcoupling/core/client/syc_container.py,sha256=_EZRscY5iWyJPbqY-ep_e6Y-Nu1XKygduzVYjg5xJg8,3170
534
534
  ansys/systemcoupling/core/client/syc_process.py,sha256=udVsRxD5QaaL1n7MPjmpIvybv5dlPmXiO2KCPRNnWGE,5635
535
535
  ansys/systemcoupling/core/client/variant.py,sha256=di_eWRZnDQ69cknunYxRAOnbnwXnG6aZ_Se1VxOX7VQ,3064
@@ -548,13 +548,13 @@ ansys/systemcoupling/core/native_api/object_path.py,sha256=DAULeS_asHMf1O3PiFnLL
548
548
  ansys/systemcoupling/core/participant/manager.py,sha256=kJzfsTA1HquDQT-j3ib9OQMD0QRpvWGpnPMYDDvnYZU,9685
549
549
  ansys/systemcoupling/core/participant/mapdl.py,sha256=v9Ms6uVaPj1-AbZYsaAY9JR_WpkLD7xSOJ3kQRGgtT0,11166
550
550
  ansys/systemcoupling/core/participant/protocol.py,sha256=Kc90wvz-ZDJfhvL-SrlFymdb_mn2oqVucaRZW7BfFWM,2479
551
- ansys/systemcoupling/core/util/file_transfer.py,sha256=h_Ny-rcawVbmNooyKmCbjMkDhGIAX8rZHsZ-odJIS1o,5756
551
+ ansys/systemcoupling/core/util/file_transfer.py,sha256=ZYRYAo6wDRVB7ihEMbK3JHYAoXiU5lxo6yzGTd830jo,6560
552
552
  ansys/systemcoupling/core/util/logging.py,sha256=dFj0migeyUGke7sYL-hN80amMnUvuIO1kkCsOH_8ipc,5059
553
553
  ansys/systemcoupling/core/util/name_util.py,sha256=AqALTBRe9hjS0SqbKk2BnN09pCq0M1irhd9illTTuwk,1470
554
554
  ansys/systemcoupling/core/util/pathstr.py,sha256=xfnBAee68WG1R8s2LkoO9fLYZsJ0Nrx84woVuQv9bVY,1941
555
555
  ansys/systemcoupling/core/util/state_keys.py,sha256=52gk88CJw1K3YIC6hg7Jc6_C2_EznQjrB1FrpcjhI1M,4545
556
556
  ansys/systemcoupling/core/util/yaml_helper.py,sha256=6j2VNGXSEiJ11GUsUn4Z3wbPB9Cw-5JBsb5gWHAVsYo,2982
557
- ansys_systemcoupling_core-0.7.0.dist-info/LICENSE,sha256=4sCWlgkqcWBhkmfDi4UpSkzpTxXvMhLfR0G6dxLQuMA,1090
558
- ansys_systemcoupling_core-0.7.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
559
- ansys_systemcoupling_core-0.7.0.dist-info/METADATA,sha256=ZGiIfKR1A9GhJLcntfEoUHu4AbWchViT_KHDWCBY9rc,10963
560
- ansys_systemcoupling_core-0.7.0.dist-info/RECORD,,
557
+ ansys_systemcoupling_core-0.8.0.dist-info/LICENSE,sha256=JgD60xBjdC80Y3_bDlvjsoWCc6vghcXDvbHvRTRmdY0,1098
558
+ ansys_systemcoupling_core-0.8.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
559
+ ansys_systemcoupling_core-0.8.0.dist-info/METADATA,sha256=ndbuY_i0J7WKo2ZMiZlB5YA0RhP4kTJK0wcQMEQicNs,10964
560
+ ansys_systemcoupling_core-0.8.0.dist-info/RECORD,,