Skip to content

Commit

Permalink
Add reset_warnings and reset_numpy_warnings functions
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieHakim committed Apr 10, 2024
1 parent cde800a commit 06c9c7c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bnpm/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,27 @@ def array_hasher():
return partial(xxhash.xxh64_hexdigest, seed=0)


def reset_warnings():
"""
Resets warnings to default settings.
"""
import warnings
warnings.simplefilter('default')

def reset_numpy_warnings():
"""
Resets numpy warnings to default settings.
"""
import numpy as np
np.seterr(all='warn')



#####################################################################
################# CONTEXT MANAGERS AND DECORATORS ###################
#####################################################################


@contextmanager
def temp_set_attr(obj, attr_name, new_value):
"""
Expand Down

0 comments on commit 06c9c7c

Please sign in to comment.