Skip to content

Commit

Permalink
Fix: "update()" appears in local scope; docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Cooke committed May 18, 2017
1 parent cc8f6c3 commit dd0fb0c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions see/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""


class SeeError(Exception):
"""
Generic see exception.
Expand Down
19 changes: 13 additions & 6 deletions see/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@
from .features import FEATURES, PY3


class UseLocalScope(object):

class LocalScope(object):
"""
Local scope proxy object.
"""
def __repr__(self):
return 'anything'

def update(self, frame=None):
self.__dict__ = frame.f_back.f_locals
def _update(self, frame=None):
"""
Replace this object's namespace with the local namespace of a given
stack frame.
"""
self.__dict__ = frame.f_locals

LOCALS = UseLocalScope()
LOCALS = LocalScope()


class SeeResult(tuple):
Expand Down Expand Up @@ -73,7 +79,8 @@ def see(obj=LOCALS, pattern=None, r=None):
"""
use_locals = obj is LOCALS
if use_locals:
LOCALS.update(inspect.currentframe())
# Get the local scope from the caller's stack frame.
LOCALS._update(inspect.currentframe().f_back)

actions = []
attrs = dir(obj)
Expand Down

0 comments on commit dd0fb0c

Please sign in to comment.