We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`create_baseline_stubs.py` script does not add default values
As title says. Now that typeshed prefers having default values, it would make sense if the `create_baseline_stubs.py` script added them.
Maybe that would be stubgen's job?
For now I'm running https://github.com/JelleZijlstra/stubdefaulter manually as I am moving stubs out of https://github.com/microsoft/python-type-stubs, but I don't think that's even documented/mentioned in the contributing guidelines.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scripts/create_baseline_stubs.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 """Script to generate unannotated baseline stubs using stubgen.
4 
5 Basic usage:
6 $ python3 scripts/create_baseline_stubs.py <project on PyPI>
7 
8 Run with -h for more help.
9 """
10 
11 from __future__ import annotations
12 
13 import argparse
14 import os
15 import re
16 import subprocess
17 import sys
18 
19 if sys.version_info >= (3, 8):
20     from importlib.metadata import distribution
21 
22 PYRIGHT_CONFIG = "pyrightconfig.stricter.json"
23 
24 
25 def search_pip_freeze_output(project: str, output: str) -> tuple[str, str] | None:
26     # Look for lines such as "typed-ast==1.4.2".  '-' matches '_' and
27     # '_' matches '-' in project name, so that "typed_ast" matches
28     # "typed-ast", and vice versa.
29     regex = "^(" + re.sub(r"[-_]", "[-_]", project) + ")==(.*)"
30     m = re.search(regex, output, flags=re.IGNORECASE | re.MULTILINE)
31     if not m:
32         return None
33     return m.group(1), m.group(2)
34 
35 
36 def get_installed_package_info(project: str) -> tuple[str, str] | None:
37     """Find package information from pip freeze output.
38 
39     Match project name somewhat fuzzily (case sensitive; '-' matches '_', and
40     vice versa).
41 
42     Return (normalized project name, installed version) if successful.
43     """
44     r = subprocess.run(["pip", "freeze"], capture_output=True, text=True, check=True)
45     return search_pip_freeze_output(project, r.stdout)
46 
47 
48 def run_stubgen(package: str, output: str) -> None:
49     print(f"Running stubgen: stubgen -o {output} -p {package}")
50     subprocess.run(["stubgen", "-o", output, "-p", package, "--export-less"], check=True)
51 
52 
53 def run_black(stub_dir: str) -> None:
54     print(f"Running black: black {stub_dir}")
55     subprocess.run(["black", stub_dir])
56 
57 
58 def run_isort(stub_dir: str) -> None:
59     print(f"Running isort: isort {stub_dir}")
60     subprocess.run(["python3", "-m", "isort", stub_dir])
61 
62 
63 def create_metadata(stub_dir: str, version: str) -> None:
64     """Create a METADATA.toml file."""
65     match = re.match(r"[0-9]+.[0-9]+", version)
66     if match is None:
67         sys.exit(f"Error: Cannot parse version number: {version}")
68     filename = os.path.join(stub_dir, "METADATA.toml")
69     version = match.group(0)
70     if os.path.exists(filename):
71         return
72     print(f"Writing {filename}")
73     with open(filename, "w", encoding="UTF-8") as file:
74         file.write(f'version = "{version}.*"')
75 
76 
77 def add_pyright_exclusion(stub_dir: str) -> None:
78     """Exclude stub_dir from strict pyright checks."""
79     with open(PYRIGHT_CONFIG, encoding="UTF-8") as f:
80         lines = f.readlines()
81     i = 0
82     while i < len(lines) and not lines[i].strip().startswith('"exclude": ['):
83         i += 1
84     assert i < len(lines), f"Error parsing {PYRIGHT_CONFIG}"
85     while not lines[i].strip().startswith("]"):
86         i += 1
87     # Must use forward slash in the .json file
88     line_to_add = f'        "{stub_dir}",'.replace("\\", "/")
89     initial = i - 1
90     while lines[i].lower() > line_to_add.lower():
91         i -= 1
92     if lines[i + 1].strip().rstrip(",") == line_to_add.strip().rstrip(","):
93         print(f"{PYRIGHT_CONFIG} already up-to-date")
94         return
95     if i == initial:
96         # Special case: when adding to the end of the list, commas need tweaking
97         line_to_add = line_to_add.rstrip(",")
98         lines[i] = lines[i].rstrip() + ",\n"
99     lines.insert(i + 1, line_to_add + "\n")
100     print(f"Updating {PYRIGHT_CONFIG}")
101     with open(PYRIGHT_CONFIG, "w", encoding="UTF-8") as f:
102         f.writelines(lines)
103 
104 
105 def main() -> None:
106     parser = argparse.ArgumentParser(
107         description="""Generate baseline stubs automatically for an installed pip package
108                        using stubgen. Also run black and isort. If the name of
109                        the project is different from the runtime Python package name, you may
110                        need to use --package (example: --package yaml PyYAML)."""
111     )
112     parser.add_argument("project", help="name of PyPI project for which to generate stubs under stubs/")
113     parser.add_argument("--package", help="generate stubs for this Python package (default is autodetected)")
114     args = parser.parse_args()
115     project = args.project
116     package = args.package
117 
118     if not re.match(r"[a-zA-Z0-9-_.]+$", project):
119         sys.exit(f"Invalid character in project name: {project!r}")
120 
121     if not package:
122         package = project  # default
123         # Try to find which packages are provided by the project
124         # Use default if that fails or if several packages are found
125         #
126         # The importlib.metadata module is used for projects whose name is different
127         # from the runtime Python package name (example: PyYAML/yaml)
128         if sys.version_info >= (3, 8):
129             dist = distribution(project).read_text("top_level.txt")
130             if dist is not None:
131                 packages = [name for name in dist.split() if not name.startswith("_")]
132                 if len(packages) == 1:
133                     package = packages[0]
134         print(f'Using detected package "{package}" for project "{project}"', file=sys.stderr)
135         print("Suggestion: Try again with --package argument if that's not what you wanted", file=sys.stderr)
136 
137     if not os.path.isdir("stubs") or not os.path.isdir("stdlib"):
138         sys.exit("Error: Current working directory must be the root of typeshed repository")
139 
140     # Get normalized project name and version of installed package.
141     info = get_installed_package_info(project)
142     if info is None:
143         print(f'Error: "{project}" is not installed', file=sys.stderr)
144         print("", file=sys.stderr)
145         print(f'Suggestion: Run "python3 -m pip install {project}" and try again', file=sys.stderr)
146         sys.exit(1)
147     project, version = info
148 
149     stub_dir = os.path.join("stubs", project)
150     package_dir = os.path.join(stub_dir, package)
151     if os.path.exists(package_dir):
152         sys.exit(f"Error: {package_dir} already exists (delete it first)")
153 
154     run_stubgen(package, stub_dir)
155 
156     run_isort(stub_dir)
157     run_black(stub_dir)
158 
159     create_metadata(stub_dir, version)
160 
161     # Since the generated stubs won't have many type annotations, we
162     # have to exclude them from strict pyright checks.
163     add_pyright_exclusion(stub_dir)
164 
165     print("\nDone!\n\nSuggested next steps:")
166     print(f" 1. Manually review the generated stubs in {stub_dir}")
167     print(" 2. Optionally run tests and autofixes (see tests/README.md for details)")
168     print(" 3. Commit the changes on a new branch and create a typeshed PR (don't force-push!)")
169 
170 
171 if __name__ == "__main__":
172     main()
173
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scripts/create_baseline_stubs.py b/scripts/create_baseline_stubs.py
--- a/scripts/create_baseline_stubs.py
+++ b/scripts/create_baseline_stubs.py
@@ -50,6 +50,11 @@
     subprocess.run(["stubgen", "-o", output, "-p", package, "--export-less"], check=True)
 
 
+def run_stubdefaulter(stub_dir: str) -> None:
+    print(f"Running stubdefaulter: stubdefaulter --packages {stub_dir}")
+    subprocess.run(["stubdefaulter", "--packages", stub_dir])
+
+
 def run_black(stub_dir: str) -> None:
     print(f"Running black: black {stub_dir}")
     subprocess.run(["black", stub_dir])
@@ -57,7 +62,7 @@
 
 def run_isort(stub_dir: str) -> None:
     print(f"Running isort: isort {stub_dir}")
-    subprocess.run(["python3", "-m", "isort", stub_dir])
+    subprocess.run([sys.executable, "-m", "isort", stub_dir])
 
 
 def create_metadata(stub_dir: str, version: str) -> None:
@@ -152,6 +157,7 @@
         sys.exit(f"Error: {package_dir} already exists (delete it first)")
 
     run_stubgen(package, stub_dir)
+    run_stubdefaulter(stub_dir)
 
     run_isort(stub_dir)
     run_black(stub_dir)

{"golden_diff": "diff --git a/scripts/create_baseline_stubs.py b/scripts/create_baseline_stubs.py\n--- a/scripts/create_baseline_stubs.py\n+++ b/scripts/create_baseline_stubs.py\n@@ -50,6 +50,11 @@\n     subprocess.run([\"stubgen\", \"-o\", output, \"-p\", package, \"--export-less\"], check=True)\n \n \n+def run_stubdefaulter(stub_dir: str) -> None:\n+    print(f\"Running stubdefaulter: stubdefaulter --packages {stub_dir}\")\n+    subprocess.run([\"stubdefaulter\", \"--packages\", stub_dir])\n+\n+\n def run_black(stub_dir: str) -> None:\n     print(f\"Running black: black {stub_dir}\")\n     subprocess.run([\"black\", stub_dir])\n@@ -57,7 +62,7 @@\n \n def run_isort(stub_dir: str) -> None:\n     print(f\"Running isort: isort {stub_dir}\")\n-    subprocess.run([\"python3\", \"-m\", \"isort\", stub_dir])\n+    subprocess.run([sys.executable, \"-m\", \"isort\", stub_dir])\n \n \n def create_metadata(stub_dir: str, version: str) -> None:\n@@ -152,6 +157,7 @@\n         sys.exit(f\"Error: {package_dir} already exists (delete it first)\")\n \n     run_stubgen(package, stub_dir)\n+    run_stubdefaulter(stub_dir)\n \n     run_isort(stub_dir)\n     run_black(stub_dir)\n", "issue": "`create_baseline_stubs.py` script does not add default values\nAs title says. Now that typeshed prefers having default values, it would make sense if the `create_baseline_stubs.py` script added them.\r\nMaybe that would be stubgen's job?\r\nFor now I'm running https://github.com/JelleZijlstra/stubdefaulter manually as I am moving stubs out of https://github.com/microsoft/python-type-stubs, but I don't think that's even documented/mentioned in the contributing guidelines.\n", "before_files": [{"content": "#!/usr/bin/env python3\n\n\"\"\"Script to generate unannotated baseline stubs using stubgen.\n\nBasic usage:\n$ python3 scripts/create_baseline_stubs.py <project on PyPI>\n\nRun with -h for more help.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport argparse\nimport os\nimport re\nimport subprocess\nimport sys\n\nif sys.version_info >= (3, 8):\n    from importlib.metadata import distribution\n\nPYRIGHT_CONFIG = \"pyrightconfig.stricter.json\"\n\n\ndef search_pip_freeze_output(project: str, output: str) -> tuple[str, str] | None:\n    # Look for lines such as \"typed-ast==1.4.2\".  '-' matches '_' and\n    # '_' matches '-' in project name, so that \"typed_ast\" matches\n    # \"typed-ast\", and vice versa.\n    regex = \"^(\" + re.sub(r\"[-_]\", \"[-_]\", project) + \")==(.*)\"\n    m = re.search(regex, output, flags=re.IGNORECASE | re.MULTILINE)\n    if not m:\n        return None\n    return m.group(1), m.group(2)\n\n\ndef get_installed_package_info(project: str) -> tuple[str, str] | None:\n    \"\"\"Find package information from pip freeze output.\n\n    Match project name somewhat fuzzily (case sensitive; '-' matches '_', and\n    vice versa).\n\n    Return (normalized project name, installed version) if successful.\n    \"\"\"\n    r = subprocess.run([\"pip\", \"freeze\"], capture_output=True, text=True, check=True)\n    return search_pip_freeze_output(project, r.stdout)\n\n\ndef run_stubgen(package: str, output: str) -> None:\n    print(f\"Running stubgen: stubgen -o {output} -p {package}\")\n    subprocess.run([\"stubgen\", \"-o\", output, \"-p\", package, \"--export-less\"], check=True)\n\n\ndef run_black(stub_dir: str) -> None:\n    print(f\"Running black: black {stub_dir}\")\n    subprocess.run([\"black\", stub_dir])\n\n\ndef run_isort(stub_dir: str) -> None:\n    print(f\"Running isort: isort {stub_dir}\")\n    subprocess.run([\"python3\", \"-m\", \"isort\", stub_dir])\n\n\ndef create_metadata(stub_dir: str, version: str) -> None:\n    \"\"\"Create a METADATA.toml file.\"\"\"\n    match = re.match(r\"[0-9]+.[0-9]+\", version)\n    if match is None:\n        sys.exit(f\"Error: Cannot parse version number: {version}\")\n    filename = os.path.join(stub_dir, \"METADATA.toml\")\n    version = match.group(0)\n    if os.path.exists(filename):\n        return\n    print(f\"Writing {filename}\")\n    with open(filename, \"w\", encoding=\"UTF-8\") as file:\n        file.write(f'version = \"{version}.*\"')\n\n\ndef add_pyright_exclusion(stub_dir: str) -> None:\n    \"\"\"Exclude stub_dir from strict pyright checks.\"\"\"\n    with open(PYRIGHT_CONFIG, encoding=\"UTF-8\") as f:\n        lines = f.readlines()\n    i = 0\n    while i < len(lines) and not lines[i].strip().startswith('\"exclude\": ['):\n        i += 1\n    assert i < len(lines), f\"Error parsing {PYRIGHT_CONFIG}\"\n    while not lines[i].strip().startswith(\"]\"):\n        i += 1\n    # Must use forward slash in the .json file\n    line_to_add = f'        \"{stub_dir}\",'.replace(\"\\\\\", \"/\")\n    initial = i - 1\n    while lines[i].lower() > line_to_add.lower():\n        i -= 1\n    if lines[i + 1].strip().rstrip(\",\") == line_to_add.strip().rstrip(\",\"):\n        print(f\"{PYRIGHT_CONFIG} already up-to-date\")\n        return\n    if i == initial:\n        # Special case: when adding to the end of the list, commas need tweaking\n        line_to_add = line_to_add.rstrip(\",\")\n        lines[i] = lines[i].rstrip() + \",\\n\"\n    lines.insert(i + 1, line_to_add + \"\\n\")\n    print(f\"Updating {PYRIGHT_CONFIG}\")\n    with open(PYRIGHT_CONFIG, \"w\", encoding=\"UTF-8\") as f:\n        f.writelines(lines)\n\n\ndef main() -> None:\n    parser = argparse.ArgumentParser(\n        description=\"\"\"Generate baseline stubs automatically for an installed pip package\n                       using stubgen. Also run black and isort. If the name of\n                       the project is different from the runtime Python package name, you may\n                       need to use --package (example: --package yaml PyYAML).\"\"\"\n    )\n    parser.add_argument(\"project\", help=\"name of PyPI project for which to generate stubs under stubs/\")\n    parser.add_argument(\"--package\", help=\"generate stubs for this Python package (default is autodetected)\")\n    args = parser.parse_args()\n    project = args.project\n    package = args.package\n\n    if not re.match(r\"[a-zA-Z0-9-_.]+$\", project):\n        sys.exit(f\"Invalid character in project name: {project!r}\")\n\n    if not package:\n        package = project  # default\n        # Try to find which packages are provided by the project\n        # Use default if that fails or if several packages are found\n        #\n        # The importlib.metadata module is used for projects whose name is different\n        # from the runtime Python package name (example: PyYAML/yaml)\n        if sys.version_info >= (3, 8):\n            dist = distribution(project).read_text(\"top_level.txt\")\n            if dist is not None:\n                packages = [name for name in dist.split() if not name.startswith(\"_\")]\n                if len(packages) == 1:\n                    package = packages[0]\n        print(f'Using detected package \"{package}\" for project \"{project}\"', file=sys.stderr)\n        print(\"Suggestion: Try again with --package argument if that's not what you wanted\", file=sys.stderr)\n\n    if not os.path.isdir(\"stubs\") or not os.path.isdir(\"stdlib\"):\n        sys.exit(\"Error: Current working directory must be the root of typeshed repository\")\n\n    # Get normalized project name and version of installed package.\n    info = get_installed_package_info(project)\n    if info is None:\n        print(f'Error: \"{project}\" is not installed', file=sys.stderr)\n        print(\"\", file=sys.stderr)\n        print(f'Suggestion: Run \"python3 -m pip install {project}\" and try again', file=sys.stderr)\n        sys.exit(1)\n    project, version = info\n\n    stub_dir = os.path.join(\"stubs\", project)\n    package_dir = os.path.join(stub_dir, package)\n    if os.path.exists(package_dir):\n        sys.exit(f\"Error: {package_dir} already exists (delete it first)\")\n\n    run_stubgen(package, stub_dir)\n\n    run_isort(stub_dir)\n    run_black(stub_dir)\n\n    create_metadata(stub_dir, version)\n\n    # Since the generated stubs won't have many type annotations, we\n    # have to exclude them from strict pyright checks.\n    add_pyright_exclusion(stub_dir)\n\n    print(\"\\nDone!\\n\\nSuggested next steps:\")\n    print(f\" 1. Manually review the generated stubs in {stub_dir}\")\n    print(\" 2. Optionally run tests and autofixes (see tests/README.md for details)\")\n    print(\" 3. Commit the changes on a new branch and create a typeshed PR (don't force-push!)\")\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "scripts/create_baseline_stubs.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\n\"\"\"Script to generate unannotated baseline stubs using stubgen.\n\nBasic usage:\n$ python3 scripts/create_baseline_stubs.py <project on PyPI>\n\nRun with -h for more help.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport argparse\nimport os\nimport re\nimport subprocess\nimport sys\n\nif sys.version_info >= (3, 8):\n    from importlib.metadata import distribution\n\nPYRIGHT_CONFIG = \"pyrightconfig.stricter.json\"\n\n\ndef search_pip_freeze_output(project: str, output: str) -> tuple[str, str] | None:\n    # Look for lines such as \"typed-ast==1.4.2\".  '-' matches '_' and\n    # '_' matches '-' in project name, so that \"typed_ast\" matches\n    # \"typed-ast\", and vice versa.\n    regex = \"^(\" + re.sub(r\"[-_]\", \"[-_]\", project) + \")==(.*)\"\n    m = re.search(regex, output, flags=re.IGNORECASE | re.MULTILINE)\n    if not m:\n        return None\n    return m.group(1), m.group(2)\n\n\ndef get_installed_package_info(project: str) -> tuple[str, str] | None:\n    \"\"\"Find package information from pip freeze output.\n\n    Match project name somewhat fuzzily (case sensitive; '-' matches '_', and\n    vice versa).\n\n    Return (normalized project name, installed version) if successful.\n    \"\"\"\n    r = subprocess.run([\"pip\", \"freeze\"], capture_output=True, text=True, check=True)\n    return search_pip_freeze_output(project, r.stdout)\n\n\ndef run_stubgen(package: str, output: str) -> None:\n    print(f\"Running stubgen: stubgen -o {output} -p {package}\")\n    subprocess.run([\"stubgen\", \"-o\", output, \"-p\", package, \"--export-less\"], check=True)\n\n\ndef run_stubdefaulter(stub_dir: str) -> None:\n    print(f\"Running stubdefaulter: stubdefaulter --packages {stub_dir}\")\n    subprocess.run([\"stubdefaulter\", \"--packages\", stub_dir])\n\n\ndef run_black(stub_dir: str) -> None:\n    print(f\"Running black: black {stub_dir}\")\n    subprocess.run([\"black\", stub_dir])\n\n\ndef run_isort(stub_dir: str) -> None:\n    print(f\"Running isort: isort {stub_dir}\")\n    subprocess.run([sys.executable, \"-m\", \"isort\", stub_dir])\n\n\ndef create_metadata(stub_dir: str, version: str) -> None:\n    \"\"\"Create a METADATA.toml file.\"\"\"\n    match = re.match(r\"[0-9]+.[0-9]+\", version)\n    if match is None:\n        sys.exit(f\"Error: Cannot parse version number: {version}\")\n    filename = os.path.join(stub_dir, \"METADATA.toml\")\n    version = match.group(0)\n    if os.path.exists(filename):\n        return\n    print(f\"Writing {filename}\")\n    with open(filename, \"w\", encoding=\"UTF-8\") as file:\n        file.write(f'version = \"{version}.*\"')\n\n\ndef add_pyright_exclusion(stub_dir: str) -> None:\n    \"\"\"Exclude stub_dir from strict pyright checks.\"\"\"\n    with open(PYRIGHT_CONFIG, encoding=\"UTF-8\") as f:\n        lines = f.readlines()\n    i = 0\n    while i < len(lines) and not lines[i].strip().startswith('\"exclude\": ['):\n        i += 1\n    assert i < len(lines), f\"Error parsing {PYRIGHT_CONFIG}\"\n    while not lines[i].strip().startswith(\"]\"):\n        i += 1\n    # Must use forward slash in the .json file\n    line_to_add = f'        \"{stub_dir}\",'.replace(\"\\\\\", \"/\")\n    initial = i - 1\n    while lines[i].lower() > line_to_add.lower():\n        i -= 1\n    if lines[i + 1].strip().rstrip(\",\") == line_to_add.strip().rstrip(\",\"):\n        print(f\"{PYRIGHT_CONFIG} already up-to-date\")\n        return\n    if i == initial:\n        # Special case: when adding to the end of the list, commas need tweaking\n        line_to_add = line_to_add.rstrip(\",\")\n        lines[i] = lines[i].rstrip() + \",\\n\"\n    lines.insert(i + 1, line_to_add + \"\\n\")\n    print(f\"Updating {PYRIGHT_CONFIG}\")\n    with open(PYRIGHT_CONFIG, \"w\", encoding=\"UTF-8\") as f:\n        f.writelines(lines)\n\n\ndef main() -> None:\n    parser = argparse.ArgumentParser(\n        description=\"\"\"Generate baseline stubs automatically for an installed pip package\n                       using stubgen. Also run black and isort. If the name of\n                       the project is different from the runtime Python package name, you may\n                       need to use --package (example: --package yaml PyYAML).\"\"\"\n    )\n    parser.add_argument(\"project\", help=\"name of PyPI project for which to generate stubs under stubs/\")\n    parser.add_argument(\"--package\", help=\"generate stubs for this Python package (default is autodetected)\")\n    args = parser.parse_args()\n    project = args.project\n    package = args.package\n\n    if not re.match(r\"[a-zA-Z0-9-_.]+$\", project):\n        sys.exit(f\"Invalid character in project name: {project!r}\")\n\n    if not package:\n        package = project  # default\n        # Try to find which packages are provided by the project\n        # Use default if that fails or if several packages are found\n        #\n        # The importlib.metadata module is used for projects whose name is different\n        # from the runtime Python package name (example: PyYAML/yaml)\n        if sys.version_info >= (3, 8):\n            dist = distribution(project).read_text(\"top_level.txt\")\n            if dist is not None:\n                packages = [name for name in dist.split() if not name.startswith(\"_\")]\n                if len(packages) == 1:\n                    package = packages[0]\n        print(f'Using detected package \"{package}\" for project \"{project}\"', file=sys.stderr)\n        print(\"Suggestion: Try again with --package argument if that's not what you wanted\", file=sys.stderr)\n\n    if not os.path.isdir(\"stubs\") or not os.path.isdir(\"stdlib\"):\n        sys.exit(\"Error: Current working directory must be the root of typeshed repository\")\n\n    # Get normalized project name and version of installed package.\n    info = get_installed_package_info(project)\n    if info is None:\n        print(f'Error: \"{project}\" is not installed', file=sys.stderr)\n        print(\"\", file=sys.stderr)\n        print(f'Suggestion: Run \"python3 -m pip install {project}\" and try again', file=sys.stderr)\n        sys.exit(1)\n    project, version = info\n\n    stub_dir = os.path.join(\"stubs\", project)\n    package_dir = os.path.join(stub_dir, package)\n    if os.path.exists(package_dir):\n        sys.exit(f\"Error: {package_dir} already exists (delete it first)\")\n\n    run_stubgen(package, stub_dir)\n    run_stubdefaulter(stub_dir)\n\n    run_isort(stub_dir)\n    run_black(stub_dir)\n\n    create_metadata(stub_dir, version)\n\n    # Since the generated stubs won't have many type annotations, we\n    # have to exclude them from strict pyright checks.\n    add_pyright_exclusion(stub_dir)\n\n    print(\"\\nDone!\\n\\nSuggested next steps:\")\n    print(f\" 1. Manually review the generated stubs in {stub_dir}\")\n    print(\" 2. Optionally run tests and autofixes (see tests/README.md for details)\")\n    print(\" 3. Commit the changes on a new branch and create a typeshed PR (don't force-push!)\")\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "scripts/create_baseline_stubs.py"}]}