Skip to content

Commit

Permalink
Only set attributes if value present
Browse files Browse the repository at this point in the history
  • Loading branch information
bpepple committed Sep 8, 2020
1 parent 17bf40d commit caba4b2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions darkseid/genericmetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,11 @@ def overlay(self, new_md: "GenericMetadata") -> None:

def assign_str(cur: str, new: Optional[str]) -> None:
if new is not None:
if len(new) == 0:
setattr(self, cur, None)
else:
setattr(self, cur, new)
setattr(self, cur, new)

def assign_bool(cur: str, new: Optional[bool]) -> None:
if new is not None:
setattr(self, cur, new)
else:
setattr(self, cur, None)

if not new_md.is_empty:
self.is_empty = False
Expand Down

0 comments on commit caba4b2

Please sign in to comment.