@@ -1215,6 +1215,20 @@ def pick_atom_idx(self, idx, nopbc=None):
1215
1215
new_sys .append (ss .pick_atom_idx (idx , nopbc = nopbc ))
1216
1216
return new_sys
1217
1217
1218
+ def get_cls_name (cls : object ) -> str :
1219
+ """Returns the fully qualified name of a class, such as `np.ndarray`.
1220
+
1221
+ Parameters
1222
+ ----------
1223
+ cls : object
1224
+ the class
1225
+
1226
+ Returns
1227
+ -------
1228
+ str
1229
+ the fully qualified name of a class
1230
+ """
1231
+ return "." .join ([cls .__module__ , cls .__name__ ])
1218
1232
1219
1233
def add_format_methods ():
1220
1234
"""Add format methods to System, LabeledSystem, and MultiSystems.
@@ -1237,6 +1251,7 @@ def get_func(ff):
1237
1251
# ff is not initized when defining from_format so cannot be polluted
1238
1252
def from_format (self , file_name , ** kwargs ):
1239
1253
return self .from_fmt_obj (ff (), file_name , ** kwargs )
1254
+ from_format .__doc__ = "Read data from :class:`%s` format." % (get_cls_name (ff ))
1240
1255
return from_format
1241
1256
1242
1257
setattr (System , method , get_func (formatcls ))
@@ -1247,6 +1262,7 @@ def from_format(self, file_name, **kwargs):
1247
1262
def get_func (ff ):
1248
1263
def to_format (self , * args , ** kwargs ):
1249
1264
return self .to_fmt_obj (ff (), * args , ** kwargs )
1265
+ to_format .__doc__ = "Dump data to :class:`%s` format." % (get_cls_name (ff ))
1250
1266
return to_format
1251
1267
1252
1268
setattr (System , method , get_func (formatcls ))
0 commit comments