Electronic and magnetic properties of Co and Ni impurities in Cu wires: First-principles investigation of local moment formation in one dimension