Comments (7)
Hi @joyceerhl! Thanks for pointing out this bug and for the helpful reproduction :-)
I think I've figured out the issue here---the dataflow code needs to be extended to look for uses of names within classes. One fix for this exact case will be to fill in the empty case for ast.CLASS
here to collect the names used from all def's (update: all defs and variable definitions) in the class (e.g., by calling getUses
on all of the class's functions).
I can take a go at it, though it will take me a couple more days. I'm also happy to walk you through the process of updating it if you've got some time on your hands and are feeling adventurous ^_^
from gather.
By the way, wanted to thank you again for helping us improve the parser!
from gather.
@andrewhead I can take a crack at it! :-)
from gather.
Sweet! Do you want to set up a remote call to talk through any of this, or just take a go and follow up as any questions come up? Lmk as I'm happy to help!
from gather.
@joyceerhl Great pull request! Do we want to keep this issue open (i.e. is there any other refinement of that functionality we should keep in mind for the near future), or is this good to close?
from gather.
I just found a related bug while testing Gather on classes:
# Cell 1
def func():
pass
class Foo():
def bar(self):
func()
# Cell 2
Foo().bar()
If you gather the output of Cell 2 to a notebook, the resultant output contains class Foo():
twice:
# Cell 1
def func():
pass
class Foo():
class Foo():
def bar(self):
func()
# Cell 2
Foo().bar()
Edit: I should also mention that this is not a problem if you define func and Foo in two separate cells like so:
# Cell 1
def func():
pass
# Cell 2
class Foo():
def bar(self):
func()
# Cell 3
Foo().bar()
I only noticed this after we merged #28 which is why I'm reporting it here, but this could also be a bug with how sliceLocations are computed. Would love to get your thoughts on this one!
from gather.
Closing this issue for now as #31 is a separate problem and the class gathering functionality seems complete for now!
from gather.
Related Issues (20)
- Slicing: Fails to include import for symbol used in method HOT 2
- Make gathering conservative by default HOT 1
- Discuss binder integration HOT 7
- Change Variable Highlighting Color HOT 4
- Idea: support gathering functions at point of definition HOT 4
- Parser does not correctly set this.indents = [0] when this.indents is undefined HOT 2
- Dependencies of lambda functions with >0 args are not gathered HOT 2
- Bump to support Jupyter Lab API 1.0 HOT 1
- Lightweight API for adding new `gather` commands
- Function and class definition textSliceLines are incorrectly computed HOT 1
- Icons for gathering not appearing in version browser HOT 3
- Gather generates invalid Python code in simple scenario. HOT 1
- jupyterlab-extension topic for discoverability HOT 1
- jupterlab-extionsion fails due to HTTP Error 500 HOT 4
- Notebook instead of lab
- JupyterLab 2.2.0 not supported HOT 1
- Gather API
- The extension "nbgather" does not yet support the current version of JupyterLab (for jupyterlab 3.0.14) HOT 4
- This repo is missing important files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gather.