Skip to content

Commit

Permalink
moving to the old code.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubelMozumder committed Nov 29, 2023
1 parent 2fdfe82 commit 6fbe192
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pynxtools/dataconverter/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,24 @@ def __contains__(self, k):

def get(self, key, return_value=None):
"""Implementing get method for template.
Parameters
----------
key : str
Template key
return_value : Any
return :
The value comes with return_value
"""
try:
return self.__getitem__(key)
except KeyError:
val = self.optional.get(key, None)
if val is None:
val = self.recommended.get(key, None)
if val is None:
val = self.required.get(key, None)
if val is None:
val = self.undocumented.get(key, None)
if val is None:
return return_value
return val

def __getitem__(self, k):
"""Handles how values are accessed from the Template object."""
Expand Down

0 comments on commit 6fbe192

Please sign in to comment.