Lines Matching refs:name
18 # information: Portions Copyright [yyyy] [name of copyright owner]
86 """Exception class used to indicate an invalid property name."""
93 return _("Property name '{0}' is not valid. Section names "
100 """Exception class used to indicate an invalid property template name.
108 return _("Property template name '{0}' is not valid.").format(
173 """Exception class used to indicate an invalid section name."""
180 return _("Section name '{0}' is not valid. Section names "
187 """Exception class used to indicate an invalid section template name."""
194 return _("Section template name '{0}' is not valid.").format(
226 def __init__(self, name, default="", value_map=misc.EmptyDict):
227 if not isinstance(name, six.string_types) or \
228 not self.__name_re.match(name):
229 raise InvalidPropertyNameError(prop=name)
231 name.encode("ascii")
234 raise InvalidPropertyNameError(prop=name)
235 self.__name = name
244 return self.name < other.name
249 return self.name > other.name
260 if self.name != other.name:
267 if self.name != other.name:
272 return hash((self.name, self.value))
275 return self.__class__(self.name, default=self.value,
288 raise InvalidPropertyValueError(prop=self.name,
308 def name(self):
309 """The name of the property."""
335 properties to an existing configuration object if the property name
336 found matches the pattern name given for the template.
365 def create(self, name):
367 using the given name.
369 assert self.match(name)
377 return self.__prop_type(name, **pargs)
379 def match(self, name):
380 """Returns a boolean indicating whether the given name matches
383 return self.__pattern.match(name) is not None
386 def name(self):
387 """The name (pattern string) of the property template."""
395 def __init__(self, name, default=False, value_map=misc.EmptyDict):
396 Property.__init__(self, name, default=default,
416 raise InvalidPropertyValueError(prop=self.name, value=value)
422 def __init__(self, name, default=0, maximum=None,
428 Property.__init__(self, name, default=default,
457 raise InvalidPropertyValueError(prop=self.name,
461 raise InvalidPropertyValueError(prop=self.name,
464 raise InvalidPropertyValueError(prop=self.name,
483 raise InvalidPropertyValueError(prop=self.name,
492 def __init__(self, name, allowed=misc.EmptyI, default="",
495 Property.__init__(self, name, default=default,
535 raise InvalidPropertyValueError(prop=self.name,
556 raise InvalidPropertyValueError(prop=self.name,
571 raise InvalidPropertyValueError(prop=self.name,
577 raise InvalidPropertyValueError(prop=self.name,
588 raise InvalidPropertyValueError(prop=self.name,
594 raise InvalidPropertyValueError(prop=self.name,
616 raise InvalidPropertyValueError(prop=self.name,
622 raise InvalidPropertyValueError(prop=self.name,
632 raise InvalidPropertyValueError(prop=self.name,
644 raise InvalidPropertyValueError(prop=self.name,
650 raise InvalidPropertyValueError(prop=self.name,
656 raise InvalidPropertyValueError(prop=self.name,
665 raise InvalidPropertyValueError(prop=self.name,
668 raise InvalidPropertyValueError(prop=self.name,
700 raise InvalidPropertyValueError(prop=self.name,
729 prop=self.name,
758 raise InvalidPropertyValueError(prop=self.name,
780 raise InvalidPropertyValueError(prop=self.name,
797 raise InvalidPropertyValueError(prop=self.name,
827 raise InvalidPropertyValueError(prop=self.name,
830 raise InvalidPropertyValueError(prop=self.name,
845 raise InvalidPropertyValueError(prop=self.name,
853 def __init__(self, name, default="0", value_map=misc.EmptyDict):
854 Property.__init__(self, name, default=default,
873 raise InvalidPropertyValueError(prop=self.name,
887 # a name re. In addition, the name "CONFIGURATION" is reserved for
891 def __init__(self, name, properties=misc.EmptyI):
892 if not isinstance(name, six.string_types) or \
893 not self.__name_re.match(name) or \
894 name == "CONFIGURATION":
895 raise InvalidSectionNameError(name)
897 name.encode("ascii")
900 raise InvalidSectionNameError(name)
901 self.__name = name
906 self.__properties = OrderedDict((p.name, p) for p in properties)
911 return self.name < other.name
916 return self.name > other.name
921 return self.name == other.name
924 return hash(self.name)
933 return six.text_type(self.name)
938 assert prop.name not in self.__properties
939 self.__properties[prop.name] = prop
944 name."""
951 def get_property(self, name):
952 """Returns the property object with the specified name. If
955 return self.__properties[name]
958 prop=name)
965 def remove_property(self, name):
968 del self.__properties[name]
971 prop=name)
974 def name(self):
975 """The name of the section."""
983 the section name found matches the pattern name given for the template.
1005 def create(self, name):
1007 using the given name.
1009 assert self.match(name)
1013 return PropertySection(name, properties=[
1017 def match(self, name):
1018 """Returns a boolean indicating whether the given name matches
1021 return self.__pattern.match(name) is not None
1024 def name(self):
1025 """The name (pattern text) of the property section template."""
1047 by section name and property name. If provided, it will be used
1074 out += u"[{0}]\n".format(sec.name)
1076 out += u"{0} = {1}\n".format(p.name, six.text_type(p))
1080 def _get_matching_property(self, section, name, default_type=Property):
1081 """Returns the Property object matching the given name for
1091 self._validate_property_name(name)
1101 p.name for p in secobj.get_properties()
1109 return secobj.get_property(name)
1114 secdef = self.__get_section_def(secobj.name)
1115 propobj = self.__get_property_def(secdef, name,
1121 # section and property names. These methods should return if the name
1124 def _validate_property_name(self, name):
1125 """Raises an exception if property name is not valid for this
1130 def _validate_section_name(self, name):
1131 """Raises an exception if section name is not valid for this
1136 def __get_property_def(self, secdef, name, default_type=Property):
1137 """Returns a new Property object for the given name based on
1142 propobj = secdef.get_property(name)
1151 if p.match(name):
1152 return p.create(name)
1156 return default_type(name)
1158 def __get_section_def(self, name):
1159 """Returns a new PropertySection object for the given name based
1169 if s.name == name:
1180 if s.match(name):
1181 return s.create(name)
1182 return PropertySection(name)
1191 self._validate_section_name(s.name)
1196 p.name for p in secobj.get_properties()
1206 def add_property_value(self, section, name, value):
1208 section and name. If the section or property does not already
1213 propobj = self._get_matching_property(section, name,
1217 prop=name, value=value)
1240 assert section.name not in self.__sections
1241 self._validate_section_name(section.name)
1242 self.__sections[section.name] = section
1245 """Returns a dictionary of dictionaries indexed by section name
1246 and then property name for all properties."""
1248 (s.name, s.get_index())
1252 def get_property(self, section, name):
1254 section and name. Raises UnknownPropertyError if it does not
1271 raise UnknownPropertyError(section=section, prop=name)
1272 return sec.get_property(name).value
1284 def get_section(self, name):
1285 """Returns the PropertySection object with the given name.
1289 return self.__sections[name]
1291 raise UnknownSectionError(section=name)
1298 def remove_property(self, section, name):
1300 name. Raises UnknownPropertyError if it does not exist.
1308 raise UnknownPropertyError(section=section, prop=name)
1309 sec.remove_property(name)
1312 def remove_property_value(self, section, name, value):
1314 object matching the given section and name. Raises
1321 self._validate_property_name(name)
1329 raise UnknownPropertyError(section=section, prop=name)
1331 propobj = secobj.get_property(name)
1334 prop=name, value=value)
1343 prop=name, value=value)
1353 def remove_section(self, name):
1354 """Remove the object matching the given section name. Raises
1358 del self.__sections[name]
1360 raise UnknownSectionError(section=name)
1368 indexed by section name and property name. If provided,
1377 def set_property(self, section, name, value):
1379 section and name. If the section or property does not already
1384 self._validate_property_name(name)
1386 propobj = self._get_matching_property(section, name)
1403 section and then by property name. As an example:
1449 by a "[section]" header, and followed by "name = value" entries, with
1467 'pathname' is the name of the file to read existing
1478 by section name and property name. If provided, it will be used
1580 indexed by section name and property name. If provided,
1612 cp.add_section(section.name)
1615 cp.set(section.name, p.name, misc.force_str(p))
1672 """Exception class used to indicate an invalid SMF property name."""
1679 return _("Property name '{name}' is not valid. Property "
1683 name=self.prop, exp=_SMF_name_re)
1687 """Exception class used to indicate an invalid SMF section name."""
1694 return _("Section name '{name}' is not valid. Section names "
1698 name=self.prop, exp=_SMF_name_re)
1758 by section name and property name. If provided, it will be used
1774 def _validate_property_name(self, name):
1775 """Raises an exception if property name is not valid for this
1778 if not self.__name_re.match(name):
1779 raise SMFInvalidPropertyNameError(name)
1781 def _validate_section_name(self, name):
1782 """Raises an exception if section name is not valid for this
1785 if not self.__name_re.match(name) or \
1786 name in self.__reserved_sections:
1787 raise SMFInvalidSectionNameError(name)
1903 indexed by section name and property name. If provided,