@ -104,7 +104,7 @@ class GitWrapper:
def __init__ ( self , config = None ) :
self . repo = None
if config is not None and osp. isdir ( config. project_dir ) :
if config is not None and config. project_dir :
self . init ( config . project_dir )
@staticmethod
@ -116,8 +116,12 @@ class GitWrapper:
spawn = not osp . isdir ( cls . _git_dir ( path ) )
repo = git . Repo . init ( path = path )
if spawn :
author = git . Actor ( " Nobody " , " nobody@example.com " )
repo . index . commit ( ' Initial commit ' , author = author )
repo . config_writer ( ) . set_value ( " user " , " name " , " User " ) \
. set_value ( " user " , " email " , " user@nowhere.com " ) \
. release ( )
# gitpython does not support init, use git directly
repo . git . init ( )
repo . git . commit ( ' -m ' , ' Initial commit ' , ' --allow-empty ' )
return repo
def init ( self , path ) :
@ -377,9 +381,10 @@ class Dataset(Extractor):
def get ( self , item_id , subset = None , path = None ) :
if path :
raise KeyError ( " Requested dataset item path is not found " )
if subset is None :
subset = ' '
return self . _subsets [ subset ] . items [ item_id ]
item_id = str ( item_id )
subset = subset or ' '
subset = self . _subsets [ subset ]
return subset . items [ item_id ]
def put ( self , item , item_id = None , subset = None , path = None ) :
if path :
@ -567,7 +572,7 @@ class ProjectDataset(Dataset):
rest_path = path [ 1 : ]
return self . _sources [ source ] . get (
item_id = item_id , subset = subset , path = rest_path )
return self . _subsets [ subset ] . items [ item_id ]
return super ( ) . get ( item_id , subset )
def put ( self , item , item_id = None , subset = None , path = None ) :
if path is None :
@ -754,9 +759,10 @@ class Project:
@staticmethod
def generate ( save_dir , config = None ) :
config = Config ( config )
config . project_dir = save_dir
project = Project ( config )
project . save ( save_dir )
project . config . project_dir = save_dir
return project
@staticmethod