@@ -116,8 +116,7 @@ def check(self, system: "System"):
116116 pass
117117 elif not isinstance (data , self .dtype ):
118118 raise DataError (
119- "Type of %s is %s, but expected %s"
120- % (self .name , type (data ).__name__ , self .dtype .__name__ )
119+ f"Type of { self .name } is { type (data ).__name__ } , but expected { self .dtype .__name__ } "
121120 )
122121 # check shape
123122 if self .shape is not None :
@@ -126,8 +125,7 @@ def check(self, system: "System"):
126125 if isinstance (data , np .ndarray ):
127126 if data .size and shape != data .shape :
128127 raise DataError (
129- "Shape of %s is %s, but expected %s"
130- % (self .name , data .shape , shape )
128+ f"Shape of { self .name } is { data .shape } , but expected { shape } "
131129 )
132130 elif isinstance (data , list ):
133131 if len (shape ) and shape [0 ] != len (data ):
@@ -381,7 +379,7 @@ def __len__(self):
381379 return self .get_nframes ()
382380
383381 def __add__ (self , others ):
384- """magic method "+" operation."""
382+ """Magic method "+" operation."""
385383 self_copy = self .copy ()
386384 if isinstance (others , System ):
387385 other_copy = others .copy ()
@@ -396,7 +394,7 @@ def __add__(self, others):
396394 return self .__class__ .from_dict ({"data" : self_copy .data })
397395
398396 def dump (self , filename , indent = 4 ):
399- """dump .json or .yaml file."""
397+ """Dump .json or .yaml file."""
400398 dumpfn (self .as_dict (), filename , indent = indent )
401399
402400 def map_atom_types (self , type_map = None ) -> np .ndarray :
@@ -439,7 +437,7 @@ def map_atom_types(self, type_map=None) -> np.ndarray:
439437
440438 @staticmethod
441439 def load (filename ):
442- """rebuild System obj. from .json or .yaml file."""
440+ """Rebuild System obj. from .json or .yaml file."""
443441 return loadfn (filename )
444442
445443 def as_dict (self ):
@@ -527,8 +525,7 @@ def append(self, system):
527525 return False
528526 if system .uniq_formula != self .uniq_formula :
529527 raise RuntimeError (
530- "systems with inconsistent formula could not be append: %s v.s. %s"
531- % (self .uniq_formula , system .uniq_formula )
528+ f"systems with inconsistent formula could not be append: { self .uniq_formula } v.s. { system .uniq_formula } "
532529 )
533530 if system .data ["atom_names" ] != self .data ["atom_names" ]:
534531 # allow to append a system with different atom_names order
@@ -1193,7 +1190,7 @@ def __str__(self):
11931190 return ret
11941191
11951192 def __add__ (self , others ):
1196- """magic method "+" operation."""
1193+ """Magic method "+" operation."""
11971194 self_copy = self .copy ()
11981195 if isinstance (others , LabeledSystem ):
11991196 other_copy = others .copy ()
@@ -1389,7 +1386,7 @@ def __str__(self):
13891386 )
13901387
13911388 def __add__ (self , others ):
1392- """magic method "+" operation."""
1389+ """Magic method "+" operation."""
13931390 self_copy = deepcopy (self )
13941391 if isinstance (others , System ) or isinstance (others , MultiSystems ):
13951392 return self .__class__ (self , others )
0 commit comments