Skip to content

Commit

Permalink
Merge pull request #14 from mvinyard/dev
Browse files Browse the repository at this point in the history
Fix early calling of `__repr__`
  • Loading branch information
mvinyard authored Mar 5, 2025
2 parents c03163d + 94d4e59 commit 6fdb151
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ABCParse/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.2"
__version__ = "0.1.3"
11 changes: 7 additions & 4 deletions ABCParse/_abc_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,16 @@ def __parse__(
"""

public, private = self.__setup_inputs__(kwargs, public, private, ignore)
self._cls_logger.debug(f"Parsing kwargs: {kwargs}")


# First set all attributes
for key, val in kwargs.items():
if not key in self._IGNORE:
self.__set__(key, val, public, private)

# Then log after attributes are set
self._cls_logger.debug(f"Parsing kwargs: {kwargs}")
self._cls_logger.debug(f"Parsed {len(self._PARAMS)} parameters")

def __update__(
self,
kwargs: Dict,
Expand Down Expand Up @@ -179,12 +181,12 @@ def __update__(
-------
None
"""
self._cls_logger.debug(f"Updating with kwargs: {kwargs}")
public, private = self.__setup_inputs__(kwargs, public, private, ignore)

updated_count = 0
new_count = 0

# First update/set all attributes
for key, val in kwargs.items():
if not (val is None) and (key in self._STORED):
self.__set_existing__(key, val)
Expand All @@ -194,6 +196,7 @@ def __update__(
self.__set__(key, val, public, private)
new_count += 1

# Then log after attributes are set
self._cls_logger.debug(f"Updated {updated_count} existing parameters and added {new_count} new parameters")

def __repr__(self) -> str:
Expand Down

0 comments on commit 6fdb151

Please sign in to comment.