-
Notifications
You must be signed in to change notification settings - Fork 25
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
Updates in the data sources api reference #1795
Conversation
src/ansys/dpf/core/data_sources.py
Outdated
self, | ||
result_path: Optional[Union[str, os.PathLike]] = None, | ||
data_sources: Optional[dpf.DataSources] = None, | ||
server: Optional[server_types.DpfServer] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not server_types.DpfServer
.
Either the BaseServer
class, or a Union
of LegacyGrpcServer
, GrpcServer
, and InProcessServer
. I think the Union
is best.
src/ansys/dpf/core/data_sources.py
Outdated
def __init__( | ||
self, | ||
result_path: Optional[Union[str, os.PathLike]] = None, | ||
data_sources: Optional[dpf.DataSources] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a dpf.DataSources
.
A Union
of either int
for a memory address or ansys.grpc.dpf.data_sources_pb2.DataSources
as in the original signature.
self, path: Union[str, os.PathLike], domain_id: int, key: Union[str, None] = None | ||
): | ||
"""Add a result file path by domain. | ||
self, path: Union[str, os.PathLike], domain_id: int, key: Optional[str] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self, path: Union[str, os.PathLike], domain_id: int, key: Optional[str] = None | |
self, path: Union[str, os.PathLike], domain_id: int, key: Optional[Union[str, None]] = None |
I think here None
has to be listed as a valid type for the key argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when we use optional is exactly to omit the "None" in a union :
https://peps.python.org/pep-0484/#annotating-generator-functions-and-coroutines
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1795 +/- ##
==========================================
+ Coverage 85.64% 88.11% +2.46%
==========================================
Files 83 83
Lines 9937 9956 +19
==========================================
+ Hits 8511 8773 +262
+ Misses 1426 1183 -243 |
@@ -44,9 +46,16 @@ | |||
from ansys.dpf.core.check_version import version_requires | |||
from ansys.dpf.core import errors | |||
|
|||
if TYPE_CHECKING: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if TYPE_CHECKING: | |
if TYPE_CHECKING: # pragma: no cover |
src/ansys/dpf/core/data_sources.py
Outdated
- If you added an upstream result file, it is not listed in the main ``DataSources`` object. You have to | ||
check directly in the ``DataSources`` object created to define the upstream data. | ||
|
||
Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luisaFelixSalles maybe the second Examples
section title is the source of error
2d863c3
to
da2e685
Compare
Updates the DataSources API reference