def _from_path(path):
 if (not path.startswith('s3://')):
  raise ValueError(('Bad S3 path %s' % path))
 r = path[len('s3://'):].split('/', 1)
 bucket = key = None
 if (len(r) == 2):
  (bucket, key) = (r[0], r[1])
 else:
  bucket = r[0]
 if (not bucket):
  raise ValueError(('Bad S3 path %s' % path))
 return (bucket, key)

def _from_path ( path ) : if ( not path . startswith ( 's3://' ) ) : raise ValueError ( ( 'Bad S3 path %s' % path ) ) r = path [ len ( 's3://' ) : ] . split ( '/' , 1 ) bucket = key = None if ( len ( r ) == 2 ) : ( bucket , key ) = ( r [ 0 ] , r [ 1 ] ) else : bucket = r [ 0 ] if ( not bucket ) : raise ValueError ( ( 'Bad S3 path %s' % path ) ) return ( bucket , key )
return bucket and key names from an s3 path .