From 89a7b95eaaffba1f8f97d714dc4f1904b7e4c7d1 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Wed, 22 Nov 2017 13:23:26 -0800 Subject: [PATCH] Fix Processing Levels code and docstring --- odm2api/ODM2/services/readService.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index e6295f9..830b0af 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -390,15 +390,28 @@ def getMethods(self, ids=None, codes=None, type=None): # ProcessingLevel def getProcessingLevels(self, ids=None, codes=None): """ - getProcessingLevels(self, ids=None, codes=None) - * Pass nothing - returns full list of ProcessingLevel objects - * Pass a list of ProcessingLevelID - returns a single processingLevel object for each given id - * Pass a list of ProcessingLevelCode - returns a single processingLevel object for each given code + Retrieve a list of Processing Levels + + If no arguments are passed to the function, or their values are None, + all Processing Levels objects in the database will be returned. + + Args: + ids (list, optional): List of Processing Levels IDs. + codes (list, optional): List of Processing Levels Codes. + + + Returns: + list: List of ProcessingLevels Objects + + Examples: + >>> READ = ReadODM2(SESSION_FACTORY) + >>> READ.getProcessingLevels(ids=[1, 3]) + >>> READ.getProcessingLevels(codes=['L1', 'L3']) """ q = self._session.query(ProcessingLevels) if ids: - q = q.filter(ProcessingLevels.ProcessingLevelsID.in_(ids)) + q = q.filter(ProcessingLevels.ProcessingLevelID.in_(ids)) if codes: q = q.filter(ProcessingLevels.ProcessingLevelCode.in_(codes))