You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2020/10/22 16:13:22 UTC
svn commit: r1882764 - in /openoffice/devtools/aoo-stats: countries.py
detail-by-day.py get-aoo-stats.py platform.py
Author: mseidel
Date: Thu Oct 22 16:13:21 2020
New Revision: 1882764
URL: http://svn.apache.org/viewvc?rev=1882764&view=rev
Log:
Fixed typos, removed whitespace
Modified:
openoffice/devtools/aoo-stats/countries.py
openoffice/devtools/aoo-stats/detail-by-day.py
openoffice/devtools/aoo-stats/get-aoo-stats.py
openoffice/devtools/aoo-stats/platform.py
Modified: openoffice/devtools/aoo-stats/countries.py
URL: http://svn.apache.org/viewvc/openoffice/devtools/aoo-stats/countries.py?rev=1882764&r1=1882763&r2=1882764&view=diff
==============================================================================
--- openoffice/devtools/aoo-stats/countries.py (original)
+++ openoffice/devtools/aoo-stats/countries.py Thu Oct 22 16:13:21 2020
@@ -1,5 +1,5 @@
################################################################
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
################################################################
@@ -33,14 +33,14 @@ from urllib import urlencode
def getSourceForgeStats(download, start_date, end_date):
print download
url = download + "/stats/json?start_date=" + start_date + "&" "end_date=" + end_date
-
+
attempts = 0
while attempts < 3:
- try:
+ try:
conn = urllib.urlopen(url)
data = conn.read()
-
+
return data
except:
@@ -51,7 +51,7 @@ def getSourceForgeStats(download, start_
-#extracts the language code from the URL
+# extracts the language code from the URL
# this logic is very sensitive to the exact naming conventions
def getLanguage(url):
@@ -68,7 +68,7 @@ def getLanguage(url):
-# dictionary of language code to country_dict (dictionary of country name to count)
+# dictionary of language code to country_dict (dictionary of country name to count)
master_dict = {}
def mergeCountries(lang, countries):
@@ -89,12 +89,12 @@ def mergeCountries(lang, countries):
else:
country_dict[country_name] = country_count
-
+
if len(sys.argv) == 0:
- print "syntax: python countries.py <urls.lst> <start-date> <end-date>"
+ print "syntax: python countries.py <urls.lst> <start-date> <end-date>"
print "where <file.list> is a list of files URL's to gather stats on, and <start-date> and <end-date> are in YYYY-MM-DD format."
downloads = [line.strip() for line in open(sys.argv[1])]
@@ -119,4 +119,3 @@ for lang in master_dict:
print
print
-
Modified: openoffice/devtools/aoo-stats/detail-by-day.py
URL: http://svn.apache.org/viewvc/openoffice/devtools/aoo-stats/detail-by-day.py?rev=1882764&r1=1882763&r2=1882764&view=diff
==============================================================================
--- openoffice/devtools/aoo-stats/detail-by-day.py (original)
+++ openoffice/devtools/aoo-stats/detail-by-day.py Thu Oct 22 16:13:21 2020
@@ -1,5 +1,5 @@
################################################################
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,22 +7,22 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
################################################################
-# This script queries the SourceForce REST API for download statistics for
+# This script queries the SourceForge REST API for download statistics for
# sets of files on SourceForge, for a range of dates, in ISO format (YYYY-MM-DD)
-# passed in as a command line argument. The data, in CSV format is written to stdout
+# passed in as a command line argument. The data, in CSV format is written to stdout.
import urllib
@@ -41,10 +41,10 @@ def getSourceForgeStats(download, startD
attempts = 0
while attempts < 3:
- try:
+ try:
conn = urllib.urlopen(url)
data = conn.read()
-
+
return data
except:
@@ -53,10 +53,10 @@ def getSourceForgeStats(download, startD
print >> sys.stderr, "error " + download + "(" + str(attempts) + ")"
return ""
-
-
+
+
if len(sys.argv) != 4:
- print "syntax: python detail-by-day.py <urls.lst> <start-date> <end-date>"
+ print "syntax: python detail-by-day.py <urls.lst> <start-date> <end-date>"
print "where <file.list> is a list of files URL's to gather stats on, and <start-date> and <end-date> are in YYYY-MM-DD format."
exit(-1)
@@ -75,9 +75,9 @@ columns = [ "count_total",
"pl", "pt", "pt-BR", "ru", "sk", "sl", "sr", "sv", "ta", "th",
"tr", "vi", "zh-CN", "zh-TW"]
-# column counters are updated if the download name contains a matching pattern
+# Column counters are updated if the download name contains a matching pattern.
# The dictionary below maps the column names to these search patterns.
-# If there is no entry for a column then the pattern for language columns is assumed
+# If there is no entry for a column then the pattern for language columns is assumed.
patternDict = {
"count_total" : "",
"count_340" : "3.4.0",
@@ -114,7 +114,7 @@ while today <= end_date:
print >> sys.stderr, date_string
for download in downloads :
-
+
try:
data = json.loads(getSourceForgeStats(download,date_string,date_string))
day_count = data["total"]
Modified: openoffice/devtools/aoo-stats/get-aoo-stats.py
URL: http://svn.apache.org/viewvc/openoffice/devtools/aoo-stats/get-aoo-stats.py?rev=1882764&r1=1882763&r2=1882764&view=diff
==============================================================================
--- openoffice/devtools/aoo-stats/get-aoo-stats.py (original)
+++ openoffice/devtools/aoo-stats/get-aoo-stats.py Thu Oct 22 16:13:21 2020
@@ -1,5 +1,5 @@
################################################################
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,22 +7,22 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
################################################################
-# This script queries the SourceForce REST API for download statistics for
+# This script queries the SourceForge REST API for download statistics for
# sets of files on SourceForge, on a given date, in ISO format (YYYY-MM-DD)
-# passed in as a command line argument. The download count for that date
+# passed in as a command line argument. The download count for that date
# is written to stdout.
@@ -41,10 +41,10 @@ def getSourceForgeStats(download, startD
attempts = 0
while attempts < 3:
- try:
+ try:
conn = urllib.urlopen(url)
data = conn.read()
-
+
return data
except:
@@ -52,9 +52,9 @@ def getSourceForgeStats(download, startD
print "error " + str(attempts)
return ""
-
+
def printSyntax():
- print "syntax: python get-aoo-stats.py <urls.lst> <iso-date> [<iso-date>]"
+ print "syntax: python get-aoo-stats.py <urls.lst> <iso-date> [<iso-date>]"
print "where <file.list> is a list of files URL's to gather stats on,"
print "and <iso-date> is a date of interest, in YYYY-MM-DD format."
print "If two dates are given this expresses a range of dates."
@@ -73,7 +73,7 @@ else:
printSyntax()
exit(-1)
-#all of the URLs for AOO 3.4 install downloads
+# all of the URLs for AOO 3.4 install downloads
downloads = [line.strip() for line in open(sys.argv[1])]
count = 0
@@ -93,9 +93,7 @@ for download in downloads :
count = count + day_count
-print "date range: " + startDate + " - " + endDate
+print "date range: " + startDate + " - " + endDate
print "stats_updated: " + data["stats_updated"]
print "count: " + str(count)
-
-
Modified: openoffice/devtools/aoo-stats/platform.py
URL: http://svn.apache.org/viewvc/openoffice/devtools/aoo-stats/platform.py?rev=1882764&r1=1882763&r2=1882764&view=diff
==============================================================================
--- openoffice/devtools/aoo-stats/platform.py (original)
+++ openoffice/devtools/aoo-stats/platform.py Thu Oct 22 16:13:21 2020
@@ -1,5 +1,5 @@
################################################################
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,22 +7,22 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
################################################################
-# This script queries the SourceForce REST API for download statistics for
+# This script queries the SourceForge REST API for download statistics for
# sets of files on SourceForge, on a given date, in ISO format (YYYY-MM-DD)
-# passed in as a command line argument. The download count for that date
+# passed in as a command line argument. The download count for that date
# is written to stdout.
@@ -55,7 +55,7 @@ def getSourceForgeStats(download, startD
if len(sys.argv) != 4:
- print "syntax: python platform.py <urls.lst> <start-date> <end-date>"
+ print "syntax: python platform.py <urls.lst> <start-date> <end-date>"
print "where <file.list> is a list of files URL's to gather stats on, and <start-date> and <end-date> are in YYYY-MM-DD format."
exit(-1)
@@ -102,7 +102,7 @@ print
total = windows + mac + linux + android + solaris + bsd + unknown
-print "Windows: " + str(windows) + " (" + "%0.2f" % (100.0*windows/total) + "%)"
+print "Windows: " + str(windows) + " (" + "%0.2f" % (100.0*windows/total) + "%)"
print "Macintosh: " + str(mac) + " (" + "%0.2f" % (100.0*mac/total) + "%)"
print "Linux: " + str(linux) + " (" + "%0.2f" % (100.0*linux/total) + "%)"
print "Android: " + str(android) + " (" + "%0.2f" % (100.0*android/total) + "%)"
@@ -110,4 +110,3 @@ print "Solaris: " + str(solaris) + " ("
print "BSD: " + str(bsd) + " (" + "%0.2f" % (100.0*bsd/total) + "%)"
print "Unknown: " + str(unknown) + " (" + "%0.2f" % (100.0*unknown/total) + "%)"
-