-
Notifications
You must be signed in to change notification settings - Fork 315
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
added item_count #1492
base: main
Are you sure you want to change the base?
added item_count #1492
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good to me!
I think two things need to be added here:
- a test for
item_count
, probably somewhere here:
async def test_get(jp_contents_manager): - a documentation entry in:
jupyter_server/docs/source/developers/contents.rst
Lines 34 to 38 in dd7daf9
Models may contain the following entries: +--------------------+------------+-------------------------------+ | Key | Type | Info | +====================+============+===============================+
and
jupyter_server/docs/source/developers/contents.rst
Lines 107 to 112 in dd7daf9
- ``directory`` models - The ``format`` field is always ``"json"``. - The ``mimetype`` field is always ``None``. - The ``content`` field contains a list of :ref:`content-free<contentfree>` models representing the entities in the directory. - The ``hash`` field is always ``None``.
I think this is fully backwards compatible but wanted to run it by @Zsailer to confirm.
@krassowski , I've changed tests and doc and ensured no tests are failing, ig its ready to be reviewed now |
Very good point! I just checked in two file managers (Nautilus and Nemo) and both do show the "1 item" if a folder includes both a hidden file and a non-hidden file by default, but if user selects "show hidden files" then they show "2 items". I wonder if there is a potential performance consideration here though.. |
For now I've added the filters to not count hidden files or any other file which are not visible on jupyter lab's file browser by default (which means item_count and len(contents) are equal), But yeah I otherwise need to somehow know if a user has selected show hidden folders in settings if yes then count those files too, not sure if it will cause any performance issues need to look into the code in more detail! Also noticed one more thing even after turning on show hidden folders in jupyter labs I was not able to see all files which were otherwise easily visible in files app, so I think it might not be necessary to add count of hidden folders or files especially if it may cause performance issues and can lead to inconsistent item counts and actual items visible though I can be completely wrong here |
Fixes #1491, This PR adds item_count