假设有一个external package可以被调用 下面的方法
import GEOparse
gse = GEOparse.get_GEO(geo="GSE1563", destdir="./")
# I want to mypackage to inherit this iterator
for gsm_name, gsm in gse.gsms.iteritems():
pass
然后我正在制作我自己的包,目的是包装这个外部包,并可能在以后添加更多的函数。你知道吗
我的包.py
import GEOparse
def load(geoid=None, destdir=None, filepath=None):
if filepath:
GEOparse.get_GEO(filepath=filepath)
else:
GEOparse.get_GEO(geo=geoid, destdir=destdir)
return
现在有了这个测试代码,我可以毫无问题地调用mypackage
测试_代码.py
import mypackage
mygse = mypackage.load(filepath="./GSE74306.soft.gz")
我的问题是如何在mypackage
内部实现迭代器gse.gsm.iteritems
。我怎样才能从test_code.py
调用它呢?
我想做一些类似的事情:
for foo, bar in mygse.my_gsms_function.iteritems():
pass
目前没有回答
相关问题 更多 >
编程相关推荐