Author: sebb
Date: Fri Sep 15 11:22:28 2023
New Revision: 1912324
URL: http://svn.apache.org/viewvc?rev=1912324&view=rev
Log:
Pylint
Modified:
comdev/projects.apache.org/trunk/scripts/committee_info.py
comdev/projects.apache.org/trunk/scripts/newtlp.py
comdev/projects.apache.org/trunk/scripts/project2attic.py
comdev/projects.apache.org/trunk/scripts/update_create.py
Modified: comdev/projects.apache.org/trunk/scripts/committee_info.py
URL:
http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/scripts/committee_info.py?rev=1912324&r1=1912323&r2=1912324&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/scripts/committee_info.py (original)
+++ comdev/projects.apache.org/trunk/scripts/committee_info.py Fri Sep 15
11:22:28 2023
@@ -46,10 +46,10 @@ def file_mtime(filename):
return t
# download url as file if the cached copy is too old
-def get_url_if_newer(url, dir, name):
- path=join(dir,name)
+def get_url_if_newer(url, folder, name):
+ path=join(folder,name)
fileTime = file_mtime(path)
- check = join(dir,".checked_"+name)
+ check = join(folder,".checked_"+name)
if fileTime >= 0:
checkTime = file_mtime(check)
now = time.time()
@@ -70,7 +70,7 @@ def get_url_if_newer(url, dir, name):
lastMod = response.headers['Last-Modified']
lastModT = calendar.timegm(time.strptime(lastMod, HTTP_TIME_FORMAT))
outFile = path + ".tmp"
- with open(outFile,'wb') as f:
+ with open(outFile,'wb', encoding='utf-8') as f:
f.write(response.read())
f.close()
@@ -84,7 +84,7 @@ def get_url_if_newer(url, dir, name):
else:
print("Cached copy of %s is up to date" % path)
- with open(check,'a'):
+ with open(check,'a', encoding='utf-8'):
os.utime(check, None) # touch the marker file
def update_cache():
@@ -98,11 +98,11 @@ update_cache() # done when loading
def chairs():
- committees = cidata['committees']
+ cttees = cidata['committees']
chairjson={}
- for ctte in committees:
- c = committees[ctte]
+ for ctte in cttees:
+ c = cttees[ctte]
if not c['pmc']:
continue
chs = c['chair']
@@ -117,20 +117,20 @@ def chairs():
def cycles():
- committees = cidata['committees']
+ cttees = cidata['committees']
- cycles={}
- for ctte in committees:
- c = committees[ctte]
+ reportcycles={}
+ for ctte in cttees:
+ c = cttees[ctte]
if not c['pmc']:
continue
- cycles[ctte] = c['report']
+ reportcycles[ctte] = c['report']
# Duplicate some entries for now so the code can find them (the
existing json has the duplicates)
if ctte == 'ws': # Special processing
- cycles['webservices'] = cycles[ctte]
+ reportcycles['webservices'] = reportcycles[ctte]
if ctte == 'httpd': # Special processing
- cycles['http server'] = cycles[ctte]
- return cycles
+ reportcycles['http server'] = reportcycles[ctte]
+ return reportcycles
"""
Returns an array of entries of the form:
@@ -156,7 +156,7 @@ Returns an array of entries of the form:
"""
def committees():
- committees = {}
+ cttees = {}
cttes = cidata['committees']
for ent in cttes:
ctte = cttes[ent]
@@ -190,8 +190,8 @@ def committees():
c['reporting'] = 0
else:
c[key] = ctte[key]
- committees[ent]=c
- return committees
+ cttees[ent]=c
+ return cttees
def pmcdates():
dates = {}
@@ -210,16 +210,16 @@ def pmcdates():
date = calendar.timegm(time.strptime(est[0:7], '%m/%Y'))
except Exception as e:
print("Date parse error for %s: %s %s" % (ent, est, e))
- pass
dates[ent] = {'pmc': [est, date], 'roster': {} }
ids = {}
- for id in roster:
- rid = roster[id]
+ for idk in roster:
+ rid = roster[idk]
try:
date = calendar.timegm(time.strptime(rid['date'], '%Y-%m-%d'))
- except:
+ except Exception:
+ print("Date parse error for %s: %s %s" % (ent, rid['date'], e))
date = 0
- ids[id] = [rid['name'], date]
+ ids[idk] = [rid['name'], date]
dates[ent]['roster'] = ids
# The 'CI' internal name for Web Services is 'ws' but reporter code
originally used 'webservices'
if ent == 'ws':
Modified: comdev/projects.apache.org/trunk/scripts/newtlp.py
URL:
http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/scripts/newtlp.py?rev=1912324&r1=1912323&r2=1912324&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/scripts/newtlp.py (original)
+++ comdev/projects.apache.org/trunk/scripts/newtlp.py Fri Sep 15 11:22:28 2023
@@ -40,7 +40,7 @@ OVERRIDEDIR = os.path.join(DATADIR,'proj
print("Reading _template.rdf")
tmpfile = os.path.join(RDFDIR,'_template.rdf')
-with open(tmpfile,'r') as t:
+with open(tmpfile,'r', encoding='utf-8') as t:
template = Template(t.read())
@@ -49,7 +49,7 @@ def update_xml(pid):
xmlfilet = os.path.join(DATADIR,'committees.xml.t')
print("Updating committees.xml")
notYetFound = True
- with open(xmlfile,'r') as r, open(xmlfilet,'w') as w:
+ with open(xmlfile,'r', encoding='utf-8') as r, open(xmlfilet,'w',
encoding='utf-8') as w:
for l in r:
if notYetFound:
m = re.search("^(\\s+)<location>committees/(.+)\\.rdf<",l)
@@ -96,7 +96,7 @@ for arg in sys.argv[1:]:
}
out = template.substitute(data)
print("Creating "+outfile)
- with open(outfile,'w') as o:
+ with open(outfile,'w', encoding='utf-8') as o:
o.write(out)
os.system("svn add %s" % outfile)
update_xml(arg)
Modified: comdev/projects.apache.org/trunk/scripts/project2attic.py
URL:
http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/scripts/project2attic.py?rev=1912324&r1=1912323&r2=1912324&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/scripts/project2attic.py (original)
+++ comdev/projects.apache.org/trunk/scripts/project2attic.py Fri Sep 15
11:22:28 2023
@@ -45,9 +45,9 @@ def update_pmc_xml(pmc):
xmlfilet = join(datadir,'committees.xml.t')
print("Updating committees.xml")
found = 0
- with open(xmlfile,'r') as r, open(xmlfilet,'w') as w:
+ with open(xmlfile,'r', encoding='utf-8') as r, open(xmlfilet,'w',
encoding='utf-8') as w:
for l in r:
- m = re.search("^(\s+)<location>(.+)</location",l)
+ m = re.search(r"^(\s+)<location>(.+)</location",l)
if m:
indent = m.group(1)
url = m.group(2)
@@ -55,12 +55,12 @@ def update_pmc_xml(pmc):
# committees/<pmc>.rdf
# https://ofbiz.apache.org/<pmc>/...
# http://svn.apache.org/repos/asf/<pmc>/...
- regex =
"^(committees/%s\.rdf|https?://%s\.apache\.org/.+|https?://svn.apache.org/repos/asf/%s/.+)$"
% (pmc,pmc,pmc)
+ regex =
r"^(committees/%s\.rdf|https?://%s\.apache\.org/.+|https?://svn.apache.org/repos/asf/%s/.+)$"
% (pmc,pmc,pmc)
if re.search(regex, url, flags=re.IGNORECASE):
print("Found %s at %s" % (pmc, url))
if url.startswith('committees/'):
new = url.replace('committees/','committees-retired/')
- subprocess.run(["svn", "mv", "data/%s" % url,
"data/%s" % new])
+ subprocess.run(["svn", "mv", "data/%s" % url,
"data/%s" % new], check=True)
url = new
w.write("%s<!-- Retired: location>%s</location -->\n" %
(indent, url))
found += 1
@@ -82,7 +82,7 @@ def update_doap(doap, source):
infile = doap
tmpfile = doap + '.t'
catWrite = True
- with open(infile,'r') as r, open(tmpfile,'w') as w:
+ with open(infile,'r', encoding='utf-8') as r, open(tmpfile,'w',
encoding='utf-8') as w:
for l in r:
if re.search("<rdf:RDF",l):
w.write("<!-- Copied from %s -->\n" % source)
@@ -115,15 +115,15 @@ def update_project_xml(pid):
# Parse each line to extract the project name.
repore = '([-a-z0-9]+)' # repo regex
lines2match = [
- f"^https?://svn\.apache\.org/repos/asf/{repore}/",
- f"^https?://gitbox\.apache\.org/repos/asf\?p={repore}\.git",
- f"^https?://raw\.githubusercontent\.com/apache/{repore}/",
- f"^https?://{repore}(?:\.incubator)?\.apache\.org/",
+ fr"^https?://svn\.apache\.org/repos/asf/{repore}/",
+ fr"^https?://gitbox\.apache\.org/repos/asf\?p={repore}\.git",
+ fr"^https?://raw\.githubusercontent\.com/apache/{repore}/",
+ fr"^https?://{repore}(?:\.incubator)?\.apache\.org/",
]
# 1 2 3
4
- with open(xmlfile,'r') as r, open(xmlfilet,'w') as w:
+ with open(xmlfile,'r', encoding='utf-8') as r, open(xmlfilet,'w',
encoding='utf-8') as w:
for l in r:
- m = re.search("^(\s+)<location>(.+)<",l)
+ m = re.search(r"^(\s+)<location>(.+)<",l)
if m:
indent = m.group(1)
url = m.group(2)
Modified: comdev/projects.apache.org/trunk/scripts/update_create.py
URL:
http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/scripts/update_create.py?rev=1912324&r1=1912323&r2=1912324&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/scripts/update_create.py (original)
+++ comdev/projects.apache.org/trunk/scripts/update_create.py Fri Sep 15
11:22:28 2023
@@ -11,7 +11,7 @@ import committee_info
SITEDIR = os.path.join(committee_info.COMDEV_HOME, 'site')
validation = {}
-with open(os.path.join(SITEDIR, "validation.json")) as f:
+with open(os.path.join(SITEDIR, "validation.json"), encoding='utf-8') as f:
validation = json.loads(f.read())
lang = validation['languages']
cats = validation['categories']
@@ -19,12 +19,12 @@ cats = validation['categories']
createfile = os.path.join(SITEDIR, "create.html")
createfilet = os.path.join(SITEDIR, "create.html.t")
sections = 0
-with open(createfile,'r') as r, open(createfilet,'w') as w:
+with open(createfile,'r', encoding='utf-8') as r, open(createfilet,'w',
encoding='utf-8') as w:
section = None
line = 0
for l in r:
# start of a section?
- m = re.match('^\s+<select name="(cat|lang|pmc)"', l)
+ m = re.match(r'^\s+<select name="(cat|lang|pmc)"', l)
if m:
section = m.group(1)
line = 0
@@ -51,10 +51,10 @@ with open(createfile,'r') as r, open(cre
line = 0
if section:
line = line + 1
- if re.match('^\s*<option value="\w', l): # an existing option line
+ if re.match(r'^\s*<option value="\w', l): # an existing option line
continue # drop the line
if section == 'pmc':
- if re.match(" <!-- [A-Z] -->", l) or (re.match("\s*$", l)
and line > 2):
+ if re.match(" <!-- [A-Z] -->", l) or (re.match(r"\s*$",
l) and line > 2):
continue
w.write(l) # write the original line
os.rename(createfilet, createfile)