Philipp Hörist pushed to branch master at gajim / gajim

Commits:

9 changed files:

Changes:

  • gajim/common/preview_helpers.py
    ... ... @@ -278,7 +278,7 @@ def pixbuf_from_data(data: bytes) -> Optional[GdkPixbuf.Pixbuf]:
    278 278
             # Fallback to Pillow
    
    279 279
             input_file = BytesIO(data)
    
    280 280
             image = Image.open(BytesIO(data)).convert('RGBA')
    
    281
    -        array = GLib.Bytes.new(image.tobytes())  # type: ignore
    
    281
    +        array = GLib.Bytes.new(image.tobytes())  # pyright: ignore
    
    282 282
             width, height = image.size
    
    283 283
             pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(array,
    
    284 284
                                                      GdkPixbuf.Colorspace.RGB,
    

  • gajim/common/settings.py
    ... ... @@ -258,7 +258,7 @@ def _load_app_overrides(self) -> None:
    258 258
         def _namedtuple_factory(cursor: sqlite3.Cursor,
    
    259 259
                                 row: tuple[Any, ...]) -> NamedTuple:
    
    260 260
             fields = [col[0] for col in cursor.description]
    
    261
    -        return namedtuple('Row', fields)(*row)  # type: ignore
    
    261
    +        return namedtuple('Row', fields)(*row)  # pyright: ignore
    
    262 262
     
    
    263 263
         def _connect_database(self) -> None:
    
    264 264
             path = configpaths.get('SETTINGS')
    

  • gajim/common/storage/archive.py
    ... ... @@ -191,7 +191,7 @@ def _namedtuple_factory(self,
    191 191
     
    
    192 192
             assert cursor.description is not None
    
    193 193
             fields = [col[0] for col in cursor.description]
    
    194
    -        Row = namedtuple('Row', fields)  # type: ignore
    
    194
    +        Row = namedtuple('Row', fields)  # pyright: ignore
    
    195 195
             named_row = Row(*row)
    
    196 196
             if 'additional_data' in fields:
    
    197 197
                 _dict = json.loads(named_row.additional_data or '{}')
    

  • gajim/common/storage/base.py
    ... ... @@ -91,7 +91,7 @@ def _jid_converter(jid: bytes) -> JID:
    91 91
     
    
    92 92
     
    
    93 93
     def _convert_disco_info(disco_info: bytes) -> DiscoInfo:
    
    94
    -    return parse_disco_info(Iq(node=disco_info))  # type: ignore
    
    94
    +    return parse_disco_info(Iq(node=disco_info))  # pyright: ignore
    
    95 95
     
    
    96 96
     
    
    97 97
     def _adapt_disco_info(disco_info: DiscoInfo) -> str:
    
    ... ... @@ -112,7 +112,7 @@ def _convert_json(json_string: bytes) -> dict[str, Any]:
    112 112
     class Encoder(json.JSONEncoder):
    
    113 113
         def default(self, o: Any) -> Any:
    
    114 114
             if isinstance(o, set):
    
    115
    -            return list(o)  # type: ignore
    
    115
    +            return list(o)  # pyright: ignore
    
    116 116
     
    
    117 117
             if isinstance(o, JID):
    
    118 118
                 return {'__type': 'JID', 'value': str(o)}
    

  • gajim/common/storage/cache.py
    ... ... @@ -87,7 +87,7 @@
    87 87
     class UnreadTableRow(NamedTuple):
    
    88 88
         account: str
    
    89 89
         jid: JID
    
    90
    -    count: int  # type: ignore
    
    90
    +    count: int  # pyright: ignore
    
    91 91
         message_id: str
    
    92 92
         timestamp: float
    
    93 93
     
    
    ... ... @@ -121,7 +121,7 @@ def _namedtuple_factory(cursor: sqlite3.Cursor,
    121 121
     
    
    122 122
             assert cursor.description is not None
    
    123 123
             fields = [col[0] for col in cursor.description]
    
    124
    -        Row = namedtuple('Row', fields)  # type: ignore
    
    124
    +        Row = namedtuple('Row', fields)  # pyright: ignore
    
    125 125
             return Row(*row)
    
    126 126
     
    
    127 127
         def _migrate(self) -> None:
    
    ... ... @@ -212,7 +212,7 @@ def get_last_disco_info(self,
    212 212
             disco_info = self._disco_info_cache.get(jid)
    
    213 213
             if disco_info is not None:
    
    214 214
                 max_timestamp = time.time() - max_age if max_age else 0
    
    215
    -            if max_timestamp > disco_info.timestamp:  # type: ignore
    
    215
    +            if max_timestamp > disco_info.timestamp:  # pyright: ignore
    
    216 216
                     return None
    
    217 217
             return disco_info
    
    218 218
     
    

  • gajim/common/storage/events.py
    ... ... @@ -88,7 +88,7 @@ def _namedtuple_factory(cursor: sqlite3.Cursor,
    88 88
     
    
    89 89
             assert cursor.description is not None
    
    90 90
             fields = [col[0] for col in cursor.description]
    
    91
    -        Row = namedtuple('Row', fields)  # type: ignore
    
    91
    +        Row = namedtuple('Row', fields)  # pyright: ignore
    
    92 92
             return Row(*row)
    
    93 93
     
    
    94 94
         def _migrate(self) -> None:
    

  • gajim/gtk/notification.py
    ... ... @@ -299,7 +299,7 @@ def on_proxy_ready(_source: Gio.DBusProxy,
    299 299
                                res: Gio.AsyncResult) -> None:
    
    300 300
                 try:
    
    301 301
                     proxy = Gio.DBusProxy.new_finish(res)
    
    302
    -                self._caps = proxy.GetCapabilities()  # type: ignore
    
    302
    +                self._caps = proxy.GetCapabilities()  # pyright: ignore
    
    303 303
                 except GLib.Error as error:
    
    304 304
                     log.warning('Notifications D-Bus not available: %s', error)
    
    305 305
                 else:
    

  • gajim/gtk/util.py
    ... ... @@ -506,7 +506,7 @@ def text_to_color(text: str) -> tuple[float, float, float]:
    506 506
             background = (0, 0, 0)  # RGB (0, 0, 0) black
    
    507 507
         else:
    
    508 508
             background = (1, 1, 1)  # RGB (255, 255, 255) white
    
    509
    -    return nbxmpp.util.text_to_color(text, background)  # type: ignore
    
    509
    +    return nbxmpp.util.text_to_color(text, background)  # pyright: ignore
    
    510 510
     
    
    511 511
     
    
    512 512
     def get_contact_color(contact: types.ChatContactT
    
    ... ... @@ -566,7 +566,7 @@ def get_pixbuf_from_data(file_data: bytes) -> Optional[GdkPixbuf.Pixbuf]:
    566 566
                         'convert avatar image using pillow')
    
    567 567
             try:
    
    568 568
                 avatar = Image.open(BytesIO(file_data)).convert('RGBA')
    
    569
    -            array = GLib.Bytes.new(avatar.tobytes())  # type: ignore
    
    569
    +            array = GLib.Bytes.new(avatar.tobytes())  # pyright: ignore
    
    570 570
                 width, height = avatar.size
    
    571 571
                 pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(
    
    572 572
                     array, GdkPixbuf.Colorspace.RGB,
    
    ... ... @@ -626,7 +626,7 @@ def load_pixbuf(path: Union[str, Path],
    626 626
                 log.debug('Error', exc_info=True)
    
    627 627
                 return None
    
    628 628
     
    
    629
    -        array = GLib.Bytes.new(avatar.tobytes())  # type: ignore
    
    629
    +        array = GLib.Bytes.new(avatar.tobytes())  # pyright: ignore
    
    630 630
             width, height = avatar.size
    
    631 631
             pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(
    
    632 632
                 array, GdkPixbuf.Colorspace.RGB, True,
    
    ... ... @@ -681,7 +681,7 @@ def get_app_windows(account: str) -> list[Gtk.Window]:
    681 681
         windows: list[Gtk.Window] = []
    
    682 682
         for win in app.app.get_windows():
    
    683 683
             if hasattr(win, 'account'):
    
    684
    -            if win.account == account:  # type: ignore
    
    684
    +            if win.account == account:  # pyright: ignore
    
    685 685
                     windows.append(win)
    
    686 686
         return windows
    
    687 687
     
    
    ... ... @@ -695,11 +695,11 @@ def get_app_window(name: str,
    695 695
                 continue
    
    696 696
     
    
    697 697
             if account is not None:
    
    698
    -            if account != win.account:  # type: ignore
    
    698
    +            if account != win.account:  # pyright: ignore
    
    699 699
                     continue
    
    700 700
     
    
    701 701
             if jid is not None:
    
    702
    -            if jid != win.jid:  # type: ignore
    
    702
    +            if jid != win.jid:  # pyright: ignore
    
    703 703
                     continue
    
    704 704
             return win
    
    705 705
         return None
    
    ... ... @@ -728,7 +728,7 @@ def get_gtk_version() -> str:
    728 728
     class EventHelper(CommonEventHelper):
    
    729 729
         def __init__(self):
    
    730 730
             CommonEventHelper.__init__(self)
    
    731
    -        self.connect('destroy', self.__on_destroy)  # type: ignore
    
    731
    +        self.connect('destroy', self.__on_destroy)  # pyright: ignore
    
    732 732
     
    
    733 733
         def __on_destroy(self, *args: Any) -> None:
    
    734 734
             self.unregister_events()
    

  • pyproject.toml
    ... ... @@ -95,6 +95,7 @@ select = [
    95 95
       "C901",   # mccabe
    
    96 96
       # "D",    # pydocstyle
    
    97 97
       "E",      # pycodestyle
    
    98
    +  # "EM",     # flake8-errmsg
    
    98 99
       # "ERA",    # eradicate
    
    99 100
       "F",      # pyflakes  
    
    100 101
       # "FBT",    # flake8-boolean-trap