Giter Club home page Giter Club logo

frilouz's People

Contributors

serge-sans-paille avatar sylvaincorlay avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

frilouz's Issues

Frilouz only works if notebook is started without any invalid code

Hey Serge, I found a new weird bug. I tried to make a screencast but didn't work, so here it's a little comic stripe on the bug:

1
This is the notebook fully initialized, it contains invalid code from the start, so frilouz is not doing its job and as you can see there's no underline on deprecated functions.

2
Here I commented the invalid code out and memestra starts working.

3
Here I uncomment the code and frilouz suddenly starts working!

I don't know what's going on but my guess would be something like... frilouz is not being initialized soon enough...

Here's the log of the first screenshot:

jupyter lab
[I 2021-03-22 15:46:59.282 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2021-03-22 15:46:59.290 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-03-22 15:46:59.438 ServerApp] nbclassic | extension was successfully linked.
[I 2021-03-22 15:46:59.519 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2021-03-22 15:46:59.519 LabApp] JupyterLab extension loaded from /home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/jupyterlab
[I 2021-03-22 15:46:59.519 LabApp] JupyterLab application directory is /home/mariana/miniconda3/envs/test/share/jupyter/lab
[I 2021-03-22 15:46:59.522 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-03-22 15:46:59.524 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-03-22 15:46:59.524 ServerApp] Serving notebooks from local directory: /home/mariana/development/pyls-memestra
[I 2021-03-22 15:46:59.524 ServerApp] Jupyter Server 1.4.1 is running at:
[I 2021-03-22 15:46:59.524 ServerApp] http://localhost:8888/lab?token=a84e0c96b6920090d7371ce0b808bc02c6b86d330ced9763
[I 2021-03-22 15:46:59.524 ServerApp]  or http://127.0.0.1:8888/lab?token=a84e0c96b6920090d7371ce0b808bc02c6b86d330ced9763
[I 2021-03-22 15:46:59.524 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2021-03-22 15:46:59.554 ServerApp] 
    
    To access the server, open this file in a browser:
        file:///home/mariana/.local/share/jupyter/runtime/jpserver-26767-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=a84e0c96b6920090d7371ce0b808bc02c6b86d330ced9763
     or http://127.0.0.1:8888/lab?token=a84e0c96b6920090d7371ce0b808bc02c6b86d330ced9763
[I 2021-03-22 15:47:03.531 LabApp] Build is up to date
[I 2021-03-22 15:47:04.459 ServerApp] Kernel started: babae909-0ce2-46d0-a94a-060d9055da2c
[I 2021-03-22 15:47:04.470 ServerApp] Kernel started: ce79c20a-221c-4f06-abf4-d82a2bb62e53
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/threading.py", line 1254, in run
    self.function(*self.args, **self.kwargs)
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pyls/_utils.py", line 37, in run
    return func(*args, **kwargs)
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pyls/python_ls.py", line 273, in lint
    flatten(self._hook('pyls_lint', doc_uri, is_saved=is_saved))
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pyls/python_ls.py", line 155, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
    return outcome.get_result()
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
    result = func()
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
    outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/mariana/development/pyls-memestra/pyls_memestra/plugin.py", line 32, in pyls_lint
    deprecated_uses = memestra(
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/memestra/memestra.py", line 420, in memestra
    module = ast.parse(file_descriptor.read())
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/site-packages/gast/gast.py", line 300, in parse
    return ast_to_gast(_ast.parse(*args, **kwargs))
  File "/home/mariana/miniconda3/envs/test/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 22
    def !a():
        ^
SyntaxError: invalid syntax

Maybe this is getting in the way of frilouz executing?

'current' is not defined when syntaxerror is found by frilouz

Hey Serge, I can't reproduce the problem in the front-end anymore which is ๐Ÿ‘ but I just spotted an issue on frilouz while running the tests described in this QuantStack/memestra#55 (comment).
Here's the log:


Exception in thread Thread-10:
Traceback (most recent call last):
  File "/home/mariana/development/frilouz/frilouz.py", line 93, in parse
    return parser(code, *args, **kwargs), errors
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/gast/gast.py", line 300, in parse
    return ast_to_gast(_ast.parse(*args, **kwargs))
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 22
    def !a():
        ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/threading.py", line 1266, in run
    self.function(*self.args, **self.kwargs)
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pyls/_utils.py", line 36, in run
    return func(*args, **kwargs)
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pyls/python_ls.py", line 274, in lint
    flatten(self._hook('pyls_lint', doc_uri, is_saved=is_saved))
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pyls/python_ls.py", line 156, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/manager.py", line 337, in traced_hookexec
    return outcome.get_result()
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/callers.py", line 52, in from_call
    result = func()
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/manager.py", line 335, in <lambda>
    outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/mariana/miniconda3/envs/memestra/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/mariana/development/pyls-memestra/pyls_memestra/plugin.py", line 32, in pyls_lint
    deprecated_uses = memestra(
  File "/home/mariana/development/memestra/memestra/memestra.py", line 421, in memestra
    module, syntax_errors = frilouz.parse(ast.parse, file_descriptor.read())
  File "/home/mariana/development/frilouz/frilouz.py", line 100, in parse
    code = _build_safe_code(code, se.lineno)
  File "/home/mariana/development/frilouz/frilouz.py", line 78, in _build_safe_code
    currindent = current[:-len(tok.string)]
NameError: name 'current' is not defined

So, first Python is finding an invalid syntax error and then something goes wrong in frilouz side.
I don't really understand how stuff is working if frilouz is breaking... But then, I don't know how frilouz works :p
I can simply catch this error on my side with a try/except and just ignore it, but anyways, I thought it'd be good to let you know.

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.