Lines Matching refs:value
4 and followed by "name: value" entries, with continuations and such in
47 a multiline option are kept as part of the value.
50 values are accepted; the value presented for these is None.
55 value can be retrieved using the ``parser_instance.default_section``
59 instance. It will be used as the handler for option value
66 represents the name of a type converter and each value is a callable
104 Return a string value for the named option. All % interpolations are
109 `vars`, the value from `vars` is used.
112 Like get(), but convert value to an integer.
115 Like get(), but convert value to a float.
118 Like get(), but convert value to a boolean (currently case
123 If section is given, return a list of tuples with (name, value) for
133 set(section, option, value)
269 msg = ("Bad value substitution: option {!r} in section {!r} contains "
271 "Raw value: {!r}".format(option, section, reference, rawval))
289 msg = ("Recursion limit exceeded in value substitution: option {!r} "
291 "cannot be substituted in {} steps. Raw value: {!r}"
327 def filename(self, value):
334 self.source = value
342 """Raised when a key-value pair is found before any section header."""
357 # a valid fallback value.
362 """Dummy interpolation that passes the value through with no changes."""
364 def before_get(self, parser, section, option, value, defaults):
365 return value
367 def before_set(self, parser, section, option, value):
368 return value
370 def before_read(self, parser, section, option, value):
371 return value
373 def before_write(self, parser, section, option, value):
374 return value
387 would resolve the "%(dir)s" to the value of dir. All reference
394 def before_get(self, parser, section, option, value, defaults):
396 self._interpolate_some(parser, option, L, value, section, defaults, 1)
399 def before_set(self, parser, section, option, value):
400 tmp_value = value.replace('%%', '') # escaped percent signs
404 "position %d" % (value, tmp_value.find('%')))
405 return value
455 def before_get(self, parser, section, option, value, defaults):
457 self._interpolate_some(parser, option, L, value, section, defaults, 1)
460 def before_set(self, parser, section, option, value):
461 tmp_value = value.replace('$$', '') # escaped dollar signs
465 "position %d" % (value, tmp_value.find('$')))
466 return value
538 def before_get(self, parser, section, option, value, vars):
539 rawval = value
543 if value and "%(" in value:
546 value = self._KEYCRE.sub(replace, value)
548 value = value % vars
554 if value and "%(" in value:
556 return value
558 def before_set(self, parser, section, option, value):
559 return value
585 (?P<value>.*)$ # everything up to eol
594 (?P<value>.*))?$ # everything up to eol
763 for key, value in keys.items():
765 if value is not None:
766 value = str(value)
770 self.set(section, key, value)
782 """Get an option value for a given section.
787 a fallback value. `None` can be provided as a `fallback` value.
805 value = d[option]
812 if raw or value is None:
813 return value
815 return self._interpolation.before_get(self, section, option, value,
848 """Return a list of (name, value) tuples for each option in a section.
869 for key, value in vars.items():
870 d[self.optionxform(key)] = value
885 value = self[key]
887 return key, value
907 def set(self, section, option, value=None):
909 if value:
910 value = self._interpolation.before_set(self, section, option,
911 value)
919 sectdict[self.optionxform(option)] = value
944 for key, value in section_items:
945 value = self._interpolation.before_write(self, section_name, key,
946 value)
947 if value is not None or not self._allow_no_value:
948 value = delimiter + str(value).replace('\n', '\n\t')
950 value = ""
951 fp.write("{}{}\n".format(key, value))
982 def __setitem__(self, key, value):
985 if key in self and self[key] is value:
993 self.read_dict({key: value})
1016 a name in square brackets (`[]`), plus key/value options, indicated by
1017 `name` and `value` delimited with a specific substring (`=` or `:` by
1021 than the first line of the value. Depending on the parser's mode, blank
1057 value = line[:comment_start].strip()
1058 if not value:
1060 # add empty line to the value, but only if there was no
1068 # empty line marks end of value
1076 cursect[optname].append(value)
1081 mo = self.SECTCRE.match(value)
1104 mo = self._optcre.match(value)
1106 optname, vi, optval = mo.group('option', 'vi', 'value')
1149 for key, value in defaults.items():
1150 self._defaults[self.optionxform(key)] = value
1172 for key, value in vars.items():
1173 if value is not None:
1174 value = str(value)
1175 vardict[self.optionxform(key)] = value
1178 def _convert_to_boolean(self, value):
1179 """Return a boolean value translating from other types if necessary.
1181 if value.lower() not in self.BOOLEAN_STATES:
1182 raise ValueError('Not a boolean: %s' % value)
1183 return self.BOOLEAN_STATES[value.lower()]
1185 def _validate_value_types(self, *, section="", option="", value=""):
1188 The only legal non-string value if we allow valueless
1189 options is None, so we need to check if the value is a
1192 - we allow valueless options but the value is not None
1202 if not self._allow_no_value or value:
1203 if not isinstance(value, str):
1216 def set(self, section, option, value=None):
1218 interpolation syntax on the value."""
1219 self._validate_value_types(option=option, value=value)
1220 super().set(section, option, value)
1276 def __setitem__(self, key, value):
1277 self._parser._validate_value_types(option=key, value=value)
1278 return self._parser.set(self._name, key, value)
1312 """Get an option value.
1329 If a parser class implements a getter directly, the value for the given
1348 def __setitem__(self, key, value):
1356 self._data[key] = value
1357 func = functools.partial(self._parser._get_conv, conv=value)
1358 func.converter = value