Is a dryer vent tube being compressed like this up to code?
I can't answer whether it complies with code or not since that depends on where you are, but I doubt it would matter. 

It's compressed some, but the volume is the same; it's just a different shape, and only slightly at that. Codes regarding airflow (and water flow) issues are mostly concerned with turns. A 90 degree angle will limit airflow whereas a larger radius bend would not, but the straight runs are rarely if ever a problem.