Skip to content

Commit

Permalink
small bugfixes like assumed capitalization of sauronx generations, a …
Browse files Browse the repository at this point in the history
…default value for truncate(), and tweaks to fig_savers (#169)
  • Loading branch information
chelsell committed Aug 2, 2022
1 parent 617da70 commit 3591770
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pocketutils/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _unmatched_type(cls) -> Optional[__qualname__]:

@classmethod
def _fix_lookup(cls, s: str) -> str:
s = s.lower().strip()
s = s.upper().strip()
return dict(t="true", false="false").get(s, s)


Expand Down Expand Up @@ -176,7 +176,7 @@ def _unmatched_type(cls) -> Optional[__qualname__]:

@classmethod
def _fix_lookup(cls, s: str) -> str:
return s.strip().replace(" ", "_").replace(".", "_").replace("-", "_").lower()
return s.strip().replace(" ", "_").replace(".", "_").replace("-", "_").upper()


__all__ = ["TrueFalseUnknown", "DisjointEnum", "FlagEnum", "CleverEnum"]
5 changes: 3 additions & 2 deletions pocketutils/plotting/fig_savers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(
save_under: Optional[PathLike] = None,
*,
clear: Union[bool, Callable[[Figure], Any]] = False,
as_type: Optional[str] = None,
as_type: Optional[str] = "",
check_paths: bool = True,
sanitize_paths: bool = True,
log: Optional[Callable[[str], None]] = None,
Expand Down Expand Up @@ -212,6 +212,7 @@ def _clean_up(self, figure: Figure) -> None:
pass
figure.clear()
figure.clf()
plt.close("all")
elif callable(self._clear):
self._clear(figure)

Expand All @@ -226,7 +227,7 @@ def _sanitized_file(self, path: PathLike, overwrite: bool) -> Path:
"""
path = Path(path)
if self._check_paths or self._sanitize_paths:
new_path = PathTools.sanitize_path(path, show_warnings=False)
new_path = PathTools.sanitize_path(path, warn=False)
if new_path != path and self._sanitize_paths:
self._log(f"Sanitized filename {path}{new_path}")
elif new_path != path:
Expand Down

0 comments on commit 3591770

Please sign in to comment.