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

refactor: add type hints and comments #205

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

ctrlaltf24
Copy link
Contributor

Small handful of comments on things I noticed while reading

No functional changes

Small handfull of comments on things I noticed while reading

No functional changes
ACTION: str = 'app'
APPIMAGE_FILE_PATH: Optional[str] = None
authenticated = False # FIXME: no references
BADPACKAGES: Optional[str] = None # FIXME: no references
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is leftover from when we were still using this for removing AppImageLauncher. We ended up having to handle AppImageLauncher differently, but we kept this in case we ever discovered a problematic package.

PACKAGES = None
PASSIVE = None
LOGOS10_RELEASES = None # used to save downloaded releases list # FIXME: not set #noqa: E501
MYDOWNLOADS: Optional[str] = None # FIXME: Should this use the tempfile module?
Copy link
Collaborator

@thw26 thw26 Oct 24, 2024

Choose a reason for hiding this comment

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

The main reason this exists is for network.reuse_download. Our goal is to minimize network bandwidth for Christian workers in low bandwidth/data limited scenarios.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. Perhaps a separate directory? ~/.cache/FaithLife-Community/...?

BADPACKAGES = None
ACTION: str = 'app'
APPIMAGE_FILE_PATH: Optional[str] = None
authenticated = False # FIXME: no references
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was from a time when I had implemented password requests using the system keyring, authenticated meaning user password authenticated. At the time we chose to drop this functionality for the sake of user trust and we opted for using pkexec in most situations.

INSTALL_STEP = 0
INSTALL_STEPS_COUNT = 0
FLPRODUCTi: Optional[str] = None
GUI = None # FIXME: no references
Copy link
Collaborator

Choose a reason for hiding this comment

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

This most likely can be safely removed. I think it would have been used to keep track of the GUI object, but we have the app var we pass around now.

LOGOS_LATEST_VERSION_URL = None
LOGOS9_RELEASES = None # used to save downloaded releases list
LOGOS_LATEST_VERSION_URL: Optional[str] = None
LOGOS9_RELEASES = None # used to save downloaded releases list # FIXME: not set #noqa: E501
Copy link
Collaborator

Choose a reason for hiding this comment

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

See #155.

PACKAGE_MANAGER_COMMAND_QUERY = None
PACKAGES = None
PASSIVE = None
LOGOS10_RELEASES = None # used to save downloaded releases list # FIXME: not set #noqa: E501
Copy link
Collaborator

Choose a reason for hiding this comment

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

See #155.

@@ -38,6 +38,7 @@ def restore(app=None):
backup_and_restore(mode='restore', app=app)


# FIXME: consider moving this into it's own file/module.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think utils is the place this probably should be in the current file structure.

Its existence here is a holdover from the bash script.

This functionality I think could easily be in its own module, or perhaps we could refactor things to have our various copy functions or otherwise all in a files.py or something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

backup.py makes sense to me, there's a lot of logic here

@@ -268,8 +269,8 @@ def set_winetricks():
# Check if local winetricks version is up-to-date; if so, offer to
# use it or to download; else, download it.
local_winetricks_version = subprocess.check_output(["winetricks", "--version"]).split()[0] # noqa: E501
if str(local_winetricks_version) >= "20220411":
if config.DIALOG == 'tk':
if str(local_winetricks_version) >= "20220411": #FIXME: consider using config.WINETRICKS_VERSION and != string comparision on versions is dodgy #noqa: E501
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds like a good improvement.

if str(local_winetricks_version) >= "20220411":
if config.DIALOG == 'tk':
if str(local_winetricks_version) >= "20220411": #FIXME: consider using config.WINETRICKS_VERSION and != string comparision on versions is dodgy #noqa: E501
if config.DIALOG == 'tk': #FIXME: CLI client not considered
Copy link
Collaborator

Choose a reason for hiding this comment

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

See #170, which may affect this

@@ -296,6 +297,7 @@ def set_winetricks():
)
return 0
else:
# FIXME: Should this call a function on the app object?
Copy link
Collaborator

Choose a reason for hiding this comment

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

The simple answer is we haven't spent much time reviewing control.py for a while. It probably needs reviewed, as do some other aspects of code. See also our comments in #35 and strewn about the code.

@@ -319,7 +321,7 @@ def set_winetricks():
return 0


def download_winetricks():
def download_winetricks(): #FIXME: unused, logic moved to system.install_winetricks
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch. I'm sure this was left behind due to a bad rebase.

@@ -677,6 +677,7 @@ def ensure_launcher_shortcuts(app=None):
ensure_launcher_executable(app=app)
config.INSTALL_STEP += 1
runmode = system.get_runmode()
# FIXME: why not do this all the time?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good idea. Should be easy to move to main

@@ -259,7 +260,7 @@ def reboot():
sys.exit(0)


def t(command):
def t(command): # FIXME: unused, have_dep does the same thing
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've noticed this before but didn't give it much thought. Good to replace one with another.

@@ -275,6 +276,7 @@ def tl(library):


def get_dialog():
# FIXME: wouldn't the cli still work without a DISPLAY? What about wayland?
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is about when executing the wine functions that require a GUI, not necessarily our CLI. We'd need to make this specified based on the CLI command run.

@@ -225,7 +225,7 @@ def delete_symlink(symlink_path):
logging.error(f"Error removing symlink: {e}")


def check_dependencies(app=None):
def check_dependencies(app=None): # FIXME: misnomer, isn't this an install_dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

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

Holdover from a refactor

@@ -442,7 +442,7 @@ def get_winetricks_options():
# Check if local winetricks version is up-to-date.
cmd = ["winetricks", "--version"]
local_winetricks_version = subprocess.check_output(cmd).split()[0]
if str(local_winetricks_version) >= "20220411":
if str(local_winetricks_version) >= "20220411": #FIXME: consider using config.WINETRICKS_VERSION and != string comparision on versions is dodgy #noqa: E501
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds like a good improvement.

Copy link
Collaborator

@thw26 thw26 left a comment

Choose a reason for hiding this comment

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

Reviewed your comments. A lot sound like good TODOs/FIXMEs. Left my thoughts on others that might need more work.

@thw26 thw26 merged commit 1770c8d into FaithLife-Community:main Oct 24, 2024
@ctrlaltf24 ctrlaltf24 deleted the refactor-add-type-hints branch October 24, 2024 22:02
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.

2 participants