Repository: ansys/pydyna

Issue:
deck.get() broken if there is an EncryptedKeyword object
> @koubaa I found an additional bug. After this implementation, Deck.get() is breaking with this error: 'EncryptedKeyword' object has no attribute 'keyword' 

 _Originally posted by @MiteshLalwala in [#700](https://github.com/ansys/pydyna/issues/700#issuecomment-2660160737)_

Hints from issue comments:
@MiteshLalwala: @koubaa Thank you for the prompt response.

Solution patch:
diff --git a/doc/changelog/720.fixed.md b/doc/changelog/720.fixed.md
new file mode 100644
index 00000000..c2563475
--- /dev/null
+++ b/doc/changelog/720.fixed.md
@@ -0,0 +1 @@
+fix: deck.get() in the presence of Encrypted keywords
\ No newline at end of file
diff --git a/src/ansys/dyna/core/lib/deck.py b/src/ansys/dyna/core/lib/deck.py
index c384fe80..ec85c1c5 100644
--- a/src/ansys/dyna/core/lib/deck.py
+++ b/src/ansys/dyna/core/lib/deck.py
@@ -393,7 +393,7 @@ class Deck:
 
         >>>deck.get_kwds_by_type("SECTION")
         """
-        return filter(lambda kwd: not isinstance(kwd, str) and kwd.keyword == type, self._keywords)
+        return filter(lambda kwd: isinstance(kwd, KeywordBase) and kwd.keyword == type, self._keywords)
 
     def get_section_by_id(self, id: int) -> typing.Optional[KeywordBase]:
         """Get the SECTION keyword in the collection for a given section ID.


Test patch:
diff --git a/tests/test_deck.py b/tests/test_deck.py
index 4286e2b2..cd3528a2 100644
--- a/tests/test_deck.py
+++ b/tests/test_deck.py
@@ -459,9 +459,11 @@ def test_deck_encrypted_import_expand(file_utils):
     """Import an encrypted file as a deck."""
     deck = Deck()
     filename = file_utils.assets_folder / "test_input_deck_1_1024bit.asc"
+    deck.append(kwd.Node())
     deck.append(kwd.Include(filename=filename))
     deck = deck.expand()
     _verify_encrypted_deck(deck)
+    assert len(deck.get(type="NODE")) == 1
 
 @pytest.mark.keywords
 def test_deck_remove_superfluous_newlines(ref_string):