Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Oct 18, 2024
1 parent 30768b0 commit 1d89622
Showing 1 changed file with 8 additions and 28 deletions.
36 changes: 8 additions & 28 deletions hiyapyco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,23 +345,14 @@ def _simplemerge(self, a, b):
if self.dereferenceyamlanchors:
a = copy.deepcopy(a)
b = copy.deepcopy(b)
logger.debug(
"simplemerge %s (%s) and %s (%s)"
% (
a,
type(a),
b,
type(b),
)
)
logger.debug('simplemerge %s (%s) and %s (%s)' % (a, type(a), b, type(b),))
if b is None:
logger.debug('pass as b is None')
# override -> None replaces object, no matter what.
if self.none_behavior == NONE_BEHAVIOR_OVERRIDE:
logger.debug('b is None + none_behavior in use => return None')
return None
# default behavior is to attempt merge or fail
else:
pass
logger.debug('pass as b is None')
elif isinstance(b, primitiveTypes):
logger.debug('simplemerge: primitiveTypes replace a "%s" w/ b "%s"' % (a, b,))
a = b
Expand Down Expand Up @@ -396,21 +387,15 @@ def _substmerge(self, a, b):
a = copy.deepcopy(a)
b = copy.deepcopy(b)
logger.debug('>' * 30)
logger.debug(
"substmerge %s and %s"
% (
a,
b,
)
)
logger.debug('substmerge %s and %s' % (a, b,))
# FIXME: make None usage configurable
if b is None:
logger.debug('pass as b is None')
# override -> None replaces object, no matter what.
if self.none_behavior == NONE_BEHAVIOR_OVERRIDE:
logger.debug('b is None + none_behavior in use => return None')
return None
# default behavior is to attempt merge or fail
else:
pass

# treat listTypes as primitiveTypes in merge
# subsititues list, don't merge them
Expand Down Expand Up @@ -461,13 +446,8 @@ def _deepmerge(self, a, b, context = None):
if self.dereferenceyamlanchors:
a = copy.deepcopy(a)
b = copy.deepcopy(b)
logger.debug(
"deepmerge %s and %s"
% (
a,
b,
)
)
logger.debug('deepmerge %s and %s' % (a, b,))
# FIXME: make None usage configurable
if b is None:
logger.debug('pass as b is None')
# override -> None replaces object, no matter what.
Expand Down

0 comments on commit 1d89622

Please sign in to comment.