In all of the positions I have been in this is considered Corporate Theft. The code I was paid to write is fully owned by my employers.
I have heard of some less restrictive contracts, but I have never seen one myself that grants me the right to take the source code with me, even if it is only the code I wrote.
This answer explains it very well: https://softwareengineering.stackexchange.com/questions/1541...