code: def get_resources(self, type: Type[T_Resource]) -> Set[T_Resource]:
          
          assert check_argument_types()
  
          # Collect all the matching resources from this context
          resources = {container.name: container.value_or_factory
                       for container in self._resources.values()
                       if not container.is_factory and type in container.types
                       }  # type: Dict[str, T_Resource]
  
          # Next, find all matching resource factories in the context chain and generate resources
          resources.update({container.name: container.generate_value(self)
                            for ctx in self.context_chain
                            for container in ctx._resources.values()
                            if container.is_factory and type in container.types
                            and container.name not in resources})
  
          # Finally, add the resource values from the parent contexts
          resources.update({container.name: container.value_or_factory
                            for ctx in self.context_chain[1:]
                            for container in ctx._resources.values()
                            if not container.is_factory and type in container.types
                            and container.name not in resources})
  
          return set(resources.values())
docs: Retrieve all the resources of the given type in this context and its parents.
  
          Any matching resource factories are also triggered if necessary.
  
          :param type: type of the resources to get
          :return: a set of all found resources of the given type