-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve type-hints and add stubs to expand docstrings (#194)
- Loading branch information
1 parent
cbded42
commit b665e79
Showing
48 changed files
with
3,218 additions
and
122 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: stubs | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} | ||
cancel-in-progress: true | ||
on: # yamllint disable-line rule:truthy | ||
schedule: | ||
- cron: '0 3 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate: | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
architecture: 'x64' | ||
- name: Install package | ||
run: | | ||
python -m pip install --progress-bar off --upgrade pip setuptools | ||
python -m pip install --progress-bar off -e .[stubs] | ||
- name: Display system information | ||
run: mne_lsl-sys_info --developer | ||
- name: Generate stub files | ||
run: python tools/stubgen.py | ||
- name: Push stub files | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git add . | ||
git commit -m "deploy stub files [ci skip]" | ||
git push | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from ._version import __version__ as __version__ | ||
from .utils.config import sys_info as sys_info | ||
from .utils.logs import add_file_handler as add_file_handler | ||
from .utils.logs import logger as logger | ||
from .utils.logs import set_log_level as set_log_level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from numpy.typing import DTypeLike as DTypeLike | ||
|
||
ScalarFloatType: tuple[DTypeLike, ...] | ||
ScalarIntType: tuple[DTypeLike, ...] | ||
ScalarType: tuple[DTypeLike, ...] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from pathlib import Path | ||
from typing import Union | ||
|
||
from ..utils._checks import ensure_path as ensure_path | ||
from ..utils._path import walk as walk | ||
from ..utils.logs import logger as logger | ||
|
||
def fetch_dataset(path: Path, base_url: str, registry: Union[str, Path]) -> Path: | ||
"""Fetch a dataset from the remote. | ||
Parameters | ||
---------- | ||
path : str | Path | ||
Local path where the dataset should be cloned. | ||
base_url : str | ||
Base URL for the remote data sources. All requests will be made relative to this | ||
URL. If the URL does not end in a '/', a trailing '/' will be added | ||
automatically. | ||
registry : str | Path | ||
Path to the txt file containing the registry. | ||
Returns | ||
------- | ||
path : Path | ||
Absolute path to the local clone of the dataset. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from pathlib import Path | ||
from typing import Optional, Union | ||
|
||
from ..utils._checks import ensure_path as ensure_path | ||
from ._fetch import fetch_dataset as fetch_dataset | ||
|
||
_REGISTRY: Path | ||
|
||
def _make_registry( | ||
folder: Union[str, Path], output: Optional[Union[str, Path]] = ... | ||
) -> None: | ||
"""Create the registry file for the sample dataset. | ||
Parameters | ||
---------- | ||
folder : path-like | ||
Path to the sample dataset. | ||
output : path-like | ||
Path to the output registry file. | ||
""" | ||
|
||
def data_path() -> Path: | ||
"""Return the path to the sample dataset, downloaded if needed. | ||
Returns | ||
------- | ||
path : Path | ||
Path to the sample dataset, by default in ``"~/mne_data/MNE-LSL"``. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from pathlib import Path | ||
from typing import Optional, Union | ||
|
||
from ..utils._checks import ensure_path as ensure_path | ||
from ._fetch import fetch_dataset as fetch_dataset | ||
|
||
_REGISTRY: Path | ||
|
||
def _make_registry( | ||
folder: Union[str, Path], output: Optional[Union[str, Path]] = ... | ||
) -> None: | ||
"""Create the registry file for the sample dataset. | ||
Parameters | ||
---------- | ||
folder : path-like | ||
Path to the sample dataset. | ||
output : path-like | ||
Path to the output registry file. | ||
""" | ||
|
||
def data_path() -> Path: | ||
"""Return the path to the sample dataset, downloaded if needed. | ||
Returns | ||
------- | ||
path : Path | ||
Path to the sample dataset, by default in ``"~/mne_data/mne_lsl"``. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from .functions import library_version as library_version | ||
from .functions import local_clock as local_clock | ||
from .functions import protocol_version as protocol_version | ||
from .functions import resolve_streams as resolve_streams | ||
from .stream_info import StreamInfo as StreamInfo | ||
from .stream_inlet import StreamInlet as StreamInlet | ||
from .stream_outlet import StreamOutlet as StreamOutlet |
Oops, something went wrong.