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

file

File of the current Sile

static is_keys(keys)[source]

Returns true if isinstance(keys,(list,np.ndarray))

static key2case(key, case)[source]

Converts str/list of keywords to proper case

static keys2case(keys, case)[source]

Converts str/list of keywords to proper case

static line_has_key(line, key, case=True)[source]
static line_has_keys(line, keys, case=True)[source]
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.

readline(comment=False)[source]

Reads the next line of the file

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.