nets_pattern.py, info_pattern.py, fix and refactor some functions in common.py