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

Reduce code duplication #5278

Closed
wants to merge 1 commit into from

Conversation

mikebeijen
Copy link

Removes duplicated code

@mikebeijen mikebeijen closed this Mar 30, 2020
@mikebeijen mikebeijen reopened this Mar 30, 2020
@mikebeijen
Copy link
Author

Closed and reopened pull request to trigger CI rebuild

Copy link
Member

@kevin-bates kevin-bates left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request. I just had a couple comments.

try:
fileobj = open_file(path, text, encoding, log, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

To preserve the original integrity, this should occur prior to the try block, otherwise you need to protect the fileobj.close() call since fileobj will be None if open_file() throws an exception.


try:
fileobj = open_file(path, text, encoding, log, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above regarding fileobj being None in exception block.

Passed to :func:`io.open`."""

if os.path.islink(path):
path = os.path.join(os.path.dirname(path), os.readlink(path))
Copy link
Member

Choose a reason for hiding this comment

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

This if block shouldn't be part of the reduction since this same code exists in atomic_writting() with dependent code in between.

@jtpio
Copy link
Member

jtpio commented Jul 19, 2023

Closing as the maintained server code now lives in the Jupyter Server repo: https://github.com/jupyter-server/jupyter_server

@mikebeijen please open a PR in https://github.com/jupyter-server/jupyter_server if you think this change is still applicable. Thanks!

@jtpio jtpio closed this Jul 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants