{"action":"created","comment":{"url":"https://api.github.com/repos/ICTU/quality-report/pulls/comments/173410545","pull_request_review_id":102597958,"id":173410545,"diff_hunk":"@@ -19,124 +19,31 @@\n import logging\n import time\n \n-from typing import Any, Optional, Callable, List\n+from typing import Optional, List\n \n from ... import utils\n from ...domain import MetricSource\n from ...metric_source import url_opener\n from ...typing import DateTime, TimeDelta\n \n \n-class TrelloObject(object):\n-    \"\"\" Base class for Trello objects. \"\"\"\n-\n-    url_template = 'https://api.trello.com/1/{object_type}/{object_id}{argument}?key={appkey}&token={token}{parameters}'\n-\n-    def __init__(self, appkey: str, token: str, object_id: str = '', urlopen=None) -> None:\n-        self._appkey = appkey\n-        self._token = token\n-        self.__object_id = object_id\n-        self.__urlopen = urlopen or url_opener.UrlOpener().url_open\n-        self.__object_type = self.__class__.__name__[len('Trello'):].lower()\n-        super().__init__()\n-\n-    @functools.lru_cache(maxsize=1024)\n-    def _json(self, object_id: str = '', argument: str = '', extra_parameters: str = '') -> Any:\n-        \"\"\" Return the JSON at url. \"\"\"\n-        url = self.url_template.format(\n-            object_type=self.__object_type, object_id=object_id or self.__object_id,\n-            appkey=self._appkey, token=self._token, argument=argument, parameters=extra_parameters)\n-        json_string = self.__urlopen(url).read()\n-        return utils.eval_json(json_string)\n-\n-    def url(self, object_id: str = '') -> str:\n-        \"\"\" Return the url of a Trello object, if object id is passed, or of trello.com. \"\"\"\n-        if object_id or self.__object_id:\n-            try:\n-                return self._json(object_id)['shortUrl']\n-            except url_opener.UrlOpener.url_open_exceptions:\n-                pass\n-        return 'http://trello.com'\n-\n-    def datetime(self, *object_ids: str) -> DateTime:\n-        \"\"\" Return the date of the last action at this Trello object. \"\"\"\n-        object_ids = object_ids or [self.__object_id]\n-        datetimes = []\n-        try:\n-            for object_id in object_ids:\n-                actions = self._json(object_id=object_id, argument='/actions', extra_parameters='&filter=all')\n-                if actions:\n-                    datetimes.append(self.date_time_from_string(actions[0]['date']))\n-        except url_opener.UrlOpener.url_open_exceptions:\n-            return datetime.datetime.min\n-        return max(datetimes) if datetimes else datetime.datetime.min\n-\n-    def last_update_time_delta(self, *board_ids: str) -> TimeDelta:\n-        \"\"\" Return the amount of time since the last update. \"\"\"\n-        return datetime.datetime.now() - self.datetime(*board_ids)\n-\n-    @staticmethod\n-    def date_time_from_string(date_time_timezone_string: str) -> DateTime:\n-        \"\"\" Parse the date/time string representation into a datetime instance. Expected format is:\n-            \"<year>-<month>-<day>T<hour>:<minute>:<second>.<timezone>Z\". \"\"\"\n-        date_time_string = date_time_timezone_string.split('.')[0]\n-        year, month, day, hour, minute, second = time.strptime(date_time_string, '%Y-%m-%dT%H:%M:%S')[:6]\n-        return datetime.datetime(year, month, day, hour, minute, second)\n-\n-\n-class TrelloList(TrelloObject):\n-    \"\"\" Class representing a Trello list. \"\"\"\n-    def name(self) -> str:\n-        \"\"\" Return the name of the list. \"\"\"\n-        return self._json()[\"name\"]\n-\n-\n-class TrelloCard(TrelloObject):\n-    \"\"\" Class representing a Trello card. \"\"\"\n-\n-    def card_id(self) -> str:\n-        \"\"\" Return the id of this Trello object. \"\"\"\n-        return self._json()['idShort']\n-\n-    def list_name(self) -> str:\n-        \"\"\" Return the name of the list that the card belongs to. \"\"\"\n-        return TrelloList(self._appkey, self._token, self._json()[\"idList\"]).name()\n-\n-    def due_date_time(self) -> Optional[DateTime]:\n-        \"\"\" Return the date/time when this card is due or None when the card has no due date/time. \"\"\"\n-        json = self._json()\n-        if 'due' in json:\n-            date_time_string = json['due']\n-            if date_time_string:\n-                return self.date_time_from_string(date_time_string)\n-        return None\n-\n-    def over_due_time_delta(self, now: Callable[[], DateTime] = datetime.datetime.now) -> TimeDelta:\n-        \"\"\" Return the amount of time the card is over due. \"\"\"\n-        due_date_time = self.due_date_time()\n-        return now() - due_date_time if due_date_time else datetime.timedelta()\n-\n-    def is_over_due(self, now: Callable[[], DateTime] = datetime.datetime.now) -> bool:\n-        \"\"\" Return whether the card is over due. \"\"\"\n-        due_date_time = self.due_date_time()\n-        return due_date_time < now() if due_date_time else False\n-\n-    def is_inactive(self, days: int, now: Callable[[], DateTime] = datetime.datetime.now) -> bool:\n-        \"\"\" Return whether the card has been inactive for the specified number of days. \"\"\"\n-        if self.due_date_time() and self.due_date_time() > now():\n-            return False\n-        max_age = datetime.timedelta(days=days)\n-        return now() - self.datetime() > max_age\n-\n-\n-class TrelloBoard(TrelloObject, MetricSource):\n+class TrelloBoard(MetricSource):\n     \"\"\" Class representing a Trello board. \"\"\"\n     metric_source_name = 'Trello'\n+    board_data_url = 'https://api.trello.com/1/boards/{object_id}/?fields=id,url&lists=open&list_fields=name' \\\n+                     '&cards=visible&card_fields=shortUrl,dateLastActivity,due,idList,name&key={appkey}&token={token}'\n \n-    def __init__(self, *args, **kwargs) -> None:\n-        self.__card_class = kwargs.pop('card_class', TrelloCard)\n+    def __init__(self, appkey: str, token: str, *args, **kwargs) -> None:","path":"backend/hqlib/metric_source/issue_log/trello.py","position":124,"original_position":124,"commit_id":"9da8fae15eb2555b000621c394346b10f9ac5507","original_commit_id":"9da8fae15eb2555b000621c394346b10f9ac5507","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [__init__ method from base class 'MetricSource' is not called](https://app.codacy.com/app/frank_10/quality-report/pullRequest?prid=1412261)","created_at":"2018-03-09T10:09:56Z","updated_at":"2018-03-09T10:09:56Z","html_url":"https://github.com/ICTU/quality-report/pull/305#discussion_r173410545","pull_request_url":"https://api.github.com/repos/ICTU/quality-report/pulls/305","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ICTU/quality-report/pulls/comments/173410545"},"html":{"href":"https://github.com/ICTU/quality-report/pull/305#discussion_r173410545"},"pull_request":{"href":"https://api.github.com/repos/ICTU/quality-report/pulls/305"}}},"pull_request":{"url":"https://api.github.com/repos/ICTU/quality-report/pulls/305","id":173772696,"html_url":"https://github.com/ICTU/quality-report/pull/305","diff_url":"https://github.com/ICTU/quality-report/pull/305.diff","patch_url":"https://github.com/ICTU/quality-report/pull/305.patch","issue_url":"https://api.github.com/repos/ICTU/quality-report/issues/305","number":305,"state":"open","locked":false,"title":"Bug 296 trello api rate limits","user":{"login":"milenk","id":32734752,"avatar_url":"https://avatars2.githubusercontent.com/u/32734752?v=4","gravatar_id":"","url":"https://api.github.com/users/milenk","html_url":"https://github.com/milenk","followers_url":"https://api.github.com/users/milenk/followers","following_url":"https://api.github.com/users/milenk/following{/other_user}","gists_url":"https://api.github.com/users/milenk/gists{/gist_id}","starred_url":"https://api.github.com/users/milenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milenk/subscriptions","organizations_url":"https://api.github.com/users/milenk/orgs","repos_url":"https://api.github.com/users/milenk/repos","events_url":"https://api.github.com/users/milenk/events{/privacy}","received_events_url":"https://api.github.com/users/milenk/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-08T15:50:26Z","updated_at":"2018-03-09T10:09:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a54f07ea5ab1f1ddebeeaa85722dcf20dd9c59ac","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ICTU/quality-report/pulls/305/commits","review_comments_url":"https://api.github.com/repos/ICTU/quality-report/pulls/305/comments","review_comment_url":"https://api.github.com/repos/ICTU/quality-report/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ICTU/quality-report/issues/305/comments","statuses_url":"https://api.github.com/repos/ICTU/quality-report/statuses/9da8fae15eb2555b000621c394346b10f9ac5507","head":{"label":"ICTU:bug-296-trello-api-rate-limits","ref":"bug-296-trello-api-rate-limits","sha":"9da8fae15eb2555b000621c394346b10f9ac5507","user":{"login":"ICTU","id":6009701,"avatar_url":"https://avatars1.githubusercontent.com/u/6009701?v=4","gravatar_id":"","url":"https://api.github.com/users/ICTU","html_url":"https://github.com/ICTU","followers_url":"https://api.github.com/users/ICTU/followers","following_url":"https://api.github.com/users/ICTU/following{/other_user}","gists_url":"https://api.github.com/users/ICTU/gists{/gist_id}","starred_url":"https://api.github.com/users/ICTU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ICTU/subscriptions","organizations_url":"https://api.github.com/users/ICTU/orgs","repos_url":"https://api.github.com/users/ICTU/repos","events_url":"https://api.github.com/users/ICTU/events{/privacy}","received_events_url":"https://api.github.com/users/ICTU/received_events","type":"Organization","site_admin":false},"repo":{"id":16836834,"name":"quality-report","full_name":"ICTU/quality-report","owner":{"login":"ICTU","id":6009701,"avatar_url":"https://avatars1.githubusercontent.com/u/6009701?v=4","gravatar_id":"","url":"https://api.github.com/users/ICTU","html_url":"https://github.com/ICTU","followers_url":"https://api.github.com/users/ICTU/followers","following_url":"https://api.github.com/users/ICTU/following{/other_user}","gists_url":"https://api.github.com/users/ICTU/gists{/gist_id}","starred_url":"https://api.github.com/users/ICTU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ICTU/subscriptions","organizations_url":"https://api.github.com/users/ICTU/orgs","repos_url":"https://api.github.com/users/ICTU/repos","events_url":"https://api.github.com/users/ICTU/events{/privacy}","received_events_url":"https://api.github.com/users/ICTU/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ICTU/quality-report","description":"HQ - Holistic Software Quality Reporting","fork":false,"url":"https://api.github.com/repos/ICTU/quality-report","forks_url":"https://api.github.com/repos/ICTU/quality-report/forks","keys_url":"https://api.github.com/repos/ICTU/quality-report/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ICTU/quality-report/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ICTU/quality-report/teams","hooks_url":"https://api.github.com/repos/ICTU/quality-report/hooks","issue_events_url":"https://api.github.com/repos/ICTU/quality-report/issues/events{/number}","events_url":"https://api.github.com/repos/ICTU/quality-report/events","assignees_url":"https://api.github.com/repos/ICTU/quality-report/assignees{/user}","branches_url":"https://api.github.com/repos/ICTU/quality-report/branches{/branch}","tags_url":"https://api.github.com/repos/ICTU/quality-report/tags","blobs_url":"https://api.github.com/repos/ICTU/quality-report/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ICTU/quality-report/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ICTU/quality-report/git/refs{/sha}","trees_url":"https://api.github.com/repos/ICTU/quality-report/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ICTU/quality-report/statuses/{sha}","languages_url":"https://api.github.com/repos/ICTU/quality-report/languages","stargazers_url":"https://api.github.com/repos/ICTU/quality-report/stargazers","contributors_url":"https://api.github.com/repos/ICTU/quality-report/contributors","subscribers_url":"https://api.github.com/repos/ICTU/quality-report/subscribers","subscription_url":"https://api.github.com/repos/ICTU/quality-report/subscription","commits_url":"https://api.github.com/repos/ICTU/quality-report/commits{/sha}","git_commits_url":"https://api.github.com/repos/ICTU/quality-report/git/commits{/sha}","comments_url":"https://api.github.com/repos/ICTU/quality-report/comments{/number}","issue_comment_url":"https://api.github.com/repos/ICTU/quality-report/issues/comments{/number}","contents_url":"https://api.github.com/repos/ICTU/quality-report/contents/{+path}","compare_url":"https://api.github.com/repos/ICTU/quality-report/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ICTU/quality-report/merges","archive_url":"https://api.github.com/repos/ICTU/quality-report/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ICTU/quality-report/downloads","issues_url":"https://api.github.com/repos/ICTU/quality-report/issues{/number}","pulls_url":"https://api.github.com/repos/ICTU/quality-report/pulls{/number}","milestones_url":"https://api.github.com/repos/ICTU/quality-report/milestones{/number}","notifications_url":"https://api.github.com/repos/ICTU/quality-report/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ICTU/quality-report/labels{/name}","releases_url":"https://api.github.com/repos/ICTU/quality-report/releases{/id}","deployments_url":"https://api.github.com/repos/ICTU/quality-report/deployments","created_at":"2014-02-14T12:39:18Z","updated_at":"2018-01-29T16:19:20Z","pushed_at":"2018-03-09T10:06:00Z","git_url":"git://github.com/ICTU/quality-report.git","ssh_url":"git@github.com:ICTU/quality-report.git","clone_url":"https://github.com/ICTU/quality-report.git","svn_url":"https://github.com/ICTU/quality-report","homepage":"http://ictu.github.io/quality-report/","size":7088,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":49,"license":null,"forks":5,"open_issues":49,"watchers":12,"default_branch":"master"}},"base":{"label":"ICTU:master","ref":"master","sha":"7323ff877533349ddc12b8de0afbe16e3c675bf2","user":{"login":"ICTU","id":6009701,"avatar_url":"https://avatars1.githubusercontent.com/u/6009701?v=4","gravatar_id":"","url":"https://api.github.com/users/ICTU","html_url":"https://github.com/ICTU","followers_url":"https://api.github.com/users/ICTU/followers","following_url":"https://api.github.com/users/ICTU/following{/other_user}","gists_url":"https://api.github.com/users/ICTU/gists{/gist_id}","starred_url":"https://api.github.com/users/ICTU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ICTU/subscriptions","organizations_url":"https://api.github.com/users/ICTU/orgs","repos_url":"https://api.github.com/users/ICTU/repos","events_url":"https://api.github.com/users/ICTU/events{/privacy}","received_events_url":"https://api.github.com/users/ICTU/received_events","type":"Organization","site_admin":false},"repo":{"id":16836834,"name":"quality-report","full_name":"ICTU/quality-report","owner":{"login":"ICTU","id":6009701,"avatar_url":"https://avatars1.githubusercontent.com/u/6009701?v=4","gravatar_id":"","url":"https://api.github.com/users/ICTU","html_url":"https://github.com/ICTU","followers_url":"https://api.github.com/users/ICTU/followers","following_url":"https://api.github.com/users/ICTU/following{/other_user}","gists_url":"https://api.github.com/users/ICTU/gists{/gist_id}","starred_url":"https://api.github.com/users/ICTU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ICTU/subscriptions","organizations_url":"https://api.github.com/users/ICTU/orgs","repos_url":"https://api.github.com/users/ICTU/repos","events_url":"https://api.github.com/users/ICTU/events{/privacy}","received_events_url":"https://api.github.com/users/ICTU/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ICTU/quality-report","description":"HQ - Holistic Software Quality Reporting","fork":false,"url":"https://api.github.com/repos/ICTU/quality-report","forks_url":"https://api.github.com/repos/ICTU/quality-report/forks","keys_url":"https://api.github.com/repos/ICTU/quality-report/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ICTU/quality-report/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ICTU/quality-report/teams","hooks_url":"https://api.github.com/repos/ICTU/quality-report/hooks","issue_events_url":"https://api.github.com/repos/ICTU/quality-report/issues/events{/number}","events_url":"https://api.github.com/repos/ICTU/quality-report/events","assignees_url":"https://api.github.com/repos/ICTU/quality-report/assignees{/user}","branches_url":"https://api.github.com/repos/ICTU/quality-report/branches{/branch}","tags_url":"https://api.github.com/repos/ICTU/quality-report/tags","blobs_url":"https://api.github.com/repos/ICTU/quality-report/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ICTU/quality-report/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ICTU/quality-report/git/refs{/sha}","trees_url":"https://api.github.com/repos/ICTU/quality-report/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ICTU/quality-report/statuses/{sha}","languages_url":"https://api.github.com/repos/ICTU/quality-report/languages","stargazers_url":"https://api.github.com/repos/ICTU/quality-report/stargazers","contributors_url":"https://api.github.com/repos/ICTU/quality-report/contributors","subscribers_url":"https://api.github.com/repos/ICTU/quality-report/subscribers","subscription_url":"https://api.github.com/repos/ICTU/quality-report/subscription","commits_url":"https://api.github.com/repos/ICTU/quality-report/commits{/sha}","git_commits_url":"https://api.github.com/repos/ICTU/quality-report/git/commits{/sha}","comments_url":"https://api.github.com/repos/ICTU/quality-report/comments{/number}","issue_comment_url":"https://api.github.com/repos/ICTU/quality-report/issues/comments{/number}","contents_url":"https://api.github.com/repos/ICTU/quality-report/contents/{+path}","compare_url":"https://api.github.com/repos/ICTU/quality-report/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ICTU/quality-report/merges","archive_url":"https://api.github.com/repos/ICTU/quality-report/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ICTU/quality-report/downloads","issues_url":"https://api.github.com/repos/ICTU/quality-report/issues{/number}","pulls_url":"https://api.github.com/repos/ICTU/quality-report/pulls{/number}","milestones_url":"https://api.github.com/repos/ICTU/quality-report/milestones{/number}","notifications_url":"https://api.github.com/repos/ICTU/quality-report/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ICTU/quality-report/labels{/name}","releases_url":"https://api.github.com/repos/ICTU/quality-report/releases{/id}","deployments_url":"https://api.github.com/repos/ICTU/quality-report/deployments","created_at":"2014-02-14T12:39:18Z","updated_at":"2018-01-29T16:19:20Z","pushed_at":"2018-03-09T10:06:00Z","git_url":"git://github.com/ICTU/quality-report.git","ssh_url":"git@github.com:ICTU/quality-report.git","clone_url":"https://github.com/ICTU/quality-report.git","svn_url":"https://github.com/ICTU/quality-report","homepage":"http://ictu.github.io/quality-report/","size":7088,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":49,"license":null,"forks":5,"open_issues":49,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ICTU/quality-report/pulls/305"},"html":{"href":"https://github.com/ICTU/quality-report/pull/305"},"issue":{"href":"https://api.github.com/repos/ICTU/quality-report/issues/305"},"comments":{"href":"https://api.github.com/repos/ICTU/quality-report/issues/305/comments"},"review_comments":{"href":"https://api.github.com/repos/ICTU/quality-report/pulls/305/comments"},"review_comment":{"href":"https://api.github.com/repos/ICTU/quality-report/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ICTU/quality-report/pulls/305/commits"},"statuses":{"href":"https://api.github.com/repos/ICTU/quality-report/statuses/9da8fae15eb2555b000621c394346b10f9ac5507"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"codacy-bot"}}