(obj, name)
| 320 | # Tools used for pickling. |
| 321 | |
| 322 | def _getattribute(obj, name): |
| 323 | for subpath in name.split('.'): |
| 324 | if subpath == '<locals>': |
| 325 | raise AttributeError("Can't get local attribute {!r} on {!r}" |
| 326 | .format(name, obj)) |
| 327 | try: |
| 328 | parent = obj |
| 329 | obj = getattr(obj, subpath) |
| 330 | except AttributeError: |
| 331 | raise AttributeError("Can't get attribute {!r} on {!r}" |
| 332 | .format(name, obj)) from None |
| 333 | return obj, parent |
| 334 | |
| 335 | def whichmodule(obj, name): |
| 336 | """Find the module an object belong to.""" |
no test coverage detected