Header ¶
- class swpy.swds.dataset.utilities. Header ¶
-
Bases:
dict
This class manages the file's header based on a dictionary. Addtionally, it includes basic dictionary functions, while allowing management of header items through additional methods.
Methods Summary
|
Returns the string representation of the object. |
|
Returns the string representation of the object. |
|
Returns the value corresponding to the given key. |
|
Sets the value for the given key. |
|
Deletes the item corresponding to the given key. |
|
Returns an iterator for the keys of the header. |
|
Returns the number of items in the header. |
|
Checks if the given key is present in the header. |
|
Returns all the keys in the header. |
|
Returns all the values in the header. |
|
Returns all the key-value pairs in the header. |
|
Returns the value corresponding to the given key. |
|
Sets the value into the given key. |
|
Deletes the item corresponding to the given key. |
|
Deletes all the item of the header. |
|
Deletes all items except for the given key. |
|
Deletes all items that are not included in the given list of keys. |
Methods Documentation
- __repr__ ( self ) ¶
-
Returns the string representation of the object.
- Returns
-
The 'string representation' that shows the 'Header' object.
- __str__ ( self ) ¶
-
Returns the string representation of the object.
- Returns
-
The 'string representation' that shows the 'Header' object.
- __getitem__ ( self, key ) ¶
-
Returns the value corresponding to the given key.
- Parameters
-
key (
str
) - The dictionary key of the header object. - Returns
-
The 'dictionary values' of the header object.
- __setitem__ ( self, key, value ) ¶
-
Sets the value for the given key.
- Parameters
-
key (
str
) - The dictionary key of the header object. -
value (
all type
) - The dictionary value of the header object. - __delitem__ ( self, key ) ¶
-
Deletes the item corresponding to the given key.
- Parameters
-
key (
str
) - The dictionary key of the header object. - __iter__ ( self ) ¶
-
Returns an iterator for the keys of the header.
- Returns
-
iterator
- An iterator for the keys of the header. - __len__ ( self ) ¶
-
Returns the number of items in the header.
- Returns
-
the number of items in the header.
- __contains__ ( self, key ) ¶
-
Checks if the given key is present in the header.
- Parameters
-
key (
str
) - The dictionary key of the header object. - Returns
-
bool (
str
) - If the key is present,'True', otherwise 'False'. - keys ( self ) ¶
-
Returns all the keys in the header.
- Returns
-
All the keys in the 'header'.
- values ( self ) ¶
-
Returns all the values in the header.
- Returns
-
All the values in the 'header'.
- items ( self ) ¶
-
Returns all the key-value pairs in the header.
- Returns
-
All the key-value pairs in the 'header'.
- get ( self, key ) ¶
-
Returns the value corresponding to the given key.
- Returns
-
The 'values' corresponding to the given key.
- set ( self, key, value ) ¶
-
Sets the value into the given key.
- Parameters
-
key (
str
) - The dictionary key of the header object. -
value (
all type
) - The dictionary value of the header object. - delete ( self, key ) ¶
-
Deletes the item corresponding to the given key.
- Parameters
-
key (
str
) - The dictionary key of the header object. - delete_all ( self ) ¶
-
Deletes all the item of the header.
- delete_all_except ( self, key ) ¶
-
Deletes all items except for the given key.
- Parameters
-
key (
str
) - The dictionary key of the header object. - delete_all_except_these ( self, key ) ¶
-
Deletes all items that are not included in the given list of keys.
- Parameters
-
key (
str
) - A list of dictionary keys to be retained.