Skip to content

Commit

Permalink
Add default argument to PBXObjects.get
Browse files Browse the repository at this point in the history
If default is given, return default if object is not found.
  • Loading branch information
simonwagner committed Feb 25, 2015
1 parent 5e98dde commit 90d9a77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pbxproj/pbxobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def __init__(self, data_dict, ignore_unknown_objects):
def keys(self):
return self.data_dict.keys()

def get(self, key):
def get(self, key, default=Ellipsis):
if key not in self.data_dict and default is not Ellipsis:
return default
return self._make_isa_object(key, self.data_dict[key])

def __contains__(self, key):
Expand Down

0 comments on commit 90d9a77

Please sign in to comment.