ladok3 4.10__tar.gz → 4.12__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.

Potentially problematic release.


This version of ladok3 might be problematic. Click here for more details.

Files changed (33) hide show
  1. {ladok3-4.10 → ladok3-4.12}/PKG-INFO +1 -1
  2. {ladok3-4.10 → ladok3-4.12}/doc/preamble.tex +1 -1
  3. {ladok3-4.10 → ladok3-4.12}/pyproject.toml +1 -1
  4. {ladok3-4.10 → ladok3-4.12}/src/ladok3/cli.nw +26 -10
  5. {ladok3-4.10 → ladok3-4.12}/LICENSE +0 -0
  6. {ladok3-4.10 → ladok3-4.12}/README.md +0 -0
  7. {ladok3-4.10 → ladok3-4.12}/doc/Makefile +0 -0
  8. {ladok3-4.10 → ladok3-4.12}/doc/abstract.tex +0 -0
  9. {ladok3-4.10 → ladok3-4.12}/doc/ladok3.tex +0 -0
  10. {ladok3-4.10 → ladok3-4.12}/makefiles/doc.mk +0 -0
  11. {ladok3-4.10 → ladok3-4.12}/makefiles/exam.mk +0 -0
  12. {ladok3-4.10 → ladok3-4.12}/makefiles/haskell.mk +0 -0
  13. {ladok3-4.10 → ladok3-4.12}/makefiles/miun.course.mk +0 -0
  14. {ladok3-4.10 → ladok3-4.12}/makefiles/miun.depend.mk +0 -0
  15. {ladok3-4.10 → ladok3-4.12}/makefiles/miun.docs.mk +0 -0
  16. {ladok3-4.10 → ladok3-4.12}/makefiles/miun.port.mk +0 -0
  17. {ladok3-4.10 → ladok3-4.12}/makefiles/miun.pub.mk +0 -0
  18. {ladok3-4.10 → ladok3-4.12}/makefiles/noweb.mk +0 -0
  19. {ladok3-4.10 → ladok3-4.12}/makefiles/pkg.mk +0 -0
  20. {ladok3-4.10 → ladok3-4.12}/makefiles/portability.mk +0 -0
  21. {ladok3-4.10 → ladok3-4.12}/makefiles/pub.mk +0 -0
  22. {ladok3-4.10 → ladok3-4.12}/makefiles/results.mk +0 -0
  23. {ladok3-4.10 → ladok3-4.12}/makefiles/subdir.mk +0 -0
  24. {ladok3-4.10 → ladok3-4.12}/makefiles/tex.mk +0 -0
  25. {ladok3-4.10 → ladok3-4.12}/makefiles/transform.mk +0 -0
  26. {ladok3-4.10 → ladok3-4.12}/src/ladok3/.gitignore +0 -0
  27. {ladok3-4.10 → ladok3-4.12}/src/ladok3/Makefile +0 -0
  28. {ladok3-4.10 → ladok3-4.12}/src/ladok3/api.nw +0 -0
  29. {ladok3-4.10 → ladok3-4.12}/src/ladok3/data.nw +0 -0
  30. {ladok3-4.10 → ladok3-4.12}/src/ladok3/ladok3.nw +0 -0
  31. {ladok3-4.10 → ladok3-4.12}/src/ladok3/report.nw +0 -0
  32. {ladok3-4.10 → ladok3-4.12}/src/ladok3/student.nw +0 -0
  33. {ladok3-4.10 → ladok3-4.12}/src/ladok3/undoc.nw +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ladok3
3
- Version: 4.10
3
+ Version: 4.12
4
4
  Summary: Python wrapper and CLI for the LADOK3 REST API.
5
5
  Home-page: https://github.com/dbosk/ladok3
6
6
  License: MIT
@@ -13,7 +13,7 @@
13
13
  \renewcommand{\foreignfullfont}{}
14
14
  \renewcommand{\foreignabbrfont}{}
15
15
 
16
- \usepackage{newclude}
16
+ %\usepackage{newclude}
17
17
  \usepackage{import}
18
18
 
19
19
  \usepackage[strict]{csquotes}
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ladok3"
3
- version = "4.10"
3
+ version = "4.12"
4
4
  description = "Python wrapper and CLI for the LADOK3 REST API."
5
5
  authors = [
6
6
  "Daniel Bosk <dbosk@kth.se>",
@@ -522,6 +522,9 @@ def load_credentials(filename="config.json"):
522
522
 
523
523
  First we try the newest format.
524
524
  We try to fetch the institution and vars from the keyring.
525
+
526
+ Note that [[keyring]] returns [[None]] if the key doesn't exist, it doesn't
527
+ raise an exception.
525
528
  <<fetch vars from keyring>>=
526
529
  try:
527
530
  institution = keyring.get_password("ladok3", "institution")
@@ -529,7 +532,9 @@ try:
529
532
 
530
533
  vars = {}
531
534
  for key in vars_keys.split(";"):
532
- vars[key] = keyring.get_password("ladok3", key)
535
+ value = keyring.get_password("ladok3", key)
536
+ if value:
537
+ vars[key] = value
533
538
 
534
539
  if institution and vars:
535
540
  return institution, vars
@@ -542,12 +547,10 @@ supported KTH.
542
547
  <<fetch username and password from keyring>>=
543
548
  try:
544
549
  institution = "KTH Royal Institute of Technology"
545
- vars = {
546
- "username": keyring.get_password("ladok3", "username"),
547
- "password": keyring.get_password("ladok3", "password")
548
- }
549
- if vars:
550
- return institution, vars
550
+ username = keyring.get_password("ladok3", "username")
551
+ password = keyring.get_password("ladok3", "password")
552
+ if username and password:
553
+ return institution, {"username": username, "password": password}
551
554
  except:
552
555
  pass
553
556
  @
@@ -567,7 +570,7 @@ try:
567
570
  "username": os.environ["LADOK_USER"],
568
571
  "password": os.environ["LADOK_PASS"]
569
572
  }
570
- if institution and vars:
573
+ if institution and vars["username"] and vars["password"]:
571
574
  return institution, vars
572
575
  except:
573
576
  pass
@@ -581,7 +584,12 @@ try:
581
584
 
582
585
  vars = {}
583
586
  for key in vars_keys.split(":"):
584
- vars[key] = os.environ[key]
587
+ try:
588
+ value = os.environ[key]
589
+ if value:
590
+ vars[key] = value
591
+ except KeyError:
592
+ <<print warning about missing variable in [[LADOK_VARS]]>>
585
593
 
586
594
  if institution and vars:
587
595
  return institution, vars
@@ -589,6 +597,14 @@ except:
589
597
  pass
590
598
  @
591
599
 
600
+ Unlike in the other cases, we don't just ignore the exception of the key not
601
+ existing.
602
+ Since the user has explicitly specified the variable, we should warn them that
603
+ it doesn't exist.
604
+ <<print warning about missing variable in [[LADOK_VARS]]>>=
605
+ warn(f"Variable {key} not set, ignoring.")
606
+ @
607
+
592
608
  If none of the above worked, the last resort is to try to read the
593
609
  configuration file.
594
610
  We pop the institution from the configuration file (a dictionary), because then
@@ -599,7 +615,7 @@ try:
599
615
  config = json.load(conf_file)
600
616
 
601
617
  institution = config.pop("institution",
602
- "KTH Royal Institute of Technology")
618
+ "KTH Royal Institute of Technology")
603
619
  return institution, config
604
620
  except:
605
621
  pass
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes