summaryrefslogtreecommitdiffstats
path: root/Smarker
diff options
context:
space:
mode:
Diffstat (limited to 'Smarker')
-rw-r--r--Smarker/assessments.py5
-rw-r--r--Smarker/smarker.py7
2 files changed, 10 insertions, 2 deletions
diff --git a/Smarker/assessments.py b/Smarker/assessments.py
index a6c4df8..4f32353 100644
--- a/Smarker/assessments.py
+++ b/Smarker/assessments.py
@@ -24,7 +24,7 @@ def generate_plagarism_report(codes):
input("%s..." % td)
print(pycode_similar.detect(os.listdir(td)))
-if __name__ == "__main__":
+def getparser():
config = configparser.ConfigParser()
config.read(os.path.join(os.path.split(__file__)[0], "smarker.conf"))
@@ -81,7 +81,10 @@ if __name__ == "__main__":
default = config.get("mysql", option),
help = "Optional argument inherited from config file. Read smarker.conf for details."
)
+ return parser
+if __name__ == "__main__":
+ parser = getparser()
args = vars(parser.parse_args())
with database.SmarkerDatabase(
diff --git a/Smarker/smarker.py b/Smarker/smarker.py
index 8b8527e..39c22e6 100644
--- a/Smarker/smarker.py
+++ b/Smarker/smarker.py
@@ -73,7 +73,7 @@ def main(**kwargs):
# input("\n\n[tempdir: %s] Press any key to close..." % tempdir)
-if __name__ == "__main__":
+def getparser():
config = configparser.ConfigParser()
config.read(os.path.join(os.path.split(__file__)[0], "smarker.conf"))
@@ -127,6 +127,11 @@ if __name__ == "__main__":
except KeyError:
pass
+ return parser
+
+if __name__ == "__main__":
+ parser = getparser()
+
args = vars(parser.parse_args())
main(**args)
\ No newline at end of file