src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/PathLib/PathlibChecker.py

branch
eric7
changeset 11147
dee6e106b4d3
parent 11145
d328a7b74fd8
child 11150
73d80859079c
equal deleted inserted replaced
11146:59e04f7003e9 11147:dee6e106b4d3
43 the pathlib module. 43 the pathlib module.
44 """ 44 """
45 45
46 Codes = [ 46 Codes = [
47 ## Replacements for the os module functions 47 ## Replacements for the os module functions
48 "P101", 48 "P-101",
49 "P102", 49 "P-102",
50 "P103", 50 "P-103",
51 "P104", 51 "P-104",
52 "P105", 52 "P-105",
53 "P106", 53 "P-106",
54 "P107", 54 "P-107",
55 "P108", 55 "P-108",
56 "P109", 56 "P-109",
57 "P110", 57 "P-110",
58 "P111", 58 "P-111",
59 "P112", 59 "P-112",
60 "P113", 60 "P-113",
61 "P114", 61 "P-114",
62 ## Replacements for the os.path module functions 62 ## Replacements for the os.path module functions
63 "P201", 63 "P-201",
64 "P202", 64 "P-202",
65 "P203", 65 "P-203",
66 "P204", 66 "P-204",
67 "P205", 67 "P-205",
68 "P206", 68 "P-206",
69 "P207", 69 "P-207",
70 "P208", 70 "P-208",
71 "P209", 71 "P-209",
72 "P210", 72 "P-210",
73 "P211", 73 "P-211",
74 "P212", 74 "P-212",
75 "P213", 75 "P-213",
76 ## Replacements for some Python standard library functions 76 ## Replacements for some Python standard library functions
77 "P301", 77 "P-301",
78 ## Replacements for py.path.local 78 ## Replacements for py.path.local
79 "P401", 79 "P-401",
80 ] 80 ]
81 81
82 # map functions to be replaced to error codes 82 # map functions to be replaced to error codes
83 Function2Code = { 83 Function2Code = {
84 "os.chmod": "P101", 84 "os.chmod": "P-101",
85 "os.mkdir": "P102", 85 "os.mkdir": "P-102",
86 "os.makedirs": "P103", 86 "os.makedirs": "P-103",
87 "os.rename": "P104", 87 "os.rename": "P-104",
88 "os.replace": "P105", 88 "os.replace": "P-105",
89 "os.rmdir": "P106", 89 "os.rmdir": "P-106",
90 "os.remove": "P107", 90 "os.remove": "P-107",
91 "os.unlink": "P108", 91 "os.unlink": "P-108",
92 "os.getcwd": "P109", 92 "os.getcwd": "P-109",
93 "os.readlink": "P110", 93 "os.readlink": "P-110",
94 "os.stat": "P111", 94 "os.stat": "P-111",
95 "os.listdir": "P112", 95 "os.listdir": "P-112",
96 "os.link": "P113", 96 "os.link": "P-113",
97 "os.symlink": "P114", 97 "os.symlink": "P-114",
98 "os.path.abspath": "P201", 98 "os.path.abspath": "P-201",
99 "os.path.exists": "P202", 99 "os.path.exists": "P-202",
100 "os.path.expanduser": "P203", 100 "os.path.expanduser": "P-203",
101 "os.path.isdir": "P204", 101 "os.path.isdir": "P-204",
102 "os.path.isfile": "P205", 102 "os.path.isfile": "P-205",
103 "os.path.islink": "P206", 103 "os.path.islink": "P-206",
104 "os.path.isabs": "P207", 104 "os.path.isabs": "P-207",
105 "os.path.join": "P208", 105 "os.path.join": "P-208",
106 "os.path.basename": "P209", 106 "os.path.basename": "P-209",
107 "os.path.dirname": "P210", 107 "os.path.dirname": "P-210",
108 "os.path.samefile": "P211", 108 "os.path.samefile": "P-211",
109 "os.path.splitext": "P212", 109 "os.path.splitext": "P-212",
110 "os.path.relpath": "P213", 110 "os.path.relpath": "P-213",
111 "open": "P301", 111 "open": "P-301",
112 "py.path.local": "P401", 112 "py.path.local": "P-401",
113 } 113 }
114 114
115 def __init__(self, source, filename, tree, selected, ignored, expected, repeat): 115 def __init__(self, source, filename, tree, selected, ignored, expected, repeat):
116 """ 116 """
117 Constructor 117 Constructor

eric ide

mercurial