class FilterModule(object):
    ''' Additional filters for use within Ansible. '''

    def filters(self):
        return {
            'is_not_in': self.is_not_in,
            'is_in': self.is_in,
            'some_are_in': self.some_are_in
        }

    def is_not_in(self, *t):
        """Determnies if there are no elements in common between x and y

            x | is_not_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        groups_to_test, all_group_names = t

        return set(groups_to_test).isdisjoint(set(all_group_names))

    def is_in(self, *t):
        """Determnies if all of the elements in x are a subset of y

            x | is_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        groups_to_test, all_group_names = t

        return set(groups_to_test).issubset(set(all_group_names))

    def some_are_in(self, *t):
        """Determnies if any element in x intersects with y

            x | some_are_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        groups_to_test, all_group_names = t

        return len(set(groups_to_test) & set(all_group_names)) > 0

class FilterModule(object):
    ''' Additional filters for use within Ansible. '''

    def filters(self):
        return {
            'is_not_in': self.is_not_in,
            'is_in': self.is_in,
            'some_are_in': self.some_are_in
        }

    def is_not_in(self, x, y):
        """Determines if there are no elements in common between x and y

            x | is_not_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        return set(x).isdisjoint(set(y))

    def is_in(self, x, y):
        """Determines if all of the elements in x are a subset of y

            x | is_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        return set(x).issubset(set(y))

    def some_are_in(self, x, y):
        """Determines if any element in x intersects with y

            x | some_are_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        return len(set(x) & set(y)) > 0

Add explicit method signature to custom filters
Add explicit method signature to custom filters

This changeset adds an explicit method signature to the Ansible custom filters.

  class FilterModule(object):
      ''' Additional filters for use within Ansible. '''
  
      def filters(self):
          return {
              'is_not_in': self.is_not_in,
              'is_in': self.is_in,
              'some_are_in': self.some_are_in
          }
  
-     def is_not_in(self, *t):
+     def is_not_in(self, x, y):
-         """Determnies if there are no elements in common between x and y
+         """Determines if there are no elements in common between x and y
  
              x | is_not_in(y)
  
          Arguments
          :param t: A tuple with two elements (x and y)
          """
-         groups_to_test, all_group_names = t
+         return set(x).isdisjoint(set(y))
  
-         return set(groups_to_test).isdisjoint(set(all_group_names))
- 
-     def is_in(self, *t):
+     def is_in(self, x, y):
-         """Determnies if all of the elements in x are a subset of y
+         """Determines if all of the elements in x are a subset of y
  
              x | is_in(y)
  
          Arguments
          :param t: A tuple with two elements (x and y)
          """
-         groups_to_test, all_group_names = t
+         return set(x).issubset(set(y))
  
-         return set(groups_to_test).issubset(set(all_group_names))
- 
-     def some_are_in(self, *t):
+     def some_are_in(self, x, y):
-         """Determnies if any element in x intersects with y
+         """Determines if any element in x intersects with y
  
              x | some_are_in(y)
  
          Arguments
          :param t: A tuple with two elements (x and y)
          """
-         groups_to_test, all_group_names = t
+         return len(set(x) & set(y)) > 0
  
-         return len(set(groups_to_test) & set(all_group_names)) > 0
- 
Add explicit method signature to custom filters
## Code Before:
class FilterModule(object):
    ''' Additional filters for use within Ansible. '''

    def filters(self):
        return {
            'is_not_in': self.is_not_in,
            'is_in': self.is_in,
            'some_are_in': self.some_are_in
        }

    def is_not_in(self, *t):
        """Determnies if there are no elements in common between x and y

            x | is_not_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        groups_to_test, all_group_names = t

        return set(groups_to_test).isdisjoint(set(all_group_names))

    def is_in(self, *t):
        """Determnies if all of the elements in x are a subset of y

            x | is_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        groups_to_test, all_group_names = t

        return set(groups_to_test).issubset(set(all_group_names))

    def some_are_in(self, *t):
        """Determnies if any element in x intersects with y

            x | some_are_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        groups_to_test, all_group_names = t

        return len(set(groups_to_test) & set(all_group_names)) > 0

## Instruction:
Add explicit method signature to custom filters
## Code After:
class FilterModule(object):
    ''' Additional filters for use within Ansible. '''

    def filters(self):
        return {
            'is_not_in': self.is_not_in,
            'is_in': self.is_in,
            'some_are_in': self.some_are_in
        }

    def is_not_in(self, x, y):
        """Determines if there are no elements in common between x and y

            x | is_not_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        return set(x).isdisjoint(set(y))

    def is_in(self, x, y):
        """Determines if all of the elements in x are a subset of y

            x | is_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        return set(x).issubset(set(y))

    def some_are_in(self, x, y):
        """Determines if any element in x intersects with y

            x | some_are_in(y)

        Arguments
        :param t: A tuple with two elements (x and y)
        """
        return len(set(x) & set(y)) > 0
