Giter VIP home page Giter VIP logo

referrers's People

Contributors

nfergu avatar

Stargazers

 avatar

Watchers

 avatar  avatar

referrers's Issues

can't use `referrers.get_referrer_graph` in Jupyter notebooks or ipdb

Hi,

I think I found a bug.
Can't run referrers.get_referrer_graph in Jupyter notebooks:

import referrers

def foo():
    a = [2, 4, 6]
    b = [1, 4, 7]

    l = [a, b]
    d = dict(a=a)
    print(referrers.get_referrer_graph(a))
    print(referrers.get_referrer_graph(b))

foo()
AttributeError                            Traceback (most recent call last)
Cell In[1], line 12
      9     print(referrers.get_referrer_graph(a))
     10     print(referrers.get_referrer_graph(b))
---> 12 foo()

Cell In[1], line 9, in foo()
      7 l = [a, b]
      8 d = dict(a=a)
----> 9 print(referrers.get_referrer_graph(a))
     10 print(referrers.get_referrer_graph(b))

File ~/projects/sga/venv2/lib/python3.10/site-packages/referrers/impl.py:142, in get_referrer_graph(target_object, max_depth, exclude_object_ids, module_prefixes, search_for_untracked_objects, max_untracked_search_depth)
    139 exclude_object_ids = exclude_object_ids or []
    140 exclude_object_ids = list(exclude_object_ids)
--> 142 return get_referrer_graph_for_list(
    143     [target_object],
    144     max_depth=max_depth,
    145     exclude_object_ids=exclude_object_ids,
    146     module_prefixes=module_prefixes,
    147     search_for_untracked_objects=search_for_untracked_objects,
    148     max_untracked_search_depth=max_untracked_search_depth,
    149 )

File ~/projects/sga/venv2/lib/python3.10/site-packages/referrers/impl.py:213, in get_referrer_graph_for_list(target_objects, max_depth, exclude_object_ids, module_prefixes, search_for_untracked_objects, max_untracked_search_depth)
    205     if untracked_objects:
    206         raise ValueError(
    207             "Some target objects are not tracked by the garbage collector. "
    208             "Set search_for_untracked_objects to True to search for referrers of "
    209             "these objects, but bear in mind that this can be slow and may not be "
    210             "reliable in all cases."
    211         )
--> 213 builder = _ReferrerGraphBuilder(
    214     target_objects,
    215     module_prefixes,
    216     max_untracked_search_depth=max_untracked_search_depth,
    217     exclude_object_ids=exclude_object_ids,
    218 )
    219 return builder.build(max_depth=max_depth)

File ~/projects/sga/venv2/lib/python3.10/site-packages/referrers/impl.py:563, in _ReferrerGraphBuilder.__init__(self, target_objects, module_prefixes, max_untracked_search_depth, exclude_object_ids)
    561 stack_frames = inspect.stack()
    562 for frame_info in stack_frames:
--> 563     frame_module = inspect.getmodule(frame_info.frame).__name__
    564     if not frame_module.startswith(_PACKAGE_PREFIX):
    565         # Use the top-level package of the calling code as the module prefix
    566         # (with a trailing dot). For example, if the calling code is in a module
    567         # called my_module.do_thing, the module prefix would be "my_module.".
    568         module_prefixes = [f"{frame_module.split('.')[0]}."]

AttributeError: 'NoneType' object has no attribute '__name__'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.