Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy issues #192

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pydriller/domain/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

import lizard
import lizard_languages
from git import Diff, Git, Commit as GitCommit, NULL_TREE
from git import Diff, Git, NULL_TREE
from git.objects import Commit as GitCommit

from pydriller.domain.developer import Developer

Expand Down Expand Up @@ -577,7 +578,7 @@ def author_timezone(self) -> int:

:return: int timezone
"""
return self._c_object.author_tz_offset
return int(self._c_object.author_tz_offset)

@property
def committer_timezone(self) -> int:
Expand All @@ -586,7 +587,7 @@ def committer_timezone(self) -> int:

:return: int timezone
"""
return self._c_object.committer_tz_offset
return int(self._c_object.committer_tz_offset)

@property
def msg(self) -> str:
Expand All @@ -595,7 +596,7 @@ def msg(self) -> str:

:return: str commit_message
"""
return self._c_object.message.strip()
return str(self._c_object.message.strip())

@property
def parents(self) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion pydriller/domain/developer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Developer:
This class represents a developer. We save the email and the name.
"""

def __init__(self, name: str, email: str):
def __init__(self, name: str = None, email: str = None):
"""
Class to identify a developer.

Expand Down
6 changes: 5 additions & 1 deletion pydriller/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from pathlib import Path
from typing import List, Dict, Set, Generator

from git import Repo, GitCommandError, Commit as GitCommit
from git import Repo, GitCommandError
from git.objects import Commit as GitCommit

from pydriller.domain.commit import Commit, ModificationType, ModifiedFile
from pydriller.utils.conf import Conf
Expand Down Expand Up @@ -68,6 +69,9 @@ def repo(self) -> Repo:
"""
if self._repo is None:
self._open_repository()

assert self._repo

return self._repo

def clear(self):
Expand Down
1 change: 0 additions & 1 deletion tests/test_git_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def test_checkout_with_commit_not_fully_merged_to_master(repo: Git):
assert len(files1) == 2

repo.reset()
assert 4, "temp branch should be cleared." == len(repo.repo.branches)
files2 = repo.files()
assert len(files2) == 1

Expand Down