Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ recursive=yes
# source root.
source-roots=

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
Expand Down Expand Up @@ -567,7 +563,7 @@ contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=PyQt5.*,orjson.*
generated-members=PyQt5.*,orjson.*,shiboken6.*

# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ indent-width = 4

[tool.ruff.lint]
extend-select = ["E", "F", "UP", "B", "SIM", "I"]
extend-ignore = [ "UP008", "SIM102", "SIM108" ]
extend-ignore = [ "UP008", "SIM102", "SIM108", "E501" ]

[tool.ruff.format]
quote-style = "single"
Expand Down
6 changes: 3 additions & 3 deletions rare/components/tabs/settings/widgets/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def getValue(self) -> str | None:
return f'{self.option}={text}' if (text := self.text()) else None

def setValue(self, options: dict[str, str]):
if (value := options.get(self.option, None)) is not None:
if (value := options.get(self.option)) is not None:
self.setText(value)
options.pop(self.option)
else:
Expand All @@ -47,7 +47,7 @@ def getValue(self) -> str | None:
return f'{self.option}={self.currentData(Qt.ItemDataRole.UserRole)}' if self.currentIndex() > 0 else None

def setValue(self, options: dict[str, str]):
if (value := options.get(self.option, None)) is not None:
if (value := options.get(self.option)) is not None:
self.setCurrentIndex(self.findData(value, Qt.ItemDataRole.UserRole))
options.pop(self.option)
else:
Expand Down Expand Up @@ -85,7 +85,7 @@ def getValue(self) -> str | None:
return value if checked ^ self.default_enabled else None

def setValue(self, options: dict[str, str]):
if options.get(self.option, None) is not None:
if options.get(self.option) is not None:
if self.values:
self.setChecked(bool(self.values.index(options[self.option])))
else:
Expand Down
12 changes: 6 additions & 6 deletions rare/components/tabs/store/api/models/diesel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DieselSystemDetailItem:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['DieselSystemDetailItem'], src: dict[str, Any]) -> 'DieselSystemDetailItem':
def from_dict(cls, src: dict[str, Any]) -> 'DieselSystemDetailItem':
d = src.copy()
return cls(
_type=d.pop('_type', ''),
Expand All @@ -36,7 +36,7 @@ class DieselSystemDetail:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['DieselSystemDetail'], src: dict[str, Any]) -> 'DieselSystemDetail':
def from_dict(cls, src: dict[str, Any]) -> 'DieselSystemDetail':
d = src.copy()
details = tuple(map(DieselSystemDetailItem.from_dict, d.pop('details', [])))
return cls(
Expand All @@ -56,7 +56,7 @@ class DieselSystemDetails:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['DieselSystemDetails'], src: dict[str, Any]) -> 'DieselSystemDetails':
def from_dict(cls, src: dict[str, Any]) -> 'DieselSystemDetails':
d = src.copy()
systems = tuple(map(DieselSystemDetail.from_dict, d.pop('systems', [])))
return cls(
Expand All @@ -78,7 +78,7 @@ class DieselProductAbout:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['DieselProductAbout'], src: dict[str, Any]) -> 'DieselProductAbout':
def from_dict(cls, src: dict[str, Any]) -> 'DieselProductAbout':
d = src.copy()
return cls(
_type=d.pop('_type', ''),
Expand All @@ -99,7 +99,7 @@ class DieselProductDetail:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['DieselProductDetail'], src: dict[str, Any]) -> 'DieselProductDetail':
def from_dict(cls, src: dict[str, Any]) -> 'DieselProductDetail':
d = src.copy()
about = DieselProductAbout.from_dict(x) if (x := d.pop('about'), {}) else None
requirements = DieselSystemDetails.from_dict(x) if (x := d.pop('requirements', {})) else None
Expand Down Expand Up @@ -127,7 +127,7 @@ class DieselProduct:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['DieselProduct'], src: dict[str, Any]) -> 'DieselProduct':
def from_dict(cls, src: dict[str, Any]) -> 'DieselProduct':
d = src.copy()
pages = tuple(map(DieselProduct.from_dict, d.pop('pages', [])))
data = DieselProductDetail.from_dict(x) if (x := d.pop('data', {})) else None
Expand Down
40 changes: 20 additions & 20 deletions rare/components/tabs/store/api/models/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def as_dict(self) -> dict[str, Any]:
return tmp

@classmethod
def from_dict(cls: type['ImageUrlModel'], src: dict[str, Any]) -> 'ImageUrlModel':
def from_dict(cls, src: dict[str, Any]) -> 'ImageUrlModel':
d = src.copy()
return cls(type=d.pop('type', ''), url=d.pop('url', ''))

Expand Down Expand Up @@ -66,7 +66,7 @@ def __bool__(self):
return bool(self.key_images)

@classmethod
def from_list(cls: type['KeyImagesModel'], src: list[dict]):
def from_list(cls, src: list[dict]):
d = src.copy()
key_images = tuple(map(ImageUrlModel.from_dict, d))
return cls(key_images=key_images)
Expand Down Expand Up @@ -112,7 +112,7 @@ class TotalPriceModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['TotalPriceModel'], src: dict[str, Any]) -> 'TotalPriceModel':
def from_dict(cls, src: dict[str, Any]) -> 'TotalPriceModel':
d = src.copy()
return cls(
discountPrice=d.pop('discountPrice', 0),
Expand All @@ -133,7 +133,7 @@ class GetPriceResModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['GetPriceResModel'], src: dict[str, Any]) -> 'GetPriceResModel':
def from_dict(cls, src: dict[str, Any]) -> 'GetPriceResModel':
d = src.copy()
total_price = TotalPriceModel.from_dict(x) if (x := d.pop('totalPrice', {})) else None
return cls(totalPrice=total_price, lineOffers=d.pop('lineOffers', {}), unmapped=d)
Expand All @@ -150,7 +150,7 @@ class PromotionalOfferModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['PromotionalOfferModel'], src: dict[str, Any]) -> 'PromotionalOfferModel':
def from_dict(cls, src: dict[str, Any]) -> 'PromotionalOfferModel':
d = src.copy()
start_date = parse_date(x) if (x := d.pop('startDate', '')) else None
end_date = parse_date(x) if (x := d.pop('endDate', '')) else None
Expand All @@ -168,7 +168,7 @@ class PromotionalOffersModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_list(cls: type['PromotionalOffersModel'], src: dict[str, list]) -> 'PromotionalOffersModel':
def from_list(cls, src: dict[str, list]) -> 'PromotionalOffersModel':
d = src.copy()
promotional_offers = tuple(map(PromotionalOfferModel.from_dict, d.pop('promotionalOffers', [])))
return cls(promotionalOffers=promotional_offers, unmapped=d)
Expand All @@ -181,7 +181,7 @@ class PromotionsModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['PromotionsModel'], src: dict[str, Any]) -> 'PromotionsModel':
def from_dict(cls, src: dict[str, Any]) -> 'PromotionsModel':
d = src.copy()
promotional_offers = tuple(map(PromotionalOffersModel.from_list, d.pop('promotionalOffers', [])))
upcoming_promotional_offers = tuple(map(PromotionalOffersModel.from_list, d.pop('upcomingPromotionalOffers', [])))
Expand Down Expand Up @@ -220,7 +220,7 @@ class CatalogOfferModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['CatalogOfferModel'], src: dict[str, Any]) -> 'CatalogOfferModel':
def from_dict(cls, src: dict[str, Any]) -> 'CatalogOfferModel':
d = src.copy()
effective_date = parse_date(x) if (x := d.pop('effectiveDate', '')) else None
expiry_date = parse_date(x) if (x := d.pop('expiryDate', '')) else None
Expand Down Expand Up @@ -269,7 +269,7 @@ class WishlistItemModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['WishlistItemModel'], src: dict[str, Any]) -> 'WishlistItemModel':
def from_dict(cls, src: dict[str, Any]) -> 'WishlistItemModel':
d = src.copy()
created = parse_date(x) if (x := d.pop('created', '')) else None
offer = CatalogOfferModel.from_dict(x) if (x := d.pop('offer', {})) else None
Expand All @@ -294,7 +294,7 @@ class PagingModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['PagingModel'], src: dict[str, Any]) -> 'PagingModel':
def from_dict(cls, src: dict[str, Any]) -> 'PagingModel':
d = src.copy()
count = d.pop('count', 0)
total = d.pop('total', 0)
Expand All @@ -308,7 +308,7 @@ class SearchStoreModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['SearchStoreModel'], src: dict[str, Any]) -> 'SearchStoreModel':
def from_dict(cls, src: dict[str, Any]) -> 'SearchStoreModel':
d = src.copy()
_elements = d.pop('elements', [])
elements = tuple(map(CatalogOfferModel.from_dict, _elements))
Expand All @@ -322,7 +322,7 @@ class CatalogModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['CatalogModel'], src: dict[str, Any]) -> 'CatalogModel':
def from_dict(cls, src: dict[str, Any]) -> 'CatalogModel':
d = src.copy()
search_store = SearchStoreModel.from_dict(x) if (x := d.pop('searchStore', {})) else None
return cls(searchStore=search_store, unmapped=d)
Expand All @@ -335,7 +335,7 @@ class WishlistItemsModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['WishlistItemsModel'], src: dict[str, Any]) -> 'WishlistItemsModel':
def from_dict(cls, src: dict[str, Any]) -> 'WishlistItemsModel':
d = src.copy()
_elements = d.pop('elements', [])
elements = tuple(map(WishlistItemModel.from_dict, _elements))
Expand All @@ -349,7 +349,7 @@ class RemoveFromWishlistModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['RemoveFromWishlistModel'], src: dict[str, Any]) -> 'RemoveFromWishlistModel':
def from_dict(cls, src: dict[str, Any]) -> 'RemoveFromWishlistModel':
d = src.copy()
return cls(success=d.pop('success', False), unmapped=d)

Expand All @@ -361,7 +361,7 @@ class AddToWishlistModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['AddToWishlistModel'], src: dict[str, Any]) -> 'AddToWishlistModel':
def from_dict(cls, src: dict[str, Any]) -> 'AddToWishlistModel':
d = src.copy()
wishlist_item = WishlistItemModel.from_dict(x) if (x := d.pop('wishlistItem', {})) else None
return cls(wishlistItem=wishlist_item, success=d.pop('success', False), unmapped=d)
Expand All @@ -375,7 +375,7 @@ class WishlistModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['WishlistModel'], src: dict[str, Any]) -> 'WishlistModel':
def from_dict(cls, src: dict[str, Any]) -> 'WishlistModel':
d = src.copy()
wishlist_items = WishlistItemsModel.from_dict(x) if (x := d.pop('wishlistItems', {})) else None
remove_from_wishlist = RemoveFromWishlistModel.from_dict(x) if (x := d.pop('removeFromWishlist', {})) else None
Expand All @@ -399,7 +399,7 @@ class DataModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['DataModel'], src: dict[str, Any]) -> 'DataModel':
def from_dict(cls, src: dict[str, Any]) -> 'DataModel':
d = src.copy()
catalog = CatalogModel.from_dict(x) if (x := d.pop('Catalog', {})) else None
wishlist = WishlistModel.from_dict(x) if (x := d.pop('Wishlist', {})) else None
Expand All @@ -417,7 +417,7 @@ def __str__(self):
return f'{self.correlationId} - {self.message}'

@classmethod
def from_dict(cls: type['ErrorModel'], src: dict[str, Any]) -> 'ErrorModel':
def from_dict(cls, src: dict[str, Any]) -> 'ErrorModel':
d = src.copy()
return cls(
message=d.pop('message', ''),
Expand All @@ -432,7 +432,7 @@ class ExtensionsModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['ExtensionsModel'], src: dict[str, Any]) -> 'ExtensionsModel':
def from_dict(cls, src: dict[str, Any]) -> 'ExtensionsModel':
d = src.copy()
return cls(unmapped=d)

Expand All @@ -445,7 +445,7 @@ class ResponseModel:
unmapped: dict[str, Any] = field(default_factory=dict)

@classmethod
def from_dict(cls: type['ResponseModel'], src: dict[str, Any]) -> 'ResponseModel':
def from_dict(cls, src: dict[str, Any]) -> 'ResponseModel':
d = src.copy()
data = DataModel.from_dict(x) if (x := d.pop('data', {})) else None
_errors = d.pop('errors', [])
Expand Down
4 changes: 2 additions & 2 deletions rare/models/steam.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SteamShortcut:
tags: dict = field(default_factory=dict)

@classmethod
def from_dict(cls: type['SteamShortcut'], src: dict[str, Any]) -> 'SteamShortcut':
def from_dict(cls, src: dict[str, Any]) -> 'SteamShortcut':
d = src.copy()
tmp = cls(
appid=d.pop('appid', 0),
Expand All @@ -97,7 +97,7 @@ def from_dict(cls: type['SteamShortcut'], src: dict[str, Any]) -> 'SteamShortcut

@classmethod
def create(
cls: type['SteamShortcut'],
cls,
app_name: str,
app_title: str,
executable: str,
Expand Down
7 changes: 4 additions & 3 deletions rare/widgets/image_widget.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from contextlib import suppress
from enum import Enum

import shiboken6
from PySide6.QtCore import QRectF, QSize, Qt
from PySide6.QtGui import (
QBrush,
Expand Down Expand Up @@ -67,7 +67,7 @@ def setPixmap(self, pixmap: QPixmap) -> None:
self.paint_image = self.paint_image_empty
# FIXME: this suppresss the RuntimeError raised by Qt if the widget has already
# deleted. Temporary until I look into it again.
with suppress(RuntimeError):
if shiboken6.isValid(self):
self.update()

def sizeHint(self) -> QSize:
Expand Down Expand Up @@ -200,7 +200,8 @@ def fetchPixmap(self, url: str, params: dict = None):

def _on_image_ready(self, data):
super()._on_image_ready(data)
self.spinner.stop()
if shiboken6.isValid(self.spinner):
self.spinner.stop()


__all__ = ['ImageSize', 'ImageWidget', 'LoadingImageWidget', 'LoadingSpinnerImageWidget']
Loading