numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef

The strings are stripped of any non alphanumeric character, and spaces are replaced by '_'. During instantiation, the user can define a list of names to exclude, as well as a list of invalid characters. Names in the exclusion list are appended a '_' character.

Once an instance has been created, it can be called with a list of names, and a list of valid names will be created. The :None:None:`__call__` method accepts an optional keyword "default" that sets the default name in case of ambiguity. By default this is 'f', so that names will default to :None:None:`f0`, :None:None:`f1`, etc.

Notes

Calling an instance of NameValidator is the same as calling its method validate .

Parameters

excludelist : sequence, optional

A list of names to exclude. This list is appended to the default list ['return', 'file', 'print']. Excluded names are appended an underscore: for example, :None:None:`file` becomes :None:None:`file_` if supplied.

deletechars : str, optional

A string combining invalid characters that must be deleted from the names.

case_sensitive : {True, False, 'upper', 'lower'}, optional
  • If True, field names are case-sensitive.

  • If False or 'upper', field names are converted to upper case.

  • If 'lower', field names are converted to lower case.

The default value is True.

replace_space : '_', optional

Character(s) used in replacement of white spaces.

Object to validate a list of strings to use as field names.

Examples

>>> validator = np.lib._iotools.NameValidator()
... validator(['file', 'field2', 'with space', 'CaSe']) ('file_', 'field2', 'with_space', 'CaSe')
>>> validator = np.lib._iotools.NameValidator(excludelist=['excl'],
...  deletechars='q',
...  case_sensitive=False)
... validator(['excl', 'field2', 'no_q', 'with space', 'CaSe']) ('EXCL', 'FIELD2', 'NO_Q', 'WITH_SPACE', 'CASE')
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.lib._iotools.NameValidator numpy.lib._iotools.easy_dtype numpy.lib._iotools.NameValidator.validate

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/_iotools.py#229
type: <class 'type'>
Commit: