dax/dax_tools_utils.py
def upload_resource(assessor_obj, resource, resource_path):
    """
    Upload a resource folder to an assessor

    :param assessor_obj: pyxnat assessor Eobject
    :param resource: resource to upload
    :param resource_path: resource path on the station
    :return: None
    """
    if resource == 'SNAPSHOTS':
        upload_snapshots(assessor_obj, resource_path)
    else:
        rfiles_list = os.listdir(resource_path)
        if not rfiles_list:
            LOGGER.warn('No files in {}'.format(resource_path))
        elif len(rfiles_list) > 1 or os.path.isdir(rfiles_list[0]):
            try:
                XnatUtils.upload_folder_to_obj(
                    resource_path, assessor_obj.out_resource(resource),
                    resource, removeall=True)
            except XnatUtilsError as err:
                print(ERR_MSG % err)
        # One or two file, let just upload them:
        else:
            fpath = os.path.join(resource_path, rfiles_list[0])
            try:
                XnatUtils.upload_file_to_obj(
                    fpath, assessor_obj.out_resource(resource), removeall=True)
            except XnatUtilsError as err:
                print(ERR_MSG % err)

    Upload a resource folder to an assessor

    :param assessor_obj: pyxnat assessor Eobject
    :param resource: resource to upload
    :param resource_path: resource path on the station
    :return: None
    
Upload a resource folder to an assessor
Upload a resource folder to an assessor
def upload_resource(assessor_obj, resource, resource_path):
    if resource == 'SNAPSHOTS':
        upload_snapshots(assessor_obj, resource_path)
    else:
        rfiles_list = os.listdir(resource_path)
        if not rfiles_list:
            LOGGER.warn('No files in {}'.format(resource_path))
        elif len(rfiles_list) > 1 or os.path.isdir(rfiles_list[0]):
            try:
                XnatUtils.upload_folder_to_obj(
                    resource_path, assessor_obj.out_resource(resource),
                    resource, removeall=True)
            except XnatUtilsError as err:
                print(ERR_MSG % err)
        else:
            fpath = os.path.join(resource_path, rfiles_list[0])
            try:
                XnatUtils.upload_file_to_obj(
                    fpath, assessor_obj.out_resource(resource), removeall=True)
            except XnatUtilsError as err:
                print(ERR_MSG % err)
def upload_resource ( assessor_obj , resource , resource_path ) : if resource == 'SNAPSHOTS' : upload_snapshots ( assessor_obj , resource_path ) else : rfiles_list = os . listdir ( resource_path ) if not rfiles_list : LOGGER . warn ( 'No files in {}' . format ( resource_path ) ) elif len ( rfiles_list ) > 1 or os . path . isdir ( rfiles_list [ 0 ] ) : try : XnatUtils . upload_folder_to_obj ( resource_path , assessor_obj . out_resource ( resource ) , resource , removeall = True ) except XnatUtilsError as err : print ( ERR_MSG % err ) else : fpath = os . path . join ( resource_path , rfiles_list [ 0 ] ) try : XnatUtils . upload_file_to_obj ( fpath , assessor_obj . out_resource ( resource ) , removeall = True ) except XnatUtilsError as err : print ( ERR_MSG % err )
Upload a resource folder to an assessor
Upload a resource folder to an assessor
"""
    Upload a resource folder to an assessor

    :param assessor_obj: pyxnat assessor Eobject
    :param resource: resource to upload
    :param resource_path: resource path on the station
    :return: None
    """ # One or two file, let just upload them:
None
assessor_obj
pyxnat assessor Eobject
pyxnat assessor Eobject
resource
resource to upload
resource to upload
resource_path
resource path on the station
resource path on the station