cornellGrading 2.16.1__tar.gz → 2.17.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {cornellGrading-2.16.1/cornellGrading.egg-info → cornellgrading-2.17.0}/PKG-INFO +1 -1
  2. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading/__init__.py +1 -1
  3. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading/cornellGrading.py +6 -5
  4. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading/cornellQualtrics.py +74 -30
  5. {cornellGrading-2.16.1 → cornellgrading-2.17.0/cornellGrading.egg-info}/PKG-INFO +1 -1
  6. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/LICENSE +0 -0
  7. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/MANIFEST.in +0 -0
  8. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/README.md +0 -0
  9. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading/cornellInterface.py +0 -0
  10. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading/dueDatesFromCSV.py +0 -0
  11. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading/pandocHTMLParser.py +0 -0
  12. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading/upload_MC_questions.py +0 -0
  13. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading.egg-info/SOURCES.txt +0 -0
  14. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading.egg-info/dependency_links.txt +0 -0
  15. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading.egg-info/entry_points.txt +0 -0
  16. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading.egg-info/requires.txt +0 -0
  17. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/cornellGrading.egg-info/top_level.txt +0 -0
  18. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/pyproject.toml +0 -0
  19. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/scripts/canvastex.py +0 -0
  20. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/scripts/matlabgrader.py +0 -0
  21. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/scripts/setupSelfGrading.py +0 -0
  22. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/setup.cfg +0 -0
  23. {cornellGrading-2.16.1 → cornellgrading-2.17.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cornellGrading
3
- Version: 2.16.1
3
+ Version: 2.17.0
4
4
  Summary: Routines for interacting with Cornell installations of Canvas and Qualtrics
5
5
  Home-page: https://github.com/dsavransky/grading
6
6
  Author: Dmitry Savransky
@@ -1,4 +1,4 @@
1
1
  name = "cornellGrading"
2
- __version__ = "2.16.1"
2
+ __version__ = "2.17.0"
3
3
  from .cornellGrading import cornellGrading
4
4
  from .cornellQualtrics import cornellQualtrics
@@ -795,7 +795,7 @@ class cornellGrading:
795
795
 
796
796
  listids = []
797
797
  listemails = []
798
- for el in tmp.json()["result"]["elements"]:
798
+ for el in tmp:
799
799
  listids.append(el["id"])
800
800
  listemails.append(el["email"])
801
801
 
@@ -1157,7 +1157,7 @@ class cornellGrading:
1157
1157
  # won't work if we don't have pandoc
1158
1158
  assert shutil.which("pandoc"), (
1159
1159
  "Cannot locate pandoc. Please visit https://pandoc.org/installing.html"
1160
- "for intallation instructions."
1160
+ "for installation instructions."
1161
1161
  )
1162
1162
 
1163
1163
  # going to assume that the pdf file is located in the working dir with the tex
@@ -1308,7 +1308,8 @@ class cornellGrading:
1308
1308
  imtag = re.search(
1309
1309
  # r'<p>(<img class="equation_image"(.*?)(?={})([\s\S]*?)(?=/></p>)/>)</p>'.format(
1310
1310
  # r'(<img class="equation_image"(.*?)(?={})([\s\S]*?)(?=/>)/>)'.format(
1311
- r'(<img class="equation_image" src="https://canvas.cornell.edu/equation_images/([\w%]*?)(?={})([\s\S]*?)(?=/>)/>)'.format(
1311
+ # r'(<img class="equation_image" src="https://canvas.cornell.edu/equation_images/([\w%]*?)(?={})([\s\S]*?)(?=/>)/>)'.format(
1312
+ r'(<img class="equation_image" src="https://canvas.cornell.edu/equation_images/([\w%.-]*?)(?={})([\s\S]*?)(?=/>)/>)'.format(
1312
1313
  enclabel
1313
1314
  ),
1314
1315
  out,
@@ -1497,7 +1498,7 @@ class cornellGrading:
1497
1498
  """
1498
1499
 
1499
1500
  # create survey and distribution
1500
- surveyname = "%s HW%d Self-Grade" % (self.coursename, assignmentNum)
1501
+ surveyname = "%s HW%d Self-Assessment" % (self.coursename, assignmentNum)
1501
1502
  surveyId = self.genPrivateHWSurvey(
1502
1503
  surveyname, nprobs, ecprobs=ecprobs, scoreOptions=scoreOptions
1503
1504
  )
@@ -1511,7 +1512,7 @@ class cornellGrading:
1511
1512
  distnetids = np.array([d["email"].split("@")[0] for d in dist])
1512
1513
 
1513
1514
  # grab the original assignment and all the submissions
1514
- hwname = "HW%d" % assignmentNum
1515
+ hwname = "Written HW%d" % assignmentNum
1515
1516
  hw = self.getAssignment(hwname)
1516
1517
  subs = hw.get_submissions()
1517
1518
 
@@ -290,8 +290,8 @@ class cornellQualtrics:
290
290
  getMailingListId
291
291
 
292
292
  Returns:
293
- requests.models.Response:
294
- response object with all mailing list contacts
293
+ list:
294
+ list of dicts encoding all mailing list contacts
295
295
 
296
296
  Notes:
297
297
 
@@ -310,7 +310,15 @@ class cornellQualtrics:
310
310
  response.status_code == 200
311
311
  ), "Could not get contacts for list {}.".format(mailingListId)
312
312
 
313
- return response
313
+ out = response.json()["result"]["elements"]
314
+
315
+ while response.json()["result"]["nextPage"] is not None:
316
+ response = requests.get(
317
+ response.json()["result"]["nextPage"], headers=self.headers_tokenOnly
318
+ )
319
+ out += response.json()["result"]["elements"]
320
+
321
+ return out
314
322
 
315
323
  def dumpContacts(self, mailingListId):
316
324
  """Repackage all contacts in a mailing list into a pandas DataFrame
@@ -329,7 +337,7 @@ class cornellQualtrics:
329
337
 
330
338
  """
331
339
 
332
- contacts = self.getListContacts(mailingListId).json()["result"]["elements"]
340
+ contacts = self.getListContacts(mailingListId)
333
341
 
334
342
  fn = []
335
343
  ln = []
@@ -461,7 +469,15 @@ class cornellQualtrics:
461
469
  )
462
470
  response2 = requests.get(baseUrl2, headers=self.headers_tokenOnly)
463
471
 
464
- return response2.json()["result"]["elements"]
472
+ out = response2.json()["result"]["elements"]
473
+
474
+ while response2.json()["result"]["nextPage"] is not None:
475
+ response2 = requests.get(
476
+ response2.json()["result"]["nextPage"], headers=self.headers_tokenOnly
477
+ )
478
+ out += response2.json()["result"]["elements"]
479
+
480
+ return out
465
481
 
466
482
  def getDistributionLinks(self, distributionId, surveyId):
467
483
  """Retrieve distribution info
@@ -643,6 +659,34 @@ class cornellQualtrics:
643
659
 
644
660
  return response.json()["result"]["elements"]
645
661
 
662
+ def getDistribution(self, surveyId, distributionId):
663
+ """Get a distribution
664
+
665
+ Args:
666
+ surveyId (str):
667
+ Unique id string of survey. Get either from web interface or via
668
+ getSurveyId
669
+ distributionId (str):
670
+ Unique id string of distribution.
671
+
672
+ Returns:
673
+ dict:
674
+ Dictionary encoding distribution definition and stats
675
+
676
+ Notes:
677
+ https://api.qualtrics.com/f5b1d8775d803-get-distribution
678
+
679
+ """
680
+
681
+ baseUrl = "https://{0}{1}distributions/{2}?surveyId={3}".format(
682
+ self.dataCenter, self.qualtricsapi, distributionId, surveyId
683
+ )
684
+
685
+ response = requests.get(baseUrl, headers=self.headers_tokenOnly)
686
+ assert response.status_code == 200
687
+
688
+ return response.json()["result"]
689
+
646
690
  def exportSurvey(self, surveyId, fileFormat="csv", useLabels="true", saveDir=None):
647
691
  """Download and extract survey results
648
692
 
@@ -800,31 +844,31 @@ class cornellQualtrics:
800
844
  "userId": sharewith,
801
845
  "permissions": {
802
846
  "surveyDefinitionManipulation": {
803
- "copySurveyQuestions": True,
804
- "editSurveyFlow": True,
805
- "useBlocks": True,
806
- "useSkipLogic": True,
807
- "useConjoint": True,
808
- "useTriggers": True,
809
- "useQuotas": True,
810
- "setSurveyOptions": True,
811
- "editQuestions": True,
812
- "deleteSurveyQuestions": True,
813
- "useTableOfContents": True,
814
- "useAdvancedQuotas": True,
847
+ "copySurveyQuestions": False,
848
+ "editSurveyFlow": False,
849
+ "useBlocks": False,
850
+ "useSkipLogic": False,
851
+ "useConjoint": False,
852
+ "useTriggers": False,
853
+ "useQuotas": False,
854
+ "setSurveyOptions": False,
855
+ "editQuestions": False,
856
+ "deleteSurveyQuestions": False,
857
+ "useTableOfContents": False,
858
+ "useAdvancedQuotas": False,
815
859
  },
816
860
  "surveyManagement": {
817
- "editSurveys": True,
818
- "activateSurveys": True,
819
- "deactivateSurveys": True,
820
- "copySurveys": True,
821
- "distributeSurveys": True,
822
- "deleteSurveys": True,
823
- "translateSurveys": True,
861
+ "editSurveys": False,
862
+ "activateSurveys": False,
863
+ "deactivateSurveys": False,
864
+ "copySurveys": False,
865
+ "distributeSurveys": False,
866
+ "deleteSurveys": False,
867
+ "translateSurveys": False,
824
868
  },
825
869
  "response": {
826
- "editSurveyResponses": True,
827
- "createResponseSets": True,
870
+ "editSurveyResponses": False,
871
+ "createResponseSets": False,
828
872
  "viewResponseId": True,
829
873
  "useCrossTabs": True,
830
874
  "useScreenouts": True,
@@ -975,7 +1019,7 @@ class cornellQualtrics:
975
1019
  return response.json()["result"]
976
1020
 
977
1021
  def updateSurveyOptions(self, surveyId, data):
978
- """Return survey options
1022
+ """Update survey options
979
1023
 
980
1024
  Args:
981
1025
  surveyId (str):
@@ -1183,8 +1227,8 @@ class cornellQualtrics:
1183
1227
  Message ID string
1184
1228
 
1185
1229
  Returns:
1186
- list:
1187
- message dictionaries
1230
+ dict:
1231
+ message contents
1188
1232
 
1189
1233
  """
1190
1234
  baseUrl = "https://{0}{2}libraries/{1}/messages/{3}".format(
@@ -1194,7 +1238,7 @@ class cornellQualtrics:
1194
1238
  response = requests.get(baseUrl, headers=self.headers_tokenOnly)
1195
1239
  assert response.status_code == 200, "Couldn't get messages"
1196
1240
 
1197
- return response.json()["result"]["elements"]
1241
+ return response.json()["result"]
1198
1242
 
1199
1243
  def createLibraryMessage(self, libraryId, subject, msg, category="thankYou"):
1200
1244
  """Create message in a library
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cornellGrading
3
- Version: 2.16.1
3
+ Version: 2.17.0
4
4
  Summary: Routines for interacting with Cornell installations of Canvas and Qualtrics
5
5
  Home-page: https://github.com/dsavransky/grading
6
6
  Author: Dmitry Savransky
File without changes