Skip to content

Allow slicing of collections #1907

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Allow slicing of collections #1907

wants to merge 10 commits into from

Conversation

PProfizi
Copy link
Contributor

Allow requesting entries in collections via Python slices, aka [start:stop:step].

@PProfizi PProfizi added the enhancement New feature or request label Nov 18, 2024
@PProfizi PProfizi self-assigned this Nov 18, 2024
@PProfizi PProfizi added this to the 0.13.3 milestone Nov 18, 2024
@PProfizi PProfizi modified the milestones: 0.13.3, 0.13.4 Nov 22, 2024
@PProfizi PProfizi modified the milestones: 0.13.4, 0.13.5 Jan 17, 2025
@PProfizi PProfizi modified the milestones: 0.13.5, 0.13.6, 0.13.7 Mar 6, 2025
@PProfizi PProfizi modified the milestones: 0.13.7, 0.13.8 May 12, 2025
Copy link

codecov bot commented May 12, 2025

❌ 74 Tests Failed:

Tests completed Failed Passed Skipped
22817 74 22743 3154
View the top 3 failed test(s) by shortest run time
tests/test_collection.py::test_generic_data_containers_collection_slice[ansys-grpc-dpf]
Stack Traces | 0.003s run time
server_type = <ansys.dpf.core.server_types.LegacyGrpcServer object at 0x7f9f5c93ed40>

    def test_generic_data_containers_collection_slice(server_type):
>       coll = GenericDataContainersCollection(server=server_type)

tests/test_collection.py:251: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ansys.dpf.core.GenericDataContainersCollection object at 0x7f9f50168520>
collection = None
server = <ansys.dpf.core.server_types.LegacyGrpcServer object at 0x7f9f5c93ed40>
entries_type = None

    def __init__(self, collection=None, server=None, entries_type: type = None):
        # step 1: get server
        self._server = server_module.get_or_create_server(
            collection._server if isinstance(collection, Collection) else server
        )
        if not self._server.meet_version("8.1"):
>           raise errors.DpfVersionNotSupported("8.1")
E           ansys.dpf.gate.errors.DpfVersionNotSupported: Feature not supported. Upgrade the server to 8.1 version (or above).

..../test-api/lib/python3.10.../dpf/core/collection.py:61: DpfVersionNotSupported
tests/test_collection.py::test_string_containers_collection_slice[ansys-grpc-dpf]
Stack Traces | 0.003s run time
server_type = <ansys.dpf.core.server_types.LegacyGrpcServer object at 0x7f22607a9fc0>

    def test_string_containers_collection_slice(server_type):
>       coll = StringFieldsCollection(server=server_type)

tests/test_collection.py:266: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ansys.dpf.core.StringFieldsCollection object at 0x7f225a5ed4b0>
collection = None
server = <ansys.dpf.core.server_types.LegacyGrpcServer object at 0x7f22607a9fc0>
entries_type = None

    def __init__(self, collection=None, server=None, entries_type: type = None):
        # step 1: get server
        self._server = server_module.get_or_create_server(
            collection._server if isinstance(collection, Collection) else server
        )
        if not self._server.meet_version("8.1"):
>           raise errors.DpfVersionNotSupported("8.1")
E           ansys.dpf.gate.errors.DpfVersionNotSupported: Feature not supported. Upgrade the server to 8.1 version (or above).

..../test-api/lib/python3.10.../dpf/core/collection.py:61: DpfVersionNotSupported
tests\test_collection.py::test_collection::test_generic_data_containers_collection_slice[in Process CLayer]
Stack Traces | 0.003s run time
server_type = <ansys.dpf.core.server_types.InProcessServer object at 0x0000013C99BD3220>

    def test_generic_data_containers_collection_slice(server_type):
>       coll = GenericDataContainersCollection(server=server_type)

tests\test_collection.py:251: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <ansys.dpf.core.GenericDataContainersCollection object at 0x0000013C99BD0400>
collection = None
server = <ansys.dpf.core.server_types.InProcessServer object at 0x0000013C99BD3220>
entries_type = None

    def __init__(self, collection=None, server=None, entries_type: type = None):
        # step 1: get server
        self._server = server_module.get_or_create_server(
            collection._server if isinstance(collection, Collection) else server
        )
        if not self._server.meet_version("8.1"):
>           raise errors.DpfVersionNotSupported("8.1")
E           ansys.dpf.gate.errors.DpfVersionNotSupported: Feature not supported. Upgrade the server to 8.1 version (or above).

.tox\test-api\lib\site-packages\ansys\dpf\core\collection.py:61: DpfVersionNotSupported

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant