Let say there is an external package which are can be invoke the following way
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
Then I am making my own package which aim to wrap that external package and possibly later adding more functions.
mypackage.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
Now with this test code I'm calling mypackage
without any problem
test_code.py
import mypackage
mygse = mypackage.load(filepath="./GSE74306.soft.gz")
My question is how can implement the iterator gse.gsm.iteritems
inside mypackage
. And how can I invoke that from test_code.py
?
I'm thinking to do something like:
for foo, bar in mygse.my_gsms_function.iteritems():
pass