From fd1db7fe9bf920e168f6945db111b7f265df2c79 Mon Sep 17 00:00:00 2001
From: janmax <j.michal@stud.uni-goettingen.de>
Date: Sat, 24 Feb 2018 22:31:37 +0100
Subject: [PATCH] Added gitlab-ci and some README updates

---
 .gitlab-ci.yml  | 10 ++++++++++
 README          | 24 +++++++++++++-----------
 hektor.py       | 20 ++++++++++----------
 lib/__init__.py |  6 +++---
 setup.py        |  4 ++--
 5 files changed, 38 insertions(+), 26 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..bc39087
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,10 @@
+image: python:3.4
+
+before_script:
+  - python -V
+
+test:
+  script:
+  - pip install -e .
+  - pip install flake8
+  - flake8 hektor.py bin lib
diff --git a/README b/README
index 5e4a8b2..a80697a 100644
--- a/README
+++ b/README
@@ -1,17 +1,19 @@
 Hektor QTI-XML to JSON converter
+--------------------------------
 
-This small converter should convert an Ilias export into
-somthing more readable, like a json file. The main consumers
-of these files will be Grady or other applications that do
-not want to deal with the QTI mess.
+This small converter should convert an Ilias export into somthing more readable,
+like a json file. The main consumers of these files will be Grady or other
+applications that do not want to deal with the QTI mess.
 
-The name Hektor is taken from Homer's Iilas. Despite being the
-greatest warrior of Troja he met his doom in the Ilias. Anyone who 
-works with the E-Learning Platform Ilias shall be equally doomed.
+The name Hektor is taken from Homer's Iilas. Despite being the greatest warrior
+of Troja he met his doom in the Ilias. Anyone who works with the E-Learning
+Platform Ilias shall be equally doomed.
 
-Requirements:
-	- lxml
+Installation:
+    - `pip install -U hektor`
 
-Usage:
-	- python3 hektor.py -h
+Usage help:
+	- `hektor -h`
 
+Example usage:
+    - `hektor ilias_export.zip grady.json
diff --git a/hektor.py b/hektor.py
index ced0418..d84da1b 100644
--- a/hektor.py
+++ b/hektor.py
@@ -37,23 +37,23 @@ def parseme():
         'input',
         metavar='DATA',
         type=lambda f: file_exists(parser, f),
-        help='A QTI-ZIP or a .xla Ilias export that contains course data')
+        help='an Ilias course export in .zip or .xls format')
     parser.add_argument(
         'output',
         metavar='OUTFILE',
-        help='Where you want to put the output')
+        help='destination of converter output (JSON)')
     parser.add_argument(
         '-a', '--anonymous',
         action='store_true',
-        help='Strip any personal information and create a reversing table')
+        help='replace personal information and create a reversing table')
     parser.add_argument(
         '-t', '--personal-secret-table',
-        help='Where to store personal information',
+        help='where to store personal information (CSV)',
     )
     parser.add_argument(
         '-m', '--meta',
         action='store_true',
-        help='If you want to add meta information (lecturer, course title)'
+        help='add meta information (lecturer, course title)'
     )
 
     args = parser.parse_args()
@@ -102,10 +102,8 @@ def anonymise(structured_data: Dict[str, Any]) -> Dict[str, Any]:
                                                 if type(v) is str)
                         for anon, data in reverser.items()), file=out)
 
-    return {
-        **structured_data,
-        'students': students_anon
-    }
+    structured_data.update({'students': students_anon})
+    return structured_data
 
 
 def add_meta_information(structured_data: Dict[str, Any]) -> Dict[str, Any]:
@@ -186,6 +184,9 @@ def _postprocessing(structured_data: Dict[str, Any]) -> Dict[str, Any]:
 
 
 def main():
+    global args
+    args = parseme()
+
     processing = compose(_postprocessing, _processing, _preprocessing)
     data = processing(args.input)
     destination = args.output.split('.json')[0] + '.json'
@@ -195,5 +196,4 @@ def main():
 
 
 if __name__ == '__main__':
-    args = parseme()
     main()
diff --git a/lib/__init__.py b/lib/__init__.py
index 02d4a05..f7c0d5e 100644
--- a/lib/__init__.py
+++ b/lib/__init__.py
@@ -1,5 +1,5 @@
 # New modules need to be registered here
 
-from lib.generic import Converter
-from lib.qti import QTIConverter
-from lib.xls import XLSConverter
+from lib.generic import Converter  # noqa
+from lib.qti import QTIConverter  # noqa
+from lib.xls import XLSConverter  # noqa
diff --git a/setup.py b/setup.py
index 333c6a9..344bda7 100644
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,8 @@ from setuptools import setup
 
 setup(
     name='hektor',
-    version='0.1.1',
-    description='A QTI-XML to JSON converter for humans',
+    version='0.2',
+    description='A QTI-XML/XLS to JSON converter for humans',
     author='Jan Maximilian Michal',
     author_email='mail@janmax.org',
     url='https://gitlab.gwdg.de/j.michal/hektor',
-- 
GitLab