diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py index 6c929ca2f26dae94623dd6f7098da76d23b08dcf..35efc5216eaf4aabb35cdb1bf6af3e9eb90ec650 100644 --- a/addons/hw_escpos/controllers/main.py +++ b/addons/hw_escpos/controllers/main.py @@ -2,7 +2,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from __future__ import print_function -import commands import logging import math import os @@ -196,7 +195,7 @@ class EscposDriver(Thread): hosting_ap = os.system('pgrep hostapd') == 0 ssid = subprocess.check_output('iwconfig 2>&1 | grep \'ESSID:"\' | sed \'s/.*"\\(.*\\)"/\\1/\'', shell=True).rstrip() mac = subprocess.check_output('ifconfig | grep -B 1 \'inet addr\' | grep -o \'HWaddr .*\' | sed \'s/HWaddr //\'', shell=True).rstrip() - ips = [ c.split(':')[1].split(' ')[0] for c in commands.getoutput("/sbin/ifconfig").split('\n') if 'inet addr' in c ] + ips = [ c.split(':')[1].split(' ')[0] for c in subprocess.check_output("/sbin/ifconfig").split('\n') if 'inet addr' in c ] ips = [ ip for ip in ips if ip not in localips ] eprint.text('\n\n') eprint.set(align='center',type='b',height=2,width=2) diff --git a/addons/hw_proxy/controllers/main.py b/addons/hw_proxy/controllers/main.py index f341ab7b9e097f43ac88715f549fc2953525b5c5..0521b72c89be1b2e665c70e37ecc79555a875a05 100644 --- a/addons/hw_proxy/controllers/main.py +++ b/addons/hw_proxy/controllers/main.py @@ -2,8 +2,8 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from __future__ import print_function -import commands import logging +import subprocess import time from threading import Lock @@ -16,11 +16,11 @@ _logger = logging.getLogger(__name__) # Those are the builtin raspberry pi USB modules, they should # not appear in the list of connected devices. -BANNED_DEVICES = set([ +BANNED_DEVICES = { "0424:9514", # Standard Microsystem Corp. Builtin Ethernet module "1d6b:0002", # Linux Foundation 2.0 root hub "0424:ec00", # Standard Microsystem Corp. Other Builtin Ethernet module -]) +} # drivers modules must add to drivers an object with a get_status() method @@ -99,14 +99,14 @@ class Proxy(http.Controller): """ if debug is None: resp += """(<a href="/hw_proxy/status?debug">debug version</a>)""" - devices = commands.getoutput("lsusb").split('\n') + devices = subprocess.check_output("lsusb").split('\n') count = 0 resp += "<div class='devices'>\n" for device in devices: device_name = device[device.find('ID')+2:] device_id = device_name.split()[0] if not (device_id in BANNED_DEVICES): - resp+= "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n" + resp += "<div class='device' data-device='"+device+"'>"+device_name+"</div>\n" count += 1 if count == 0: diff --git a/odoo/addons/test_pylint/tests/test_pylint.py b/odoo/addons/test_pylint/tests/test_pylint.py index c2d1f2cf457d95095a3f64cc8ccbbda8348790a4..d7a6760854cfde4d455e16f2cafcf40d06153f67 100644 --- a/odoo/addons/test_pylint/tests/test_pylint.py +++ b/odoo/addons/test_pylint/tests/test_pylint.py @@ -42,6 +42,7 @@ class TestPyLint(TransactionCase): 'parameter-unpacking', 'metaclass-assignment', + 'deprecated-module', 'exception-message-attribute', 'indexing-exception', @@ -70,6 +71,11 @@ class TestPyLint(TransactionCase): 'reduce', ] + BAD_MODULES = [ + 'commands', + 'types', + ] + def _skip_test(self, reason): _logger.warn(reason) self.skipTest(reason) @@ -93,6 +99,7 @@ class TestPyLint(TransactionCase): "--msg-template='{msg} ({msg_id}) at {path}:{line}'", '--load-plugins=pylint.extensions.bad_builtin', '--bad-functions=%s' % ','.join(self.BAD_FUNCTIONS), + '--deprecated-modules=%s' % ','.join(self.BAD_MODULES) ] try: