Sutton-Barto, page 101, Eq (5.2): Assume that $\pi^\prime$ is the $\epsilon$-greedy policy. Then,
\begin{align} q_{\pi}\big(s,\pi'(s)\big)&= \sum_{a}\pi'(a|s)q_{\pi}(s,a) \\ &= \frac{\varepsilon}{|\mathcal{A}(s)|}\sum_{a}q_{\pi}(s,a)+(1-\varepsilon)\max_{a}q_{\pi}(s,a)\\ & \cdots \end{align}
I am confused by the first line in first equation. My confusion points are as follows.
(1) On the left we have $\pi'(s)$ but on the right $\pi'(a|s)$. Since $\pi^\prime$ is stochastic, how can one write $\pi'(s)$?
(2) Why does the first line in equation follow?