PK>Ju00unstable/.__init__.py.swpb0VIM 8.0X5obussonniermatthiasMacBook-Pro-3.local~bussonniermatthias/dev/unstable/unstable/__init__.pyutf-8 3210#"! UtpmadhmYDCa > - ,   W R , # "  o V = 4  \ O ,  y k L   j:!~qh\@W ihgunstable = Unstable() print('this seem tobe stable now', len(warns)) category=StableWarning, stacklevel=1) "unstable features, these feature may stable now.", warnings.warn("An unstable context manager has caught no use of " if catcher.param == 'count' and len(warns) == 0: warnings.showwarning(w.message, w.category, w.filename, w.lineno, w.file, w.line) for w in warns: if catcher.param not in ('ignore', 'count'): catcher.__exit__(a,b,c) warns = self._warns.pop() catcher = self._catch.pop() def __exit__(self, a,b,c): warnings.filterwarnings(p, category=UnstableWarning, append=False) p = 'always' if p == 'count': catcher.param = p p = 'count' else: p = self._params.pop() if self._params: self._warns.append(catcher.__enter__()) self._catch.append(catcher) catcher = warnings.catch_warnings(record=True) def __enter__(self): UnstableWarning, stacklevel=3) 'with the appropriate `unstable` context manager.'% (what, what.__qualname__), warnings.warn('You are using an unstable feature (%r, %r), please wrap ' def here_be_dragons(self, what): return self self._params.append(maybe_function) if maybe_function: else: return function return maybe_function(*args, **kwargs) self.here_be_dragons(maybe_function) def function(*args, **kwargs): @wraps(maybe_function) ### called as a context manager if callable(maybe_function): def __call__(self, maybe_function=None): return '' def __repr__(self): self._warns = [] self._catch = [] self._params = [] def __init__(self): class Unstable(object):warnings.filterwarnings('error', category=UnstableWarning) passclass StableWarning(Warning): passclass UnstableWarning(FutureWarning): __all__ = ('UnstableWarning', 'StableWarning', 'unstable')from functools import wrapsimport warnings__version__ = '.'.join(map(str, version_info))version_info = (0,5,1)"""See Readme for more information.`StableWarning`.manager that does not detect any use of `unstable` functions will log aexceptions raised by unstable functions. By default an `unstable` contextProvide an `with unstable()` context manger which silence (or log) thecontext. Thus preventing you from using an unstable function by mistake.function will **raise** an ``UnstableWarning``unless used in an `unstable`This module provides a decorator to mark function as `unstable`. Unstable=======UtilityBecause once it's stable, you'll forget to re-check again.takes too much time.Because often, reaching to the documentation to know if something is stableenough.Because sometime documenting a function is unstable is not========Unstable"""PKҕ>J}}unstable/.__init__.py.un~VimUnDo: ۆBs}u/n;tmversion_info = (0,5,0)rrrrX_X5_XMimport warnings5_XO5_XQ5_X V5_X$Not reading documentation for human.5_XW========5_ QXYSBecause informations sometime documenting that something is unstable is not enough.5_ X! Zenough.5_ X)\KBecause informations sometime documenting that something is unstable is not5_ "X.\>Because sometime documenting that something is unstable is not5_ 'X0\9Because sometime documenting something is unstable is not5_   X6 \ Because som5_ ZXM \[Because often, reaching to the documentation to know if something is not stable is toolong.5_ XP ] is toolong.5_ XW ]OBecause often, reaching to the documentation to know if something is not stable. ] is too long.5_VX^ \^Because often, reaching to the documentation to know if something is stable takes too juch ti.5_WX` \^Because often, reaching to the documentation to know if something is stable takes too juch ti.5_]Xb \^Because often, reaching to the documentation to know if something is stable takes too much ti.5_^Xc \`Because often, reaching to the documentation to know if something is stable takes too much time.5_ Xd ]takes too much time.5_ +Xy _7Because once it's stable, you'll forget to check again.5_ :X~ _:Because once it's stable, you'll forget to re-check again.5_X b =5_ X bUtility:5_X b========5_X b=======5_Xe1Provide a decorator to mark function as unstable.5_XeThis module Provides a decorator to mark function as unstable.5_!#">Xe>This module provides a decorator to mark function as unstable.5_"$#5Xf>This module provides a decorator to mark function as unstable.5_#%$>Xf?This module provides a decorator to mark function as `unstable.5_$&%@Xf@This module provides a decorator to mark function as `unstable`.5_%'& Xg0Unstable function will raise an UnstableWarning`5_&('Xg1Unstable function will raise an `UnstableWarning`5_')(Xg3Unstable function will **raise an `UnstableWarning`5_(*)$Xg5Unstable function will **raise** an `UnstableWarning`5_)+*6Xg6Unstable function will **raise** an ``UnstableWarning`5_*,+8Xg8Unstable function will **raise** an ``UnstableWarning`` 5_+-,8Xi8Unstable function will **raise** an ``UnstableWarning``.5_,/-;XiZUnstable function will **raise** an ``UnstableWarning``. THus preventing you from using a 5_-0./:Xi@This module provides a decorator to mark function as `unstable`.ZUnstable function will **raise** an ``UnstableWarning``. Thus preventing you from using a 5_/10Xja 5_021X jProvid5_132 Xj an unstable function by mistake.5_243.XjNfunction will **raise** an ``UnstableWarning``. Thus preventing you from using5_354AX jbfunction will **raise** an ``UnstableWarning``unless used in an ``. Thus preventing you from using5_465JX#jjfunction will **raise** an ``UnstableWarning``unless used in an `unstable`. Thus preventing you from using5_576KX+jrfunction will **raise** an ``UnstableWarning``unless used in an `unstable` context. Thus preventing you from using5_687X-kIThis module provides a decorator to mark function as `unstable`. UnstableJfunction will **raise** an ``UnstableWarning``unless used in an `unstable`'context. Thus preventing you from using+an unstable function by mistake, unless use5_798OX7kOcontext. Thus preventing you from using an unstable function by mistake, unless5_8:9X9use5_9;:HX:jHcontext. Thus preventing you from using an unstable function by mistake.5_:<; XEl Provide an ``5_;=<XGlProvide an `@unstable`5_<>=XMl$Provide an `@unstable`context manger5_=?>%XUl%Provide an `@unstable` context manger5_>@?=Xel>Provide an `@unstable` context manger which silence (or print)5_?A@<XglXm>raised by unstable functions. By default an `unstable` context5_LNMhXmiraised by unstable functions. By default an `unstable` context manager that does not detect any use of ``5_MONqXmqraised by unstable functions. By default an `unstable` context manager that does not detect any use of `unstable`5_NPOzXmQProvide an `with unstable()` context manger which silence (or log) the exceptions{raised by unstable functions. By default an `unstable` context manager that does not detect any use of `unstable` functions5_OQP<Xn' , def __call__(self, maybe_function=None):% if callable(maybe_function):+ ### called as a context manager " @wraps(maybe_function)* def function(*args, **kwargs):4 self.here_be_dragons(maybe_function)6 return maybe_function(*args, **kwargs) return function else: if maybe_function:3 self._params.append(maybe_function) return self $ def here_be_dragons(self, what):P warnings.warn('You are using an unstable feature (%r, %r), please wrap 'd 'with the appropriate `unstable` context manager.'% (what, what.__qualname__),4 UnstableWarning, stacklevel=3)  def __enter__(self):6 catcher = warnings.catch_warnings(record=True)# self._catch.append(catcher)/ self._warns.append(catcher.__enter__()) if self._params:" p = self._params.pop() else: p = 'count'  catcher.param = p if p == 'count': p = 'always'  J warnings.filterwarnings(p, category=UnstableWarning, append=False)  def __exit__(self, a,b,c):# catcher = self._catch.pop()! warns = self._warns.pop() catcher.__exit__(a,b,c)4 if catcher.param not in ('ignore', 'count'): for w in warns:a warnings.showwarning(w.message, w.category, w.filename, w.lineno, w.file, w.line)8 if catcher.param == 'count' and len(warns) == 0:M warnings.warn("An unstable context manager has caught no use of "M "unstable features, these feature may stable now.", > category=StableWarning, stacklevel=1): print('this seem tobe stable now', len(warns)) unstable = Unstable()5_-/.:XiIThis module provides a decorator to mark function as `unstable`. UnstableNfunction will **raise** an ``UnstableWarning``. Thus preventing you from usinga 5PKҕ>J6 unstable/__init__.py""" Unstable ======== Because sometime documenting a function is unstable is not enough. Because often, reaching to the documentation to know if something is stable takes too much time. Because once it's stable, you'll forget to re-check again. Utility ======= This module provides a decorator to mark function as `unstable`. Unstable function will **raise** an ``UnstableWarning``unless used in an `unstable` context. Thus preventing you from using an unstable function by mistake. Provide an `with unstable()` context manger which silence (or log) the exceptions raised by unstable functions. By default an `unstable` context manager that does not detect any use of `unstable` functions will log a `StableWarning`. See Readme for more information. """ version_info = (0,5,1) __version__ = '.'.join(map(str, version_info)) import warnings from functools import wraps __all__ = ('UnstableWarning', 'StableWarning', 'unstable') class UnstableWarning(FutureWarning): pass class StableWarning(Warning): pass warnings.filterwarnings('error', category=UnstableWarning) class Unstable(object): def __init__(self): self._params = [] self._catch = [] self._warns = [] def __repr__(self): return '' def __call__(self, maybe_function=None): if callable(maybe_function): ### called as a context manager @wraps(maybe_function) def function(*args, **kwargs): self.here_be_dragons(maybe_function) return maybe_function(*args, **kwargs) return function else: if maybe_function: self._params.append(maybe_function) return self def here_be_dragons(self, what): warnings.warn('You are using an unstable feature (%r, %r), please wrap ' 'with the appropriate `unstable` context manager.'% (what, what.__qualname__), UnstableWarning, stacklevel=3) def __enter__(self): catcher = warnings.catch_warnings(record=True) self._catch.append(catcher) self._warns.append(catcher.__enter__()) if self._params: p = self._params.pop() else: p = 'count' catcher.param = p if p == 'count': p = 'always' warnings.filterwarnings(p, category=UnstableWarning, append=False) def __exit__(self, a,b,c): catcher = self._catch.pop() warns = self._warns.pop() catcher.__exit__(a,b,c) if catcher.param not in ('ignore', 'count'): for w in warns: warnings.showwarning(w.message, w.category, w.filename, w.lineno, w.file, w.line) if catcher.param == 'count' and len(warns) == 0: warnings.warn("An unstable context manager has caught no use of " "unstable features, these feature may stable now.", category=StableWarning, stacklevel=1) print('this seem tobe stable now', len(warns)) unstable = Unstable() PK!H;@QPunstable-0.5.1.dist-info/WHEEL1 0 RZq+D-Dv;_[*7Fp ܦpv/fݞoL(*IPK!H !unstable-0.5.1.dist-info/METADATAVnF}߯8,ݤPp;ER?E$GB.,ERR@DrzrzYH/u'/ĵ1Yb8!y<mSޚ\R}eȒ篥(`wv$|kq|il sFkvw6Z*l8w|Ž ~ ʢhIGΩis i op4/ig-P7ş:RmFE6pJ՜=N౻gzP)Z1|1tx΄pjmNf_2(W0P\ JY90c O}Ȏ;)~"Zo\Y=*0U0E\N4zEi"t@ߧr#8g+yǮ4_ :Q<_EK wx)~60ݙˆ9/TaM(1[:ͧ!7LlBl~G~b5ÿPK!H+unstable-0.5.1.dist-info/RECORD}V@}¢Cp DGpDgբ{nKhi1&c9W $϶c4DV1Ҩt^wT+۬qmD P_ɖ|LbuV;uG|Q*-  qxE >o妋x6~ \sc2 9\ibgiľos n:=n#pt"ǐdmeJ@Q[eUɍJu00unstable/.__init__.py.swpPKҕ>J}}70unstable/.__init__.py.un~PKҕ>J6  unstable/__init__.pyPK!H;@QPunstable-0.5.1.dist-info/WHEELPK!H !Bunstable-0.5.1.dist-info/METADATAPK!H+unstable-0.5.1.dist-info/RECORDPK!