Skip to content

Commit de03667

Browse files
authored
chore(docs): use bundled api.md for docs generation (#109)
1 parent 3c7a9ba commit de03667

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

scripts/documentation_provider.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
1516
import re
16-
from sys import stderr
17+
import sys
18+
from pathlib import Path
1719
from typing import Any, Dict, List, cast
1820

19-
import requests
21+
_dirname = Path(os.path.dirname(os.path.abspath(__file__)))
2022

2123

2224
class DocumentationProvider:
@@ -33,9 +35,9 @@ def __init__(self) -> None:
3335
}
3436

3537
def load(self) -> None:
36-
api_md = requests.get(
37-
"https://raw.githubusercontent.com/microsoft/playwright/master/docs/api.md"
38-
).text
38+
api_md = (
39+
_dirname / ".." / "driver" / "node_modules" / "playwright" / "api.md"
40+
).read_text()
3941

4042
class_name = None
4143
method_name = None
@@ -160,7 +162,7 @@ def print_entry(
160162
if name not in signature:
161163
print(
162164
f"Not implemented parameter {class_name}.{method_name}({name}=)",
163-
file=stderr,
165+
file=sys.stderr,
164166
)
165167
continue
166168
else:
@@ -179,7 +181,7 @@ def print_entry(
179181
if signature:
180182
print(
181183
f"Not documented parameters: {class_name}.{method_name}({signature.keys()})",
182-
file=stderr,
184+
file=sys.stderr,
183185
)
184186

185187

0 commit comments

Comments
 (0)