Metadata-Version: 2.4
Name: nullwise
Version: 0.3.0
Summary: Precise, actionable explanations for NoneType attribute errors
Author: ZUHAYR
Project-URL: Homepage, https://github.com/ZUHAYR-A/nullwise
Keywords: debugging,error-handling,exceptions
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: license-file

\# nullwise



Precise, actionable explanations for NoneType attribute errors — plus a

suggested fix based on common causes.



\## Install



&#x20;   pip install nullwise



\## Usage — decorator (recommended)



Catches the error even if your code has broader try/except blocks around it,

and always re-raises so you never lose the real exception.



&#x20;   from nullwise import traced



&#x20;   @traced

&#x20;   def get\_user\_email(user\_id):

&#x20;       user = db.find\_user(user\_id)  # returns None if not found

&#x20;       return user.email



\## Usage — global hook



Catches any \*fully unhandled\* crash anywhere in your program automatically.



&#x20;   import nullwise

&#x20;   nullwise.enable()



\## Example output



Instead of:



&#x20;   AttributeError: 'NoneType' object has no attribute 'lower'



You get:



&#x20;   NoneType has no attribute 'lower'



&#x20;   age was None when '.lower' was accessed

&#x20;   at case\_2() — app.py:31



&#x20;   Assigned here: age = user.get("age")



&#x20;   Suggested fix:

&#x20;   This came from dict.get(), which returns None for missing keys.

&#x20;   Fix: provide a default — value = data.get('key', default)

&#x20;   Or check first — if value is not None: ...



\## What it catches



Validated against real-world patterns including:

\- Functions that return None implicitly

\- dict.get() returning None for missing keys

\- Regex functions (re.search, re.match) returning no match

\- Failed file/API loads that return None

\- In-place list methods (sort, append, etc.) that return None



\## What it doesn't catch



nullwise is scoped specifically to `AttributeError`. Errors like

`TypeError: 'NoneType' object is not subscriptable` (e.g. `None\["key"]`)

are a different error class and are not currently covered.

