| 1 | from __future__scip-python python python-stdlib 3.11 __future__/__init__: import annotationsscip-python python python-stdlib 3.11 __future__/annotations.annotations. |
| 2 | |
| 3 | import csvscip-python python python-stdlib 3.11 csv/__init__: |
| 4 | import rescip-python python python-stdlib 3.11 re/__init__: |
| 5 | from pathlibscip-python python python-stdlib 3.11 pathlib/__init__: import Pathscip-python python python-stdlib 3.11 pathlib/Path# |
| 6 | |
| 7 | from harlequinscip-python python harlequin-mysql 1.3.0 harlequin/__init__: import HarlequinCompletion |
| 8 | |
| 9 | WORDscip-python python harlequin-mysql 1.3.0 `src.harlequin_mysql.completions`/WORD. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().(r"\w+") |
| 10 | |
| 11 | |
| 12 | def load_completionsscip-python python harlequin-mysql 1.3.0 `src.harlequin_mysql.completions`/load_completions().() -> listscip-python python python-stdlib 3.11 builtins/list#[HarlequinCompletion]: |
| 13 | completions: listscip-python python python-stdlib 3.11 builtins/list#[HarlequinCompletion] = [] |
| 14 | |
| 15 | keywords_path = Pathscip-python python python-stdlib 3.11 pathlib/Path#(__file__scip-python python harlequin-mysql 1.3.0 `src.harlequin_mysql.completions`/).parentscip-python python python-stdlib 3.11 pathlib/PurePath#parent(). / "keywords.csv" |
| 16 | with keywords_path.openscip-python python python-stdlib 3.11 pathlib/Path#open().("r") as f: |
| 17 | reader = csvscip-python python python-stdlib 3.11 csv/__init__:.readerscip-python python python-stdlib 3.11 _csv/reader().(f, dialectscip-python python python-stdlib 3.11 _csv/reader().(dialect)="unix") |
| 18 | for name, reserved, removed in reader: |
| 19 | if removed == "False": |
| 20 | completions.appendscip-python python python-stdlib 3.11 builtins/list#append().( |
| 21 | HarlequinCompletion( |
| 22 | label=name.lowerscip-python python python-stdlib 3.11 builtins/str#lower().(), |
| 23 | type_label="kw", |
| 24 | value=name.lowerscip-python python python-stdlib 3.11 builtins/str#lower().(), |
| 25 | priority=100 if reserved else 1000, |
| 26 | context=None, |
| 27 | ) |
| 28 | ) |
| 29 | |
| 30 | functions_path = Pathscip-python python python-stdlib 3.11 pathlib/Path#(__file__scip-python python harlequin-mysql 1.3.0 `src.harlequin_mysql.completions`/).parentscip-python python python-stdlib 3.11 pathlib/PurePath#parent(). / "functions.tsv" |
| 31 | with functions_path.openscip-python python python-stdlib 3.11 pathlib/Path#open().("r") as f: |
| 32 | reader = csvscip-python python python-stdlib 3.11 csv/__init__:.readerscip-python python python-stdlib 3.11 _csv/reader().(f, dialectscip-python python python-stdlib 3.11 _csv/reader().(dialect)="unix", delimiterscip-python python python-stdlib 3.11 _csv/reader().(delimiter)="\t") |
| 33 | for name, _, _, deprecated in reader: |
| 34 | if deprecated: |
| 35 | continue |
| 36 | for alias in name.splitscip-python python python-stdlib 3.11 builtins/str#split().(", "): |
| 37 | if WORDscip-python python harlequin-mysql 1.3.0 `src.harlequin_mysql.completions`/WORD..matchscip-python python python-stdlib 3.11 re/Pattern#match().(alias): |
| 38 | completions.appendscip-python python python-stdlib 3.11 builtins/list#append().( |
| 39 | HarlequinCompletion( |
| 40 | label=alias.splitscip-python python python-stdlib 3.11 builtins/str#split().("...")[0].splitscip-python python python-stdlib 3.11 builtins/str#split().("(")[0].lowerscip-python python python-stdlib 3.11 builtins/str#lower().(), |
| 41 | type_label="fn", |
| 42 | value=alias.splitscip-python python python-stdlib 3.11 builtins/str#split().("...")[0].splitscip-python python python-stdlib 3.11 builtins/str#split().("(")[0].lowerscip-python python python-stdlib 3.11 builtins/str#lower().(), |
| 43 | priority=1000, |
| 44 | context=None, |
| 45 | ) |
| 46 | ) |
| 47 | |
| 48 | return completions |