4747_EMITS_CHANGED_PROP = "org.freedesktop.DBus.Property.EmitsChangedSignal"
4848
4949
50- class Diff : # pylint: disable=too-few-public-methods
50+ class Diff :
5151 """
5252 Diff between two different managed object results.
5353 """
5454
5555
56- class AddedProperty (Diff ): # pylint: disable=too-few-public-methods
56+ class AddedProperty (Diff ):
5757 """
5858 Property appears in new result but not in recorded result.
5959 """
@@ -71,7 +71,7 @@ def __repr__(self):
7171 )
7272
7373
74- class RemovedProperty (Diff ): # pylint: disable=too-few-public-methods
74+ class RemovedProperty (Diff ):
7575 """
7676 Property appears in recorded result but not in new result.
7777 """
@@ -89,14 +89,12 @@ def __repr__(self):
8989 )
9090
9191
92- class DifferentProperty (Diff ): # pylint: disable=too-few-public-methods
92+ class DifferentProperty (Diff ):
9393 """
9494 Difference between two properties.
9595 """
9696
97- def __init__ (
98- self , object_path , interface_name , key , old_value , new_value
99- ): # pylint: disable=too-many-positional-arguments,too-many-arguments
97+ def __init__ (self , object_path , interface_name , key , old_value , new_value ):
10098 self .object_path = object_path
10199 self .interface_name = interface_name
102100 self .key = key
@@ -110,7 +108,7 @@ def __repr__(self):
110108 )
111109
112110
113- class DifferentVariantLevel (Diff ): # pylint: disable=too-few-public-methods
111+ class DifferentVariantLevel (Diff ):
114112 """
115113 Represents a case where the property value is correct but the variant
116114 level does not match. The variant levels among the GetManagedObjects
@@ -120,9 +118,7 @@ class DifferentVariantLevel(Diff): # pylint: disable=too-few-public-methods
120118 they must be heterogeneous.
121119 """
122120
123- def __init__ (
124- self , object_path , interface_name , key , old_value , new_value
125- ): # pylint: disable=too-many-positional-arguments,too-many-arguments
121+ def __init__ (self , object_path , interface_name , key , old_value , new_value ):
126122 self .object_path = object_path
127123 self .interface_name = interface_name
128124 self .key = key
@@ -137,15 +133,13 @@ def __repr__(self):
137133 )
138134
139135
140- class NotInvalidatedProperty (Diff ): # pylint: disable=too-few-public-methods
136+ class NotInvalidatedProperty (Diff ):
141137 """
142138 Represents a case where the property should have been invalidated but
143139 was updated instead.
144140 """
145141
146- def __init__ (
147- self , object_path , interface_name , key , old_value , new_value
148- ): # pylint: disable=too-many-positional-arguments,too-many-arguments
142+ def __init__ (self , object_path , interface_name , key , old_value , new_value ):
149143 self .object_path = object_path
150144 self .interface_name = interface_name
151145 self .key = key
@@ -160,15 +154,13 @@ def __repr__(self):
160154 )
161155
162156
163- class ChangedProperty (Diff ): # pylint: disable=too-few-public-methods
157+ class ChangedProperty (Diff ):
164158 """
165159 Represents a case where the property should have been constant but
166160 seems to have changed.
167161 """
168162
169- def __init__ (
170- self , object_path , interface_name , key , old_value , new_value
171- ): # pylint: disable=too-many-positional-arguments,too-many-arguments
163+ def __init__ (self , object_path , interface_name , key , old_value , new_value ):
172164 self .object_path = object_path
173165 self .interface_name = interface_name
174166 self .key = key
@@ -183,7 +175,7 @@ def __repr__(self):
183175 )
184176
185177
186- class RemovedObjectPath (Diff ): # pylint: disable=too-few-public-methods
178+ class RemovedObjectPath (Diff ):
187179 """
188180 Object path appears in recorded result but not in new result.
189181 """
@@ -196,7 +188,7 @@ def __repr__(self):
196188 return f"RemovedObjectPath({ self .object_path !r} , { self .old_value !r} )"
197189
198190
199- class AddedInterface (Diff ): # pylint: disable=too-few-public-methods
191+ class AddedInterface (Diff ):
200192 """
201193 Interface appears in new result but not in recorded result.
202194 """
@@ -213,7 +205,7 @@ def __repr__(self):
213205 )
214206
215207
216- class AddedObjectPath (Diff ): # pylint: disable=too-few-public-methods
208+ class AddedObjectPath (Diff ):
217209 """
218210 Object path appears in new result but not in recorded result.
219211 """
@@ -226,7 +218,7 @@ def __repr__(self):
226218 return f"AddedObjectPath({ self .object_path !r} , { self .new_value !r} )"
227219
228220
229- class RemovedInterface (Diff ): # pylint: disable=too-few-public-methods
221+ class RemovedInterface (Diff ):
230222 """
231223 Interface appears in recorded result but not in new result.
232224 """
@@ -243,7 +235,7 @@ def __repr__(self):
243235 )
244236
245237
246- class MissingInterface (Diff ): # pylint: disable=too-few-public-methods
238+ class MissingInterface (Diff ):
247239 """
248240 Attempted to update a property on this interface, but the interface
249241 itself was missing when that happened.
@@ -295,7 +287,7 @@ def from_str(code_str):
295287 return item
296288 return None
297289
298- class Invalidated : # pylint: disable=too-few-public-methods
290+ class Invalidated :
299291 """
300292 Used to record in the updated GetManagedObjects value that a value has
301293 been invalidated.
@@ -306,7 +298,7 @@ def __repr__(self):
306298
307299 INVALIDATED = Invalidated ()
308300
309- class InterfaceMissing : # pylint: disable=too-few-public-methods
301+ class InterfaceMissing :
310302 """
311303 Used to record in the updated GetManagedObjects value that when a
312304 property changed signal was received, the interface for that property
@@ -424,7 +416,7 @@ def _interfaces_added(object_path, interfaces_added):
424416 _MO [object_path ][interface ] = props
425417 else :
426418 _MO [object_path ] = interfaces_added
427- except Exception as exc : # pylint: disable=broad-except
419+ except Exception as exc :
428420 _CALLBACK_ERRORS .append (exc )
429421
430422 def _interfaces_removed (object_path , interfaces ):
@@ -457,7 +449,7 @@ def _interfaces_removed(object_path, interfaces):
457449 # that the object itself has been removed.
458450 if _MO [object_path ] == {}:
459451 del _MO [object_path ]
460- except Exception as exc : # pylint: disable=broad-except
452+ except Exception as exc :
461453 _CALLBACK_ERRORS .append (exc )
462454
463455 def _properties_changed (* props_changed , object_path = None ):
@@ -524,7 +516,7 @@ def _properties_changed(*props_changed, object_path=None):
524516 data [interface_name ][prop ] = value
525517 for prop in properties_invalidated :
526518 data [interface_name ][prop ] = INVALIDATED
527- except Exception as exc : # pylint: disable=broad-except
519+ except Exception as exc :
528520 _CALLBACK_ERRORS .append (exc )
529521
530522 def _monitor (
@@ -544,7 +536,7 @@ def _monitor(
544536 :type interface_re: re.Pattern
545537 """
546538
547- global _TOP_OBJECT , _TOP_OBJECT_PATH , _TOP_OBJECT_INTERFACES , _SERVICE , _MO , _INTERFACE_RE # pylint: disable=global-statement
539+ global _TOP_OBJECT , _TOP_OBJECT_PATH , _TOP_OBJECT_INTERFACES , _SERVICE , _MO , _INTERFACE_RE # noqa: PLW0603
548540
549541 dbus .mainloop .glib .DBusGMainLoop (set_as_default = True )
550542 bus = dbus .SystemBus ()
@@ -556,7 +548,7 @@ def _monitor(
556548 while True :
557549 try :
558550 _TOP_OBJECT = bus .get_object (service , _TOP_OBJECT_PATH )
559- except Exception as err : # pylint: disable=broad-exception-caught
551+ except Exception as err :
560552 print (
561553 f'Failed to get top object "{ _TOP_OBJECT_PATH } " for '
562554 f'service "{ _SERVICE } ". Error: { err } . Retrying.'
@@ -588,7 +580,7 @@ def _monitor(
588580 while True :
589581 try :
590582 _MO = _MAKE_MO ()
591- except Exception as err : # pylint: disable=broad-exception-caught
583+ except Exception as err :
592584 print (
593585 "Failed to get initial GetManagedObjects result for "
594586 f'service "{ _SERVICE } " and top object '
@@ -747,24 +739,21 @@ def _check():
747739 if _MO is None :
748740 return []
749741
750- mos = _MAKE_MO () # pylint: disable=not-callable
742+ mos = _MAKE_MO ()
751743
752744 diffs = []
753745
754746 old_object_paths = frozenset (_MO .keys ())
755747 new_object_paths = frozenset (mos .keys ())
756748
757749 for object_path in old_object_paths - new_object_paths :
758- diffs .append (
759- # pylint: disable=unsubscriptable-object
760- RemovedObjectPath (object_path , _MO [object_path ])
761- )
750+ diffs .append (RemovedObjectPath (object_path , _MO [object_path ]))
762751
763752 for object_path in new_object_paths - old_object_paths :
764753 diffs .append (AddedObjectPath (object_path , mos [object_path ]))
765754
766755 for object_path in new_object_paths & old_object_paths :
767- old_data = _MO [object_path ] # pylint: disable=unsubscriptable-object
756+ old_data = _MO [object_path ]
768757 new_data = mos [object_path ]
769758
770759 old_ifns = frozenset (old_data .keys ())
@@ -792,7 +781,7 @@ def _check():
792781
793782 try :
794783 result = _check ()
795- except Exception as exco : # pylint: disable=broad-except
784+ except Exception as exco :
796785 print (f"{ exco } " )
797786 sys .exit (4 )
798787
0 commit comments