Skip to content

Commit

Permalink
Fix issues for new pylint check
Browse files Browse the repository at this point in the history
The possibly-used-before-assignment was introduced in Pylint
version 3.2.0.
  • Loading branch information
jkonecny12 committed Jun 4, 2024
1 parent c91904e commit 6a12d15
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
14 changes: 10 additions & 4 deletions anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ def exitHandler(rebootData):
from pyanaconda.core.process_watchers import WatchProcesses
WatchProcesses.unwatch_all_processes()

# pylint: disable=possibly-used-before-assignment
# pylint: disable=used-before-assignment
if flags.usevnc:
vnc.shutdownServer()

# pylint: disable=possibly-used-before-assignment
# pylint: disable=used-before-assignment
if "nokill" in kernel_arguments:
util.vtActivate(1)
Expand All @@ -52,13 +54,14 @@ def exitHandler(rebootData):
uninhibit_screensaver()

# Unsetup the payload, which most usefully unmounts live images
# pylint: disable=possibly-used-before-assignment
if anaconda.payload:
anaconda.payload.unsetup()

# Collect all optical media.
from pyanaconda.modules.common.constants.objects import DEVICE_TREE
from pyanaconda.modules.common.structures.storage import DeviceData
device_tree = STORAGE.get_proxy(DEVICE_TREE)
device_tree = STORAGE.get_proxy(DEVICE_TREE) # pylint: disable=possibly-used-before-assignment
optical_media = []

for device_name in device_tree.FindOpticalMedia():
Expand All @@ -79,15 +82,16 @@ def exitHandler(rebootData):
anaconda.dbus_launcher.stop()

# Clean up the PID file
if pidfile:
if pidfile: # pylint: disable=possibly-used-before-assignment
pidfile.close()

# Reboot the system.
if conf.system.can_reboot:
if conf.system.can_reboot: # pylint: disable=possibly-used-before-assignment
from pykickstart.constants import KS_SHUTDOWN, KS_WAIT

if flags.eject or rebootData.eject:
for device_path in optical_media:
# pylint: disable=possibly-used-before-assignment
if path.get_mount_paths(device_path):
util.dracut_eject(device_path)

Expand Down Expand Up @@ -150,7 +154,9 @@ def setup_environment():
if "DISPLAY" in os.environ:
flags.preexisting_x11 = True
else:
os.environ["DISPLAY"] = ":%s" % constants.X_DISPLAY_NUMBER # pylint: disable=used-before-assignment
# This line is too long, unfortunately this disable won't work when used on above line
# pylint: disable=used-before-assignment
os.environ["DISPLAY"] = ":%s" % constants.X_DISPLAY_NUMBER # pylint: disable=possibly-used-before-assignment

# We mostly don't run from bash, so it won't load the file for us, and libreport will then
# show vi instead of nano. Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1889674
Expand Down
2 changes: 2 additions & 0 deletions pyanaconda/modules/storage/bootloader/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,8 @@ def _set_storage_boot_args(self, storage):
if device != dep and not device.depends_on(dep):
continue

setup_args = None

if isinstance(dep, blivet.devices.FcoeDiskDevice):
log.debug("Getting dracut arguments for FCoE device %s", dep)
setup_args = fcoe_proxy.GetDracutArguments(dep.nic)
Expand Down
3 changes: 2 additions & 1 deletion pyanaconda/ui/gui/spokes/lib/accordion.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def process_event(self, selector, event, cb):
gi.require_version("Gdk", "3.0")
from gi.repository import Gdk

old_selector = self.current_selector

if event:
if event.type not in [Gdk.EventType.BUTTON_PRESS, Gdk.EventType.KEY_RELEASE,
Gdk.EventType.FOCUS_CHANGE]:
Expand All @@ -325,7 +327,6 @@ def process_event(self, selector, event, cb):
event.keyval not in [Gdk.KEY_space, Gdk.KEY_Return, Gdk.KEY_ISO_Enter, Gdk.KEY_KP_Enter, Gdk.KEY_KP_Space]:
return

old_selector = self.current_selector
# deal with multiselection
state = event.get_state()
if state & Gdk.ModifierType.CONTROL_MASK: # holding CTRL
Expand Down
3 changes: 3 additions & 0 deletions pyanaconda/ui/gui/spokes/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def refresh(self):
homedir = self.user.homedir
elif self.user.name:
homedir = "/home/" + self.user.name
else:
# this state shouldn't happen
raise ValueError("Can't resolve home directory")

self._tHome.set_text(homedir)
self._origHome = homedir
Expand Down

0 comments on commit 6a12d15

Please sign in to comment.