pep-0020 - Readability counts
Closes from
SivaMaplelabs/pep-0008-indentation
#!/bin/env /usr/bin/python2.6
-
+# pylint: disable=missing-docstring
+# pylint: disable=unused-import
from datetime import date, timedelta
import json
import httplib
@@ -8,11 +9,13 @@ import sys
import urllib
def search_issues(query_terms, sortBy=None, orderDir=None):
+ # pylint: disable=line-too-long
+ # pylint: disable=invalid-name
conn = httplib.HTTPSConnection("api.github.com")
params_map = {"q": "+".join(query_terms)}
- if None != sortBy:
+ if sortBy is not None:
params_map["sort"] = sortBy
- if None != orderDir:
+ if orderDir is not None:
params_map["order"] = orderDir
# Note we don't do urlencode because the output is not compatible with the q syntax, e.g. : and / should not be escaped
# params = urllib.urlencode(params_map)
@@ -32,16 +35,19 @@ def search_issues(query_terms, sortBy=None, orderDir=None):
def get_created_issues_since(day):
+ # pylint: disable=line-too-long
return search_issues(query_terms=["repo:linkedin/gobblin", "is:open", "is:issue", "created:>=" + day],
sortBy="created",
orderDir="desc"
)
def get_created_issues_last_days(n=10):
+ # pylint: disable=invalid-name
since_day = (date.today() - timedelta(days=n)).strftime("%Y-%m-%d")
return get_created_issues_since(since_day)
def simple_issue_list(issues):
+ # pylint: disable=invalid-name
HEADER_TEMPLATE = Template("$total_count issues found")
ISSUE_TEMPLATE = Template("""------------------
ISSUE $number : HTML: $html_url JSON: $url
@@ -65,6 +71,7 @@ $body
print ISSUE_TEMPLATE.safe_substitute(issue)
def main(argv):
+ # pylint: disable=unused-argument
issues = get_created_issues_last_days(7)
print simple_issue_list(issues)
