Exemplo n.º 1
0
    def populate_annos():
        from protcur import document as ptcdoc
        from protcur.core import annoSync
        from protcur.analysis import Hybrid, protc
        from hyputils.hypothesis import HypothesisHelper, group_to_memfile
        from hyputils import hypothesis as hyp
        ProtcurData.protc = protc
        group = auth.get('hypothesis-group')
        get_annos, annos, stream_thread, exit_loop = annoSync(
            group_to_memfile(group + 'sparcur'),
            helpers=(HypothesisHelper, Hybrid, protc),
            group=group,
            sync=False)

        # FIXME hack to workaround bad api key init for hyutils until we can integrate orthauth
        get_annos.api_token = auth.get('hypothesis-api-key')
        annos.clear()
        annos.extend([ptcdoc.Annotation(a) for a in get_annos()])

        # reset classes in case some other class has populated them
        # (e.g. during testing) FIXME this is a bad hack
        protc.reset()
        Hybrid.reset()

        # FIXME this is expensive and slow to continually recompute
        [protc(a, annos) for a in annos]
        [Hybrid(a, annos) for a in annos]
Exemplo n.º 2
0
    def populate_annos(group_name='sparc-curation'):
        from hyputils import hypothesis as hyp
        if hyp.api_token == 'TOKEN':  # FIXME does not work
            hyp.api_token = auth.get('hypothesis-api-key')

        group = auth.get('hypothesis-group')
        get_annos, annos, stream_thread, exit_loop = annoSync(group_to_memfile(group + 'sparcur'),
                                                              helpers=(HypothesisHelper, Hybrid, protc),
                                                              group=group,
                                                              sync=False)

        [protc(a, annos) for a in annos]
        [Hybrid(a, annos) for a in annos]
Exemplo n.º 3
0
    def populate_annos(group_name='sparc-curation'):
        from hyputils import hypothesis as hyp
        if hyp.api_token == 'TOKEN':  # FIXME does not work
            hyp.api_token = devconfig.secrets('hypothesis', 'api',
                                              devconfig.hypothesis_api_user)

        group = devconfig.secrets('hypothesis', 'group', group_name)
        get_annos, annos, stream_thread, exit_loop = annoSync(
            group_to_memfile(group + 'sparcur'),
            helpers=(HypothesisHelper, Hybrid, protc),
            group=group,
            sync=False)

        [protc(a, annos) for a in annos]
        [Hybrid(a, annos) for a in annos]
Exemplo n.º 4
0
    def populate_annos():
        from protcur.core import annoSync
        from protcur.analysis import Hybrid, protc
        from hyputils.hypothesis import HypothesisHelper, group_to_memfile
        from hyputils import hypothesis as hyp
        ProtcurData.protc = protc
        group = auth.get('hypothesis-group')
        get_annos, annos, stream_thread, exit_loop = annoSync(
            group_to_memfile(group + 'sparcur'),
            helpers=(HypothesisHelper, Hybrid, protc),
            group=group,
            sync=False)

        # FIXME hack to workaround bad api key init for hyutils until we can integrate orthauth
        get_annos.api_token = auth.get('hypothesis-api-key')
        annos.clear()
        annos.extend(get_annos())

        # FIXME this is expensive and slow to continually recompute
        [protc(a, annos) for a in annos]
        [Hybrid(a, annos) for a in annos]
Exemplo n.º 5
0
    def populate_annos():
        from protcur import document as ptcdoc
        from protcur.core import annoSync
        from protcur.analysis import Hybrid, protc
        from hyputils.hypothesis import HypothesisHelper, group_to_memfile, AnnoReader
        from hyputils import hypothesis as hyp
        ProtcurData.protc = protc
        group = auth.get('hypothesis-group')
        memfile = group_to_memfile(group + 'sparcur')
        #ar = AnnoReader(memfile, group)
        #annos = ar.get_annos()
        #ud = [a.updated for a in annos]
        #lud_before = max(ud) if ud else None
        #del ud
        get_annos, annos, stream_thread, exit_loop = annoSync(
            memfile,
            helpers=(HypothesisHelper, Hybrid, protc),
            group=group,
            sync=False)

        # FIXME hack to workaround bad api key init for hyutils until we can integrate orthauth
        get_annos.api_token = auth.get('hypothesis-api-key')
        annos.clear()
        annos.extend([ptcdoc.Annotation(a) for a in get_annos()])
        #lud_after = max([a.updated for a in annos])

        # reset classes in case some other class has populated them
        # (e.g. during testing) FIXME this is a bad hack
        protc.reset()
        Hybrid.reset()

        #if lud_before == lud_after:  # no new annos
        # yeah we can use pickled ... but how :/
        #return ???

        # FIXME this is expensive and slow to continually recompute
        [protc(a, annos) for a in annos]
        [Hybrid(a, annos) for a in annos]