Skip to content

Commit

Permalink
resolve code rabbit suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
JaGeo committed Apr 14, 2024
1 parent 247a08c commit b8d03f1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pymatgen/io/lobster/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,7 @@ def __setitem__(self, key, val):
leading and trailing white spaces. Similar to INCAR class.
"""
# due to the missing case sensitivity of lobster, the following code is necessary

new_key = key
for key_here in self:
if key.strip().lower() == key_here.lower():
new_key = key_here
new_key = next((key_here for key_here in self if key.strip().lower() == key_here.lower()), key)

if new_key.lower() not in [element.lower() for element in Lobsterin.AVAILABLE_KEYWORDS]:
raise ValueError("Key is currently not available")
Expand All @@ -154,10 +150,7 @@ def __setitem__(self, key, val):

def __getitem__(self, item):
"""Implements getitem from dict to avoid problems with cases."""
new_item = item
for key_here in self:
if item.strip().lower() == key_here.lower():
new_item = key_here
new_item = next((key_here for key_here in self if item.strip().lower() == key_here.lower()), item)

if new_item.lower() not in [element.lower() for element in Lobsterin.AVAILABLE_KEYWORDS]:
raise ValueError("Key is currently not available")
Expand Down

0 comments on commit b8d03f1

Please sign in to comment.