@@ -36,6 +36,7 @@ def __init__(self,
36
36
readme : str = None ,
37
37
in_collection : Union [str , List [str ]] = None ,
38
38
_filepath : str = None ,
39
+ _path_to_readme : str = None ,
39
40
** kwargs ,
40
41
):
41
42
"""
@@ -51,6 +52,7 @@ def __init__(self,
51
52
readme (str): path to the README file for the model
52
53
in_collection (str, List): name of the collection to which the model belongs to
53
54
_filepath: The file path to where the data was loaded from
55
+ _path_to_readme: Path to the markdown readme file if data is coming from there
54
56
**kwargs: Any other custom fields
55
57
"""
56
58
@@ -93,6 +95,8 @@ def __init__(self,
93
95
# Only non-empty items
94
96
data = {k : v for k , v in d .items () if v is not None }
95
97
98
+ self ._path_to_readme = _path_to_readme
99
+
96
100
super ().__init__ (
97
101
data = data ,
98
102
filepath = _filepath ,
@@ -103,7 +107,7 @@ def _check(self, silent=True):
103
107
if self .name is None or self .name == "" :
104
108
self .check_errors .add ("Field 'Name' cannot be empty" )
105
109
106
- if self .readme and self .readme .endswith (".md" ) and len (self .readme ) < 256 :
110
+ if self .readme and self .readme .endswith (".md" ) and len (self .readme ) < 256 and not self . _path_to_readme :
107
111
# check if the README exists
108
112
fullpath = full_filepath (self .readme , self .filepath )
109
113
if not os .path .isfile (fullpath ):
@@ -149,6 +153,7 @@ def from_dict(cls, d: Dict, _filepath: str = None, _path_to_readme: str = None):
149
153
150
154
return cls (
151
155
_filepath = _filepath ,
156
+ _path_to_readme = _path_to_readme ,
152
157
** dd ,
153
158
)
154
159
0 commit comments