diff --git a/client/contributions.py b/client/contributions.py index 175b004..b837978 100644 --- a/client/contributions.py +++ b/client/contributions.py @@ -25,7 +25,7 @@ def _user_score(self, user_id: str, start_date: datetime = None, end_date: datet @staticmethod def _filter_prs(prs: List[PullRequest], start_date: datetime = None, end_date: datetime = None) -> List[PullRequest]: - if start_date != None and end_date != None: + if start_date is not None and end_date is not None: return [pr for pr in prs if pr.created_between(start_date, end_date)] else: return prs diff --git a/client/github_stats.py b/client/github_stats.py index 3527342..f064737 100644 --- a/client/github_stats.py +++ b/client/github_stats.py @@ -23,10 +23,10 @@ def list_of_prs(self, user_id: str, state=None, request_parallelization_count=5) prs = Pool(request_parallelization_count).map( self._to_pull_request, items) - if state == None: + if state is None: return prs else: - def stateNotEqual(pr: PullRequest) -> Boolean: + def stateNotEqual(pr: PullRequest) -> bool: return pr._state != state return filter(stateNotEqual, prs) diff --git a/client_test/models/pr_test_data.py b/client_test/models/pr_test_data.py index 7368d57..2b6155b 100644 --- a/client_test/models/pr_test_data.py +++ b/client_test/models/pr_test_data.py @@ -4,7 +4,7 @@ class PRData: def __init__(self, data: dict = None): - if data == None: + if data is None: with open('./client_test/models/empty_pr_data.json') as file: self.data = json.load(file) else: @@ -17,7 +17,7 @@ def with_pr_url(self, url: str = 'some-url'): def with_label(self, label_to_add: str = None): data = copy.deepcopy(self.data) - if label_to_add == None: + if label_to_add is None: label_number = len(data["issues_data"]["labels"]) + 1 label_to_add = f'label-{label_number}' diff --git a/client_test/models/pull_request_test.py b/client_test/models/pull_request_test.py index 273dfcd..3917c32 100644 --- a/client_test/models/pull_request_test.py +++ b/client_test/models/pull_request_test.py @@ -18,7 +18,7 @@ def test_should_create_pull_request(): assert pr._created_at == datetime(2014, 4, 24, 16, 34, 47) assert pr._owner == 'owner_user_id' assert pr._pr_raised_by == 'pr_raised_by_user_id' - assert pr._merged == False + assert pr._merged is False @staticmethod def test_summary(): @@ -34,7 +34,7 @@ def test_should_not_be_spam_when_labels_do_not_contain_invalid_and_spam(): data = _input.data pr = PullRequest(**data) - assert pr.is_spam() == False + assert pr.is_spam() is False @staticmethod def test_should_be_spam_when_labels_contain_invalid(): @@ -72,7 +72,7 @@ def test_not_in_between(): assert pr.created_between( start_date=datetime(2020, 1, 1), end_date=datetime(2021, 1, 1) - ) == False + ) is False @staticmethod def test_created_at_start(): diff --git a/stats.py b/stats.py index 0416e91..e7ef158 100644 --- a/stats.py +++ b/stats.py @@ -1,11 +1,8 @@ -import sys from argparse import ArgumentParser, ArgumentTypeError from datetime import datetime -from typing import List from client.contributions import Contributions from client.github_stats import GithubStats -from client.models.user_stats import UserStats def valid_date(s: str) -> datetime: