Compatibility with older python3-nautilus
Quoting from devhelp, migrating Nautilus section:
The get_file_items, get_file_items_full, get_background_items a get_background_items_full methods of Nautilus.MenuProvider no longer take the window argument. Remove it from your implementations.
If you need to keep supporting older versions of Nautilus, you can use variadic arguments:
def get_file_items(self, *args): # `args` will be `[files: List[Nautilus.FileInfo]]` in Nautilus 4.0 API, # and `[window: Gtk.Widget, files: List[Nautilus.FileInfo]]` in Nautilus 3.0 API. files = args[-1]