Skip to content

Update session.py #318

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update session.py #318

wants to merge 1 commit into from

Conversation

mbledek
Copy link

@mbledek mbledek commented Apr 3, 2025

Fixed save_session_to_file() function

Fixed save_session_to_file() function
json.dump(data, outfile)

def load_session_from_file(self, session_file: Path):
try:
with open(session_file) as f:
with open(session_file, "r") as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding this is redundant and linters will scream at you for it:

https://docs.python.org/3/library/functions.html#open

Copy link
Collaborator

Choose a reason for hiding this comment

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

This change does not make sense, IMO. We should make use of the Path object and call .open() on it.

@@ -633,12 +633,12 @@ def save_session_to_file(self, session_file: Path):
"is_pkce": {"data": self.is_pkce},
# "expiry_time": {"data": self.expiry_time},
}
with session_file.open("w") as outfile:
with open(session_file, "w") as outfile:
Copy link
Contributor

@C0rn3j C0rn3j Apr 26, 2025

Choose a reason for hiding this comment

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

session_file is declared to be a Path object, what's the point of reverting it to the plain open()?

If anything, rest of the code should be converted to Path.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If anything, rest of the code should be converted to Path.

Agreed

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

Successfully merging this pull request may close these issues.

3 participants