From 4fdd124fddf0529813aabe72f19374cb08803732 Mon Sep 17 00:00:00 2001 From: Florian Rau Date: Mon, 2 Sep 2024 20:23:00 +0100 Subject: [PATCH] repair CI --- docs/source/_templates/custom-class-template.rst | 2 ++ docs/source/conf.py | 11 ++++++----- iblrig/base_choice_world.py | 5 ++--- iblrig/base_tasks.py | 12 ++++++------ iblrig/serial_singleton.py | 4 ++-- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/source/_templates/custom-class-template.rst b/docs/source/_templates/custom-class-template.rst index 77226c60c..999ac4127 100644 --- a/docs/source/_templates/custom-class-template.rst +++ b/docs/source/_templates/custom-class-template.rst @@ -3,6 +3,8 @@ .. currentmodule:: {{ module }} .. inheritance-diagram:: {{ objname }} + :parts: 1 + | .. autoclass:: {{ objname }} diff --git a/docs/source/conf.py b/docs/source/conf.py index 61c04719b..976c709ae 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,10 +25,11 @@ 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.inheritance_diagram', - 'sphinx.ext.todo', + 'sphinx.ext.viewcode', ] -autodoc_typehints = 'description' +autodoc_typehints = 'none' autosummary_generate = True +autosummary_imported_members = False autosectionlabel_prefix_document = True source_suffix = ['.rst', '.md'] exclude_patterns = [] @@ -65,7 +66,7 @@ } # -- Napoleon Settings ------------------------------------------------------- -napoleon_google_docstring = False +napoleon_google_docstring = True napoleon_numpy_docstring = True napoleon_include_init_with_doc = True napoleon_include_special_with_doc = False @@ -74,7 +75,7 @@ napoleon_use_admonition_for_references = True napoleon_use_ivar = True napoleon_use_param = True -napoleon_use_rtype = False +napoleon_use_rtype = True napoleon_preprocess_types = True napoleon_type_aliases = None -napoleon_attr_annotations = True \ No newline at end of file +napoleon_attr_annotations = True diff --git a/iblrig/base_choice_world.py b/iblrig/base_choice_world.py index 97736275c..4647e2979 100644 --- a/iblrig/base_choice_world.py +++ b/iblrig/base_choice_world.py @@ -114,7 +114,6 @@ class ChoiceWorldSession( # task_params = ChoiceWorldParams() base_parameters_file = Path(__file__).parent.joinpath('base_choice_world_params.yaml') - @property def get_trial_data_model(self): return ChoiceWorldTrialData @@ -129,7 +128,7 @@ def __init__(self, *args, delay_secs=0, **kwargs): self.block_num = -1 self.block_trial_num = -1 # init the tables, there are 2 of them: a trials table and a ambient sensor data table - self.trials_table = self.get_trial_data_model.preallocate_dataframe(NTRIALS_INIT) + self.trials_table = self.get_trial_data_model().preallocate_dataframe(NTRIALS_INIT) self.ambient_sensor_table = pd.DataFrame( { @@ -543,7 +542,7 @@ def save_trial_data_to_json(self, bpod_data: dict): """ # get trial's data as a dict, validate by passing through pydantic model trial_data = self.trials_table.iloc[self.trial_num].to_dict() - trial_data = self.get_trial_data_model.model_validate(trial_data).model_dump() + trial_data = self.get_trial_data_model().model_validate(trial_data).model_dump() # add bpod_data as 'behavior_data' trial_data['behavior_data'] = bpod_data diff --git a/iblrig/base_tasks.py b/iblrig/base_tasks.py index c94a03dbe..77776b078 100644 --- a/iblrig/base_tasks.py +++ b/iblrig/base_tasks.py @@ -29,12 +29,11 @@ from pythonosc import udp_client import ibllib.io.session_params as ses_params -import iblrig import iblrig.graphic as graph import iblrig.path_helper import pybpodapi from ibllib.oneibl.registration import IBLRegistrationClient -from iblrig import net, sound +from iblrig import net, path_helper, sound from iblrig.constants import BASE_PATH, BONSAI_EXE, PYSPIN_AVAILABLE from iblrig.frame2ttl import Frame2TTL from iblrig.hardware import SOFTCODE, Bpod, MyRotaryEncoder, sound_device_factory @@ -71,8 +70,8 @@ class BaseSession(ABC): extractor_tasks: list | None = None """list of str: An optional list of pipeline task class names to instantiate when preprocessing task data.""" - @abstractmethod - def get_trial_data_model(self) -> type[TrialDataModel]: ... + def get_trial_data_model(self): + return TrialDataModel def __init__( self, @@ -262,7 +261,7 @@ def _init_paths(self, append: bool = False) -> Bunch: * SETTINGS_FILE_PATH: contains the task settings `C:\iblrigv8_data\mainenlab\Subjects\SWC_043\2019-01-01\001\raw_task_data_00\_iblrig_taskSettings.raw.json` """ - rig_computer_paths = iblrig.path_helper.get_local_and_remote_paths( + rig_computer_paths = path_helper.get_local_and_remote_paths( local_path=self.iblrig_settings.iblrig_local_data_path, remote_path=self.iblrig_settings.iblrig_remote_data_path, lab=self.iblrig_settings.ALYX_LAB, @@ -315,7 +314,8 @@ def _setup_loggers(self, level='INFO', level_bpod='WARNING', file=None): self._logger = setup_logger('iblrig', level=level, file=file) # logger attr used by create_session to determine log level setup_logger('pybpodapi', level=level_bpod, file=file) - def _remove_file_loggers(self): + @staticmethod + def _remove_file_loggers(): for logger_name in ['iblrig', 'pybpodapi']: logger = logging.getLogger(logger_name) file_handlers = [fh for fh in logger.handlers if isinstance(fh, logging.FileHandler)] diff --git a/iblrig/serial_singleton.py b/iblrig/serial_singleton.py index d94c061b1..d2cad388f 100644 --- a/iblrig/serial_singleton.py +++ b/iblrig/serial_singleton.py @@ -188,7 +188,7 @@ def query(self, query, data_specifier=1): Parameters ---------- - query : any + query : Any Query to be sent to the serial device. data_specifier : int or str, default: 1 The number of bytes to receive from the serial device, or a format string @@ -222,7 +222,7 @@ def to_bytes(data: Any) -> bytes: Parameters ---------- - data : any + data : Any Data to be converted to bytestring. Returns