Skip to content

Commit 2f2b0b4

Browse files
committed
update acc. to linter
- LICENSE update - Travis CI changes
1 parent 9c75f28 commit 2f2b0b4

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ script:
1414
- isort --check-only --recursive plagcheck
1515
- black --check --diff plagcheck
1616
- flake8 plagcheck --max-line-length=88 --ignore=F401
17-
- pylint plagcheck --disable=bad-continuation,invalid-name,attribute-defined-outside-init,no-self-use,too-many-locals
17+
- pylint plagcheck --disable=bad-continuation,invalid-name,attribute-defined-outside-init,no-self-use,too-many-locals,too-few-public-methods
1818
after_success:
1919
- coveralls

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Bhupesh Varshney
3+
Copyright (c) 2020 Bhupesh Varshney
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

plagcheck/analyze.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def __init__(self, name):
1414
self.tag = None
1515
self.links = []
1616

17+
def pointTo(self):
18+
"""Return all nodes a node points to"""
19+
return [link.name for link in self.links]
20+
1721

1822
class Mgroups:
1923
"""A Disconnected directed graph consisting all individual solutions"""
@@ -44,8 +48,8 @@ def relatesTo(self, P1, P2, node1, node2):
4448
def __indegree(self, node: Node):
4549
indegree_count = 0
4650
for n in self.nodes:
47-
for link in n.links:
48-
if link.name == node.name:
51+
for link in n.pointTo():
52+
if link == node.name:
4953
indegree_count += 1
5054
return indegree_count
5155

@@ -71,13 +75,15 @@ def createNodes(self, node_set: set):
7175
self.addNode(n)
7276

7377
def addNode(self, name: str):
78+
"""Add a single node to graph"""
7479
if name not in [r.name for r in self.nodes]:
7580
node = Node(name)
7681
self.nodes.append(node)
7782
self.nodeCount += 1
7883
return node
7984

8085
def displayNodes(self):
86+
"""Return all nodes in the graph"""
8187
return [r.name for r in self.nodes]
8288

8389
def displayTags(self):

plagcheck/plagcheck.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
"""The MOSS interface package for CodeClassroom"""
2+
import collections
23
import re
34
import urllib.request
45
from concurrent.futures import ThreadPoolExecutor
56
from typing import List, Tuple
6-
import collections
7+
78
import mosspy
89
from bs4 import BeautifulSoup as bs
10+
911
from plagcheck.analyze import Mgroups
1012

1113
HEADERS = {"User-Agent": "Mozilla/5.0"}
@@ -106,9 +108,11 @@ def __get_line_numbers(self, url: str) -> List[List[str]]:
106108
return list_of_line_nos
107109

108110
def addFilesByWildCard(self, files):
111+
"""Add multiple files"""
109112
self.__moss.addFilesByWildcard(files)
110113

111114
def addFile(self, file):
115+
"""Add a single file for submission"""
112116
self.__moss.addFile(file)
113117

114118
def addBaseCode(self, base_file: str):
@@ -156,7 +160,11 @@ def getInsights(self):
156160
mg.createNodes(similar_code_files)
157161

158162
for r in self.moss_results:
159-
mg.relatesTo(r['percentage_file1'], r['percentage_file2'], r['file1'], r['file2'])
163+
mg.relatesTo(
164+
r['percentage_file1'],
165+
r['percentage_file2'],
166+
r['file1'], r['file2']
167+
)
160168

161169
mg.set_tags()
162170

0 commit comments

Comments
 (0)