Sile¶
-
class
sisl.io.
Sile
(filename, mode='r', comment='#')[source]¶ Base class for ASCII files
All ASCII files that needs to be added to the global lookup table can with benefit inherit this class.
Attributes
file
File of the current Sile
Methods
__init__
(filename[, mode, comment])exist
()Query whether the file exists is_keys
(keys)Returns true if isinstance(keys,(list,np.ndarray))
key2case
(key, case)Converts str/list of keywords to proper case keys2case
(keys, case)Converts str/list of keywords to proper case line_has_key
(line, key[, case])line_has_keys
(line, keys[, case])read
(*args, **kwargs)Generic read method which should be overloaded in child-classes readline
([comment])Reads the next line of the file step_either
(keywords[, case])Steps the file-handle until the keyword is found in the input step_to
(keywords[, case, reread])Steps the file-handle until the keyword is found in the input write
(*args, **kwargs)Generic write method which should be overloaded in child-classes -
exist
()¶ Query whether the file exists
-
read
(*args, **kwargs)¶ Generic read method which should be overloaded in child-classes
Parameters: **kwargs :
keyword arguments will try and search for the attribute
read_<>
and call it with the remaining**kwargs
as arguments.
-
step_either
(keywords, case=True)[source]¶ Steps the file-handle until the keyword is found in the input
-
step_to
(keywords, case=True, reread=True)[source]¶ Steps the file-handle until the keyword is found in the input
-
write
(*args, **kwargs)¶ Generic write method which should be overloaded in child-classes
Parameters: **kwargs :
keyword arguments will try and search for the attribute write_ and call it with the remaining
**kwargs
as arguments.
-