Remove license text from some docstrings in `derivepassphrase.cli`
Marco Ricci

Marco Ricci commited on 2025-01-19 13:49:11
Zeige 1 geänderte Dateien mit 58 Einfügungen und 284 Löschungen.


The license of some parts of the code is clearly an implementation
detail: you have to read the source code to make any use of this license
information.  Accordingly, it does not belong in the rendered API
documentation.  So take it out of the docstrings, and put it into inline
code comments.

Apart from that, also include only *one* copy of the license text and
have all other affected methods refer to that copy instead.
... ...
@@ -431,6 +431,46 @@ class StandardOption(OptionGroupOption):
431 431
     pass
432 432
 
433 433
 
434
+# Portions of this class are based directly on code from click 8.1.
435
+# (This does not in general include docstrings, unless otherwise noted.)
436
+# They are subject to the 3-clause BSD license in the following
437
+# paragraphs.  Modifications to their code are marked with respective
438
+# comments; they too are released under the same license below.  The
439
+# original code did not contain any "noqa" or "pragma" comments.
440
+#
441
+#     Copyright 2024 Pallets
442
+#
443
+#     Redistribution and use in source and binary forms, with or
444
+#     without modification, are permitted provided that the
445
+#     following conditions are met:
446
+#
447
+#      1. Redistributions of source code must retain the above
448
+#         copyright notice, this list of conditions and the
449
+#         following disclaimer.
450
+#
451
+#      2. Redistributions in binary form must reproduce the above
452
+#         copyright notice, this list of conditions and the
453
+#         following disclaimer in the documentation and/or other
454
+#         materials provided with the distribution.
455
+#
456
+#      3. Neither the name of the copyright holder nor the names
457
+#         of its contributors may be used to endorse or promote
458
+#         products derived from this software without specific
459
+#         prior written permission.
460
+#
461
+#     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
462
+#     CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
463
+#     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
464
+#     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
465
+#     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
466
+#     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
467
+#     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
468
+#     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
469
+#     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
470
+#     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
471
+#     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
472
+#     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
473
+#     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
434 474
 class CommandWithHelpGroups(click.Command):
435 475
     """A [`click.Command`][] with support for some help text customizations.
436 476
 
... ...
@@ -452,50 +492,11 @@ class CommandWithHelpGroups(click.Command):
452 492
             return '\n\n'.join(str(x) for x in text)
453 493
         return str(text)
454 494
 
495
+    # This method is based on click 8.1; see the comment above the class
496
+    # declaration for license details.
455 497
     def collect_usage_pieces(self, ctx: click.Context) -> list[str]:
456 498
         """Return the pieces for the usage string.
457 499
 
458
-        Based on code from click 8.1.  Subject to the following license
459
-        (3-clause BSD license):
460
-
461
-            Copyright 2024 Pallets
462
-
463
-            Redistribution and use in source and binary forms, with or
464
-            without modification, are permitted provided that the
465
-            following conditions are met:
466
-
467
-             1. Redistributions of source code must retain the above
468
-                copyright notice, this list of conditions and the
469
-                following disclaimer.
470
-
471
-             2. Redistributions in binary form must reproduce the above
472
-                copyright notice, this list of conditions and the
473
-                following disclaimer in the documentation and/or other
474
-                materials provided with the distribution.
475
-
476
-             3. Neither the name of the copyright holder nor the names
477
-                of its contributors may be used to endorse or promote
478
-                products derived from this software without specific
479
-                prior written permission.
480
-
481
-            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
482
-            CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
483
-            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
484
-            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
485
-            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
486
-            CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
487
-            SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
488
-            NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
489
-            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
490
-            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
491
-            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
492
-            OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
493
-            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
494
-
495
-        Modifications are marked with respective comments.  They too are
496
-        released under the same license above.  The original code did
497
-        not contain any "noqa" or "pragma" comments.
498
-
499 500
         Args:
500 501
             ctx:
501 502
                 The click context.
... ...
@@ -506,53 +507,14 @@ class CommandWithHelpGroups(click.Command):
506 507
             rv.extend(str(x) for x in param.get_usage_pieces(ctx))
507 508
         return rv
508 509
 
510
+    # This method is based on click 8.1; see the comment above the class
511
+    # declaration for license details.
509 512
     def get_help_option(
510 513
         self,
511 514
         ctx: click.Context,
512 515
     ) -> click.Option | None:
513 516
         """Return a standard help option object.
514 517
 
515
-        Based on code from click 8.1.  Subject to the following license
516
-        (3-clause BSD license):
517
-
518
-            Copyright 2024 Pallets
519
-
520
-            Redistribution and use in source and binary forms, with or
521
-            without modification, are permitted provided that the
522
-            following conditions are met:
523
-
524
-             1. Redistributions of source code must retain the above
525
-                copyright notice, this list of conditions and the
526
-                following disclaimer.
527
-
528
-             2. Redistributions in binary form must reproduce the above
529
-                copyright notice, this list of conditions and the
530
-                following disclaimer in the documentation and/or other
531
-                materials provided with the distribution.
532
-
533
-             3. Neither the name of the copyright holder nor the names
534
-                of its contributors may be used to endorse or promote
535
-                products derived from this software without specific
536
-                prior written permission.
537
-
538
-            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
539
-            CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
540
-            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
541
-            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
542
-            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
543
-            CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
544
-            SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
545
-            NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
546
-            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
547
-            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
548
-            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
549
-            OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
550
-            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
551
-
552
-        Modifications are marked with respective comments.  They too are
553
-        released under the same license above.  The original code did
554
-        not contain any "noqa" or "pragma" comments.
555
-
556 518
         Args:
557 519
             ctx:
558 520
                 The click context.
... ...
@@ -583,6 +545,8 @@ class CommandWithHelpGroups(click.Command):
583 545
             help=_msg.TranslatedString(_msg.Label.HELP_OPTION_HELP_TEXT),
584 546
         )
585 547
 
548
+    # This method is based on click 8.1; see the comment above the class
549
+    # declaration for license details.
586 550
     def get_short_help_str(
587 551
         self,
588 552
         limit: int = 45,
... ...
@@ -591,47 +555,6 @@ class CommandWithHelpGroups(click.Command):
591 555
 
592 556
         If only a long help string is given, shorten it.
593 557
 
594
-        Based on code from click 8.1.  Subject to the following license
595
-        (3-clause BSD license):
596
-
597
-            Copyright 2024 Pallets
598
-
599
-            Redistribution and use in source and binary forms, with or
600
-            without modification, are permitted provided that the
601
-            following conditions are met:
602
-
603
-             1. Redistributions of source code must retain the above
604
-                copyright notice, this list of conditions and the
605
-                following disclaimer.
606
-
607
-             2. Redistributions in binary form must reproduce the above
608
-                copyright notice, this list of conditions and the
609
-                following disclaimer in the documentation and/or other
610
-                materials provided with the distribution.
611
-
612
-             3. Neither the name of the copyright holder nor the names
613
-                of its contributors may be used to endorse or promote
614
-                products derived from this software without specific
615
-                prior written permission.
616
-
617
-            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
618
-            CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
619
-            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
620
-            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
621
-            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
622
-            CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
623
-            SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
624
-            NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
625
-            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
626
-            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
627
-            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
628
-            OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
629
-            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
630
-
631
-        Modifications are marked with respective comments.  They too are
632
-        released under the same license above.  The original code did
633
-        not contain any "noqa" or "pragma" comments.
634
-
635 558
         Args:
636 559
             limit:
637 560
                 The maximum width of the short help string.
... ...
@@ -658,6 +581,8 @@ class CommandWithHelpGroups(click.Command):
658 581
             ).format(text=text)
659 582
         return text.strip()
660 583
 
584
+    # This method is based on click 8.1; see the comment above the class
585
+    # declaration for license details.
661 586
     def format_help_text(
662 587
         self,
663 588
         ctx: click.Context,
... ...
@@ -665,47 +590,6 @@ class CommandWithHelpGroups(click.Command):
665 590
     ) -> None:
666 591
         """Format the help text prologue, if any.
667 592
 
668
-        Based on code from click 8.1.  Subject to the following license
669
-        (3-clause BSD license):
670
-
671
-            Copyright 2024 Pallets
672
-
673
-            Redistribution and use in source and binary forms, with or
674
-            without modification, are permitted provided that the
675
-            following conditions are met:
676
-
677
-             1. Redistributions of source code must retain the above
678
-                copyright notice, this list of conditions and the
679
-                following disclaimer.
680
-
681
-             2. Redistributions in binary form must reproduce the above
682
-                copyright notice, this list of conditions and the
683
-                following disclaimer in the documentation and/or other
684
-                materials provided with the distribution.
685
-
686
-             3. Neither the name of the copyright holder nor the names
687
-                of its contributors may be used to endorse or promote
688
-                products derived from this software without specific
689
-                prior written permission.
690
-
691
-            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
692
-            CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
693
-            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
694
-            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
695
-            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
696
-            CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
697
-            SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
698
-            NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
699
-            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
700
-            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
701
-            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
702
-            OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
703
-            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
704
-
705
-        Modifications are marked with respective comments.  They too are
706
-        released under the same license above.  The original code did
707
-        not contain any "noqa" or "pragma" comments.
708
-
709 593
         Args:
710 594
             ctx:
711 595
                 The click context.
... ...
@@ -735,6 +619,10 @@ class CommandWithHelpGroups(click.Command):
735 619
             with formatter.indentation():
736 620
                 formatter.write_text(text)
737 621
 
622
+    # This method is based on click 8.1; see the comment above the class
623
+    # declaration for license details.  Consider the whole section
624
+    # marked as modified; the code modifications are too numerous to
625
+    # mark individually.
738 626
     def format_options(
739 627
         self,
740 628
         ctx: click.Context,
... ...
@@ -757,45 +645,6 @@ class CommandWithHelpGroups(click.Command):
757 645
         We unconditionally call [`format_commands`][], and rely on it to
758 646
         act as a no-op if we aren't actually a [`click.MultiCommand`][].
759 647
 
760
-        Based on code from click 8.1.  Subject to the following license
761
-        (3-clause BSD license):
762
-
763
-            Copyright 2024 Pallets
764
-
765
-            Redistribution and use in source and binary forms, with or
766
-            without modification, are permitted provided that the
767
-            following conditions are met:
768
-
769
-             1. Redistributions of source code must retain the above
770
-                copyright notice, this list of conditions and the
771
-                following disclaimer.
772
-
773
-             2. Redistributions in binary form must reproduce the above
774
-                copyright notice, this list of conditions and the
775
-                following disclaimer in the documentation and/or other
776
-                materials provided with the distribution.
777
-
778
-             3. Neither the name of the copyright holder nor the names
779
-                of its contributors may be used to endorse or promote
780
-                products derived from this software without specific
781
-                prior written permission.
782
-
783
-            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
784
-            CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
785
-            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
786
-            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
787
-            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
788
-            CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
789
-            SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
790
-            NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
791
-            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
792
-            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
793
-            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
794
-            OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
795
-            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
796
-
797
-        Modifications are released under the same license above.
798
-
799 648
         Args:
800 649
             ctx:
801 650
                 The click context.
... ...
@@ -843,6 +692,10 @@ class CommandWithHelpGroups(click.Command):
843 692
                     formatter.write_text(epilog)
844 693
         self.format_commands(ctx, formatter)
845 694
 
695
+    # This method is based on click 8.1; see the comment above the class
696
+    # declaration for license details.  Consider the whole section
697
+    # marked as modified; the code modifications are too numerous to
698
+    # mark individually.
846 699
     def format_commands(
847 700
         self,
848 701
         ctx: click.Context,
... ...
@@ -853,47 +706,6 @@ class CommandWithHelpGroups(click.Command):
853 706
         If called on a command object that isn't derived from
854 707
         [`click.MultiCommand`][], then do nothing.
855 708
 
856
-        Based on code from click 8.1.  Subject to the following license
857
-        (3-clause BSD license):
858
-
859
-            Copyright 2024 Pallets
860
-
861
-            Redistribution and use in source and binary forms, with or
862
-            without modification, are permitted provided that the
863
-            following conditions are met:
864
-
865
-             1. Redistributions of source code must retain the above
866
-                copyright notice, this list of conditions and the
867
-                following disclaimer.
868
-
869
-             2. Redistributions in binary form must reproduce the above
870
-                copyright notice, this list of conditions and the
871
-                following disclaimer in the documentation and/or other
872
-                materials provided with the distribution.
873
-
874
-             3. Neither the name of the copyright holder nor the names
875
-                of its contributors may be used to endorse or promote
876
-                products derived from this software without specific
877
-                prior written permission.
878
-
879
-            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
880
-            CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
881
-            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
882
-            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
883
-            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
884
-            CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
885
-            SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
886
-            NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
887
-            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
888
-            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
889
-            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
890
-            OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
891
-            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
892
-
893
-        Modifications are marked with respective comments.  They too are
894
-        released under the same license above.  The original code did
895
-        not contain any "noqa" or "pragma" comments.
896
-
897 709
         Args:
898 710
             ctx:
899 711
                 The click context.
... ...
@@ -923,6 +735,8 @@ class CommandWithHelpGroups(click.Command):
923 735
                 with formatter.section(commands_label):
924 736
                     formatter.write_dl(rows)
925 737
 
738
+    # This method is based on click 8.1; see the comment above the class
739
+    # declaration for license details.
926 740
     def format_epilog(
927 741
         self,
928 742
         ctx: click.Context,
... ...
@@ -930,46 +744,6 @@ class CommandWithHelpGroups(click.Command):
930 744
     ) -> None:
931 745
         """Format the epilog, if any.
932 746
 
933
-        Based on code from click 8.1.  Subject to the following license
934
-        (3-clause BSD license):
935
-
936
-            Copyright 2024 Pallets
937
-
938
-            Redistribution and use in source and binary forms, with or
939
-            without modification, are permitted provided that the
940
-            following conditions are met:
941
-
942
-             1. Redistributions of source code must retain the above
943
-                copyright notice, this list of conditions and the
944
-                following disclaimer.
945
-
946
-             2. Redistributions in binary form must reproduce the above
947
-                copyright notice, this list of conditions and the
948
-                following disclaimer in the documentation and/or other
949
-                materials provided with the distribution.
950
-
951
-             3. Neither the name of the copyright holder nor the names
952
-                of its contributors may be used to endorse or promote
953
-                products derived from this software without specific
954
-                prior written permission.
955
-
956
-            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
957
-            CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
958
-            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
959
-            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
960
-            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
961
-            CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
962
-            SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
963
-            NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
964
-            LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
965
-            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
966
-            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
967
-            OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
968
-            SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
969
-
970
-        Modifications are marked with respective comments.  They too are
971
-        released under the same license above.
972
-
973 747
         Args:
974 748
             ctx:
975 749
                 The click context.
976 750