Skip to content

Conversation

@mbledek
Copy link

@mbledek mbledek commented Apr 3, 2025

Fixed save_session_to_file() function

Fixed save_session_to_file() function
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.

# "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

@tehkillerbee
Copy link
Collaborator

Fixed some of the issues mentioned in this MR here: #331

Closing...

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