ladok3 4.10__tar.gz → 4.11__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.11}/PKG-INFO +1 -1
  2. {ladok3-4.10 → ladok3-4.11}/doc/preamble.tex +1 -1
  3. {ladok3-4.10 → ladok3-4.11}/pyproject.toml +1 -1
  4. {ladok3-4.10 → ladok3-4.11}/src/ladok3/cli.nw +23 -9
  5. {ladok3-4.10 → ladok3-4.11}/LICENSE +0 -0
  6. {ladok3-4.10 → ladok3-4.11}/README.md +0 -0
  7. {ladok3-4.10 → ladok3-4.11}/doc/Makefile +0 -0
  8. {ladok3-4.10 → ladok3-4.11}/doc/abstract.tex +0 -0
  9. {ladok3-4.10 → ladok3-4.11}/doc/ladok3.tex +0 -0
  10. {ladok3-4.10 → ladok3-4.11}/makefiles/doc.mk +0 -0
  11. {ladok3-4.10 → ladok3-4.11}/makefiles/exam.mk +0 -0
  12. {ladok3-4.10 → ladok3-4.11}/makefiles/haskell.mk +0 -0
  13. {ladok3-4.10 → ladok3-4.11}/makefiles/miun.course.mk +0 -0
  14. {ladok3-4.10 → ladok3-4.11}/makefiles/miun.depend.mk +0 -0
  15. {ladok3-4.10 → ladok3-4.11}/makefiles/miun.docs.mk +0 -0
  16. {ladok3-4.10 → ladok3-4.11}/makefiles/miun.port.mk +0 -0
  17. {ladok3-4.10 → ladok3-4.11}/makefiles/miun.pub.mk +0 -0
  18. {ladok3-4.10 → ladok3-4.11}/makefiles/noweb.mk +0 -0
  19. {ladok3-4.10 → ladok3-4.11}/makefiles/pkg.mk +0 -0
  20. {ladok3-4.10 → ladok3-4.11}/makefiles/portability.mk +0 -0
  21. {ladok3-4.10 → ladok3-4.11}/makefiles/pub.mk +0 -0
  22. {ladok3-4.10 → ladok3-4.11}/makefiles/results.mk +0 -0
  23. {ladok3-4.10 → ladok3-4.11}/makefiles/subdir.mk +0 -0
  24. {ladok3-4.10 → ladok3-4.11}/makefiles/tex.mk +0 -0
  25. {ladok3-4.10 → ladok3-4.11}/makefiles/transform.mk +0 -0
  26. {ladok3-4.10 → ladok3-4.11}/src/ladok3/.gitignore +0 -0
  27. {ladok3-4.10 → ladok3-4.11}/src/ladok3/Makefile +0 -0
  28. {ladok3-4.10 → ladok3-4.11}/src/ladok3/api.nw +0 -0
  29. {ladok3-4.10 → ladok3-4.11}/src/ladok3/data.nw +0 -0
  30. {ladok3-4.10 → ladok3-4.11}/src/ladok3/ladok3.nw +0 -0
  31. {ladok3-4.10 → ladok3-4.11}/src/ladok3/report.nw +0 -0
  32. {ladok3-4.10 → ladok3-4.11}/src/ladok3/student.nw +0 -0
  33. {ladok3-4.10 → ladok3-4.11}/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.11
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.11"
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
  @
@@ -581,7 +584,10 @@ try:
581
584
 
582
585
  vars = {}
583
586
  for key in vars_keys.split(":"):
584
- vars[key] = os.environ[key]
587
+ try:
588
+ vars[key] = os.environ[key]
589
+ except KeyError:
590
+ <<print warning about missing variable in [[LADOK_VARS]]>>
585
591
 
586
592
  if institution and vars:
587
593
  return institution, vars
@@ -589,6 +595,14 @@ except:
589
595
  pass
590
596
  @
591
597
 
598
+ Unlike in the other cases, we don't just ignore the exception of the key not
599
+ existing.
600
+ Since the user has explicitly specified the variable, we should warn them that
601
+ it doesn't exist.
602
+ <<print warning about missing variable in [[LADOK_VARS]]>>=
603
+ warn(f"Variable {key} not set, ignoring.")
604
+ @
605
+
592
606
  If none of the above worked, the last resort is to try to read the
593
607
  configuration file.
594
608
  We pop the institution from the configuration file (a dictionary), because then
@@ -599,7 +613,7 @@ try:
599
613
  config = json.load(conf_file)
600
614
 
601
615
  institution = config.pop("institution",
602
- "KTH Royal Institute of Technology")
616
+ "KTH Royal Institute of Technology")
603
617
  return institution, config
604
618
  except:
605
619
  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