Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes AsyncContentsManager#exists #542

Merged

Conversation

icankeep
Copy link
Contributor

There is a bug in AsyncContentsManager#exists.

async def exists(self, path):
    return await (ensure_async(self.file_exists(path)) or ensure_async(self.dir_exists(path)))

it always returns False when file_exists returns False

reproduce code:

from jupyter_server.utils import ensure_async
import asyncio


async def dir_exists():
    return True


async def file_exists():
    return False


async def exists():
    return await (ensure_async(file_exists()) or ensure_async(dir_exists()))


if __name__ == '__main__':
    a = asyncio.get_event_loop().run_until_complete(exists())
    print(a)

@welcome
Copy link

welcome bot commented Jun 18, 2021

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@icankeep icankeep force-pushed the fix-asynccontentsmanager-exists branch from 8192d55 to 186949d Compare June 18, 2021 10:44
@codecov-commenter
Copy link

codecov-commenter commented Jun 18, 2021

Codecov Report

Merging #542 (186949d) into master (450010e) will increase coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #542      +/-   ##
==========================================
+ Coverage   76.33%   76.35%   +0.02%     
==========================================
  Files         110      110              
  Lines        9816     9816              
  Branches     1067     1067              
==========================================
+ Hits         7493     7495       +2     
+ Misses       1943     1942       -1     
+ Partials      380      379       -1     
Impacted Files Coverage Δ
jupyter_server/services/contents/manager.py 87.76% <0.00%> (ø)
jupyter_server/tests/services/kernels/test_api.py 99.01% <0.00%> (+1.96%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 450010e...186949d. Read the comment docs.

Copy link
Collaborator

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@blink1073 blink1073 added this to the 1.9 milestone Jun 24, 2021
@blink1073 blink1073 added the bug label Jun 24, 2021
@blink1073 blink1073 merged commit c0a67e4 into jupyter-server:master Jun 24, 2021
@welcome
Copy link

welcome bot commented Jun 24, 2021

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants