Marco Ricci commited on 2025-01-19 23:56:09
Zeige 1 geänderte Dateien mit 391 Einfügungen und 150 Löschungen.
Also rename the `_Commented` pseudo-decorator function to `commented`, and the `_TranslatedStringConstructor` protocol (a typo) to `TranslatableStringConstructor`.
... | ... |
@@ -2,7 +2,18 @@ |
2 | 2 |
# |
3 | 3 |
# SPDX-Licence-Identifier: MIT |
4 | 4 |
|
5 |
-"""Internal module. Do not use. Contains error strings and functions.""" |
|
5 |
+"""Messages for the command-line interface of `derivepassphrase`. |
|
6 |
+ |
|
7 |
+Also contains some machinery related to internationalization and |
|
8 |
+localization. |
|
9 |
+ |
|
10 |
+!!! warning |
|
11 |
+ |
|
12 |
+ Non-public module (implementation detail), provided for didactical and |
|
13 |
+ educational purposes only. Subject to change without notice, including |
|
14 |
+ removal. |
|
15 |
+ |
|
16 |
+""" |
|
6 | 17 |
|
7 | 18 |
from __future__ import annotations |
8 | 19 |
|
... | ... |
@@ -209,11 +220,36 @@ class DebugTranslations(gettext.NullTranslations): |
209 | 220 |
|
210 | 221 |
|
211 | 222 |
class TranslatableString(NamedTuple): |
223 |
+ """Translatable string as used by the `derivepassphrase` command-line. |
|
224 |
+ |
|
225 |
+ For typing purposes. |
|
226 |
+ |
|
227 |
+ Attributes: |
|
228 |
+ l10n_context: |
|
229 |
+ The localization context, as per [`gettext`][]. Used to |
|
230 |
+ disambiguate different uses of the same translatable string. |
|
231 |
+ singular: |
|
232 |
+ The translatable message, base case. |
|
233 |
+ plural: |
|
234 |
+ The translatable message, plural case. Usually unset. |
|
235 |
+ translator_comments: |
|
236 |
+ Explicit commentary for the translator. |
|
237 |
+ flags: |
|
238 |
+ `.mo` file flags for this message, e.g. to indicate the |
|
239 |
+ string formatting style in use. |
|
240 |
+ |
|
241 |
+ """ |
|
242 |
+ |
|
212 | 243 |
l10n_context: str |
244 |
+ """""" |
|
213 | 245 |
singular: str |
246 |
+ """""" |
|
214 | 247 |
plural: str = '' |
248 |
+ """""" |
|
215 | 249 |
flags: frozenset[str] = frozenset() |
250 |
+ """""" |
|
216 | 251 |
translator_comments: str = '' |
252 |
+ """""" |
|
217 | 253 |
|
218 | 254 |
def fields(self) -> list[str]: |
219 | 255 |
"""Return the replacement fields this template requires. |
... | ... |
@@ -404,7 +440,8 @@ def translatable( |
404 | 440 |
"""Return a [`TranslatableString`][] with validated parts. |
405 | 441 |
|
406 | 442 |
This factory function is really only there to make the enum |
407 |
- definitions more readable. |
|
443 |
+ definitions more readable. It is the main implementation of the |
|
444 |
+ [`TranslatableStringConstructor`][]. |
|
408 | 445 |
|
409 | 446 |
""" |
410 | 447 |
flags = ( |
... | ... |
@@ -419,6 +456,13 @@ def translatable( |
419 | 456 |
|
420 | 457 |
|
421 | 458 |
class TranslatedString: |
459 |
+ """A string object that stringifies to its translation. |
|
460 |
+ |
|
461 |
+ The translation and replacement value rendering is only performed |
|
462 |
+ when this string object is actually stringified. |
|
463 |
+ |
|
464 |
+ """ |
|
465 |
+ |
|
422 | 466 |
def __init__( |
423 | 467 |
self, |
424 | 468 |
template: str | TranslatableString | MsgTemplate, |
... | ... |
@@ -426,6 +470,21 @@ class TranslatedString: |
426 | 470 |
/, |
427 | 471 |
**kwargs: Any, # noqa: ANN401 |
428 | 472 |
) -> None: |
473 |
+ """Initializer. |
|
474 |
+ |
|
475 |
+ Args: |
|
476 |
+ template: |
|
477 |
+ A template string, suitable for [`str.format`][]. If |
|
478 |
+ a string, use it directly. If |
|
479 |
+ a [`TranslatableString`][], or a known enum value whose |
|
480 |
+ value is a `TranslatableString`, then use that string's |
|
481 |
+ "singular" entry. |
|
482 |
+ args_dict: |
|
483 |
+ Keyword arguments to be passed to [`str.format`][]. |
|
484 |
+ kwargs: |
|
485 |
+ More keyword arguments to be passed to [`str.format`][]. |
|
486 |
+ |
|
487 |
+ """ |
|
429 | 488 |
if isinstance(template, MSG_TEMPLATE_CLASSES): |
430 | 489 |
template = cast('TranslatableString', template.value) |
431 | 490 |
self.template = template |
... | ... |
@@ -433,12 +492,15 @@ class TranslatedString: |
433 | 492 |
self._rendered: str | None = None |
434 | 493 |
|
435 | 494 |
def __bool__(self) -> bool: |
495 |
+ """Return true if the rendered string is truthy.""" |
|
436 | 496 |
return bool(str(self)) |
437 | 497 |
|
438 | 498 |
def __eq__(self, other: object) -> bool: # pragma: no cover |
499 |
+ """Return true if the rendered string is equal to `other`.""" |
|
439 | 500 |
return str(self) == other |
440 | 501 |
|
441 | 502 |
def __hash__(self) -> int: # pragma: no cover |
503 |
+ """Return the hash of the rendered string.""" |
|
442 | 504 |
return hash(str(self)) |
443 | 505 |
|
444 | 506 |
def __repr__(self) -> str: # pragma: no cover |
... | ... |
@@ -448,6 +510,13 @@ class TranslatedString: |
448 | 510 |
) |
449 | 511 |
|
450 | 512 |
def __str__(self) -> str: |
513 |
+ """Return the rendered translation of this string. |
|
514 |
+ |
|
515 |
+ First, look up the translation of the string's template. Then |
|
516 |
+ fill in the replacement fields. Cache the result for future |
|
517 |
+ calls. |
|
518 |
+ |
|
519 |
+ """ |
|
451 | 520 |
if self._rendered is None: |
452 | 521 |
do_escape = False |
453 | 522 |
if isinstance(self.template, str): |
... | ... |
@@ -504,7 +573,9 @@ class TranslatedString: |
504 | 573 |
return self |
505 | 574 |
|
506 | 575 |
|
507 |
-class _TranslatedStringConstructor(Protocol): |
|
576 |
+class TranslatableStringConstructor(Protocol): |
|
577 |
+ """Construct a [`TranslatableString`][].""" |
|
578 |
+ |
|
508 | 579 |
def __call__( |
509 | 580 |
self, |
510 | 581 |
context: str, |
... | ... |
@@ -513,27 +584,45 @@ class _TranslatedStringConstructor(Protocol): |
513 | 584 |
flags: Iterable[str] = (), |
514 | 585 |
plural: str = '', |
515 | 586 |
comments: str = '', |
516 |
- ) -> TranslatableString: ... |
|
587 |
+ ) -> TranslatableString: |
|
588 |
+ """Return a [`TranslatableString`][] from these parts. |
|
589 |
+ |
|
590 |
+ Usually some form of validation or normalization is performed |
|
591 |
+ first on these parts. |
|
517 | 592 |
|
593 |
+ The main implementation of this is in [`translatable`][]. |
|
518 | 594 |
|
519 |
-def _Commented(comments: str = '', /) -> _TranslatedStringConstructor: # noqa: N802 |
|
595 |
+ """ |
|
596 |
+ |
|
597 |
+ |
|
598 |
+def commented(comments: str = '', /) -> TranslatableStringConstructor: |
|
520 | 599 |
"""A "decorator" for readably constructing commented enum values. |
521 | 600 |
|
601 |
+ Returns a partial application of [`translatable`][] with the `comments` |
|
602 |
+ argument pre-filled. |
|
603 |
+ |
|
522 | 604 |
This is geared towards the quirks of the API documentation extractor |
523 | 605 |
`mkdocstrings-python`/`griffe`, which reformat and trim enum value |
524 |
- declarations in somewhat weird ways. Chains of function calls are |
|
525 |
- preserved, though, so use this to our advantage to suggest |
|
606 |
+ declarations in predictable but somewhat weird ways. Chains of function |
|
607 |
+ calls are preserved, though, so use this to our advantage to suggest |
|
526 | 608 |
a specific formatting. |
527 | 609 |
|
528 |
- This is not necessarily good code style, and it is |
|
529 |
- (quasi-)unnecessarily heavyweight. |
|
610 |
+ This is not necessarily good code style, nor is it a lightweight |
|
611 |
+ solution. |
|
530 | 612 |
|
531 | 613 |
""" # noqa: DOC201 |
532 | 614 |
return functools.partial(translatable, comments=comments) |
533 | 615 |
|
534 | 616 |
|
535 | 617 |
class Label(enum.Enum): |
536 |
- DEPRECATION_WARNING_LABEL = _Commented( |
|
618 |
+ """Labels for the `derivepassphrase` command-line. |
|
619 |
+ |
|
620 |
+ Includes help text (long-form and short-form), help metavar names, |
|
621 |
+ diagnostic labels and interactive prompts. |
|
622 |
+ |
|
623 |
+ """ |
|
624 |
+ |
|
625 |
+ DEPRECATION_WARNING_LABEL = commented( |
|
537 | 626 |
'This is a short label that will be prepended to ' |
538 | 627 |
'a warning message, e.g., "Deprecation warning: A subcommand ' |
539 | 628 |
'will be required in v1.0."', |
... | ... |
@@ -541,7 +630,8 @@ class Label(enum.Enum): |
541 | 630 |
'Label :: Diagnostics :: Marker', |
542 | 631 |
'Deprecation warning', |
543 | 632 |
) |
544 |
- WARNING_LABEL = _Commented( |
|
633 |
+ """""" |
|
634 |
+ WARNING_LABEL = commented( |
|
545 | 635 |
'This is a short label that will be prepended to ' |
546 | 636 |
'a warning message, e.g., "Warning: An empty service name ' |
547 | 637 |
'is not supported by vault(1)."', |
... | ... |
@@ -549,7 +639,8 @@ class Label(enum.Enum): |
549 | 639 |
'Label :: Diagnostics :: Marker', |
550 | 640 |
'Warning', |
551 | 641 |
) |
552 |
- CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_GLOBAL = _Commented( |
|
642 |
+ """""" |
|
643 |
+ CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_GLOBAL = commented( |
|
553 | 644 |
'This is one of two values of the settings_type metavar ' |
554 | 645 |
'used in the CANNOT_UPDATE_SETTINGS_NO_SETTINGS entry. ' |
555 | 646 |
'It is only used there. ' |
... | ... |
@@ -559,7 +650,8 @@ class Label(enum.Enum): |
559 | 650 |
'Label :: Error message :: Metavar', |
560 | 651 |
'global settings', |
561 | 652 |
) |
562 |
- CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_SERVICE = _Commented( |
|
653 |
+ """""" |
|
654 |
+ CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_SERVICE = commented( |
|
563 | 655 |
'This is one of two values of the settings_type metavar ' |
564 | 656 |
'used in the CANNOT_UPDATE_SETTINGS_NO_SETTINGS entry. ' |
565 | 657 |
'It is only used there. ' |
... | ... |
@@ -570,7 +662,8 @@ class Label(enum.Enum): |
570 | 662 |
'Label :: Error message :: Metavar', |
571 | 663 |
'service-specific settings', |
572 | 664 |
) |
573 |
- DERIVEPASSPHRASE_01 = _Commented( |
|
665 |
+ """""" |
|
666 |
+ DERIVEPASSPHRASE_01 = commented( |
|
574 | 667 |
'This is the first paragraph of the command help text, ' |
575 | 668 |
'but it also appears (in truncated form, if necessary) ' |
576 | 669 |
'as one-line help text for this command. ' |
... | ... |
@@ -580,7 +673,8 @@ class Label(enum.Enum): |
580 | 673 |
'Label :: Help text :: Explanation', |
581 | 674 |
'Derive a strong passphrase, deterministically, from a master secret.', |
582 | 675 |
) |
583 |
- DERIVEPASSPHRASE_02 = _Commented( |
|
676 |
+ """""" |
|
677 |
+ DERIVEPASSPHRASE_02 = commented( |
|
584 | 678 |
'', |
585 | 679 |
)( |
586 | 680 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -590,14 +684,16 @@ class Label(enum.Enum): |
590 | 684 |
'See the respective `--help` output for instructions. ' |
591 | 685 |
'If no subcommand is given, we default to "vault".', |
592 | 686 |
) |
593 |
- DERIVEPASSPHRASE_03 = _Commented( |
|
687 |
+ """""" |
|
688 |
+ DERIVEPASSPHRASE_03 = commented( |
|
594 | 689 |
'', |
595 | 690 |
)( |
596 | 691 |
'Label :: Help text :: Explanation', |
597 | 692 |
'Deprecation notice: Defaulting to "vault" is deprecated. ' |
598 | 693 |
'Starting in v1.0, the subcommand must be specified explicitly.', |
599 | 694 |
) |
600 |
- DERIVEPASSPHRASE_EPILOG_01 = _Commented( |
|
695 |
+ """""" |
|
696 |
+ DERIVEPASSPHRASE_EPILOG_01 = commented( |
|
601 | 697 |
'', |
602 | 698 |
)( |
603 | 699 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -606,7 +702,8 @@ class Label(enum.Enum): |
606 | 702 |
'`~/.derivepassphrase` on UNIX-like systems and ' |
607 | 703 |
r'`C:\Users\<user>\AppData\Roaming\Derivepassphrase` on Windows.', |
608 | 704 |
) |
609 |
- DERIVEPASSPHRASE_EXPORT_01 = _Commented( |
|
705 |
+ """""" |
|
706 |
+ DERIVEPASSPHRASE_EXPORT_01 = commented( |
|
610 | 707 |
'This is the first paragraph of the command help text, ' |
611 | 708 |
'but it also appears (in truncated form, if necessary) ' |
612 | 709 |
'as one-line help text for this command. ' |
... | ... |
@@ -616,7 +713,8 @@ class Label(enum.Enum): |
616 | 713 |
'Label :: Help text :: Explanation', |
617 | 714 |
'Export a foreign configuration to standard output.', |
618 | 715 |
) |
619 |
- DERIVEPASSPHRASE_EXPORT_02 = _Commented( |
|
716 |
+ """""" |
|
717 |
+ DERIVEPASSPHRASE_EXPORT_02 = commented( |
|
620 | 718 |
'', |
621 | 719 |
)( |
622 | 720 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -624,8 +722,10 @@ class Label(enum.Enum): |
624 | 722 |
'which implements the vault-native configuration scheme. ' |
625 | 723 |
'If no subcommand is given, we default to "vault".', |
626 | 724 |
) |
725 |
+ """""" |
|
627 | 726 |
DERIVEPASSPHRASE_EXPORT_03 = DERIVEPASSPHRASE_03 |
628 |
- DERIVEPASSPHRASE_EXPORT_VAULT_01 = _Commented( |
|
727 |
+ """""" |
|
728 |
+ DERIVEPASSPHRASE_EXPORT_VAULT_01 = commented( |
|
629 | 729 |
'This is the first paragraph of the command help text, ' |
630 | 730 |
'but it also appears (in truncated form, if necessary) ' |
631 | 731 |
'as one-line help text for this command. ' |
... | ... |
@@ -635,7 +735,8 @@ class Label(enum.Enum): |
635 | 735 |
'Label :: Help text :: Explanation', |
636 | 736 |
'Export a vault-native configuration to standard output.', |
637 | 737 |
) |
638 |
- DERIVEPASSPHRASE_EXPORT_VAULT_02 = _Commented( |
|
738 |
+ """""" |
|
739 |
+ DERIVEPASSPHRASE_EXPORT_VAULT_02 = commented( |
|
639 | 740 |
'', |
640 | 741 |
)( |
641 | 742 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -644,7 +745,8 @@ class Label(enum.Enum): |
644 | 745 |
'We support the vault "v0.2", "v0.3" and "storeroom" formats.', |
645 | 746 |
flags='python-brace-format', |
646 | 747 |
) |
647 |
- DERIVEPASSPHRASE_EXPORT_VAULT_03 = _Commented( |
|
748 |
+ """""" |
|
749 |
+ DERIVEPASSPHRASE_EXPORT_VAULT_03 = commented( |
|
648 | 750 |
'', |
649 | 751 |
)( |
650 | 752 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -655,7 +757,8 @@ class Label(enum.Enum): |
655 | 757 |
'actually named `VAULT_PATH`.)', |
656 | 758 |
flags='python-brace-format', |
657 | 759 |
) |
658 |
- DERIVEPASSPHRASE_VAULT_01 = _Commented( |
|
760 |
+ """""" |
|
761 |
+ DERIVEPASSPHRASE_VAULT_01 = commented( |
|
659 | 762 |
'This is the first paragraph of the command help text, ' |
660 | 763 |
'but it also appears (in truncated form, if necessary) ' |
661 | 764 |
'as one-line help text for this command. ' |
... | ... |
@@ -665,7 +768,8 @@ class Label(enum.Enum): |
665 | 768 |
'Label :: Help text :: Explanation', |
666 | 769 |
'Derive a passphrase using the vault derivation scheme.', |
667 | 770 |
) |
668 |
- DERIVEPASSPHRASE_VAULT_02 = _Commented( |
|
771 |
+ """""" |
|
772 |
+ DERIVEPASSPHRASE_VAULT_02 = commented( |
|
669 | 773 |
'', |
670 | 774 |
)( |
671 | 775 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -674,7 +778,8 @@ class Label(enum.Enum): |
674 | 778 |
'Otherwise it is required.', |
675 | 779 |
flags='python-brace-format', |
676 | 780 |
) |
677 |
- DERIVEPASSPHRASE_VAULT_EPILOG_01 = _Commented( |
|
781 |
+ """""" |
|
782 |
+ DERIVEPASSPHRASE_VAULT_EPILOG_01 = commented( |
|
678 | 783 |
'', |
679 | 784 |
)( |
680 | 785 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -685,14 +790,16 @@ class Label(enum.Enum): |
685 | 790 |
'You are STRONGLY advised to keep independent backups of ' |
686 | 791 |
'the settings and the SSH key, if any.', |
687 | 792 |
) |
688 |
- DERIVEPASSPHRASE_VAULT_EPILOG_02 = _Commented( |
|
793 |
+ """""" |
|
794 |
+ DERIVEPASSPHRASE_VAULT_EPILOG_02 = commented( |
|
689 | 795 |
'', |
690 | 796 |
)( |
691 | 797 |
'Label :: Help text :: Explanation', |
692 | 798 |
'The configuration is NOT encrypted, and you are ' |
693 | 799 |
'STRONGLY discouraged from using a stored passphrase.', |
694 | 800 |
) |
695 |
- DEPRECATED_COMMAND_LABEL = _Commented( |
|
801 |
+ """""" |
|
802 |
+ DEPRECATED_COMMAND_LABEL = commented( |
|
696 | 803 |
'We use this format string to indicate, at the beginning ' |
697 | 804 |
"of a command's help text, that this command is deprecated.", |
698 | 805 |
)( |
... | ... |
@@ -700,13 +807,15 @@ class Label(enum.Enum): |
700 | 807 |
'(Deprecated) {text}', |
701 | 808 |
flags='python-brace-format', |
702 | 809 |
) |
703 |
- DEBUG_OPTION_HELP_TEXT = _Commented( |
|
810 |
+ """""" |
|
811 |
+ DEBUG_OPTION_HELP_TEXT = commented( |
|
704 | 812 |
'', |
705 | 813 |
)( |
706 | 814 |
'Label :: Help text :: One-line description', |
707 | 815 |
'also emit debug information (implies --verbose)', |
708 | 816 |
) |
709 |
- EXPORT_VAULT_FORMAT_HELP_TEXT = _Commented( |
|
817 |
+ """""" |
|
818 |
+ EXPORT_VAULT_FORMAT_HELP_TEXT = commented( |
|
710 | 819 |
'The defaults_hint is Label.EXPORT_VAULT_FORMAT_DEFAULTS_HELP_TEXT, ' |
711 | 820 |
'the metavar is Label.EXPORT_VAULT_FORMAT_METAVAR_FMT.', |
712 | 821 |
)( |
... | ... |
@@ -716,7 +825,8 @@ class Label(enum.Enum): |
716 | 825 |
'formats will be tried in order {defaults_hint!s}', |
717 | 826 |
flags='python-brace-format', |
718 | 827 |
) |
719 |
- EXPORT_VAULT_FORMAT_DEFAULTS_HELP_TEXT = _Commented( |
|
828 |
+ """""" |
|
829 |
+ EXPORT_VAULT_FORMAT_DEFAULTS_HELP_TEXT = commented( |
|
720 | 830 |
'See EXPORT_VAULT_FORMAT_HELP_TEXT. ' |
721 | 831 |
'The format names/labels "v0.3", "v0.2" and "storeroom" ' |
722 | 832 |
'should not be translated.', |
... | ... |
@@ -724,7 +834,8 @@ class Label(enum.Enum): |
724 | 834 |
'Label :: Help text :: One-line description', |
725 | 835 |
'(default: v0.3, v0.2, storeroom)', |
726 | 836 |
) |
727 |
- EXPORT_VAULT_KEY_HELP_TEXT = _Commented( |
|
837 |
+ """""" |
|
838 |
+ EXPORT_VAULT_KEY_HELP_TEXT = commented( |
|
728 | 839 |
'The defaults_hint is Label.EXPORT_VAULT_KEY_DEFAULTS_HELP_TEXT, ' |
729 | 840 |
'the metavar is Label.EXPORT_VAULT_KEY_METAVAR_K.', |
730 | 841 |
)( |
... | ... |
@@ -732,155 +843,178 @@ class Label(enum.Enum): |
732 | 843 |
'use {metavar!s} as the storage master key {defaults_hint!s}', |
733 | 844 |
flags='python-brace-format', |
734 | 845 |
) |
735 |
- EXPORT_VAULT_KEY_DEFAULTS_HELP_TEXT = _Commented( |
|
846 |
+ """""" |
|
847 |
+ EXPORT_VAULT_KEY_DEFAULTS_HELP_TEXT = commented( |
|
736 | 848 |
'See EXPORT_VAULT_KEY_HELP_TEXT.', |
737 | 849 |
)( |
738 | 850 |
'Label :: Help text :: One-line description', |
739 | 851 |
'(default: check the `VAULT_KEY`, `LOGNAME`, `USER`, or ' |
740 | 852 |
'`USERNAME` environment variables)', |
741 | 853 |
) |
742 |
- HELP_OPTION_HELP_TEXT = _Commented( |
|
854 |
+ """""" |
|
855 |
+ HELP_OPTION_HELP_TEXT = commented( |
|
743 | 856 |
'', |
744 | 857 |
)( |
745 | 858 |
'Label :: Help text :: One-line description', |
746 | 859 |
'show this help text, then exit', |
747 | 860 |
) |
748 |
- QUIET_OPTION_HELP_TEXT = _Commented( |
|
861 |
+ """""" |
|
862 |
+ QUIET_OPTION_HELP_TEXT = commented( |
|
749 | 863 |
'', |
750 | 864 |
)( |
751 | 865 |
'Label :: Help text :: One-line description', |
752 | 866 |
'suppress even warnings, emit only errors', |
753 | 867 |
) |
754 |
- VERBOSE_OPTION_HELP_TEXT = _Commented( |
|
868 |
+ """""" |
|
869 |
+ VERBOSE_OPTION_HELP_TEXT = commented( |
|
755 | 870 |
'', |
756 | 871 |
)( |
757 | 872 |
'Label :: Help text :: One-line description', |
758 | 873 |
'emit extra/progress information to standard error', |
759 | 874 |
) |
760 |
- VERSION_OPTION_HELP_TEXT = _Commented( |
|
875 |
+ """""" |
|
876 |
+ VERSION_OPTION_HELP_TEXT = commented( |
|
761 | 877 |
'', |
762 | 878 |
)( |
763 | 879 |
'Label :: Help text :: One-line description', |
764 | 880 |
'show applicable version information, then exit', |
765 | 881 |
) |
882 |
+ """""" |
|
766 | 883 |
|
767 |
- DERIVEPASSPHRASE_VAULT_PHRASE_HELP_TEXT = _Commented( |
|
884 |
+ DERIVEPASSPHRASE_VAULT_PHRASE_HELP_TEXT = commented( |
|
768 | 885 |
'', |
769 | 886 |
)( |
770 | 887 |
'Label :: Help text :: One-line description', |
771 | 888 |
'prompt for a master passphrase', |
772 | 889 |
) |
773 |
- DERIVEPASSPHRASE_VAULT_KEY_HELP_TEXT = _Commented( |
|
890 |
+ """""" |
|
891 |
+ DERIVEPASSPHRASE_VAULT_KEY_HELP_TEXT = commented( |
|
774 | 892 |
'', |
775 | 893 |
)( |
776 | 894 |
'Label :: Help text :: One-line description', |
777 | 895 |
'select a suitable SSH key from the SSH agent', |
778 | 896 |
) |
779 |
- DERIVEPASSPHRASE_VAULT_LENGTH_HELP_TEXT = _Commented( |
|
897 |
+ """""" |
|
898 |
+ DERIVEPASSPHRASE_VAULT_LENGTH_HELP_TEXT = commented( |
|
780 | 899 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
781 | 900 |
)( |
782 | 901 |
'Label :: Help text :: One-line description', |
783 | 902 |
'ensure a passphrase length of {metavar!s} characters', |
784 | 903 |
flags='python-brace-format', |
785 | 904 |
) |
786 |
- DERIVEPASSPHRASE_VAULT_REPEAT_HELP_TEXT = _Commented( |
|
905 |
+ """""" |
|
906 |
+ DERIVEPASSPHRASE_VAULT_REPEAT_HELP_TEXT = commented( |
|
787 | 907 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
788 | 908 |
)( |
789 | 909 |
'Label :: Help text :: One-line description', |
790 | 910 |
'forbid any run of {metavar!s} identical characters', |
791 | 911 |
flags='python-brace-format', |
792 | 912 |
) |
793 |
- DERIVEPASSPHRASE_VAULT_LOWER_HELP_TEXT = _Commented( |
|
913 |
+ """""" |
|
914 |
+ DERIVEPASSPHRASE_VAULT_LOWER_HELP_TEXT = commented( |
|
794 | 915 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
795 | 916 |
)( |
796 | 917 |
'Label :: Help text :: One-line description', |
797 | 918 |
'ensure at least {metavar!s} lowercase characters', |
798 | 919 |
flags='python-brace-format', |
799 | 920 |
) |
800 |
- DERIVEPASSPHRASE_VAULT_UPPER_HELP_TEXT = _Commented( |
|
921 |
+ """""" |
|
922 |
+ DERIVEPASSPHRASE_VAULT_UPPER_HELP_TEXT = commented( |
|
801 | 923 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
802 | 924 |
)( |
803 | 925 |
'Label :: Help text :: One-line description', |
804 | 926 |
'ensure at least {metavar!s} uppercase characters', |
805 | 927 |
flags='python-brace-format', |
806 | 928 |
) |
807 |
- DERIVEPASSPHRASE_VAULT_NUMBER_HELP_TEXT = _Commented( |
|
929 |
+ """""" |
|
930 |
+ DERIVEPASSPHRASE_VAULT_NUMBER_HELP_TEXT = commented( |
|
808 | 931 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
809 | 932 |
)( |
810 | 933 |
'Label :: Help text :: One-line description', |
811 | 934 |
'ensure at least {metavar!s} digits', |
812 | 935 |
flags='python-brace-format', |
813 | 936 |
) |
814 |
- DERIVEPASSPHRASE_VAULT_SPACE_HELP_TEXT = _Commented( |
|
937 |
+ """""" |
|
938 |
+ DERIVEPASSPHRASE_VAULT_SPACE_HELP_TEXT = commented( |
|
815 | 939 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
816 | 940 |
)( |
817 | 941 |
'Label :: Help text :: One-line description', |
818 | 942 |
'ensure at least {metavar!s} spaces', |
819 | 943 |
flags='python-brace-format', |
820 | 944 |
) |
821 |
- DERIVEPASSPHRASE_VAULT_DASH_HELP_TEXT = _Commented( |
|
945 |
+ """""" |
|
946 |
+ DERIVEPASSPHRASE_VAULT_DASH_HELP_TEXT = commented( |
|
822 | 947 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
823 | 948 |
)( |
824 | 949 |
'Label :: Help text :: One-line description', |
825 | 950 |
'ensure at least {metavar!s} "-" or "_" characters', |
826 | 951 |
flags='python-brace-format', |
827 | 952 |
) |
828 |
- DERIVEPASSPHRASE_VAULT_SYMBOL_HELP_TEXT = _Commented( |
|
953 |
+ """""" |
|
954 |
+ DERIVEPASSPHRASE_VAULT_SYMBOL_HELP_TEXT = commented( |
|
829 | 955 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
830 | 956 |
)( |
831 | 957 |
'Label :: Help text :: One-line description', |
832 | 958 |
'ensure at least {metavar!s} symbol characters', |
833 | 959 |
flags='python-brace-format', |
834 | 960 |
) |
961 |
+ """""" |
|
835 | 962 |
|
836 |
- DERIVEPASSPHRASE_VAULT_NOTES_HELP_TEXT = _Commented( |
|
963 |
+ DERIVEPASSPHRASE_VAULT_NOTES_HELP_TEXT = commented( |
|
837 | 964 |
'', |
838 | 965 |
)( |
839 | 966 |
'Label :: Help text :: One-line description', |
840 | 967 |
'spawn an editor to edit notes for {service_metavar!s}', |
841 | 968 |
flags='python-brace-format', |
842 | 969 |
) |
843 |
- DERIVEPASSPHRASE_VAULT_CONFIG_HELP_TEXT = _Commented( |
|
970 |
+ """""" |
|
971 |
+ DERIVEPASSPHRASE_VAULT_CONFIG_HELP_TEXT = commented( |
|
844 | 972 |
'', |
845 | 973 |
)( |
846 | 974 |
'Label :: Help text :: One-line description', |
847 | 975 |
'save the given settings for {service_metavar!s}, or global', |
848 | 976 |
flags='python-brace-format', |
849 | 977 |
) |
850 |
- DERIVEPASSPHRASE_VAULT_DELETE_HELP_TEXT = _Commented( |
|
978 |
+ """""" |
|
979 |
+ DERIVEPASSPHRASE_VAULT_DELETE_HELP_TEXT = commented( |
|
851 | 980 |
'', |
852 | 981 |
)( |
853 | 982 |
'Label :: Help text :: One-line description', |
854 | 983 |
'delete the settings for {service_metavar!s}', |
855 | 984 |
flags='python-brace-format', |
856 | 985 |
) |
857 |
- DERIVEPASSPHRASE_VAULT_DELETE_GLOBALS_HELP_TEXT = _Commented( |
|
986 |
+ """""" |
|
987 |
+ DERIVEPASSPHRASE_VAULT_DELETE_GLOBALS_HELP_TEXT = commented( |
|
858 | 988 |
'', |
859 | 989 |
)( |
860 | 990 |
'Label :: Help text :: One-line description', |
861 | 991 |
'delete the global settings', |
862 | 992 |
) |
863 |
- DERIVEPASSPHRASE_VAULT_DELETE_ALL_HELP_TEXT = _Commented( |
|
993 |
+ """""" |
|
994 |
+ DERIVEPASSPHRASE_VAULT_DELETE_ALL_HELP_TEXT = commented( |
|
864 | 995 |
'', |
865 | 996 |
)( |
866 | 997 |
'Label :: Help text :: One-line description', |
867 | 998 |
'delete all settings', |
868 | 999 |
) |
869 |
- DERIVEPASSPHRASE_VAULT_EXPORT_HELP_TEXT = _Commented( |
|
1000 |
+ """""" |
|
1001 |
+ DERIVEPASSPHRASE_VAULT_EXPORT_HELP_TEXT = commented( |
|
870 | 1002 |
'The metavar is Label.STORAGE_MANAGEMENT_METAVAR_SERVICE.', |
871 | 1003 |
)( |
872 | 1004 |
'Label :: Help text :: One-line description', |
873 | 1005 |
'export all saved settings to {metavar!s}', |
874 | 1006 |
flags='python-brace-format', |
875 | 1007 |
) |
876 |
- DERIVEPASSPHRASE_VAULT_IMPORT_HELP_TEXT = _Commented( |
|
1008 |
+ """""" |
|
1009 |
+ DERIVEPASSPHRASE_VAULT_IMPORT_HELP_TEXT = commented( |
|
877 | 1010 |
'The metavar is Label.STORAGE_MANAGEMENT_METAVAR_SERVICE.', |
878 | 1011 |
)( |
879 | 1012 |
'Label :: Help text :: One-line description', |
880 | 1013 |
'import saved settings from {metavar!s}', |
881 | 1014 |
flags='python-brace-format', |
882 | 1015 |
) |
883 |
- DERIVEPASSPHRASE_VAULT_OVERWRITE_HELP_TEXT = _Commented( |
|
1016 |
+ """""" |
|
1017 |
+ DERIVEPASSPHRASE_VAULT_OVERWRITE_HELP_TEXT = commented( |
|
884 | 1018 |
'The corresponding option is displayed as ' |
885 | 1019 |
'"--overwrite-existing / --merge-existing", so you may want to ' |
886 | 1020 |
'hint that the default (merge) is the second of those options.', |
... | ... |
@@ -888,7 +1022,8 @@ class Label(enum.Enum): |
888 | 1022 |
'Label :: Help text :: One-line description', |
889 | 1023 |
'overwrite or merge (default) the existing configuration', |
890 | 1024 |
) |
891 |
- DERIVEPASSPHRASE_VAULT_UNSET_HELP_TEXT = _Commented( |
|
1025 |
+ """""" |
|
1026 |
+ DERIVEPASSPHRASE_VAULT_UNSET_HELP_TEXT = commented( |
|
892 | 1027 |
'The corresponding option is displayed as ' |
893 | 1028 |
'"--unset=phrase|key|...|symbol", so the "given setting" is ' |
894 | 1029 |
'referring to "phrase", "key", "lower", ..., or "symbol", ' |
... | ... |
@@ -900,7 +1035,8 @@ class Label(enum.Enum): |
900 | 1035 |
'with --config, also unsets the given setting; ' |
901 | 1036 |
'may be specified multiple times', |
902 | 1037 |
) |
903 |
- DERIVEPASSPHRASE_VAULT_EXPORT_AS_HELP_TEXT = _Commented( |
|
1038 |
+ """""" |
|
1039 |
+ DERIVEPASSPHRASE_VAULT_EXPORT_AS_HELP_TEXT = commented( |
|
904 | 1040 |
'The corresponding option is displayed as ' |
905 | 1041 |
'"--export-as=json|sh", so json refers to the JSON format (default) ' |
906 | 1042 |
'and sh refers to the POSIX sh format.', |
... | ... |
@@ -908,58 +1044,67 @@ class Label(enum.Enum): |
908 | 1044 |
'Label :: Help text :: One-line description', |
909 | 1045 |
'when exporting, export as JSON (default) or POSIX sh', |
910 | 1046 |
) |
1047 |
+ """""" |
|
911 | 1048 |
|
912 |
- EXPORT_VAULT_FORMAT_METAVAR_FMT = _Commented( |
|
1049 |
+ EXPORT_VAULT_FORMAT_METAVAR_FMT = commented( |
|
913 | 1050 |
'', |
914 | 1051 |
)( |
915 | 1052 |
'Label :: Help text :: Metavar :: export vault', |
916 | 1053 |
'FMT', |
917 | 1054 |
) |
918 |
- EXPORT_VAULT_KEY_METAVAR_K = _Commented( |
|
1055 |
+ """""" |
|
1056 |
+ EXPORT_VAULT_KEY_METAVAR_K = commented( |
|
919 | 1057 |
'See Label.EXPORT_VAULT_KEY_HELP_TEXT.', |
920 | 1058 |
)( |
921 | 1059 |
'Label :: Help text :: Metavar :: export vault', |
922 | 1060 |
'K', |
923 | 1061 |
) |
924 |
- EXPORT_VAULT_METAVAR_PATH = _Commented( |
|
1062 |
+ """""" |
|
1063 |
+ EXPORT_VAULT_METAVAR_PATH = commented( |
|
925 | 1064 |
'Used as "path_metavar" in ' |
926 | 1065 |
'Label.DERIVEPASSPHRASE_EXPORT_VAULT_02 and others.', |
927 | 1066 |
)( |
928 | 1067 |
'Label :: Help text :: Metavar :: export vault', |
929 | 1068 |
'PATH', |
930 | 1069 |
) |
931 |
- PASSPHRASE_GENERATION_METAVAR_NUMBER = _Commented( |
|
1070 |
+ """""" |
|
1071 |
+ PASSPHRASE_GENERATION_METAVAR_NUMBER = commented( |
|
932 | 1072 |
'This metavar is also used in a matching epilog.', |
933 | 1073 |
)( |
934 | 1074 |
'Label :: Help text :: Metavar :: vault', |
935 | 1075 |
'NUMBER', |
936 | 1076 |
) |
937 |
- STORAGE_MANAGEMENT_METAVAR_PATH = _Commented( |
|
1077 |
+ """""" |
|
1078 |
+ STORAGE_MANAGEMENT_METAVAR_PATH = commented( |
|
938 | 1079 |
'This metavar is also used in multiple one-line help texts.', |
939 | 1080 |
)( |
940 | 1081 |
'Label :: Help text :: Metavar :: vault', |
941 | 1082 |
'PATH', |
942 | 1083 |
) |
943 |
- VAULT_METAVAR_SERVICE = _Commented( |
|
1084 |
+ """""" |
|
1085 |
+ VAULT_METAVAR_SERVICE = commented( |
|
944 | 1086 |
'This metavar is also used in multiple one-line help texts.', |
945 | 1087 |
)( |
946 | 1088 |
'Label :: Help text :: Metavar :: vault', |
947 | 1089 |
'SERVICE', |
948 | 1090 |
) |
949 |
- CONFIGURATION_EPILOG = _Commented( |
|
1091 |
+ """""" |
|
1092 |
+ CONFIGURATION_EPILOG = commented( |
|
950 | 1093 |
'', |
951 | 1094 |
)( |
952 | 1095 |
'Label :: Help text :: Explanation', |
953 | 1096 |
'Use $VISUAL or $EDITOR to configure the spawned editor.', |
954 | 1097 |
) |
955 |
- PASSPHRASE_GENERATION_EPILOG = _Commented( |
|
1098 |
+ """""" |
|
1099 |
+ PASSPHRASE_GENERATION_EPILOG = commented( |
|
956 | 1100 |
'The metavar is Label.PASSPHRASE_GENERATION_METAVAR_NUMBER.', |
957 | 1101 |
)( |
958 | 1102 |
'Label :: Help text :: Explanation', |
959 | 1103 |
'Use {metavar!s}=0 to exclude a character type from the output.', |
960 | 1104 |
flags='python-brace-format', |
961 | 1105 |
) |
962 |
- STORAGE_MANAGEMENT_EPILOG = _Commented( |
|
1106 |
+ """""" |
|
1107 |
+ STORAGE_MANAGEMENT_EPILOG = commented( |
|
963 | 1108 |
'The metavar is Label.STORAGE_MANAGEMENT_METAVAR_PATH.', |
964 | 1109 |
)( |
965 | 1110 |
'Label :: Help text :: Explanation', |
... | ... |
@@ -967,62 +1112,72 @@ class Label(enum.Enum): |
967 | 1112 |
'is supported.', |
968 | 1113 |
flags='python-brace-format', |
969 | 1114 |
) |
970 |
- COMMANDS_LABEL = _Commented( |
|
1115 |
+ """""" |
|
1116 |
+ COMMANDS_LABEL = commented( |
|
971 | 1117 |
'', |
972 | 1118 |
)( |
973 | 1119 |
'Label :: Help text :: Option group name', |
974 | 1120 |
'Commands', |
975 | 1121 |
) |
976 |
- COMPATIBILITY_OPTION_LABEL = _Commented( |
|
1122 |
+ """""" |
|
1123 |
+ COMPATIBILITY_OPTION_LABEL = commented( |
|
977 | 1124 |
'', |
978 | 1125 |
)( |
979 | 1126 |
'Label :: Help text :: Option group name', |
980 | 1127 |
'Compatibility and extension options', |
981 | 1128 |
) |
982 |
- CONFIGURATION_LABEL = _Commented( |
|
1129 |
+ """""" |
|
1130 |
+ CONFIGURATION_LABEL = commented( |
|
983 | 1131 |
'', |
984 | 1132 |
)( |
985 | 1133 |
'Label :: Help text :: Option group name', |
986 | 1134 |
'Configuration', |
987 | 1135 |
) |
988 |
- LOGGING_LABEL = _Commented( |
|
1136 |
+ """""" |
|
1137 |
+ LOGGING_LABEL = commented( |
|
989 | 1138 |
'', |
990 | 1139 |
)( |
991 | 1140 |
'Label :: Help text :: Option group name', |
992 | 1141 |
'Logging', |
993 | 1142 |
) |
994 |
- OPTIONS_LABEL = _Commented( |
|
1143 |
+ """""" |
|
1144 |
+ OPTIONS_LABEL = commented( |
|
995 | 1145 |
'', |
996 | 1146 |
)( |
997 | 1147 |
'Label :: Help text :: Option group name', |
998 | 1148 |
'Options', |
999 | 1149 |
) |
1000 |
- OTHER_OPTIONS_LABEL = _Commented( |
|
1150 |
+ """""" |
|
1151 |
+ OTHER_OPTIONS_LABEL = commented( |
|
1001 | 1152 |
'', |
1002 | 1153 |
)( |
1003 | 1154 |
'Label :: Help text :: Option group name', |
1004 | 1155 |
'Other options', |
1005 | 1156 |
) |
1006 |
- PASSPHRASE_GENERATION_LABEL = _Commented( |
|
1157 |
+ """""" |
|
1158 |
+ PASSPHRASE_GENERATION_LABEL = commented( |
|
1007 | 1159 |
'', |
1008 | 1160 |
)( |
1009 | 1161 |
'Label :: Help text :: Option group name', |
1010 | 1162 |
'Passphrase generation', |
1011 | 1163 |
) |
1012 |
- STORAGE_MANAGEMENT_LABEL = _Commented( |
|
1164 |
+ """""" |
|
1165 |
+ STORAGE_MANAGEMENT_LABEL = commented( |
|
1013 | 1166 |
'', |
1014 | 1167 |
)( |
1015 | 1168 |
'Label :: Help text :: Option group name', |
1016 | 1169 |
'Storage management', |
1017 | 1170 |
) |
1018 |
- VERSION_INFO_TEXT = _Commented( |
|
1171 |
+ """""" |
|
1172 |
+ VERSION_INFO_TEXT = commented( |
|
1019 | 1173 |
'', |
1020 | 1174 |
)( |
1021 | 1175 |
'Label :: Info Message', |
1022 | 1176 |
'{PROG_NAME!s} {__version__}', # noqa: RUF027 |
1023 | 1177 |
flags='python-brace-format', |
1024 | 1178 |
) |
1025 |
- CONFIRM_THIS_CHOICE_PROMPT_TEXT = _Commented( |
|
1179 |
+ """""" |
|
1180 |
+ CONFIRM_THIS_CHOICE_PROMPT_TEXT = commented( |
|
1026 | 1181 |
'There is no support for "yes" or "no" in other languages ' |
1027 | 1182 |
'than English, so it is advised that your translation makes it ' |
1028 | 1183 |
'clear that only the strings "y", "yes", "n" or "no" are supported, ' |
... | ... |
@@ -1031,23 +1186,28 @@ class Label(enum.Enum): |
1031 | 1186 |
'Label :: Interactive prompt', |
1032 | 1187 |
'Confirm this choice? (y/N)', |
1033 | 1188 |
) |
1034 |
- SUITABLE_SSH_KEYS_LABEL = _Commented( |
|
1189 |
+ """""" |
|
1190 |
+ SUITABLE_SSH_KEYS_LABEL = commented( |
|
1035 | 1191 |
'This label is the heading of the list of suitable SSH keys.', |
1036 | 1192 |
)( |
1037 | 1193 |
'Label :: Interactive prompt', |
1038 | 1194 |
'Suitable SSH keys:', |
1039 | 1195 |
) |
1040 |
- YOUR_SELECTION_PROMPT_TEXT = _Commented( |
|
1196 |
+ """""" |
|
1197 |
+ YOUR_SELECTION_PROMPT_TEXT = commented( |
|
1041 | 1198 |
'', |
1042 | 1199 |
)( |
1043 | 1200 |
'Label :: Interactive prompt', |
1044 | 1201 |
'Your selection? (1-{n}, leave empty to abort)', |
1045 | 1202 |
flags='python-brace-format', |
1046 | 1203 |
) |
1204 |
+ """""" |
|
1047 | 1205 |
|
1048 | 1206 |
|
1049 | 1207 |
class DebugMsgTemplate(enum.Enum): |
1050 |
- BUCKET_ITEM_FOUND = _Commented( |
|
1208 |
+ """Debug messages for the `derivepassphrase` command-line.""" |
|
1209 |
+ |
|
1210 |
+ BUCKET_ITEM_FOUND = commented( |
|
1051 | 1211 |
'This message is emitted by the vault configuration exporter ' |
1052 | 1212 |
'for "storeroom"-type configuration directories. ' |
1053 | 1213 |
'The system stores entries in different "buckets" of a hash table. ' |
... | ... |
@@ -1059,7 +1219,8 @@ class DebugMsgTemplate(enum.Enum): |
1059 | 1219 |
'Found bucket item: {path} -> {value}', |
1060 | 1220 |
flags='python-brace-format', |
1061 | 1221 |
) |
1062 |
- DECRYPT_BUCKET_ITEM_INFO = _Commented( |
|
1222 |
+ """""" |
|
1223 |
+ DECRYPT_BUCKET_ITEM_INFO = commented( |
|
1063 | 1224 |
'"AES256-CBC" and "PKCS#7" are, in essence, names of formats, ' |
1064 | 1225 |
'and should not be translated. ' |
1065 | 1226 |
'"IV" means "initialization vector", and is specifically ' |
... | ... |
@@ -1078,7 +1239,8 @@ Decrypt bucket item contents: |
1078 | 1239 |
""", |
1079 | 1240 |
flags='python-brace-format', |
1080 | 1241 |
) |
1081 |
- DECRYPT_BUCKET_ITEM_KEY_INFO = _Commented( |
|
1242 |
+ """""" |
|
1243 |
+ DECRYPT_BUCKET_ITEM_KEY_INFO = commented( |
|
1082 | 1244 |
'', |
1083 | 1245 |
)( |
1084 | 1246 |
'Debug message', |
... | ... |
@@ -1092,7 +1254,8 @@ Decrypt bucket item: |
1092 | 1254 |
""", |
1093 | 1255 |
flags='python-brace-format', |
1094 | 1256 |
) |
1095 |
- DECRYPT_BUCKET_ITEM_MAC_INFO = _Commented( |
|
1257 |
+ """""" |
|
1258 |
+ DECRYPT_BUCKET_ITEM_MAC_INFO = commented( |
|
1096 | 1259 |
'The MAC stands for "message authentication code", ' |
1097 | 1260 |
'which guarantees the authenticity of the message to anyone ' |
1098 | 1261 |
'who holds the corresponding key, similar to a digital signature. ' |
... | ... |
@@ -1114,7 +1277,8 @@ Decrypt bucket item contents: |
1114 | 1277 |
""", |
1115 | 1278 |
flags='python-brace-format', |
1116 | 1279 |
) |
1117 |
- DECRYPT_BUCKET_ITEM_SESSION_KEYS_INFO = _Commented( |
|
1280 |
+ """""" |
|
1281 |
+ DECRYPT_BUCKET_ITEM_SESSION_KEYS_INFO = commented( |
|
1118 | 1282 |
'"AES256-CBC" and "PKCS#7" are, in essence, names of formats, ' |
1119 | 1283 |
'and should not be translated. ' |
1120 | 1284 |
'"IV" means "initialization vector", and is specifically ' |
... | ... |
@@ -1134,7 +1298,8 @@ Decrypt bucket item session keys: |
1134 | 1298 |
""", |
1135 | 1299 |
flags='python-brace-format', |
1136 | 1300 |
) |
1137 |
- DECRYPT_BUCKET_ITEM_SESSION_KEYS_MAC_INFO = _Commented( |
|
1301 |
+ """""" |
|
1302 |
+ DECRYPT_BUCKET_ITEM_SESSION_KEYS_MAC_INFO = commented( |
|
1138 | 1303 |
'The MAC stands for "message authentication code", ' |
1139 | 1304 |
'which guarantees the authenticity of the message to anyone ' |
1140 | 1305 |
'who holds the corresponding key, similar to a digital signature. ' |
... | ... |
@@ -1156,7 +1321,8 @@ Decrypt bucket item session keys: |
1156 | 1321 |
""", |
1157 | 1322 |
flags='python-brace-format', |
1158 | 1323 |
) |
1159 |
- DERIVED_MASTER_KEYS_KEYS = _Commented( |
|
1324 |
+ """""" |
|
1325 |
+ DERIVED_MASTER_KEYS_KEYS = commented( |
|
1160 | 1326 |
'', |
1161 | 1327 |
)( |
1162 | 1328 |
'Debug message', |
... | ... |
@@ -1171,7 +1337,8 @@ Derived master keys' keys: |
1171 | 1337 |
""", # noqa: E501 |
1172 | 1338 |
flags='python-brace-format', |
1173 | 1339 |
) |
1174 |
- DIRECTORY_CONTENTS_CHECK_OK = _Commented( |
|
1340 |
+ """""" |
|
1341 |
+ DIRECTORY_CONTENTS_CHECK_OK = commented( |
|
1175 | 1342 |
'This message is emitted by the vault configuration exporter ' |
1176 | 1343 |
'for "storeroom"-type configuration directories, ' |
1177 | 1344 |
'while "assembling" the items stored in the configuration ' |
... | ... |
@@ -1186,7 +1353,8 @@ Derived master keys' keys: |
1186 | 1353 |
'Directory contents check OK: {path} -> {contents}', |
1187 | 1354 |
flags='python-brace-format', |
1188 | 1355 |
) |
1189 |
- MASTER_KEYS_DATA_MAC_INFO = _Commented( |
|
1356 |
+ """""" |
|
1357 |
+ MASTER_KEYS_DATA_MAC_INFO = commented( |
|
1190 | 1358 |
'The MAC stands for "message authentication code", ' |
1191 | 1359 |
'which guarantees the authenticity of the message to anyone ' |
1192 | 1360 |
'who holds the corresponding key, similar to a digital signature. ' |
... | ... |
@@ -1208,7 +1376,8 @@ Master keys data: |
1208 | 1376 |
""", |
1209 | 1377 |
flags='python-brace-format', |
1210 | 1378 |
) |
1211 |
- POSTPONING_DIRECTORY_CONTENTS_CHECK = _Commented( |
|
1379 |
+ """""" |
|
1380 |
+ POSTPONING_DIRECTORY_CONTENTS_CHECK = commented( |
|
1212 | 1381 |
'This message is emitted by the vault configuration exporter ' |
1213 | 1382 |
'for "storeroom"-type configuration directories, ' |
1214 | 1383 |
'while "assembling" the items stored in the configuration ' |
... | ... |
@@ -1223,7 +1392,8 @@ Master keys data: |
1223 | 1392 |
'Postponing directory contents check: {path} -> {contents}', |
1224 | 1393 |
flags='python-brace-format', |
1225 | 1394 |
) |
1226 |
- SETTING_CONFIG_STRUCTURE_CONTENTS = _Commented( |
|
1395 |
+ """""" |
|
1396 |
+ SETTING_CONFIG_STRUCTURE_CONTENTS = commented( |
|
1227 | 1397 |
'This message is emitted by the vault configuration exporter ' |
1228 | 1398 |
'for "storeroom"-type configuration directories, ' |
1229 | 1399 |
'while "assembling" the items stored in the configuration ' |
... | ... |
@@ -1235,7 +1405,8 @@ Master keys data: |
1235 | 1405 |
'Setting contents: {path} -> {value}', |
1236 | 1406 |
flags='python-brace-format', |
1237 | 1407 |
) |
1238 |
- SETTING_CONFIG_STRUCTURE_CONTENTS_EMPTY_DIRECTORY = _Commented( |
|
1408 |
+ """""" |
|
1409 |
+ SETTING_CONFIG_STRUCTURE_CONTENTS_EMPTY_DIRECTORY = commented( |
|
1239 | 1410 |
'This message is emitted by the vault configuration exporter ' |
1240 | 1411 |
'for "storeroom"-type configuration directories, ' |
1241 | 1412 |
'while "assembling" the items stored in the configuration ' |
... | ... |
@@ -1247,7 +1418,8 @@ Master keys data: |
1247 | 1418 |
'Setting contents (empty directory): {path}', |
1248 | 1419 |
flags='python-brace-format', |
1249 | 1420 |
) |
1250 |
- VAULT_NATIVE_EVP_BYTESTOKEY_INIT = _Commented( |
|
1421 |
+ """""" |
|
1422 |
+ VAULT_NATIVE_EVP_BYTESTOKEY_INIT = commented( |
|
1251 | 1423 |
'This message is emitted by the vault configuration exporter ' |
1252 | 1424 |
'for "native"-type configuration directories: ' |
1253 | 1425 |
'in v0.2, the non-standard and deprecated "EVP_bytestokey" function ' |
... | ... |
@@ -1269,7 +1441,8 @@ evp_bytestokey_md5 (initialization): |
1269 | 1441 |
""", |
1270 | 1442 |
flags='python-brace-format', |
1271 | 1443 |
) |
1272 |
- VAULT_NATIVE_EVP_BYTESTOKEY_RESULT = _Commented( |
|
1444 |
+ """""" |
|
1445 |
+ VAULT_NATIVE_EVP_BYTESTOKEY_RESULT = commented( |
|
1273 | 1446 |
'This message is emitted by the vault configuration exporter ' |
1274 | 1447 |
'for "native"-type configuration directories: ' |
1275 | 1448 |
'in v0.2, the non-standard and deprecated "EVP_bytestokey" function ' |
... | ... |
@@ -1288,7 +1461,8 @@ evp_bytestokey_md5 (result): |
1288 | 1461 |
""", |
1289 | 1462 |
flags='python-brace-format', |
1290 | 1463 |
) |
1291 |
- VAULT_NATIVE_EVP_BYTESTOKEY_ROUND = _Commented( |
|
1464 |
+ """""" |
|
1465 |
+ VAULT_NATIVE_EVP_BYTESTOKEY_ROUND = commented( |
|
1292 | 1466 |
'This message is emitted by the vault configuration exporter ' |
1293 | 1467 |
'for "native"-type configuration directories: ' |
1294 | 1468 |
'in v0.2, the non-standard and deprecated "EVP_bytestokey" function ' |
... | ... |
@@ -1308,7 +1482,8 @@ evp_bytestokey_md5 (round update): |
1308 | 1482 |
""", |
1309 | 1483 |
flags='python-brace-format', |
1310 | 1484 |
) |
1311 |
- VAULT_NATIVE_CHECKING_MAC_DETAILS = _Commented( |
|
1485 |
+ """""" |
|
1486 |
+ VAULT_NATIVE_CHECKING_MAC_DETAILS = commented( |
|
1312 | 1487 |
'This message is emitted by the vault configuration exporter ' |
1313 | 1488 |
'for "native"-type configuration directories. ' |
1314 | 1489 |
'It is preceded by the info message ' |
... | ... |
@@ -1325,7 +1500,8 @@ MAC details: |
1325 | 1500 |
""", |
1326 | 1501 |
flags='python-brace-format', |
1327 | 1502 |
) |
1328 |
- VAULT_NATIVE_PADDED_PLAINTEXT = _Commented( |
|
1503 |
+ """""" |
|
1504 |
+ VAULT_NATIVE_PADDED_PLAINTEXT = commented( |
|
1329 | 1505 |
'This message is emitted by the vault configuration exporter ' |
1330 | 1506 |
'for "native"-type configuration directories. ' |
1331 | 1507 |
'"padding" and "plaintext" are cryptographic terms.', |
... | ... |
@@ -1334,7 +1510,8 @@ MAC details: |
1334 | 1510 |
'Padded plaintext: {contents}', |
1335 | 1511 |
flags='python-brace-format', |
1336 | 1512 |
) |
1337 |
- VAULT_NATIVE_PARSE_BUFFER = _Commented( |
|
1513 |
+ """""" |
|
1514 |
+ VAULT_NATIVE_PARSE_BUFFER = commented( |
|
1338 | 1515 |
'This message is emitted by the vault configuration exporter ' |
1339 | 1516 |
'for "native"-type configuration directories. ' |
1340 | 1517 |
'It is preceded by the info message ' |
... | ... |
@@ -1352,7 +1529,8 @@ Buffer: {contents} |
1352 | 1529 |
""", |
1353 | 1530 |
flags='python-brace-format', |
1354 | 1531 |
) |
1355 |
- VAULT_NATIVE_PLAINTEXT = _Commented( |
|
1532 |
+ """""" |
|
1533 |
+ VAULT_NATIVE_PLAINTEXT = commented( |
|
1356 | 1534 |
'This message is emitted by the vault configuration exporter ' |
1357 | 1535 |
'for "native"-type configuration directories. ' |
1358 | 1536 |
'"plaintext" is a cryptographic term.', |
... | ... |
@@ -1361,7 +1539,8 @@ Buffer: {contents} |
1361 | 1539 |
'Plaintext: {contents}', |
1362 | 1540 |
flags='python-brace-format', |
1363 | 1541 |
) |
1364 |
- VAULT_NATIVE_PBKDF2_CALL = _Commented( |
|
1542 |
+ """""" |
|
1543 |
+ VAULT_NATIVE_PBKDF2_CALL = commented( |
|
1365 | 1544 |
'', |
1366 | 1545 |
)( |
1367 | 1546 |
'Debug message', |
... | ... |
@@ -1375,7 +1554,8 @@ Master key derivation: |
1375 | 1554 |
""", # noqa: E501 |
1376 | 1555 |
flags='python-brace-format', |
1377 | 1556 |
) |
1378 |
- VAULT_NATIVE_V02_PAYLOAD_MAC_POSTPROCESSING = _Commented( |
|
1557 |
+ """""" |
|
1558 |
+ VAULT_NATIVE_V02_PAYLOAD_MAC_POSTPROCESSING = commented( |
|
1379 | 1559 |
'This message is emitted by the vault configuration exporter ' |
1380 | 1560 |
'for "native"-type configuration directories. ' |
1381 | 1561 |
'It is preceded by the info message ' |
... | ... |
@@ -1393,10 +1573,13 @@ Postprocessing buffer (v0.2): |
1393 | 1573 |
""", |
1394 | 1574 |
flags='python-brace-format', |
1395 | 1575 |
) |
1576 |
+ """""" |
|
1396 | 1577 |
|
1397 | 1578 |
|
1398 | 1579 |
class InfoMsgTemplate(enum.Enum): |
1399 |
- ASSEMBLING_CONFIG_STRUCTURE = _Commented( |
|
1580 |
+ """Info messages for the `derivepassphrase` command-line.""" |
|
1581 |
+ |
|
1582 |
+ ASSEMBLING_CONFIG_STRUCTURE = commented( |
|
1400 | 1583 |
'This message is emitted by the vault configuration exporter ' |
1401 | 1584 |
'for "storeroom"-type configuration directories. ' |
1402 | 1585 |
'The system stores entries in different "buckets" of a hash table. ' |
... | ... |
@@ -1409,7 +1592,8 @@ class InfoMsgTemplate(enum.Enum): |
1409 | 1592 |
'Info message', |
1410 | 1593 |
'Assembling config structure', |
1411 | 1594 |
) |
1412 |
- CANNOT_LOAD_AS_VAULT_CONFIG = _Commented( |
|
1595 |
+ """""" |
|
1596 |
+ CANNOT_LOAD_AS_VAULT_CONFIG = commented( |
|
1413 | 1597 |
'"fmt" is a string such as "v0.2" or "storeroom", ' |
1414 | 1598 |
'indicating the format which we tried to load the ' |
1415 | 1599 |
'vault configuration as.', |
... | ... |
@@ -1418,7 +1602,8 @@ class InfoMsgTemplate(enum.Enum): |
1418 | 1602 |
'Cannot load {path!r} as a {fmt!s} vault configuration.', |
1419 | 1603 |
flags='python-brace-format', |
1420 | 1604 |
) |
1421 |
- CHECKING_CONFIG_STRUCTURE_CONSISTENCY = _Commented( |
|
1605 |
+ """""" |
|
1606 |
+ CHECKING_CONFIG_STRUCTURE_CONSISTENCY = commented( |
|
1422 | 1607 |
'This message is emitted by the vault configuration exporter ' |
1423 | 1608 |
'for "storeroom"-type configuration directories. ' |
1424 | 1609 |
'Having "assembled" the configuration items according to ' |
... | ... |
@@ -1428,7 +1613,8 @@ class InfoMsgTemplate(enum.Enum): |
1428 | 1613 |
'Info message', |
1429 | 1614 |
'Checking config structure consistency', |
1430 | 1615 |
) |
1431 |
- DECRYPTING_BUCKET = _Commented( |
|
1616 |
+ """""" |
|
1617 |
+ DECRYPTING_BUCKET = commented( |
|
1432 | 1618 |
'This message is emitted by the vault configuration exporter ' |
1433 | 1619 |
'for "storeroom"-type configuration directories. ' |
1434 | 1620 |
'The system stores entries in different "buckets" of a hash table. ' |
... | ... |
@@ -1440,7 +1626,8 @@ class InfoMsgTemplate(enum.Enum): |
1440 | 1626 |
'Decrypting bucket {bucket_number}', |
1441 | 1627 |
flags='python-brace-format', |
1442 | 1628 |
) |
1443 |
- PARSING_MASTER_KEYS_DATA = _Commented( |
|
1629 |
+ """""" |
|
1630 |
+ PARSING_MASTER_KEYS_DATA = commented( |
|
1444 | 1631 |
'This message is emitted by the vault configuration exporter ' |
1445 | 1632 |
'for "storeroom"-type configuration directories. ' |
1446 | 1633 |
'`.keys` is a filename, from which data about the master keys ' |
... | ... |
@@ -1449,7 +1636,8 @@ class InfoMsgTemplate(enum.Enum): |
1449 | 1636 |
'Info message', |
1450 | 1637 |
'Parsing master keys data from .keys', |
1451 | 1638 |
) |
1452 |
- PIP_INSTALL_EXTRA = _Commented( |
|
1639 |
+ """""" |
|
1640 |
+ PIP_INSTALL_EXTRA = commented( |
|
1453 | 1641 |
'This message immediately follows an error message about ' |
1454 | 1642 |
'a missing library that needs to be installed. ' |
1455 | 1643 |
'The Python Package Index (PyPI) supports declaring sets of ' |
... | ... |
@@ -1463,7 +1651,8 @@ class InfoMsgTemplate(enum.Enum): |
1463 | 1651 |
'For users installing from PyPI, see the {extra_name!r} extra.', |
1464 | 1652 |
flags='python-brace-format', |
1465 | 1653 |
) |
1466 |
- SUCCESSFULLY_MIGRATED = _Commented( |
|
1654 |
+ """""" |
|
1655 |
+ SUCCESSFULLY_MIGRATED = commented( |
|
1467 | 1656 |
'This info message immediately follows the ' |
1468 | 1657 |
'"Using deprecated v0.1-style ..." deprecation warning.', |
1469 | 1658 |
)( |
... | ... |
@@ -1471,25 +1660,29 @@ class InfoMsgTemplate(enum.Enum): |
1471 | 1660 |
'Successfully migrated to {path!r}.', |
1472 | 1661 |
flags='python-brace-format', |
1473 | 1662 |
) |
1474 |
- VAULT_NATIVE_CHECKING_MAC = _Commented( |
|
1663 |
+ """""" |
|
1664 |
+ VAULT_NATIVE_CHECKING_MAC = commented( |
|
1475 | 1665 |
'', |
1476 | 1666 |
)( |
1477 | 1667 |
'Info message', |
1478 | 1668 |
'Checking MAC', |
1479 | 1669 |
) |
1480 |
- VAULT_NATIVE_DECRYPTING_CONTENTS = _Commented( |
|
1670 |
+ """""" |
|
1671 |
+ VAULT_NATIVE_DECRYPTING_CONTENTS = commented( |
|
1481 | 1672 |
'', |
1482 | 1673 |
)( |
1483 | 1674 |
'Info message', |
1484 | 1675 |
'Decrypting contents', |
1485 | 1676 |
) |
1486 |
- VAULT_NATIVE_DERIVING_KEYS = _Commented( |
|
1677 |
+ """""" |
|
1678 |
+ VAULT_NATIVE_DERIVING_KEYS = commented( |
|
1487 | 1679 |
'', |
1488 | 1680 |
)( |
1489 | 1681 |
'Info message', |
1490 | 1682 |
'Deriving an encryption and signing key', |
1491 | 1683 |
) |
1492 |
- VAULT_NATIVE_PARSING_IV_PAYLOAD_MAC = _Commented( |
|
1684 |
+ """""" |
|
1685 |
+ VAULT_NATIVE_PARSING_IV_PAYLOAD_MAC = commented( |
|
1493 | 1686 |
'This message is emitted by the vault configuration exporter ' |
1494 | 1687 |
'for "native"-type configuration directories. ' |
1495 | 1688 |
'"IV" means "initialization vector", and "MAC" means ' |
... | ... |
@@ -1504,10 +1697,13 @@ class InfoMsgTemplate(enum.Enum): |
1504 | 1697 |
'Info message', |
1505 | 1698 |
'Parsing IV, payload and MAC from the file contents', |
1506 | 1699 |
) |
1700 |
+ """""" |
|
1507 | 1701 |
|
1508 | 1702 |
|
1509 | 1703 |
class WarnMsgTemplate(enum.Enum): |
1510 |
- EMPTY_SERVICE_NOT_SUPPORTED = _Commented( |
|
1704 |
+ """Warning messages for the `derivepassphrase` command-line.""" |
|
1705 |
+ |
|
1706 |
+ EMPTY_SERVICE_NOT_SUPPORTED = commented( |
|
1511 | 1707 |
'', |
1512 | 1708 |
)( |
1513 | 1709 |
'Warning message', |
... | ... |
@@ -1516,7 +1712,8 @@ class WarnMsgTemplate(enum.Enum): |
1516 | 1712 |
'supplied, i.e., it will error out, or operate on global settings.', |
1517 | 1713 |
flags='python-brace-format', |
1518 | 1714 |
) |
1519 |
- EMPTY_SERVICE_SETTINGS_INACCESSIBLE = _Commented( |
|
1715 |
+ """""" |
|
1716 |
+ EMPTY_SERVICE_SETTINGS_INACCESSIBLE = commented( |
|
1520 | 1717 |
'', |
1521 | 1718 |
)( |
1522 | 1719 |
'Warning message', |
... | ... |
@@ -1527,21 +1724,24 @@ class WarnMsgTemplate(enum.Enum): |
1527 | 1724 |
'move them into the "global" section.', |
1528 | 1725 |
flags='python-brace-format', |
1529 | 1726 |
) |
1530 |
- FAILED_TO_MIGRATE_CONFIG = _Commented( |
|
1727 |
+ """""" |
|
1728 |
+ FAILED_TO_MIGRATE_CONFIG = commented( |
|
1531 | 1729 |
'"error" is supplied by the operating system (errno/strerror).', |
1532 | 1730 |
)( |
1533 | 1731 |
'Warning message', |
1534 | 1732 |
'Failed to migrate to {path!r}: {error!s}: {filename!r}.', |
1535 | 1733 |
flags='python-brace-format', |
1536 | 1734 |
) |
1537 |
- GLOBAL_PASSPHRASE_INEFFECTIVE = _Commented( |
|
1735 |
+ """""" |
|
1736 |
+ GLOBAL_PASSPHRASE_INEFFECTIVE = commented( |
|
1538 | 1737 |
'', |
1539 | 1738 |
)( |
1540 | 1739 |
'Warning message', |
1541 | 1740 |
'Setting a global passphrase is ineffective ' |
1542 | 1741 |
'because a key is also set.', |
1543 | 1742 |
) |
1544 |
- PASSPHRASE_NOT_NORMALIZED = _Commented( |
|
1743 |
+ """""" |
|
1744 |
+ PASSPHRASE_NOT_NORMALIZED = commented( |
|
1545 | 1745 |
'The key is a (vault) configuration key, in JSONPath syntax, ' |
1546 | 1746 |
'typically "$.global" for the global passphrase or ' |
1547 | 1747 |
'"$.services.service_name" or "$.services["service with spaces"]" ' |
... | ... |
@@ -1561,7 +1761,8 @@ class WarnMsgTemplate(enum.Enum): |
1561 | 1761 |
'for unexpected results.', |
1562 | 1762 |
flags='python-brace-format', |
1563 | 1763 |
) |
1564 |
- SERVICE_NAME_INCOMPLETABLE = _Commented( |
|
1764 |
+ """""" |
|
1765 |
+ SERVICE_NAME_INCOMPLETABLE = commented( |
|
1565 | 1766 |
'', |
1566 | 1767 |
)( |
1567 | 1768 |
'Warning message', |
... | ... |
@@ -1574,7 +1775,8 @@ class WarnMsgTemplate(enum.Enum): |
1574 | 1775 |
'service name instead.', |
1575 | 1776 |
flags='python-brace-format', |
1576 | 1777 |
) |
1577 |
- SERVICE_PASSPHRASE_INEFFECTIVE = _Commented( |
|
1778 |
+ """""" |
|
1779 |
+ SERVICE_PASSPHRASE_INEFFECTIVE = commented( |
|
1578 | 1780 |
'The key that is set need not necessarily be set at the ' |
1579 | 1781 |
'service level; it may be a global key as well.', |
1580 | 1782 |
)( |
... | ... |
@@ -1583,21 +1785,24 @@ class WarnMsgTemplate(enum.Enum): |
1583 | 1785 |
'because a key is also set: {service!s}.', |
1584 | 1786 |
flags='python-brace-format', |
1585 | 1787 |
) |
1586 |
- STEP_REMOVE_INEFFECTIVE_VALUE = _Commented( |
|
1788 |
+ """""" |
|
1789 |
+ STEP_REMOVE_INEFFECTIVE_VALUE = commented( |
|
1587 | 1790 |
'', |
1588 | 1791 |
)( |
1589 | 1792 |
'Warning message', |
1590 | 1793 |
'Removing ineffective setting {path!s} = {old!s}.', |
1591 | 1794 |
flags='python-brace-format', |
1592 | 1795 |
) |
1593 |
- STEP_REPLACE_INVALID_VALUE = _Commented( |
|
1796 |
+ """""" |
|
1797 |
+ STEP_REPLACE_INVALID_VALUE = commented( |
|
1594 | 1798 |
'', |
1595 | 1799 |
)( |
1596 | 1800 |
'Warning message', |
1597 | 1801 |
'Replacing invalid value {old!s} for key {path!s} with {new!s}.', |
1598 | 1802 |
flags='python-brace-format', |
1599 | 1803 |
) |
1600 |
- V01_STYLE_CONFIG = _Commented( |
|
1804 |
+ """""" |
|
1805 |
+ V01_STYLE_CONFIG = commented( |
|
1601 | 1806 |
'', |
1602 | 1807 |
)( |
1603 | 1808 |
'Warning message :: Deprecation', |
... | ... |
@@ -1606,7 +1811,8 @@ class WarnMsgTemplate(enum.Enum): |
1606 | 1811 |
'Support for v0.1-style config filenames will be removed in v1.0.', |
1607 | 1812 |
flags='python-brace-format', |
1608 | 1813 |
) |
1609 |
- V10_SUBCOMMAND_REQUIRED = _Commented( |
|
1814 |
+ """""" |
|
1815 |
+ V10_SUBCOMMAND_REQUIRED = commented( |
|
1610 | 1816 |
'This deprecation warning may be issued at any level, ' |
1611 | 1817 |
'i.e. we may actually be talking about subcommands, ' |
1612 | 1818 |
'or sub-subcommands, or sub-sub-subcommands, etc., ' |
... | ... |
@@ -1617,16 +1823,20 @@ class WarnMsgTemplate(enum.Enum): |
1617 | 1823 |
'See --help for available subcommands. ' |
1618 | 1824 |
'Defaulting to subcommand "vault".', |
1619 | 1825 |
) |
1826 |
+ """""" |
|
1620 | 1827 |
|
1621 | 1828 |
|
1622 | 1829 |
class ErrMsgTemplate(enum.Enum): |
1623 |
- AGENT_REFUSED_LIST_KEYS = _Commented( |
|
1830 |
+ """Error messages for the `derivepassphrase` command-line.""" |
|
1831 |
+ |
|
1832 |
+ AGENT_REFUSED_LIST_KEYS = commented( |
|
1624 | 1833 |
'"loaded keys" being keys loaded into the agent.', |
1625 | 1834 |
)( |
1626 | 1835 |
'Error message', |
1627 | 1836 |
'The SSH agent failed to or refused to supply a list of loaded keys.', |
1628 | 1837 |
) |
1629 |
- AGENT_REFUSED_SIGNATURE = _Commented( |
|
1838 |
+ """""" |
|
1839 |
+ AGENT_REFUSED_SIGNATURE = commented( |
|
1630 | 1840 |
'The message to be signed is the vault UUID, ' |
1631 | 1841 |
"but there's no space to explain that here, " |
1632 | 1842 |
'so ideally the error message does not go into detail.', |
... | ... |
@@ -1635,49 +1845,56 @@ class ErrMsgTemplate(enum.Enum): |
1635 | 1845 |
'The SSH agent failed to or refused to issue a signature ' |
1636 | 1846 |
'with the selected key, necessary for deriving a service passphrase.', |
1637 | 1847 |
) |
1638 |
- CANNOT_CONNECT_TO_AGENT = _Commented( |
|
1848 |
+ """""" |
|
1849 |
+ CANNOT_CONNECT_TO_AGENT = commented( |
|
1639 | 1850 |
'"error" is supplied by the operating system (errno/strerror).', |
1640 | 1851 |
)( |
1641 | 1852 |
'Error message', |
1642 | 1853 |
'Cannot connect to the SSH agent: {error!s}: {filename!r}.', |
1643 | 1854 |
flags='python-brace-format', |
1644 | 1855 |
) |
1645 |
- CANNOT_DECODEIMPORT_VAULT_SETTINGS = _Commented( |
|
1856 |
+ """""" |
|
1857 |
+ CANNOT_DECODEIMPORT_VAULT_SETTINGS = commented( |
|
1646 | 1858 |
'"error" is supplied by the operating system (errno/strerror).', |
1647 | 1859 |
)( |
1648 | 1860 |
'Error message', |
1649 | 1861 |
'Cannot import vault settings: cannot decode JSON: {error!s}.', |
1650 | 1862 |
flags='python-brace-format', |
1651 | 1863 |
) |
1652 |
- CANNOT_EXPORT_VAULT_SETTINGS = _Commented( |
|
1864 |
+ """""" |
|
1865 |
+ CANNOT_EXPORT_VAULT_SETTINGS = commented( |
|
1653 | 1866 |
'"error" is supplied by the operating system (errno/strerror).', |
1654 | 1867 |
)( |
1655 | 1868 |
'Error message', |
1656 | 1869 |
'Cannot export vault settings: {error!s}: {filename!r}.', |
1657 | 1870 |
flags='python-brace-format', |
1658 | 1871 |
) |
1659 |
- CANNOT_IMPORT_VAULT_SETTINGS = _Commented( |
|
1872 |
+ """""" |
|
1873 |
+ CANNOT_IMPORT_VAULT_SETTINGS = commented( |
|
1660 | 1874 |
'"error" is supplied by the operating system (errno/strerror).', |
1661 | 1875 |
)( |
1662 | 1876 |
'Error message', |
1663 | 1877 |
'Cannot import vault settings: {error!s}: {filename!r}.', |
1664 | 1878 |
flags='python-brace-format', |
1665 | 1879 |
) |
1666 |
- CANNOT_LOAD_USER_CONFIG = _Commented( |
|
1880 |
+ """""" |
|
1881 |
+ CANNOT_LOAD_USER_CONFIG = commented( |
|
1667 | 1882 |
'"error" is supplied by the operating system (errno/strerror).', |
1668 | 1883 |
)( |
1669 | 1884 |
'Error message', |
1670 | 1885 |
'Cannot load user config: {error!s}: {filename!r}.', |
1671 | 1886 |
flags='python-brace-format', |
1672 | 1887 |
) |
1673 |
- CANNOT_LOAD_VAULT_SETTINGS = _Commented( |
|
1888 |
+ """""" |
|
1889 |
+ CANNOT_LOAD_VAULT_SETTINGS = commented( |
|
1674 | 1890 |
'"error" is supplied by the operating system (errno/strerror).', |
1675 | 1891 |
)( |
1676 | 1892 |
'Error message', |
1677 | 1893 |
'Cannot load vault settings: {error!s}: {filename!r}.', |
1678 | 1894 |
flags='python-brace-format', |
1679 | 1895 |
) |
1680 |
- CANNOT_PARSE_AS_VAULT_CONFIG = _Commented( |
|
1896 |
+ """""" |
|
1897 |
+ CANNOT_PARSE_AS_VAULT_CONFIG = commented( |
|
1681 | 1898 |
'Unlike the "Cannot load {path!r} as a {fmt!s} ' |
1682 | 1899 |
'vault configuration." message, *this* error message is emitted ' |
1683 | 1900 |
'when we have tried loading the path in each of our ' |
... | ... |
@@ -1691,7 +1908,8 @@ class ErrMsgTemplate(enum.Enum): |
1691 | 1908 |
'configuration file/directory.', |
1692 | 1909 |
flags='python-brace-format', |
1693 | 1910 |
) |
1694 |
- CANNOT_PARSE_AS_VAULT_CONFIG_OSERROR = _Commented( |
|
1911 |
+ """""" |
|
1912 |
+ CANNOT_PARSE_AS_VAULT_CONFIG_OSERROR = commented( |
|
1695 | 1913 |
'"error" is supplied by the operating system (errno/strerror).', |
1696 | 1914 |
)( |
1697 | 1915 |
'Error message', |
... | ... |
@@ -1699,14 +1917,16 @@ class ErrMsgTemplate(enum.Enum): |
1699 | 1917 |
'configuration file/directory: {error!s}: {filename!r}.', |
1700 | 1918 |
flags='python-brace-format', |
1701 | 1919 |
) |
1702 |
- CANNOT_STORE_VAULT_SETTINGS = _Commented( |
|
1920 |
+ """""" |
|
1921 |
+ CANNOT_STORE_VAULT_SETTINGS = commented( |
|
1703 | 1922 |
'"error" is supplied by the operating system (errno/strerror).', |
1704 | 1923 |
)( |
1705 | 1924 |
'Error message', |
1706 | 1925 |
'Cannot store vault settings: {error!s}: {filename!r}.', |
1707 | 1926 |
flags='python-brace-format', |
1708 | 1927 |
) |
1709 |
- CANNOT_UNDERSTAND_AGENT = _Commented( |
|
1928 |
+ """""" |
|
1929 |
+ CANNOT_UNDERSTAND_AGENT = commented( |
|
1710 | 1930 |
'This error message is used whenever we cannot make ' |
1711 | 1931 |
'any sense of a response from the SSH agent ' |
1712 | 1932 |
'because the response is ill-formed ' |
... | ... |
@@ -1720,7 +1940,8 @@ class ErrMsgTemplate(enum.Enum): |
1720 | 1940 |
"Cannot understand the SSH agent's response because it " |
1721 | 1941 |
'violates the communications protocol.', |
1722 | 1942 |
) |
1723 |
- CANNOT_UPDATE_SETTINGS_NO_SETTINGS = _Commented( |
|
1943 |
+ """""" |
|
1944 |
+ CANNOT_UPDATE_SETTINGS_NO_SETTINGS = commented( |
|
1724 | 1945 |
'The settings_type metavar contains translations for ' |
1725 | 1946 |
'either "global settings" or "service-specific settings"; ' |
1726 | 1947 |
'see the CANNOT_UPDATE_SETTINGS_METAVAR_SETTINGS_TYPE_GLOBAL and ' |
... | ... |
@@ -1739,14 +1960,16 @@ class ErrMsgTemplate(enum.Enum): |
1739 | 1960 |
'or --phrase or --key.', |
1740 | 1961 |
flags='python-brace-format', |
1741 | 1962 |
) |
1742 |
- INVALID_USER_CONFIG = _Commented( |
|
1963 |
+ """""" |
|
1964 |
+ INVALID_USER_CONFIG = commented( |
|
1743 | 1965 |
'"error" is supplied by the operating system (errno/strerror).', |
1744 | 1966 |
)( |
1745 | 1967 |
'Error message', |
1746 | 1968 |
'The user configuration file is invalid. {error!s}: {filename!r}.', |
1747 | 1969 |
flags='python-brace-format', |
1748 | 1970 |
) |
1749 |
- INVALID_VAULT_CONFIG = _Commented( |
|
1971 |
+ """""" |
|
1972 |
+ INVALID_VAULT_CONFIG = commented( |
|
1750 | 1973 |
'This error message is a reaction to a validator function ' |
1751 | 1974 |
'saying *that* the configuration is not valid, ' |
1752 | 1975 |
'but not *how* it is not valid. ' |
... | ... |
@@ -1756,41 +1979,47 @@ class ErrMsgTemplate(enum.Enum): |
1756 | 1979 |
'Invalid vault config: {config!r}.', |
1757 | 1980 |
flags='python-brace-format', |
1758 | 1981 |
) |
1759 |
- MISSING_MODULE = _Commented( |
|
1982 |
+ """""" |
|
1983 |
+ MISSING_MODULE = commented( |
|
1760 | 1984 |
'', |
1761 | 1985 |
)( |
1762 | 1986 |
'Error message', |
1763 | 1987 |
'Cannot load the required Python module {module!r}.', |
1764 | 1988 |
flags='python-brace-format', |
1765 | 1989 |
) |
1766 |
- NO_AF_UNIX = _Commented( |
|
1990 |
+ """""" |
|
1991 |
+ NO_AF_UNIX = commented( |
|
1767 | 1992 |
'', |
1768 | 1993 |
)( |
1769 | 1994 |
'Error message', |
1770 | 1995 |
'Cannot connect to an SSH agent because this Python version ' |
1771 | 1996 |
'does not support UNIX domain sockets.', |
1772 | 1997 |
) |
1773 |
- NO_KEY_OR_PHRASE = _Commented( |
|
1998 |
+ """""" |
|
1999 |
+ NO_KEY_OR_PHRASE = commented( |
|
1774 | 2000 |
'', |
1775 | 2001 |
)( |
1776 | 2002 |
'Error message', |
1777 | 2003 |
'No passphrase or key was given in the configuration. ' |
1778 | 2004 |
'In this case, the --phrase or --key argument is required.', |
1779 | 2005 |
) |
1780 |
- NO_SSH_AGENT_FOUND = _Commented( |
|
2006 |
+ """""" |
|
2007 |
+ NO_SSH_AGENT_FOUND = commented( |
|
1781 | 2008 |
'', |
1782 | 2009 |
)( |
1783 | 2010 |
'Error message', |
1784 | 2011 |
'Cannot find any running SSH agent because SSH_AUTH_SOCK is not set.', |
1785 | 2012 |
) |
1786 |
- NO_SUITABLE_SSH_KEYS = _Commented( |
|
2013 |
+ """""" |
|
2014 |
+ NO_SUITABLE_SSH_KEYS = commented( |
|
1787 | 2015 |
'', |
1788 | 2016 |
)( |
1789 | 2017 |
'Error message', |
1790 | 2018 |
'The SSH agent contains no keys suitable for {PROG_NAME!s}.', # noqa: RUF027 |
1791 | 2019 |
flags='python-brace-format', |
1792 | 2020 |
) |
1793 |
- PARAMS_MUTUALLY_EXCLUSIVE = _Commented( |
|
2021 |
+ """""" |
|
2022 |
+ PARAMS_MUTUALLY_EXCLUSIVE = commented( |
|
1794 | 2023 |
'The params are long-form command-line option names. ' |
1795 | 2024 |
'Typical example: "--key is mutually exclusive with --phrase."', |
1796 | 2025 |
)( |
... | ... |
@@ -1798,7 +2027,8 @@ class ErrMsgTemplate(enum.Enum): |
1798 | 2027 |
'{param1!s} is mutually exclusive with {param2!s}.', |
1799 | 2028 |
flags='python-brace-format', |
1800 | 2029 |
) |
1801 |
- PARAMS_NEEDS_SERVICE_OR_CONFIG = _Commented( |
|
2030 |
+ """""" |
|
2031 |
+ PARAMS_NEEDS_SERVICE_OR_CONFIG = commented( |
|
1802 | 2032 |
'The param is a long-form command-line option name, ' |
1803 | 2033 |
'the metavar is Label.VAULT_METAVAR_SERVICE.', |
1804 | 2034 |
)( |
... | ... |
@@ -1806,7 +2036,8 @@ class ErrMsgTemplate(enum.Enum): |
1806 | 2036 |
'{param!s} requires a {service_metavar!s} or --config.', |
1807 | 2037 |
flags='python-brace-format', |
1808 | 2038 |
) |
1809 |
- PARAMS_NEEDS_SERVICE = _Commented( |
|
2039 |
+ """""" |
|
2040 |
+ PARAMS_NEEDS_SERVICE = commented( |
|
1810 | 2041 |
'The param is a long-form command-line option name, ' |
1811 | 2042 |
'the metavar is Label.VAULT_METAVAR_SERVICE.', |
1812 | 2043 |
)( |
... | ... |
@@ -1814,7 +2045,8 @@ class ErrMsgTemplate(enum.Enum): |
1814 | 2045 |
'{param!s} requires a {service_metavar!s}.', |
1815 | 2046 |
flags='python-brace-format', |
1816 | 2047 |
) |
1817 |
- PARAMS_NO_SERVICE = _Commented( |
|
2048 |
+ """""" |
|
2049 |
+ PARAMS_NO_SERVICE = commented( |
|
1818 | 2050 |
'The param is a long-form command-line option name, ' |
1819 | 2051 |
'the metavar is Label.VAULT_METAVAR_SERVICE.', |
1820 | 2052 |
)( |
... | ... |
@@ -1822,14 +2054,16 @@ class ErrMsgTemplate(enum.Enum): |
1822 | 2054 |
'{param!s} does not take a {service_metavar!s} argument.', |
1823 | 2055 |
flags='python-brace-format', |
1824 | 2056 |
) |
1825 |
- SERVICE_REQUIRED = _Commented( |
|
2057 |
+ """""" |
|
2058 |
+ SERVICE_REQUIRED = commented( |
|
1826 | 2059 |
'The metavar is Label.VAULT_METAVAR_SERVICE.', |
1827 | 2060 |
)( |
1828 | 2061 |
'Error message', |
1829 | 2062 |
'Deriving a passphrase requires a {service_metavar!s}.', |
1830 | 2063 |
flags='python-brace-format', |
1831 | 2064 |
) |
1832 |
- SET_AND_UNSET_SAME_SETTING = _Commented( |
|
2065 |
+ """""" |
|
2066 |
+ SET_AND_UNSET_SAME_SETTING = commented( |
|
1833 | 2067 |
'The rephrasing ' |
1834 | 2068 |
'"Attempted to unset and set the same setting ' |
1835 | 2069 |
'(--unset={setting!s} --{setting!s}=...) at the same time."' |
... | ... |
@@ -1839,33 +2073,38 @@ class ErrMsgTemplate(enum.Enum): |
1839 | 2073 |
'Attempted to unset and set --{setting!s} at the same time.', |
1840 | 2074 |
flags='python-brace-format', |
1841 | 2075 |
) |
1842 |
- SSH_KEY_NOT_LOADED = _Commented( |
|
2076 |
+ """""" |
|
2077 |
+ SSH_KEY_NOT_LOADED = commented( |
|
1843 | 2078 |
'', |
1844 | 2079 |
)( |
1845 | 2080 |
'Error message', |
1846 | 2081 |
'The requested SSH key is not loaded into the agent.', |
1847 | 2082 |
) |
1848 |
- USER_ABORTED_EDIT = _Commented( |
|
2083 |
+ """""" |
|
2084 |
+ USER_ABORTED_EDIT = commented( |
|
1849 | 2085 |
'The user requested to edit the notes for a service, ' |
1850 | 2086 |
'but aborted the request mid-editing.', |
1851 | 2087 |
)( |
1852 | 2088 |
'Error message', |
1853 | 2089 |
'Not saving any new notes: the user aborted the request.', |
1854 | 2090 |
) |
1855 |
- USER_ABORTED_PASSPHRASE = _Commented( |
|
2091 |
+ """""" |
|
2092 |
+ USER_ABORTED_PASSPHRASE = commented( |
|
1856 | 2093 |
'The user was prompted for a master passphrase, ' |
1857 | 2094 |
'but aborted the request.', |
1858 | 2095 |
)( |
1859 | 2096 |
'Error message', |
1860 | 2097 |
'No passphrase was given; the user aborted the request.', |
1861 | 2098 |
) |
1862 |
- USER_ABORTED_SSH_KEY_SELECTION = _Commented( |
|
2099 |
+ """""" |
|
2100 |
+ USER_ABORTED_SSH_KEY_SELECTION = commented( |
|
1863 | 2101 |
'The user was prompted to select a master SSH key, ' |
1864 | 2102 |
'but aborted the request.', |
1865 | 2103 |
)( |
1866 | 2104 |
'Error message', |
1867 | 2105 |
'No SSH key was selected; the user aborted the request.', |
1868 | 2106 |
) |
2107 |
+ """""" |
|
1869 | 2108 |
|
1870 | 2109 |
|
1871 | 2110 |
MsgTemplate: TypeAlias = Union[ |
... | ... |
@@ -1875,6 +2114,7 @@ MsgTemplate: TypeAlias = Union[ |
1875 | 2114 |
WarnMsgTemplate, |
1876 | 2115 |
ErrMsgTemplate, |
1877 | 2116 |
] |
2117 |
+"""A type alias for all enums containing translatable strings as values.""" |
|
1878 | 2118 |
MSG_TEMPLATE_CLASSES = ( |
1879 | 2119 |
Label, |
1880 | 2120 |
DebugMsgTemplate, |
... | ... |
@@ -1882,6 +2122,7 @@ MSG_TEMPLATE_CLASSES = ( |
1882 | 2122 |
WarnMsgTemplate, |
1883 | 2123 |
ErrMsgTemplate, |
1884 | 2124 |
) |
2125 |
+"""A collection all enums containing translatable strings as values.""" |
|
1885 | 2126 |
|
1886 | 2127 |
DebugTranslations._load_cache() # noqa: SLF001 |
1887 | 2128 |
|
1888 | 2129 |