class_docstr: Abstract base class for PennyLane devices.
  
  Args:
      wires (int or Iterable[Number, str]]): Number of subsystems represented by the device,
          or iterable that contains unique labels for the subsystems as numbers (i.e., ``[-1, 0, 2]``)
          or strings (``['ancilla', 'q1', 'q2']``). Default 1 if not specified.
      shots (int): Number of circuit evaluations/random samples used to estimate
          expectation values of observables. Defaults to 1000 if not specified.
class_docstr_tok: ["Abstract","base","class","for","PennyLane","devices",".","Args",":","wires","(","int","or","Iterable","[","Number",",","str","]","]",")",":","Number","of","subsystems","represented","by","the","device",",","or","iterable","that","contains","unique","labels","for","the","subsystems","as","numbers","(","i.e.",",","``","[","-1",",","0",",","2","]","``",")","or","strings","(","``","[","'ancilla","'",",","'q1","'",",","'q2","'","]","``",")",".","Default","1","if","not","specified",".","shots","(","int",")",":","Number","of","circuit","evaluations\/random","samples","used","to","estimate","expectation","values","of","observables",".","Defaults","to","1000","if","not","specified","."]
docstr: Checks whether the operations and observables in queue are all supported by the device.
  
  Args:
      queue (Iterable[~.operation.Operation]): quantum operation objects which are intended
          to be applied on the device
      observables (Iterable[~.operation.Observable]): observables which are intended
          to be evaluated on the device
  
  Raises:
      DeviceError: if there are operations in the queue or observables that the device does
          not support
docstr_tok: ["Checks","whether","the","operations","and","observables","in","queue","are","all","supported","by","the","device",".","Args",":","queue","(","Iterable","[","~.operation.Operation","]",")",":","quantum","operation","objects","which","are","intended","to","be","applied","on","the","device","observables","(","Iterable","[","~.operation.Observable","]",")",":","observables","which","are","intended","to","be","evaluated","on","the","device","Raises",":","DeviceError",":","if","there","are","operations","in","the","queue","or","observables","that","the","device","does","not","support"]
code: def check_validity(self, queue, observables):
      """Checks whether the operations and observables in queue are all supported by the device.
  
      Args:
          queue (Iterable[~.operation.Operation]): quantum operation objects which are intended
              to be applied on the device
          observables (Iterable[~.operation.Observable]): observables which are intended
              to be evaluated on the device
  
      Raises:
          DeviceError: if there are operations in the queue or observables that the device does
              not support
      """
  
      for o in queue:
          operation_name = o.name
  
          if isinstance(
              o, MidMeasureMP
          ) and not self.capabilities().get(
              "supports_mid_measure", False
          ):
              raise DeviceError(
                  f"Mid-circuit measurements are not natively supported on device {self.short_name}. "
                  "Apply the @qml.defer_measurements decorator to your quantum function to "
                  "simulate the application of mid-circuit measurements on this device."
              )
  
          if isinstance(o, qml.Projector):
              raise ValueError(
                  f"Postselection is not supported on the {self.name} device."
              )
  
          if not self.stopping_condition(o):
              raise DeviceError(
                  f"Gate {operation_name} not supported on device {self.short_name}"
              )
  
      for o in observables:
          if (
              isinstance(o, qml.measurements.MeasurementProcess)
              and o.obs is not None
          ):
              o = o.obs
  
          if isinstance(o, Tensor):
              # TODO: update when all capabilities keys changed to "supports_tensor_observables"
              supports_tensor = self.capabilities().get(
                  "supports_tensor_observables", False
              ) or self.capabilities().get("tensor_observables", False)
              if not supports_tensor:
                  raise DeviceError(
                      f"Tensor observables not supported on device {self.short_name}"
                  )
  
              for i in o.obs:
                  if not self.supports_observable(i.name):
                      raise DeviceError(
                          f"Observable {i.name} not supported on device {self.short_name}"
                      )
          else:
              observable_name = o.name
  
              if not self.supports_observable(observable_name):
                  raise DeviceError(
                      f"Observable {observable_name} not supported on device {self.short_name}"
                  )
  
imports: import abc
  import copy
  import types
  import warnings
  from collections import OrderedDict
  from collections.abc import Iterable, Sequence
  from functools import lru_cache
  import numpy
  import pennylane
  from pennylane.measurements import MeasurementProcess, CountsMP, Expectation, ExpectationMP, MidMeasureMP, Probability, ProbabilityMP, Sample, SampleMP, ShadowExpvalMP, State, Variance
  from pennylane.operation import Observable, Operation, Tensor, Operator, StatePrepBase
  from pennylane.ops import Hamiltonian, Sum
  from pennylane.tape import QuantumScript, QuantumTape, expand_tape_state_prep
  from pennylane.wires import WireError, Wires
  from pennylane.queuing import QueuingManager
label_desc: Use image node_id 42 for calling the Device obj's underlying member method code with example usage: obj.check_validity(queue, observables) without return types