@@ -116,8 +116,7 @@ def check(self, system: "System"):
116
116
pass
117
117
elif not isinstance (data , self .dtype ):
118
118
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__ } "
121
120
)
122
121
# check shape
123
122
if self .shape is not None :
@@ -126,8 +125,7 @@ def check(self, system: "System"):
126
125
if isinstance (data , np .ndarray ):
127
126
if data .size and shape != data .shape :
128
127
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 } "
131
129
)
132
130
elif isinstance (data , list ):
133
131
if len (shape ) and shape [0 ] != len (data ):
@@ -381,7 +379,7 @@ def __len__(self):
381
379
return self .get_nframes ()
382
380
383
381
def __add__ (self , others ):
384
- """magic method "+" operation."""
382
+ """Magic method "+" operation."""
385
383
self_copy = self .copy ()
386
384
if isinstance (others , System ):
387
385
other_copy = others .copy ()
@@ -396,7 +394,7 @@ def __add__(self, others):
396
394
return self .__class__ .from_dict ({"data" : self_copy .data })
397
395
398
396
def dump (self , filename , indent = 4 ):
399
- """dump .json or .yaml file."""
397
+ """Dump .json or .yaml file."""
400
398
dumpfn (self .as_dict (), filename , indent = indent )
401
399
402
400
def map_atom_types (self , type_map = None ) -> np .ndarray :
@@ -439,7 +437,7 @@ def map_atom_types(self, type_map=None) -> np.ndarray:
439
437
440
438
@staticmethod
441
439
def load (filename ):
442
- """rebuild System obj. from .json or .yaml file."""
440
+ """Rebuild System obj. from .json or .yaml file."""
443
441
return loadfn (filename )
444
442
445
443
def as_dict (self ):
@@ -527,8 +525,7 @@ def append(self, system):
527
525
return False
528
526
if system .uniq_formula != self .uniq_formula :
529
527
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 } "
532
529
)
533
530
if system .data ["atom_names" ] != self .data ["atom_names" ]:
534
531
# allow to append a system with different atom_names order
@@ -1193,7 +1190,7 @@ def __str__(self):
1193
1190
return ret
1194
1191
1195
1192
def __add__ (self , others ):
1196
- """magic method "+" operation."""
1193
+ """Magic method "+" operation."""
1197
1194
self_copy = self .copy ()
1198
1195
if isinstance (others , LabeledSystem ):
1199
1196
other_copy = others .copy ()
@@ -1389,7 +1386,7 @@ def __str__(self):
1389
1386
)
1390
1387
1391
1388
def __add__ (self , others ):
1392
- """magic method "+" operation."""
1389
+ """Magic method "+" operation."""
1393
1390
self_copy = deepcopy (self )
1394
1391
if isinstance (others , System ) or isinstance (others , MultiSystems ):
1395
1392
return self .__class__ (self , others )
0 commit comments