Example #1
0
    def _expand_stages(cls):
        ocs = {c.__name__: c for c in subclasses(object)}
        for type_ in (cls._submission, cls._curation):
            for name in type_:
                cname, *rest = name.split('.', 1)
                c = ocs[cname]
                suffix = ''
                if rest:
                    suffix = '.' + ''.join(rest)

                for sc in subclasses(c):
                    type_.append(sc.__name__ + suffix)
Example #2
0
def getOnts():
    return tuple(
        l for l in subclasses(ParcOnt) if l.__name__ != 'parcBridge'
        and not hasattr(l, f'_{l.__name__}__pythonOnly') and (
            l.__module__ != 'nifstd_tools.parcellation'
            if __name__ == '__main__' or __name__ == '__init__' else
            l.__module__ != '__main__' and l.__module__ != '__init__'))
Example #3
0
 def _triples(self):
     from nifstd_tools.parcellation import Artifact
     yield from Artifact.class_triples()
     # OH LOOK PYTHON IS BEING AN AWFUL LANGUAGE AGAIN
     for art_type in subclasses(
             Artifact
     ):  # this is ok because all subclasses are in this file...
         # do not comment this out it is what makes the
         # upper classes in the artifacts hierarchy
         yield from art_type.class_triples()
     for artifact in self._artifacts:
         yield from artifact
Example #4
0
class parcBridge(ParcOnt):
    """ Main bridge for importing the various files that
        make up the parcellation ontology. """

    # setup

    path = 'ttl/bridge/'
    filename = 'parcellation-bridge'
    name = 'Parcellation Bridge'
    imports = (
        (
            g[subclass.__name__]
            if subclass.__name__ in g and subclass.__module__ ==
            'nifstd_tools.parcellation'  # parcellation is insurance for name reuse
            else subclass) for g in (globals(), ) for subclass in subclasses(
                LabelsBase
            )  # XXX wow, well apparently __main__.Class != module.Class
        if not hasattr(subclass, f'_{subclass.__name__}__pythonOnly'))

    @property
    def __imports(self):
        for subclass in subclasses(LabelsBase):
            if not hasattr(subclass, f'_{subclass.__name__}__pythonOnly'):
                yield subclass()
Example #5
0
 def __imports(self):
     for subclass in subclasses(LabelsBase):
         if not hasattr(subclass, f'_{subclass.__name__}__pythonOnly'):
             yield subclass()
Example #6
0
 def _artifacts(self):
     for collector in subclasses(Collector):
         if collector.__module__ != 'nifstd_tools.parcellation':  # just run __main__
             yield from collector.arts()
Example #7
0
    top_tag = 'METADATA'  # LOL OH WOW >_< this just keeps getting better
    
    mimetype = 'application/x.vnd.zeiss.czi.ZISRAWSUBBLOCK.METADATA+xml'  # TODO

    def _extract(self):
        # TODO has time information and stage and focus
        # seems to be using file naming conventions to match
        # sidecar to tiff (urg)
        return {}


class ExtractMSXMLExcel(XmlSource):
    """ MS-XML for Excel.
        https://en.wikipedia.org/wiki/Microsoft_Office_XML_formats
    """

    top_tag = '{urn:schemas-microsoft-com:office:spreadsheet}Workbook'
    # not clear that this is really xml metadata, it might count as data
    mimetype = 'application/vnd.ms-excel+xml'  # this isn't real, but close enough

    def _extract(self):
        return {}


ExtractXml.classes = (*[c for c in subclasses(XmlSource)], XmlSource)

# FIXME not entirely clear that I am using type correctly here
[register_type(None, cls.mimetype) for cls in ExtractXml.classes
 # NotXml has no mimetype
 if cls.mimetype is not None]