Browse Source

[REF] remove unused imports

pull/142/head
robin.keunen 2 years ago
parent
commit
54f1aebd4a
  1. 154
      .eslintrc
  2. 20
      .isort.cfg
  3. 122
      .pre-commit-config.yaml
  4. 36
      .travis.yml
  5. 2
      beesdoo_base/models/__init__.py
  6. 2
      beesdoo_base/models/membercard.py
  7. 3
      beesdoo_base/wizard/portal_wizard.py
  8. 2
      beesdoo_easy_my_coop/__init__.py
  9. 1
      beesdoo_easy_my_coop/controllers/main.py
  10. 6
      beesdoo_easy_my_coop/models/__init__.py
  11. 1
      beesdoo_easy_my_coop/models/product.py
  12. 3
      beesdoo_easy_my_coop/models/res_company.py
  13. 3
      beesdoo_easy_my_coop/models/subscription_request.py
  14. 1
      beesdoo_easy_my_coop/tests/test_res_partner.py
  15. 3
      beesdoo_easy_my_coop/wizards/beesdoo_shift_subscribe.py
  16. 2
      beesdoo_inventory/models/stock.py
  17. 4
      beesdoo_shift/models/__init__.py
  18. 2
      beesdoo_shift/models/cooperative_status.py
  19. 4
      beesdoo_shift/models/res_partner.py
  20. 6
      beesdoo_shift/wizard/__init__.py
  21. 2
      beesdoo_shift/wizard/assign_super_coop.py
  22. 6
      beesdoo_shift_attendance/models/attendance_sheet.py
  23. 2
      beesdoo_shift_attendance/models/res_config_settings.py
  24. 3
      beesdoo_shift_attendance/tests/test_beesdoo_shift.py
  25. 2
      beesdoo_shift_attendance/wizard/__init__.py
  26. 2
      beesdoo_shift_attendance/wizard/generate_missing_attendance_sheets.py
  27. 4
      beesdoo_shift_attendance/wizard/validate_attendance_sheet.py
  28. 2
      beesdoo_stock/models/stock.py
  29. 3
      beesdoo_website_shift/controllers/main.py
  30. 2
      beesdoo_website_shift/models/__init__.py
  31. 4
      beesdoo_website_shift/models/res_config.py
  32. 6
      beesdoo_worker_status/models/cooperative_status.py
  33. 6
      beesdoo_worker_status/models/task.py
  34. 4
      beesdoo_worker_status/tests/test_beesdoo_shift.py
  35. 4
      macavrac_base/models/res_partner.py
  36. 2
      purchase_order_generator/models/__init__.py

154
.eslintrc

@ -52,9 +52,14 @@
"no-fallthrough": "warn",
"no-floating-decimal": "warn",
"no-func-assign": "warn",
"no-implicit-coercion": ["warn", {
"allow": ["~"]
}],
"no-implicit-coercion": [
"warn",
{
"allow": [
"~"
]
}
],
"no-implicit-globals": "warn",
"no-implied-eval": "warn",
"no-inline-comments": "warn",
@ -147,19 +152,32 @@
"arrow-spacing": "off",
"accessor-pairs": "warn",
"block-scoped-var": "off",
"block-spacing": ["warn", "always"],
"block-spacing": [
"warn",
"always"
],
"brace-style": "warn",
"callback-return": "warn",
"camelcase": "off",
"capitalized-comments": ["warn", "always", {
"ignoreConsecutiveComments": true,
"ignoreInlineComments": true
}],
"comma-dangle": ["warn", "always-multiline"],
"comma-spacing": ["warn", {
"before": false,
"after": true
}],
"capitalized-comments": [
"warn",
"always",
{
"ignoreConsecutiveComments": true,
"ignoreInlineComments": true
}
],
"comma-dangle": [
"warn",
"always-multiline"
],
"comma-spacing": [
"warn",
{
"before": false,
"after": true
}
],
"comma-style": "warn",
"complexity": [
"warn",
@ -171,7 +189,10 @@
"constructor-super": "warn",
"curly": "warn",
"default-case": "off",
"dot-location": ["warn", "property"],
"dot-location": [
"warn",
"property"
],
"dot-notation": "warn",
"eol-last": "warn",
"eqeqeq": "warn",
@ -195,11 +216,14 @@
],
"lines-around-comment": "warn",
"max-depth": "warn",
"max-len": ["warn", {
"code": 88,
"ignorePattern": "odoo\\.define\\(",
"tabWidth": 4
}],
"max-len": [
"warn",
{
"code": 88,
"ignorePattern": "odoo\\.define\\(",
"tabWidth": 4
}
],
"max-lines": "off",
"max-nested-callbacks": "warn",
"max-params": "off",
@ -211,11 +235,22 @@
"newline-after-var": "off",
"newline-before-return": "off",
"newline-per-chained-call": "off",
"object-curly-newline": ["warn", { "consistent": true }],
"object-curly-spacing": ["warn", "never"],
"object-property-newline": ["warn", {
"allowAllPropertiesOnSameLine": true
}],
"object-curly-newline": [
"warn",
{
"consistent": true
}
],
"object-curly-spacing": [
"warn",
"never"
],
"object-property-newline": [
"warn",
{
"allowAllPropertiesOnSameLine": true
}
],
"object-shorthand": "off",
"one-var": "off",
"one-var-declaration-per-line": "off",
@ -245,39 +280,48 @@
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"spaced-comment": ["warn", "always"],
"strict": ["warn", "function"],
"spaced-comment": [
"warn",
"always"
],
"strict": [
"warn",
"function"
],
"template-curly-spacing": "off",
"unicode-bom": "warn",
"use-isnan": "warn",
"valid-jsdoc": ["warn", {
"prefer": {
"arg": "param",
"argument": "param",
"augments": "extends",
"constructor": "class",
"exception": "throws",
"func": "function",
"method": "function",
"prop": "property",
"return": "returns",
"virtual": "abstract",
"yield": "yields"
},
"preferType": {
"array": "Array",
"bool": "Boolean",
"boolean": "Boolean",
"number": "Number",
"object": "Object",
"str": "String",
"string": "String"
},
"requireParamDescription": false,
"requireReturn": false,
"requireReturnDescription": false,
"requireReturnType": false
}],
"valid-jsdoc": [
"warn",
{
"prefer": {
"arg": "param",
"argument": "param",
"augments": "extends",
"constructor": "class",
"exception": "throws",
"func": "function",
"method": "function",
"prop": "property",
"return": "returns",
"virtual": "abstract",
"yield": "yields"
},
"preferType": {
"array": "Array",
"bool": "Boolean",
"boolean": "Boolean",
"number": "Number",
"object": "Object",
"str": "String",
"string": "String"
},
"requireParamDescription": false,
"requireReturn": false,
"requireReturnDescription": false,
"requireReturnType": false
}
],
"valid-typeof": "warn",
"vars-on-top": "off",
"wrap-iife": "warn",
@ -286,6 +330,6 @@
"yoda": "warn"
},
"parserOptions": {
"ecmaVersion": 2017
"ecmaVersion": 2017
}
}

20
.isort.cfg

@ -1,12 +1,12 @@
[settings]
; see https://github.com/psf/black
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
combine_as_imports=True
use_parentheses=True
line_length=79
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=lxml,pytz
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
combine_as_imports = True
use_parentheses = True
line_length = 79
known_odoo = odoo
known_odoo_addons = odoo.addons
sections = FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party = pytz

122
.pre-commit-config.yaml

@ -1,67 +1,67 @@
exclude: "^setup/|/static/lib/|/static/src/lib/"
default_language_version:
python: python3
python: python3
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
args: [-l 79]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: debug-statements
- id: flake8
name: flake8 except __init__.py
exclude: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.3.1
hooks:
- id: pylint
name: pylint with optional checks
args: ["--rcfile=.pylintrc", "--exit-zero"]
verbose: true
additional_dependencies: ["pylint-odoo==3.0.3"]
- id: pylint
name: pylint with mandatory checks
args: ["--rcfile=.pylintrc-mandatory"]
additional_dependencies: ["pylint-odoo==3.0.3"]
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.0
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
name: isort except __init__.py
exclude: /__init__\.py$
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
args: [-l 79]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: debug-statements
- id: flake8
name: flake8 except __init__.py
exclude: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.3.1
hooks:
- id: pylint
name: pylint with optional checks
args: ["--rcfile=.pylintrc", "--exit-zero"]
verbose: true
additional_dependencies: ["pylint-odoo==3.0.3"]
- id: pylint
name: pylint with mandatory checks
args: ["--rcfile=.pylintrc-mandatory"]
additional_dependencies: ["pylint-odoo==3.0.3"]
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.0
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
name: isort except __init__.py
exclude: /__init__\.py$
#- repo: https://github.com/pre-commit/mirrors-eslint
# rev: v6.5.1
# hooks:

36
.travis.yml

@ -3,33 +3,33 @@ sudo: false
cache: pip
python:
- "3.5"
- "3.5"
addons:
postgresql: "9.6"
apt:
packages:
- expect-dev # provides unbuffer utility
postgresql: "9.6"
apt:
packages:
- expect-dev # provides unbuffer utility
env:
global:
- VERSION="12.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
global:
- VERSION="12.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
matrix:
- LINT_CHECK="1"
- TESTS="1" ODOO_REPO="OCA/OCB"
- TESTS="1" ODOO_REPO="OCA/OCB" UNIT_TEST="1"
matrix:
- LINT_CHECK="1"
- TESTS="1" ODOO_REPO="OCA/OCB"
- TESTS="1" ODOO_REPO="OCA/OCB" UNIT_TEST="1"
install:
- git clone --depth=1 https://github.com/coopiteasy/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
# Disable manifest-required-author for this repository
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly
- pip install unidecode
- git clone --depth=1 https://github.com/coopiteasy/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
# Disable manifest-required-author for this repository
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly
- pip install unidecode
script:
- travis_run_tests
- travis_run_tests
after_success:
- travis_after_tests_success
- travis_after_tests_success

2
beesdoo_base/models/__init__.py

@ -1,2 +1,2 @@
from . import partner
from . import membercard
from . import partner

2
beesdoo_base/models/membercard.py

@ -1,6 +1,6 @@
import uuid
from odoo import api, fields, models
from odoo import fields, models
class MemberCard(models.Model):

3
beesdoo_base/wizard/portal_wizard.py

@ -1,8 +1,7 @@
from odoo import SUPERUSER_ID, api, fields, models
from odoo import api, models
class BeesdooWizard(models.TransientModel):
_inherit = "portal.wizard"
@api.onchange("portal_id")

2
beesdoo_easy_my_coop/__init__.py

@ -1,3 +1,3 @@
from . import controllers
from . import models
from . import wizards
from . import controllers

1
beesdoo_easy_my_coop/controllers/main.py

@ -1,4 +1,3 @@
from odoo import http
from odoo.http import request
from odoo.addons.easy_my_coop_website.controllers.main import (

6
beesdoo_easy_my_coop/models/__init__.py

@ -1,5 +1,5 @@
from . import coop
from . import product
from . import res_company
from . import res_partner
from . import subscription_request
from . import res_company
from . import product
from . import coop

1
beesdoo_easy_my_coop/models/product.py

@ -2,7 +2,6 @@ from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
max_nb_eater_allowed = fields.Integer(

3
beesdoo_easy_my_coop/models/res_company.py

@ -1,11 +1,10 @@
# Copyright 2019 Coop IT Easy SCRLfs
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo import api, fields, models
class ResCompany(models.Model):
_inherit = "res.company"
display_info_session_confirmation = fields.Boolean(
help="Choose to display a info session checkbox on the cooperator"

3
beesdoo_easy_my_coop/models/subscription_request.py

@ -1,11 +1,10 @@
# Copyright 2019 Coop IT Easy SCRLfs
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo import fields, models
class SubscriptionRequest(models.Model):
_inherit = "subscription.request"
info_session_confirmed = fields.Boolean(

1
beesdoo_easy_my_coop/tests/test_res_partner.py

@ -1,7 +1,6 @@
# Copyright 2020 Coop IT Easy SCRLfs (<http://www.coopiteasy.be>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import exceptions
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase

3
beesdoo_easy_my_coop/wizards/beesdoo_shift_subscribe.py

@ -1,11 +1,10 @@
# Copyright 2019 Coop IT Easy SCRLfs
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo import fields, models
class Subscribe(models.TransientModel):
_inherit = "beesdoo.shift.subscribe"
def _get_info_session_followed(self):

2
beesdoo_inventory/models/stock.py

@ -1,4 +1,4 @@
from odoo import _, api, fields, models
from odoo import api, fields, models
class StockPicking(models.Model):

4
beesdoo_shift/models/__init__.py

@ -1,4 +1,4 @@
from . import task
from . import planning
from . import cooperative_status
from . import planning
from . import res_partner
from . import task

2
beesdoo_shift/models/cooperative_status.py

@ -1,5 +1,5 @@
import logging
from datetime import datetime, timedelta
from datetime import timedelta
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError

4
beesdoo_shift/models/res_partner.py

@ -1,8 +1,4 @@
import logging
from datetime import datetime, timedelta
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
class ResPartner(models.Model):

6
beesdoo_shift/wizard/__init__.py

@ -1,7 +1,7 @@
from . import instanciate_planning
from . import batch_template
from . import assign_super_coop
from . import subscribe
from . import batch_template
from . import extension
from . import holiday
from . import instanciate_planning
from . import subscribe
from . import temporary_exemption

2
beesdoo_shift/wizard/assign_super_coop.py

@ -1,4 +1,4 @@
from odoo import _, api, fields, models
from odoo import api, fields, models
class AssignSuperCoop(models.TransientModel):

6
beesdoo_shift_attendance/models/attendance_sheet.py

@ -1,9 +1,7 @@
from datetime import date, datetime, timedelta
from lxml import etree
from odoo import _, api, exceptions, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class AttendanceSheetShift(models.Model):

2
beesdoo_shift_attendance/models/res_config_settings.py

@ -1,8 +1,6 @@
# Copyright 2019-2020 Elouan Le Bars <elouan@coopiteasy.be>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import ast
from odoo import api, fields, models

3
beesdoo_shift_attendance/tests/test_beesdoo_shift.py

@ -4,8 +4,7 @@
import time
from datetime import datetime, timedelta
from odoo import exceptions, fields
from odoo.exceptions import UserError, ValidationError
from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase

2
beesdoo_shift_attendance/wizard/__init__.py

@ -1,2 +1,2 @@
from . import validate_attendance_sheet
from . import generate_missing_attendance_sheets
from . import validate_attendance_sheet

2
beesdoo_shift_attendance/wizard/generate_missing_attendance_sheets.py

@ -1,7 +1,7 @@
from datetime import datetime
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo.exceptions import UserError
class GenerateMissingAttendanceSheets(models.TransientModel):

4
beesdoo_shift_attendance/wizard/validate_attendance_sheet.py

@ -1,7 +1,7 @@
import ast
from odoo import _, api, exceptions, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class ValidateAttendanceSheet(models.TransientModel):

2
beesdoo_stock/models/stock.py

@ -1,4 +1,4 @@
from odoo import api, fields, models
from odoo import api, models
class StockPackOperation(models.Model):

3
beesdoo_website_shift/controllers/main.py

@ -3,13 +3,12 @@
# Copyright 2017-2018 Thibault François
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from ast import literal_eval
from datetime import datetime, timedelta
from itertools import groupby
from pytz import timezone, utc
from odoo import fields, http
from odoo import http
from odoo.http import request
from odoo.addons.beesdoo_shift.models.planning import float_to_time

2
beesdoo_website_shift/models/__init__.py

@ -1,2 +1,2 @@
from . import website
from . import res_config
from . import website

4
beesdoo_website_shift/models/res_config.py

@ -1,9 +1,7 @@
# Copyright 2017-2020 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from ast import literal_eval
from odoo import api, fields, models
from odoo import fields, models
class WebsiteShiftConfigSettings(models.TransientModel):

6
beesdoo_worker_status/models/cooperative_status.py

@ -1,8 +1,4 @@
import logging
from datetime import datetime, timedelta
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo import api, fields, models
from odoo.addons.beesdoo_shift.models.cooperative_status import add_days_delta

6
beesdoo_worker_status/models/task.py

@ -1,8 +1,4 @@
import json
from datetime import datetime, timedelta
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo import fields, models
class Task(models.Model):

4
beesdoo_worker_status/tests/test_beesdoo_shift.py

@ -1,11 +1,9 @@
# Copyright 2019 - Today Coop IT Easy SCRLfs (<http://www.coopiteasy.be>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import time
from datetime import datetime, timedelta
from odoo import exceptions, fields
from odoo.exceptions import UserError, ValidationError
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase

4
macavrac_base/models/res_partner.py

@ -1,9 +1,7 @@
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo import api, fields, models
class Partner(models.Model):
_inherit = "res.partner"
date_stamp = fields.Date(

2
purchase_order_generator/models/__init__.py

@ -1,4 +1,4 @@
from . import product_template
from . import purchase_order
from . import purchase_order_generator
from . import purchase_order_generator_line
from . import product_template
Loading…
Cancel
Save