Skip to content

Added has copyright and has license attribute to delta objects - #141

Closed
pratik0316 wants to merge 2 commits into
aboutcode-org:developfrom
pratik0316:adding_HasLicense_HasCopyright
Closed

Added has copyright and has license attribute to delta objects#141
pratik0316 wants to merge 2 commits into
aboutcode-org:developfrom
pratik0316:adding_HasLicense_HasCopyright

Conversation

@pratik0316

Copy link
Copy Markdown
Collaborator

In this PR I added a the option to add the attribute has_license and has_copyright to the delta objects.
When either of the new file of the old file has a copyright or an license this attributes will be set to true,by default it is False
`
class Delta(object):
"""
A tuple reflecting a comparison of two files -- each of which is a File
object -- and the 'factors' (e.g., 'added', 'modified' etc.) and related
'score' that characterize that comparison.
"""
def init(self, score=0, new_file=None, old_file=None):
self.new_file = new_file if new_file else None
self.old_file = old_file if old_file else None
self.has_license = False
self.has_copyright = False
self.factors = []
self.score = score
self.status = ''

def add_license(self) :
    self.has_license = True

def add_copyright(self):
    self.has_copyright = True    

`

This PR is meant to solve issue of #109

Signed-off-by: Pratikrocks <pratikrocks.dey11@gmail.com>
@pratik0316
pratik0316 force-pushed the adding_HasLicense_HasCopyright branch from fbae501 to f71958e Compare March 17, 2020 18:04
@pratik0316

Copy link
Copy Markdown
Collaborator Author

@MaJuRG kindly review this

Comment thread src/deltacode/__init__.py
Comment on lines +286 to +287
self.has_license = False
self.has_copyright = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these again?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaJuRG I provided it as attributes of every delta objects,as we can just check these booleans for determining weather the respective deltas has a license or copyright(either new or old file)
Depending on these booleans we can actually use the license Expression Library

Comment thread src/deltacode/__init__.py Outdated
Comment on lines +292 to +296
def add_license(self) :
self.has_license = True

def add_copyright(self):
self.has_copyright = True

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need separate functions to simply change a field value?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaJuRG ,no actually it can be modified a bit and made to change the values in place,But I thaught creating a function for it wold be a better approach to it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaJuRG Should I change it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. if all the function does is change a value, there is no need for it. We can add a function later if there is more complex operations to be done.

Also I question the need for these field anyway. Is there an issue regarding this or...?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think the issue of #109 is meant for it i.g

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then these fields are fine.

@pratik0316

Copy link
Copy Markdown
Collaborator Author

@MaJuRG do I need to make any changes further in this , as I think it suffices the requirements of the issues #109

Signed-off-by: Pratikrocks <pratikrocks.dey11@gmail.com>
@pratik0316
pratik0316 force-pushed the adding_HasLicense_HasCopyright branch from fe03d95 to f4bb26e Compare April 1, 2020 18:32
@pratik0316
pratik0316 requested a review from steven-esser April 2, 2020 16:21
@steven-esser

Copy link
Copy Markdown
Contributor

Closing due to stagnation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants