<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Cradicle Explorer</title>
    <link href="/css/bootstrap/bootstrap.min.css" rel="stylesheet">
    <style>
      .form-control-dark::placeholder {
          color: #aaa;
          opacity: 1;
      }
    </style>
    <link rel="stylesheet" href="/assets/fontawesome/css/all.min.css">
    <link rel="icon" type="image/png" href="/favicon.png">


                <link href="/css/dashboard.css" rel="stylesheet">
                </head>
                <body>
                <header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
                  <a class="navbar-brand col-md-3 col-lg-2 me-0 px-3 fs-6" href="/">Cradicle Explorer</a>
                  <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                  </button>
                  <form method="get" action="/cgi-bin/main" style="width:100%;"><input class="form-control form-control-dark w-100 rounded-0 border-0" type="text" name="q" placeholder="Search repos" aria-label="Search"></form>
                  <div class="navbar-nav flex-row">
                    <div class="nav-item text-nowrap">
                      <a class="nav-link px-3 active" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9">docstrings2pep727</a>
                    </div>
                  </div>
                </header>
                <div class="container-fluid">
                  <div class="row">
                    <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-dark sidebar collapse">
                      <div class="position-sticky pt-3 sidebar-sticky">
                        <ul class="nav flex-column">
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9">
                              <i class="align-text-bottom fa-solid fa-info"></i>
                              Info
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&issue=list">
                              <i class="align-text-bottom fa-solid fa-layer-group"></i>
                              Issues
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&patch=list">
                              <i class="align-text-bottom fa-solid fa-vest-patches"></i>
                              Patches
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&wallet=list">
                              <i class="align-text-bottom fa-solid fa-wallet"></i>
                              Wallets
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link active" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=.">
                              <i class="align-text-bottom fa-solid fa-code"></i>
                              Source
                            </a>
                          </li>
                        <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted text-uppercase">
                          <span></span>
                        </h6>
                        <ul class="nav flex-column mb-2">
                        
    <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-1 mb-1 text-muted text-uppercase">
      <span>Source</span>
    </h6>
    <li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=.github"><i class="fa-solid fa-folder" style="color:#f0c040;"></i> .github</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=config"><i class="fa-solid fa-folder" style="color:#f0c040;"></i> config</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=docs"><i class="fa-solid fa-folder" style="color:#f0c040;"></i> docs</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=scripts"><i class="fa-solid fa-folder-open" style="color:#f0c040;"></i> scripts</a></li><li><a class="nav-link py-0 active" style="padding-left:32px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=scripts%2Fgen_credits.py"><i class="fa-solid fa-file" style="color:#888;"></i> gen_credits.py</a></li><li><a class="nav-link py-0" style="padding-left:32px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=scripts%2Fgen_ref_nav.py"><i class="fa-solid fa-file" style="color:#888;"></i> gen_ref_nav.py</a></li><li><a class="nav-link py-0" style="padding-left:32px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=scripts%2Fsetup.sh"><i class="fa-solid fa-file" style="color:#888;"></i> setup.sh</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=src"><i class="fa-solid fa-folder" style="color:#f0c040;"></i> src</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=tests"><i class="fa-solid fa-folder" style="color:#f0c040;"></i> tests</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=.copier-answers.yml"><i class="fa-solid fa-file" style="color:#888;"></i> .copier-answers.yml</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=.gitignore"><i class="fa-solid fa-file" style="color:#888;"></i> .gitignore</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=.gitpod.dockerfile"><i class="fa-solid fa-file" style="color:#888;"></i> .gitpod.dockerfile</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=.gitpod.yml"><i class="fa-solid fa-file" style="color:#888;"></i> .gitpod.yml</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=CHANGELOG.md"><i class="fa-solid fa-file" style="color:#888;"></i> CHANGELOG.md</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=CODE_OF_CONDUCT.md"><i class="fa-solid fa-file" style="color:#888;"></i> CODE_OF_CONDUCT.md</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=CONTRIBUTING.md"><i class="fa-solid fa-file" style="color:#888;"></i> CONTRIBUTING.md</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=LICENSE"><i class="fa-solid fa-file" style="color:#888;"></i> LICENSE</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=Makefile"><i class="fa-solid fa-file" style="color:#888;"></i> Makefile</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=README.md"><i class="fa-solid fa-file" style="color:#888;"></i> README.md</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=dummy.py"><i class="fa-solid fa-file" style="color:#888;"></i> dummy.py</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=duties.py"><i class="fa-solid fa-file" style="color:#888;"></i> duties.py</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=mkdocs.yml"><i class="fa-solid fa-file" style="color:#888;"></i> mkdocs.yml</a></li><li><a class="nav-link py-0" style="padding-left:16px;" href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&file=pyproject.toml"><i class="fa-solid fa-file" style="color:#888;"></i> pyproject.toml</a></li>
    
                        </ul>
                      </div>
                    </nav>
                <main class="col-md-9 ms-sm-auto col-lg-10">
                  <div class="container px-1 py-3">
        
<div class="mb-2" style="font-size:1.1rem;"><a href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=.">/</a> <a href="/cgi-bin/repo?id=z4YP4GCCHeUakLxeNeE43cZ8DHCf9&source=scripts">scripts</a> / gen_credits.py</div>
        <div class="list-group">
        <div class="list-group-item">
        <div class="mb-2" style="font-weight:bold;"><i class="fa-solid fa-file"></i> gen_credits.py</div>
        <pre style="margin:0; font-size:0.85rem; overflow-x:auto; color:#fafafa;"><span style="color:#666; user-select:none;">  1</span>  &quot;&quot;&quot;Script to generate the project&#x27;s credits.&quot;&quot;&quot;
<span style="color:#666; user-select:none;">  2</span>  
<span style="color:#666; user-select:none;">  3</span>  from __future__ import annotations
<span style="color:#666; user-select:none;">  4</span>  
<span style="color:#666; user-select:none;">  5</span>  import os
<span style="color:#666; user-select:none;">  6</span>  import re
<span style="color:#666; user-select:none;">  7</span>  import sys
<span style="color:#666; user-select:none;">  8</span>  from importlib.metadata import PackageNotFoundError, metadata
<span style="color:#666; user-select:none;">  9</span>  from itertools import chain
<span style="color:#666; user-select:none;"> 10</span>  from pathlib import Path
<span style="color:#666; user-select:none;"> 11</span>  from textwrap import dedent
<span style="color:#666; user-select:none;"> 12</span>  from typing import Mapping, cast
<span style="color:#666; user-select:none;"> 13</span>  
<span style="color:#666; user-select:none;"> 14</span>  from jinja2 import StrictUndefined
<span style="color:#666; user-select:none;"> 15</span>  from jinja2.sandbox import SandboxedEnvironment
<span style="color:#666; user-select:none;"> 16</span>  
<span style="color:#666; user-select:none;"> 17</span>  # TODO: Remove once support for Python 3.10 is dropped.
<span style="color:#666; user-select:none;"> 18</span>  if sys.version_info &gt;= (3, 11):
<span style="color:#666; user-select:none;"> 19</span>      import tomllib
<span style="color:#666; user-select:none;"> 20</span>  else:
<span style="color:#666; user-select:none;"> 21</span>      import tomli as tomllib
<span style="color:#666; user-select:none;"> 22</span>  
<span style="color:#666; user-select:none;"> 23</span>  project_dir = Path(os.getenv(&quot;MKDOCS_CONFIG_DIR&quot;, &quot;.&quot;))
<span style="color:#666; user-select:none;"> 24</span>  with project_dir.joinpath(&quot;pyproject.toml&quot;).open(&quot;rb&quot;) as pyproject_file:
<span style="color:#666; user-select:none;"> 25</span>      pyproject = tomllib.load(pyproject_file)
<span style="color:#666; user-select:none;"> 26</span>  project = pyproject[&quot;project&quot;]
<span style="color:#666; user-select:none;"> 27</span>  pdm = pyproject[&quot;tool&quot;][&quot;pdm&quot;]
<span style="color:#666; user-select:none;"> 28</span>  with project_dir.joinpath(&quot;pdm.lock&quot;).open(&quot;rb&quot;) as lock_file:
<span style="color:#666; user-select:none;"> 29</span>      lock_data = tomllib.load(lock_file)
<span style="color:#666; user-select:none;"> 30</span>  lock_pkgs = {pkg[&quot;name&quot;].lower(): pkg for pkg in lock_data[&quot;package&quot;]}
<span style="color:#666; user-select:none;"> 31</span>  project_name = project[&quot;name&quot;]
<span style="color:#666; user-select:none;"> 32</span>  regex = re.compile(r&quot;(?P&lt;dist&gt;[\w.-]+)(?P&lt;spec&gt;.*)$&quot;)
<span style="color:#666; user-select:none;"> 33</span>  
<span style="color:#666; user-select:none;"> 34</span>  
<span style="color:#666; user-select:none;"> 35</span>  def _get_license(pkg_name: str) -&gt; str:
<span style="color:#666; user-select:none;"> 36</span>      try:
<span style="color:#666; user-select:none;"> 37</span>          data = metadata(pkg_name)
<span style="color:#666; user-select:none;"> 38</span>      except PackageNotFoundError:
<span style="color:#666; user-select:none;"> 39</span>          return &quot;?&quot;
<span style="color:#666; user-select:none;"> 40</span>      license_name = cast(dict, data).get(&quot;License&quot;, &quot;&quot;).strip()
<span style="color:#666; user-select:none;"> 41</span>      multiple_lines = bool(license_name.count(&quot;\n&quot;))
<span style="color:#666; user-select:none;"> 42</span>      # TODO: Remove author logic once all my packages licenses are fixed.
<span style="color:#666; user-select:none;"> 43</span>      author = &quot;&quot;
<span style="color:#666; user-select:none;"> 44</span>      if multiple_lines or not license_name or license_name == &quot;UNKNOWN&quot;:
<span style="color:#666; user-select:none;"> 45</span>          for header, value in cast(dict, data).items():
<span style="color:#666; user-select:none;"> 46</span>              if header == &quot;Classifier&quot; and value.startswith(&quot;License ::&quot;):
<span style="color:#666; user-select:none;"> 47</span>                  license_name = value.rsplit(&quot;::&quot;, 1)[1].strip()
<span style="color:#666; user-select:none;"> 48</span>              elif header == &quot;Author-email&quot;:
<span style="color:#666; user-select:none;"> 49</span>                  author = value
<span style="color:#666; user-select:none;"> 50</span>      if license_name == &quot;Other/Proprietary License&quot; and &quot;pawamoy&quot; in author:
<span style="color:#666; user-select:none;"> 51</span>          license_name = &quot;ISC&quot;
<span style="color:#666; user-select:none;"> 52</span>      return license_name or &quot;?&quot;
<span style="color:#666; user-select:none;"> 53</span>  
<span style="color:#666; user-select:none;"> 54</span>  
<span style="color:#666; user-select:none;"> 55</span>  def _get_deps(base_deps: Mapping[str, Mapping[str, str]]) -&gt; dict[str, dict[str, str]]:
<span style="color:#666; user-select:none;"> 56</span>      deps = {}
<span style="color:#666; user-select:none;"> 57</span>      for dep in base_deps:
<span style="color:#666; user-select:none;"> 58</span>          parsed = regex.match(dep).groupdict()  # type: ignore[union-attr]
<span style="color:#666; user-select:none;"> 59</span>          dep_name = parsed[&quot;dist&quot;].lower()
<span style="color:#666; user-select:none;"> 60</span>          if dep_name not in lock_pkgs:
<span style="color:#666; user-select:none;"> 61</span>              continue
<span style="color:#666; user-select:none;"> 62</span>          deps[dep_name] = {&quot;license&quot;: _get_license(dep_name), **parsed, **lock_pkgs[dep_name]}
<span style="color:#666; user-select:none;"> 63</span>  
<span style="color:#666; user-select:none;"> 64</span>      again = True
<span style="color:#666; user-select:none;"> 65</span>      while again:
<span style="color:#666; user-select:none;"> 66</span>          again = False
<span style="color:#666; user-select:none;"> 67</span>          for pkg_name in lock_pkgs:
<span style="color:#666; user-select:none;"> 68</span>              if pkg_name in deps:
<span style="color:#666; user-select:none;"> 69</span>                  for pkg_dependency in lock_pkgs[pkg_name].get(&quot;dependencies&quot;, []):
<span style="color:#666; user-select:none;"> 70</span>                      parsed = regex.match(pkg_dependency).groupdict()  # type: ignore[union-attr]
<span style="color:#666; user-select:none;"> 71</span>                      dep_name = parsed[&quot;dist&quot;].lower()
<span style="color:#666; user-select:none;"> 72</span>                      if dep_name in lock_pkgs and dep_name not in deps and dep_name != project[&quot;name&quot;]:
<span style="color:#666; user-select:none;"> 73</span>                          deps[dep_name] = {&quot;license&quot;: _get_license(dep_name), **parsed, **lock_pkgs[dep_name]}
<span style="color:#666; user-select:none;"> 74</span>                          again = True
<span style="color:#666; user-select:none;"> 75</span>  
<span style="color:#666; user-select:none;"> 76</span>      return deps
<span style="color:#666; user-select:none;"> 77</span>  
<span style="color:#666; user-select:none;"> 78</span>  
<span style="color:#666; user-select:none;"> 79</span>  def _render_credits() -&gt; str:
<span style="color:#666; user-select:none;"> 80</span>      dev_dependencies = _get_deps(chain(*pdm.get(&quot;dev-dependencies&quot;, {}).values()))  # type: ignore[arg-type]
<span style="color:#666; user-select:none;"> 81</span>      prod_dependencies = _get_deps(
<span style="color:#666; user-select:none;"> 82</span>          chain(  # type: ignore[arg-type]
<span style="color:#666; user-select:none;"> 83</span>              project.get(&quot;dependencies&quot;, []),
<span style="color:#666; user-select:none;"> 84</span>              chain(*project.get(&quot;optional-dependencies&quot;, {}).values()),
<span style="color:#666; user-select:none;"> 85</span>          ),
<span style="color:#666; user-select:none;"> 86</span>      )
<span style="color:#666; user-select:none;"> 87</span>  
<span style="color:#666; user-select:none;"> 88</span>      template_data = {
<span style="color:#666; user-select:none;"> 89</span>          &quot;project_name&quot;: project_name,
<span style="color:#666; user-select:none;"> 90</span>          &quot;prod_dependencies&quot;: sorted(prod_dependencies.values(), key=lambda dep: dep[&quot;name&quot;]),
<span style="color:#666; user-select:none;"> 91</span>          &quot;dev_dependencies&quot;: sorted(dev_dependencies.values(), key=lambda dep: dep[&quot;name&quot;]),
<span style="color:#666; user-select:none;"> 92</span>          &quot;more_credits&quot;: &quot;http://pawamoy.github.io/credits/&quot;,
<span style="color:#666; user-select:none;"> 93</span>      }
<span style="color:#666; user-select:none;"> 94</span>      template_text = dedent(
<span style="color:#666; user-select:none;"> 95</span>          &quot;&quot;&quot;
<span style="color:#666; user-select:none;"> 96</span>          # Credits
<span style="color:#666; user-select:none;"> 97</span>  
<span style="color:#666; user-select:none;"> 98</span>          These projects were used to build *{{ project_name }}*. **Thank you!**
<span style="color:#666; user-select:none;"> 99</span>  
<span style="color:#666; user-select:none;">100</span>          [`python`](https://www.python.org/) |
<span style="color:#666; user-select:none;">101</span>          [`pdm`](https://pdm.fming.dev/) |
<span style="color:#666; user-select:none;">102</span>          [`copier-pdm`](https://github.com/pawamoy/copier-pdm)
<span style="color:#666; user-select:none;">103</span>  
<span style="color:#666; user-select:none;">104</span>          {% macro dep_line(dep) -%}
<span style="color:#666; user-select:none;">105</span>          [`{{ dep.name }}`](https://pypi.org/project/{{ dep.name }}/) | {{ dep.summary }} | {{ (&quot;`&quot; ~ dep.spec ~ &quot;`&quot;) if dep.spec else &quot;&quot; }} | `{{ dep.version }}` | {{ dep.license }}
<span style="color:#666; user-select:none;">106</span>          {%- endmacro %}
<span style="color:#666; user-select:none;">107</span>  
<span style="color:#666; user-select:none;">108</span>          ### Runtime dependencies
<span style="color:#666; user-select:none;">109</span>  
<span style="color:#666; user-select:none;">110</span>          Project | Summary | Version (accepted) | Version (last resolved) | License
<span style="color:#666; user-select:none;">111</span>          ------- | ------- | ------------------ | ----------------------- | -------
<span style="color:#666; user-select:none;">112</span>          {% for dep in prod_dependencies -%}
<span style="color:#666; user-select:none;">113</span>          {{ dep_line(dep) }}
<span style="color:#666; user-select:none;">114</span>          {% endfor %}
<span style="color:#666; user-select:none;">115</span>  
<span style="color:#666; user-select:none;">116</span>          ### Development dependencies
<span style="color:#666; user-select:none;">117</span>  
<span style="color:#666; user-select:none;">118</span>          Project | Summary | Version (accepted) | Version (last resolved) | License
<span style="color:#666; user-select:none;">119</span>          ------- | ------- | ------------------ | ----------------------- | -------
<span style="color:#666; user-select:none;">120</span>          {% for dep in dev_dependencies -%}
<span style="color:#666; user-select:none;">121</span>          {{ dep_line(dep) }}
<span style="color:#666; user-select:none;">122</span>          {% endfor %}
<span style="color:#666; user-select:none;">123</span>  
<span style="color:#666; user-select:none;">124</span>          {% if more_credits %}**[More credits from the author]({{ more_credits }})**{% endif %}
<span style="color:#666; user-select:none;">125</span>          &quot;&quot;&quot;,
<span style="color:#666; user-select:none;">126</span>      )
<span style="color:#666; user-select:none;">127</span>      jinja_env = SandboxedEnvironment(undefined=StrictUndefined)
<span style="color:#666; user-select:none;">128</span>      return jinja_env.from_string(template_text).render(**template_data)
<span style="color:#666; user-select:none;">129</span>  
<span style="color:#666; user-select:none;">130</span>  
<span style="color:#666; user-select:none;">131</span>  print(_render_credits())
</pre>
        </div>
        </div>

</div>
</main>
</div>
</div>


</body>
</html>

