Map a texture to a torus
A more procedural workflow suggests the use of Splines to create the shape. Moreover, Spline UV maps can be used to create the pattern you are looking for. First, model the spline and give it a full depth as follows:



Then enable Use UV For Mapping and utilize the modulo operator to create the pattern you are after. The value nodes control the number of lines along the spline and radially while the less than values control the depth of the lines: