Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

unused_argument.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # pylint: disable=missing-docstring,too-few-public-methods
  2. def test_unused(first, second, _not_used): # [unused-argument, unused-argument]
  3. pass
  4. def test_prefixed_with_ignored(first, ignored_second):
  5. first()
  6. def test_prefixed_with_unused(first, unused_second):
  7. first()
  8. # for Sub.inherited, only the warning for "aay" is desired.
  9. # The warnings for "aab" and "aac" are most likely false positives though,
  10. # because there could be another subclass that overrides the same method and does
  11. # use the arguments (eg Sub2)
  12. class Base(object):
  13. "parent"
  14. def inherited(self, aaa, aab, aac):
  15. "abstract method"
  16. raise NotImplementedError
  17. class Sub(Base):
  18. "child 1"
  19. def inherited(self, aaa, aab, aac):
  20. "overridden method, though don't use every argument"
  21. return aaa
  22. def newmethod(self, aax, aay): # [unused-argument]
  23. "another method, warning for aay desired"
  24. return self, aax
  25. class Sub2(Base):
  26. "child 1"
  27. def inherited(self, aaa, aab, aac):
  28. "overridden method, use every argument"
  29. return aaa + aab + aac
  30. def metadata_from_dict(key):
  31. """
  32. Should not raise unused-argument message because key is
  33. used inside comprehension dict
  34. """
  35. return {key: str(value) for key, value in key.items()}