Skip to content

Commit

Permalink
Correct or disable pylint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
guewen authored and nguyenminhchien committed Nov 24, 2023
1 parent 7424713 commit 401ea34
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 57 deletions.
1 change: 0 additions & 1 deletion queue_job/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers
from . import fields
from . import models
Expand Down
1 change: 0 additions & 1 deletion queue_job/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)


Expand Down
1 change: 0 additions & 1 deletion queue_job/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2013-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
Expand Down
1 change: 0 additions & 1 deletion queue_job/exception.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2016 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

Expand Down
1 change: 0 additions & 1 deletion queue_job/fields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# copyright 2016 Camptocamp
# license agpl-3.0 or later (http://www.gnu.org/licenses/agpl.html)

Expand Down
1 change: 0 additions & 1 deletion queue_job/job.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2013-2016 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

Expand Down
1 change: 0 additions & 1 deletion queue_job/jobrunner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
Expand Down
2 changes: 1 addition & 1 deletion queue_job/jobrunner/channels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
Expand Down Expand Up @@ -114,6 +113,7 @@ class SafeSet(set):
>>> s.remove(1)
"""
def remove(self, o):
# pylint: disable=missing-return,except-pass
try:
super(SafeSet, self).remove(o)
except KeyError:
Expand Down
9 changes: 8 additions & 1 deletion queue_job/jobrunner/runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
Expand Down Expand Up @@ -231,6 +230,10 @@ def __init__(self, db_name):
self._initialize()

def close(self):
# pylint: disable=except-pass
# if close fail for any reason, it's either because it's already closed
# and we don't care, or for any reason but anyway it will be closed on
# del
try:
self.conn.close()
except:
Expand Down Expand Up @@ -277,6 +280,10 @@ def _initialize(self):
cr.execute("LISTEN queue_job")

def select_jobs(self, where, args):
# pylint: disable=sql-injection
# the checker thinks we are injecting values but we are not, we are
# adding the where conditions, values are added later properly with
# parameters
query = ("SELECT channel, uuid, id as seq, date_created, "
"priority, EXTRACT(EPOCH FROM eta), state "
"FROM queue_job WHERE %s" %
Expand Down
29 changes: 0 additions & 29 deletions queue_job/migrations/10.0.1.0.0/pre-migration.py

This file was deleted.

2 changes: 0 additions & 2 deletions queue_job/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-

from . import base
from . import queue_job
1 change: 0 additions & 1 deletion queue_job/models/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

Expand Down
7 changes: 2 additions & 5 deletions queue_job/models/queue_job.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2013-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

Expand Down Expand Up @@ -53,18 +52,17 @@ class QueueJob(models.Model):
readonly=True, store=True)

state = fields.Selection(STATES,
string='State',
readonly=True,
required=True,
index=True)
priority = fields.Integer()
exc_info = fields.Text(string='Exception Info', readonly=True)
result = fields.Text(string='Result', readonly=True)
result = fields.Text(readonly=True)

date_created = fields.Datetime(string='Created Date', readonly=True)
date_started = fields.Datetime(string='Start Date', readonly=True)
date_enqueued = fields.Datetime(string='Enqueue Time', readonly=True)
date_done = fields.Datetime(string='Date Done', readonly=True)
date_done = fields.Datetime(readonly=True)

eta = fields.Datetime(string='Execute only after')
retry = fields.Integer(string='Current try')
Expand Down Expand Up @@ -252,7 +250,6 @@ class JobChannel(models.Model):

name = fields.Char()
complete_name = fields.Char(compute='_compute_complete_name',
string='Complete Name',
store=True,
readonly=True)
parent_id = fields.Many2one(comodel_name='queue.job.channel',
Expand Down
2 changes: 0 additions & 2 deletions queue_job/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from . import test_runner_channels
from . import test_runner_runner
from . import test_json_field
1 change: 0 additions & 1 deletion queue_job/tests/common.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
4 changes: 3 additions & 1 deletion queue_job/tests/test_json_field.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# copyright 2016 Camptocamp
# license agpl-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from datetime import datetime, date
import json

from odoo.tests import common

# pylint: disable=odoo-addons-relative-import
# we are testing, we want to test as we were an external consumer of the API
from odoo.addons.queue_job.fields import JobEncoder, JobDecoder


Expand Down
3 changes: 2 additions & 1 deletion queue_job/tests/test_runner_channels.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

import doctest
# pylint: disable=odoo-addons-relative-import
# we are testing, we want to test as we were an external consumer of the API
from odoo.addons.queue_job.jobrunner import channels


Expand Down
3 changes: 2 additions & 1 deletion queue_job/tests/test_runner_runner.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

import doctest
# pylint: disable=odoo-addons-relative-import
# we are testing, we want to test as we were an external consumer of the API
from odoo.addons.queue_job.jobrunner import runner


Expand Down
10 changes: 5 additions & 5 deletions queue_job/views/queue_job_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
<field name="name">queue.job.tree</field>
<field name="model">queue.job</field>
<field name="arch" type="xml">
<tree string="Jobs" create="false"
delete="false"
colors="red:state == 'failed';gray:state == 'done'">
<tree create="false" delete="false"
decoration-danger="state == 'failed'"
decoration-muted="state == 'done'">
<field name="name"/>
<field name="model_name"/>
<field name="state"/>
Expand Down Expand Up @@ -189,7 +189,7 @@
<field name="name">queue.job.channel.tree</field>
<field name="model">queue.job.channel</field>
<field name="arch" type="xml">
<tree string="Channels">
<tree>
<field name="complete_name"/>
</tree>
</field>
Expand Down Expand Up @@ -233,7 +233,7 @@
<field name="name">queue.job.function.tree</field>
<field name="model">queue.job.function</field>
<field name="arch" type="xml">
<tree string="Job Functions" create="false" delete="false">
<tree create="false" delete="false">
<field name="name"/>
<field name="channel_id"/>
</tree>
Expand Down

0 comments on commit 401ea34

Please sign in to comment.