Run pre-commit (black, isort)

This commit is contained in:
Guewen Baconnier 2020-01-28 11:49:20 +01:00
parent db2684f36f
commit 806c9f063b
2 changed files with 12 additions and 10 deletions

View File

@ -2,12 +2,14 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
import operator import operator
from odoo import api, fields, models from odoo import api, fields, models
class FetchmailServer(models.Model): class FetchmailServer(models.Model):
"""Incoming POP/IMAP mail server account""" """Incoming POP/IMAP mail server account"""
_name = 'fetchmail.server'
_name = "fetchmail.server"
_inherit = ["fetchmail.server", "server.env.mixin"] _inherit = ["fetchmail.server", "server.env.mixin"]
@property @property
@ -26,7 +28,7 @@ class FetchmailServer(models.Model):
mail_fields.update(base_fields) mail_fields.update(base_fields)
return mail_fields return mail_fields
server_type = fields.Selection(search='_search_server_type') server_type = fields.Selection(search="_search_server_type")
@api.model @api.model
def _server_env_global_section_name(self): def _server_env_global_section_name(self):
@ -34,19 +36,19 @@ class FetchmailServer(models.Model):
Can be customized in your model Can be customized in your model
""" """
return 'incoming_mail' return "incoming_mail"
@api.model @api.model
def _search_type(self, oper, value): def _search_type(self, oper, value):
operators = { operators = {
'=': operator.eq, "=": operator.eq,
'!=': operator.ne, "!=": operator.ne,
'in': operator.contains, "in": operator.contains,
'not in': lambda a, b: not operator.contains(a, b), "not in": lambda a, b: not operator.contains(a, b),
} }
if oper not in operators: if oper not in operators:
return [('id', 'in', [])] return [("id", "in", [])]
servers = self.search([]).filtered( servers = self.search([]).filtered(
lambda s: operators[oper](value, s.server_type) lambda s: operators[oper](value, s.server_type)
) )
return [('id', 'in', servers.ids)] return [("id", "in", servers.ids)]

View File

@ -27,4 +27,4 @@ class IrMailServer(models.Model):
Can be customized in your model Can be customized in your model
""" """
return 'outgoing_mail' return "outgoing_mail"