Пример #1
0
 def _diagnose_prefixes(self):
     """Returns a set of all of the prefixes seen in the main document dir
     """
     from peyotl.collections_store import COLLECTION_ID_PATTERN
     p = set()
     for owner_dirname in os.listdir(self.doc_dir):
         example_collection_name = "{n}/xxxxx".format(n=owner_dirname)
         if COLLECTION_ID_PATTERN.match(example_collection_name):
             p.add(owner_dirname)
     return p
Пример #2
0
 def _diagnose_prefixes(self):
     """Returns a set of all of the prefixes seen in the main document dir
     """
     from peyotl.collections_store import COLLECTION_ID_PATTERN
     p = set()
     for owner_dirname in os.listdir(self.doc_dir):
         example_collection_name = "{n}/xxxxx".format(n=owner_dirname)
         if COLLECTION_ID_PATTERN.match(example_collection_name):
             p.add(owner_dirname)
     return p
Пример #3
0
 def get(self, collection_id, content=None, **kwargs):
     """Syntactic sugar around to make it easier to get fine-grained access
     to the parts of a file without composing a PhyloSchema object.
     Possible invocations include:
         w.get('pg_10')
         w.get('pg_10', 'trees')
         w.get('pg_10', 'trees', format='nexus')
         w.get('pg_10', tree_id='tree3')
     see:
     """
     assert COLLECTION_ID_PATTERN.match(collection_id)
     r = self.get_collection(collection_id)
     if isinstance(r, dict) and ('data' in r):
         return r['data']
     return r
Пример #4
0
 def get(self, collection_id, content=None, **kwargs):
     """Syntactic sugar around to make it easier to get fine-grained access
     to the parts of a file without composing a PhyloSchema object.
     Possible invocations include:
         w.get('pg_10')
         w.get('pg_10', 'trees')
         w.get('pg_10', 'trees', format='nexus')
         w.get('pg_10', tree_id='tree3')
     see:
     """
     assert COLLECTION_ID_PATTERN.match(collection_id)
     r = self.get_collection(collection_id)
     if isinstance(r, dict) and ('data' in r):
         return r['data']
     return r
Пример #5
0
def get_filepath_for_id(repo_dir, collection_id):
    from peyotl.collections_store import COLLECTION_ID_PATTERN
    assert bool(COLLECTION_ID_PATTERN.match(collection_id))
    return '{r}/collections-by-owner/{s}.json'.format(r=repo_dir,
                                                      s=collection_id)
Пример #6
0
def get_filepath_for_id(repo_dir, collection_id):
    from peyotl.collections_store import COLLECTION_ID_PATTERN
    assert bool(COLLECTION_ID_PATTERN.match(collection_id))
    return '{r}/collections-by-owner/{s}.json'.format(r=repo_dir, s=collection_id)