Hacking: Fix F632
Fix F632 use ==/!= to compare str, bytes, and int literal Fix also other problems in the files found by hacking checks. Change-Id: I5122a9bbccd40d869b54fa3ddf754685aefb8d57
This commit is contained in:
parent
3ac1870e85
commit
8c1e23c275
manila
api/openstack
share/drivers/hpe
tests/share/drivers
dell_emc/plugins/isilon
inspur/as13000
netapp/dataontap/client
@ -30,7 +30,7 @@ LOG = log.getLogger(__name__)
|
||||
|
||||
class APIMapper(routes.Mapper):
|
||||
def routematch(self, url=None, environ=None):
|
||||
if url is "":
|
||||
if url == "":
|
||||
result = self._match("", environ)
|
||||
return result[0], result[1]
|
||||
return routes.Mapper.routematch(self, url, environ)
|
||||
|
@ -82,7 +82,7 @@ class FPG(types.String, types.IPAddress):
|
||||
self.max_ip = max_ip
|
||||
|
||||
def __call__(self, value):
|
||||
if value is None or value.strip(' ') is '':
|
||||
if value is None or value.strip(' ') == '':
|
||||
message = _("Invalid configuration. hpe3par_fpg must be set.")
|
||||
LOG.error(message)
|
||||
raise exception.HPE3ParInvalid(err=message)
|
||||
@ -117,6 +117,7 @@ class FPG(types.String, types.IPAddress):
|
||||
def _formatter(self, value):
|
||||
return six.text_type(value)
|
||||
|
||||
|
||||
HPE3PAR_OPTS = [
|
||||
cfg.StrOpt('hpe3par_api_url',
|
||||
default='',
|
||||
@ -473,7 +474,7 @@ class HPE3ParShareDriver(driver.ShareDriver):
|
||||
'now': datetime.datetime.now().strftime('%H%M%S'),
|
||||
}
|
||||
|
||||
acceptable = re.compile('[^a-zA-Z0-9_=:@# \-]+', re.UNICODE)
|
||||
acceptable = re.compile(r'[^a-zA-Z0-9_=:@# \-]+', re.UNICODE)
|
||||
comment = ("OpenStack Manila - host=%(host)s orig_name=%(name)s "
|
||||
"created=%(now)s" % info)
|
||||
|
||||
|
@ -156,10 +156,10 @@ class IsilonApiTest(test.TestCase):
|
||||
for call in actual_calls:
|
||||
if call.url.startswith(expected_call.match_url):
|
||||
match_found = True
|
||||
if expected_call.request_type is 'dir_creation':
|
||||
if expected_call.request_type == 'dir_creation':
|
||||
self._verify_dir_creation_request(
|
||||
call, *expected_call.verify_args)
|
||||
elif expected_call.request_type is 'file_clone':
|
||||
elif expected_call.request_type == 'file_clone':
|
||||
pass
|
||||
else:
|
||||
self.fail('Invalid request type')
|
||||
|
@ -448,7 +448,7 @@ class AS13000ShareDriverTestCase(test.TestCase):
|
||||
|
||||
if share_proto == 'nfs':
|
||||
mock_cns.assert_called_once_with(share_path='/fake/path')
|
||||
elif share['share_proto'] is 'cifs':
|
||||
elif share['share_proto'] == 'cifs':
|
||||
mock_ccs.assert_called_once_with(share_path='/fake/path',
|
||||
share_name='share_fakeinstanceid')
|
||||
|
||||
@ -480,7 +480,7 @@ class AS13000ShareDriverTestCase(test.TestCase):
|
||||
|
||||
if share_proto == 'nfs':
|
||||
mock_cns.assert_called_once_with(share_path='/fake/path')
|
||||
elif share['share_proto'] is 'cifs':
|
||||
elif share['share_proto'] == 'cifs':
|
||||
mock_ccs.assert_called_once_with(share_path='/fake/path',
|
||||
share_name='share_fakeinstanceid')
|
||||
|
||||
@ -582,7 +582,7 @@ class AS13000ShareDriverTestCase(test.TestCase):
|
||||
|
||||
if share_proto == 'nfs':
|
||||
mock_gns.assert_called_once_with(r'/P/share_fakeinstanceid')
|
||||
elif share['share_proto'] is 'cifs':
|
||||
elif share['share_proto'] == 'cifs':
|
||||
mock_gcs.assert_called_once_with(r'share_fakeinstanceid')
|
||||
|
||||
def test_create_snapshot(self):
|
||||
@ -653,7 +653,7 @@ class AS13000ShareDriverTestCase(test.TestCase):
|
||||
result = self.driver.transfer_rule_to_client(proto, rule)
|
||||
|
||||
client = {'name': '1.1.1.1',
|
||||
'authority': 'rwx' if proto == 'cifs' else 'rw'}
|
||||
'authority': 'rwx' if proto == 'cifs' else 'rw'}
|
||||
|
||||
if proto == 'nfs':
|
||||
client.update({'type': 0})
|
||||
@ -1085,7 +1085,7 @@ class AS13000ShareDriverTestCase(test.TestCase):
|
||||
result = self.driver._get_location_path('fake_name',
|
||||
'/fake/path',
|
||||
proto)
|
||||
if proto is 'nfs':
|
||||
if proto == 'nfs':
|
||||
expect = [{'path': 'ip1:/fake/path'},
|
||||
{'path': 'ip2:/fake/path'}]
|
||||
else:
|
||||
|
@ -2733,7 +2733,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
|
||||
|
||||
self.client.set_preferred_dc(security_service)
|
||||
|
||||
if server is '':
|
||||
if server == '':
|
||||
self.client.send_request.assert_not_called()
|
||||
else:
|
||||
preferred_dc_add_args = {
|
||||
|
3
tox.ini
3
tox.ini
@ -138,12 +138,11 @@ commands = alembic -c manila/db/migrations/alembic.ini revision -m ""{posargs}
|
||||
# E305 expected 2 blank lines after class or function definition, found 1
|
||||
# E241 multiple spaces after ':'
|
||||
# E731 do not assign a lambda expression, use a def
|
||||
# F632 use ==/!= to compare str, bytes, and int literals
|
||||
# E117 over-indented
|
||||
# F841 local variable 'e' is assigned to but never used
|
||||
# E226 missing whitespace around arithmetic operator
|
||||
# F601 dictionary key 'qos' repeated with different values
|
||||
ignore = E117,E123,E226,E241,E305,E402,E731,E741,F601,F632,F841,W503,W504,W605
|
||||
ignore = E117,E123,E226,E241,E305,E402,E731,E741,F601,F841,W503,W504,W605
|
||||
builtins = _
|
||||
# [H106] Don't put vim configuration in source files.
|
||||
# [H203] Use assertIs(Not)None to check for None.
|
||||
|
Loading…
x
Reference in New Issue
Block a user