Make PyLint happy with the models code
This commit is contained in:
		| @@ -115,6 +115,11 @@ class User(db.Model, UserMixin): | ||||
|  | ||||
|     @property | ||||
|     def timezone(self): | ||||
|         """The user’s time zone | ||||
|  | ||||
|         If the user didn’t set a time zone yet, the application default is used. | ||||
|         """ | ||||
|  | ||||
|         from flask import current_app | ||||
|         from pytz import timezone | ||||
|         from pytz.exceptions import UnknownTimeZoneError | ||||
| @@ -204,9 +209,9 @@ class Event(db.Model): | ||||
|     description = db.Column(db.UnicodeText()) | ||||
|  | ||||
|     def __as_tz(self, timestamp, as_timezone=None): | ||||
|         from pytz import timezone, UTC | ||||
|         from pytz import timezone, utc | ||||
|  | ||||
|         utc_timestamp = UTC.localize(timestamp) | ||||
|         utc_timestamp = utc.localize(dt=timestamp) | ||||
|  | ||||
|         return utc_timestamp.astimezone(as_timezone or timezone(self.time_zone)) | ||||
|  | ||||
| @@ -240,7 +245,7 @@ class Event(db.Model): | ||||
|         return f'<Event {self.id} ({self.title}) of {self.user}>' | ||||
|  | ||||
|  | ||||
| class UserSetting(db.Model): | ||||
| class UserSetting(db.Model):  # pylint: disable=too-few-public-methods | ||||
|     """Database model for user settings | ||||
|     """ | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user