cf.of_fraction

cf.of_fraction(*arg)[source]

The amount of concurrently open files above which files containing data arrays may be automatically closed.

Deprecated at version 3.14.0 and is no longer available.

The amount is expressed as a fraction of the maximum possible number of concurrently open files.

Note that closed files will be automatically reopened if subsequently needed by a variable to access its data array.

Parameters:
arg: float or Constant, optional

The new fraction (between 0.0 and 1.0). The default is to not change the current behaviour.

Returns:
Constant

The value prior to the change, or the current value if no new value was specified.

Examples

>>> cf.of_fraction()
0.5
>>> old = cf.of_fraction(0.33)
>>> cf.of_fraction(old)
0.33
>>> cf.of_fraction()
0.5

The fraction may be translated to an actual number of files as follows:

>>> old = cf.of_fraction(0.75)
>>> import resource
>>> max_open_files = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
>>> threshold = int(max_open_files * cf.of_fraction())
>>> max_open_files, threshold
(1024, 768)