Add "category" and "file" as exemptions in replaceExept

- pep8ified and synchronized with core by xqt

Change-Id: If103b5fa1dc5952628665ee54f1bd72c31a29040