Adding ModifiedFile.content and deprecating ModifiedFile.source_code #220
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request should address #216, open to discuss modifications and refactoring operations.
I believe
source_code
is a core property used by many and therefore should not be refactored tocontent
any time soon. Instead, it should be deprecated and then removed in a future version of PyDriller. Therefore, this pull request addresses issue #216 by adding the class variablescontent
andcontent_before
that behave exactly likesource_code
andsource_code_before
; the latter have been also translated to properties to warn the user about their deprecation.Test cases using property
source_code
andsource_code_before
. Checked ☑️ if modified for DeprecationWarning and testing the new propertycontent
:Methods in
ModifiedFile
that usesource_code
orsource_code_before
. Checked ☑️ if modified to warn deprecation and to include the new propertycontent
:self.source_code
has been renamed toself.__source_code
to handle DeprecationWarning in a new method/propertysource_code()
.self.source_code_before
has been renamed toself.__source_code_before
to handle DeprecationWarning in a new method/propertysource_code_before()
.self.content
andself.content_before
.self.source_code
replaced byself.content
to generate hashable string.source_code
andsource_code_before
tocontent
andcontent_before
.Methods in
Commit
that usesource_code
orsource_code_before
.content_before
andcontent
to thediff_and_sc
dictionary that is passed to ModifiedFile.Future refactoring:
diff_and_sc -> diff_and_content
in commit.py.