Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] Fix pep8 #19

Merged
merged 2 commits into from
Jul 23, 2014
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
18 changes: 18 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Config file .coveragerc
# adapt the include for your project

[report]
include =
*/carrier-delivery/*

omit =
*/tests/*
*__init__.py

# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about null context checking
if context is None:
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: python

python:
- "2.7"

env:
- VERSION="8.0" ODOO_REPO="odoo/odoo"
- VERSION="8.0" ODOO_REPO="OCA/OCB"

virtualenv:
system_site_packages: true

install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly ${VERSION}

script:
- travis_run_flake8
- travis_run_tests ${VERSION}

after_success:
coveralls
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/OCA/carrier-delivery.svg?branch=master)](https://travis-ci.org/OCA/carrier-delivery)
[![Coverage Status](https://coveralls.io/repos/OCA/carrier-delivery/badge.png?branch=master)](https://coveralls.io/r/OCA/carrier-delivery?branch=master)
[![Build Status](https://travis-ci.org/OCA/carrier-delivery.svg?branch=8.0)](https://travis-ci.org/OCA/carrier-delivery)
[![Coverage Status](https://coveralls.io/repos/OCA/carrier-delivery/badge.png?branch=8.0)](https://coveralls.io/r/OCA/carrier-delivery?branch=8.0)

Carriers And Deliveries Management
==================================
Expand Down
2 changes: 1 addition & 1 deletion __unported__/base_delivery_carrier_files/carrier_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _generate_files(self, cr, uid, carrier_file, picking_ids,
picking_obj.write(cr, uid, picking_ids,
{'carrier_file_generated': True},
context=context)
except Exception, e:
except Exception as e:
log.exception("Could not create the picking file "
"for pickings %s: %s",
picking_ids, e)
Expand Down
16 changes: 7 additions & 9 deletions __unported__/base_delivery_carrier_label/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def generate_default_label(self, cr, uid, ids, tracking_ids=None,

"""
raise orm.except_orm(
'Error',
'No label is configured for selected delivery method.')
'Error',
'No label is configured for selected delivery method.'
)

def generate_shipping_labels(self, cr, uid, ids, tracking_ids=None,
context=None):
Expand Down Expand Up @@ -183,7 +184,7 @@ def option_ids_change(self, cr, uid, ids, option_ids, carrier_id, context=None):
carrier = carrier_obj.browse(cr, uid, carrier_id, context=context)
for available_option in carrier.available_option_ids:
if (available_option.state == 'mandatory'
and not available_option.id in option_ids[0][2]):
and available_option.id not in option_ids[0][2]):
res['warning'] = {
'title': _('User Error !'),
'message': _("You can not remove a mandatory option."
Expand Down Expand Up @@ -228,8 +229,7 @@ def create(self, cr, uid, values, context=None):
"""
values = self._values_with_carrier_options(cr, uid, values,
context=context)
picking_id = super(stock_picking, self
).create(cr, uid, values, context=context)
picking_id = super(stock_picking, self).create(cr, uid, values, context=context)
return picking_id


Expand Down Expand Up @@ -310,8 +310,7 @@ def create(self, cr, uid, values, context=None):
picking_obj = self.pool['stock.picking']
values = picking_obj._values_with_carrier_options(cr, uid, values,
context=context)
picking_id = super(stock_picking_in, self
).create(cr, uid, values, context=context)
picking_id = super(stock_picking_in, self).create(cr, uid, values, context=context)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines like this are longer than 80. But travis doesn't complain because within unported

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Max line length is set to 120

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably I missed the decision to increment the limit.
Has it been discussed somewhere?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the mailing list last year.
https://lists.launchpad.net/openerp-community/msg03986.html

I put 120 so we wouldn't ignore line length entirely, and now it is at least uniformly checked everywhere in OCA (no style splintering).

If we want to have the dicussion again and we come to a conclusion that the line length is, say 100 (suggested in pep8) we have a constructive way of enforcing it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 07/24/2014 01:53 PM, Sandy wrote:

On the mailing list last year.
https://lists.launchpad.net/openerp-community/msg03986.html

I put 120 so we wouldn't ignore line length entirely, and now it is at
least uniformly checked everywhere in OCA (no style splintering).

If we want to have the dicussion again and we come to a conclusion
that the line length is, say 100 (suggested in pep8
http://dinsdale.python.org/dev/peps/pep-0008/#maximum-line-length)
we have a constructive way of enforcing it.

If I remember correctly, on that occasion the majority said 79

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, make a PR https://github.com/OCA/maintainer-quality-tools/edit/master/travis/travis_run_flake8 to set the line length to 80 (79 + '\n').

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What @eLBati is saying it's true. I myself prefer 80 cols, but 100 is also correct. 120 is too long I think.

Regards.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move this conversation to https://github.com/OCA/maintainer-quality-tools or the ML

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return picking_id


Expand Down Expand Up @@ -407,8 +406,7 @@ def create(self, cr, uid, values, context=None):
picking_obj = self.pool['stock.picking']
values = picking_obj._values_with_carrier_options(cr, uid, values,
context=context)
picking_id = super(stock_picking_out, self
).create(cr, uid, values, context=context)
picking_id = super(stock_picking_out, self).create(cr, uid, values, context=context)
return picking_id


Expand Down
45 changes: 23 additions & 22 deletions __unported__/delivery_carrier_label_dispatch/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{'name': 'Carrier labels - Picking dispatch (link)',
'version': '1.0',
'author': 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'version',
'complexity': 'normal',
'depends': ['base_delivery_carrier_label', 'picking_dispatch'],
'description': """
{
'name': 'Carrier labels - Picking dispatch (link)',
'version': '1.0',
'author': 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'version',
'complexity': 'normal',
'depends': ['base_delivery_carrier_label', 'picking_dispatch'],
'description': """
[Link module] Carrier labels - Picking dispatch
==============================

Expand All @@ -38,17 +39,17 @@
* Yannick Vaucher <yannick.vaucher@camptocamp.com>

""",
'website': 'http://www.camptocamp.com/',
'data': [
'picking_dispatch_view.xml',
'wizard/generate_labels_view.xml',
],
'tests': [],
'installable': False,
'auto_install': True,
'license': 'AGPL-3',
'application': False,
'external_dependencies': {
'python': ['PyPDF2'],
}
}
'website': 'http://www.camptocamp.com/',
'data': [
'picking_dispatch_view.xml',
'wizard/generate_labels_view.xml',
],
'tests': [],
'installable': False,
'auto_install': True,
'license': 'AGPL-3',
'application': False,
'external_dependencies': {
'python': ['PyPDF2'],
}
}