PlasmaCalcs.units.units_manager.UnitsStringManager

class PlasmaCalcs.units.units_manager.UnitsStringManager

Bases: dict

manages string of units; keys are unit symbol bases, values are exponents.
__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

clean()

clear()

copy()

evaluate(values_dict)

evaluate_iteratively(values_dict)

evaluate_partial(values_dict)

expand(*[, bases, known])

expand_once(*[, bases, known])

from_string(string_of_units, *[, bases, known])

fromkeys([value])

get(key[, default])

items()

keys()

pop(k[,d])

popitem()

setdefault(key[, default])

update([E, ]**F)

values()

Attributes

bases

known

clean()
return result of deleting all keys with value == 0.
clear() None.  Remove all items from D.
copy()
return copy of self.
evaluate(values_dict)
evaluates self based on values_dict, returning a numerical value.
if any units are not in values_dict, raises UnitsError.
Equivalent to self.evaluate_partial(values_dict)[0], when all units are in values_dict.
evaluate_iteratively(values_dict)
evaluates all the parts of self which can be evaluated based on values_dict,
and also calling result[1].expand_once() after each incomplete evaluation attempt.
returns numerical value.
raises UnitsError if any units are not in values_dict after expanding as many times as possible.
evaluate_partial(values_dict)
evaluates all the parts of self which can be evaluated based on values_dict.
returns (numerical value, UnitsStringManager with still-unevaluated units)
if no keys in self are also in values_dict, result[0] will be 1.
if all keys in self are also in values_dict, len(result[1]) will be 0.
if values_dict provides any relevant key with value None, returns (None, {})
expand(*, bases=None, known=None)
returns result of expanding repeatedly until all keys are si base units.
expand_once(*, bases=None, known=None)
returns result of replacing all keys other than bases with their known conversions.
classmethod from_string(string_of_units, *, bases=None, known=None)
new UnitsStringManager from a string of units; just gets the symbols & exponents.
fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.
If key is not found, default is returned if given, otherwise KeyError is raised
popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order.
Raises KeyError if the dict is empty.
setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
update([E, ]**F) None.  Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values() an object providing a view on D's values