merge_machine/admin.py
def list_projects_by_time(self, project_type, 
                                      project_access='all', 
                                      action='created', 
                                      when='before', 
                                      hours_from_now=24*7):
        '''
        Parameters
        ----------
        project_type: str (either "normalize" or "link")
        project_access: str (either "all", "public", or "private")
            Whether to list all projects or only those that are public or 
            non-public (private)
        action: str (either "created" or "last_used")
            When using temporal filters, whether to use as variable the creation
            date or the date of last use.
        when: str (either "before" or "after")
            Whether to select the elements before or after the cutoff date
            (both are inclusive, but proba of equality is very slim).
        hours_from_now: int
            How many hours before current time are we looking at.
        
        Returns
        -------
        to_return: list of dicts
            List of metadata objects corresponding to the selected projects.
        '''
        list_of_metadata = self.list_projects(project_type, project_access)
           
        field = {'created': 'timestamp', 'last_used': 'last_timestamp'}[action]
        mult = {'before': 1, 'after': -1}[when]
        now  = time.time()
        to_return = list(filter(lambda m: mult*(now - m[field]) >= mult*hours_from_now*3600, \
                      list_of_metadata))
        return to_return

        Parameters
        ----------
        project_type: str (either "normalize" or "link")
        project_access: str (either "all", "public", or "private")
            Whether to list all projects or only those that are public or 
            non-public (private)
        action: str (either "created" or "last_used")
            When using temporal filters, whether to use as variable the creation
            date or the date of last use.
        when: str (either "before" or "after")
            Whether to select the elements before or after the cutoff date
            (both are inclusive, but proba of equality is very slim).
        hours_from_now: int
            How many hours before current time are we looking at.
        
        Returns
        -------
        to_return: list of dicts
            List of metadata objects corresponding to the selected projects.
        


Returns

list of dicts
List of metadata objects corresponding to the selected projects.
Returns list of dicts List of metadata objects corresponding to the selected projects .
def list_projects_by_time(self, project_type, 
                                      project_access='all', 
                                      action='created', 
                                      when='before', 
                                      hours_from_now=24*7):
        list_of_metadata = self.list_projects(project_type, project_access)
        field = {'created': 'timestamp', 'last_used': 'last_timestamp'}[action]
        mult = {'before': 1, 'after': -1}[when]
        now  = time.time()
        to_return = list(filter(lambda m: mult*(now - m[field]) >= mult*hours_from_now*3600, \
                      list_of_metadata))
        return to_return
def list_projects_by_time ( self , project_type , project_access = 'all' , action = 'created' , when = 'before' , hours_from_now = 24 * 7 ) : list_of_metadata = self . list_projects ( project_type , project_access ) field = { 'created' : 'timestamp' , 'last_used' : 'last_timestamp' } [ action ] mult = { 'before' : 1 , 'after' : - 1 } [ when ] now = time . time ( ) to_return = list ( filter ( lambda m : mult * ( now - m [ field ] ) >= mult * hours_from_now * 3600 , list_of_metadata ) ) return to_return
Parameters
project_type: str (either "normalize" or "link")
project_access: str (either "all", "public", or "private")
Whether to list all projects or only those that are public or
non-public (private)
action: str (either "created" or "last_used")
When using temporal filters, whether to use as variable the creation
date or the date of last use.
Parameters project_type : str ( either " normalize " or " link " ) project_access : str ( either " all " " public " or " private " ) Whether to list all projects or only those that are public or non - public ( private ) action : str ( either " created " or " last_used " ) When using temporal filters whether to use as variable the creation date or the date of last use .
'''
        Parameters
        ----------
        project_type: str (either "normalize" or "link")
        project_access: str (either "all", "public", or "private")
            Whether to list all projects or only those that are public or 
            non-public (private)
        action: str (either "created" or "last_used")
            When using temporal filters, whether to use as variable the creation
            date or the date of last use.
        when: str (either "before" or "after")
            Whether to select the elements before or after the cutoff date
            (both are inclusive, but proba of equality is very slim).
        hours_from_now: int
            How many hours before current time are we looking at.
        
        Returns
        -------
        to_return: list of dicts
            List of metadata objects corresponding to the selected projects.
        '''
self
project_type
project_access
action
when
hours_from_now