Walmart Inc. filed a lawsuit against the federal government, seeking clarity on the roles and legal responsibilities of pharmacists and pharmacies in filling opioid prescriptions.