aragilar / stringtopy

File opened without the with statement PTC-W0010
Anti-pattern
Critical
4 years ago4 years old
Use the with statement to open a file
1104    except EnvironmentError:
1105        pass
1106    if not present:
1107        f = open(".gitattributes", "a+")1108        f.write("%s export-subst\n" % versionfile_source)
1109        f.close()
1110        files.append(".gitattributes")
Use the with statement to open a file
1095    files.append(versioneer_file)
1096    present = False
1097    try:
1098        f = open(".gitattributes", "r")1099        for line in f.readlines():
1100            if line.strip().startswith(versionfile_source):
1101                if "export-subst" in line.strip().split()[1:]:
Use the with statement to open a file
 935    # _version.py.
 936    keywords = {}
 937    try:
 938        f = open(versionfile_abs, "r") 939        for line in f.readlines():
 940            if line.strip().startswith("git_refnames ="):
 941                mo = re.search(r'=\s*"(.*)"', line)