mirror of https://github.com/ansible/ansible.git
ansible-test - Removed no-dict-* sanity tests
parent
9765bb46f9
commit
c349b91af3
@ -0,0 +1,3 @@
|
|||||||
|
minor_changes:
|
||||||
|
- ansible-test - Removed the ``no-dict-iteritems``, ``no-dict-iterkeys`` and ``no-dict-itervalues`` sanity tests.
|
||||||
|
The tests are no longer necessary since Python 3 is required.
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extensions": [
|
|
||||||
".py"
|
|
||||||
],
|
|
||||||
"ignore_self": true,
|
|
||||||
"output": "path-line-column-message"
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
"""Disallow use of the dict.iteritems function."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main entry point."""
|
|
||||||
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
|
||||||
with open(path, 'r', encoding='utf-8') as path_fd:
|
|
||||||
for line, text in enumerate(path_fd.readlines()):
|
|
||||||
match = re.search(r'(?<! six)\.(iteritems)', text)
|
|
||||||
|
|
||||||
if match:
|
|
||||||
print('%s:%d:%d: use `dict.items` or `ansible.module_utils.six.iteritems` instead of `dict.iteritems`' % (
|
|
||||||
path, line + 1, match.start(1) + 1))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extensions": [
|
|
||||||
".py"
|
|
||||||
],
|
|
||||||
"ignore_self": true,
|
|
||||||
"output": "path-line-column-message"
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
"""Disallow use of the dict.iterkeys function."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main entry point."""
|
|
||||||
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
|
||||||
with open(path, 'r', encoding='utf-8') as path_fd:
|
|
||||||
for line, text in enumerate(path_fd.readlines()):
|
|
||||||
match = re.search(r'\.(iterkeys)', text)
|
|
||||||
|
|
||||||
if match:
|
|
||||||
print('%s:%d:%d: use `dict.keys` or `for key in dict:` instead of `dict.iterkeys`' % (
|
|
||||||
path, line + 1, match.start(1) + 1))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extensions": [
|
|
||||||
".py"
|
|
||||||
],
|
|
||||||
"ignore_self": true,
|
|
||||||
"output": "path-line-column-message"
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
"""Disallow use of the dict.itervalues function."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main entry point."""
|
|
||||||
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
|
||||||
with open(path, 'r', encoding='utf-8') as path_fd:
|
|
||||||
for line, text in enumerate(path_fd.readlines()):
|
|
||||||
match = re.search(r'(?<! six)\.(itervalues)', text)
|
|
||||||
|
|
||||||
if match:
|
|
||||||
print('%s:%d:%d: use `dict.values` or `ansible.module_utils.six.itervalues` instead of `dict.itervalues`' % (
|
|
||||||
path, line + 1, match.start(1) + 1))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
Loading…
Reference in New Issue