def __init__(self, in_file_path): # Assume that the class should be called the same as the file. self.class_name, _ = os.path.splitext(os.path.basename(in_file_path)) defaults = { 'condition' : None, 'depends_on' : [], 'default': 'false', 'custom': False, } self._all_features = InFile.load_from_path(in_file_path, defaults).name_dictionaries # Make sure the resulting dictionaries have all the keys we expect. for feature in self._all_features: feature['first_lowered_name'] = self._lower_first(feature['name']) # Most features just check their isFooEnabled bool # but some depend on more than one bool. enabled_condition = "is%sEnabled" % feature['name'] for dependant_name in feature['depends_on']: enabled_condition += " && is%sEnabled" % dependant_name feature['enabled_condition'] = enabled_condition self._non_custom_features = filter(lambda feature: not feature['custom'], self._all_features)
def __init__(self, in_file_path): # Assume that the class should be called the same as the file. self.class_name, _ = os.path.splitext(os.path.basename(in_file_path)) defaults = { 'condition': None, 'depends_on': [], 'default': 'false', 'custom': False, } self._all_features = InFile.load_from_path(in_file_path, defaults).name_dictionaries # Make sure the resulting dictionaries have all the keys we expect. for feature in self._all_features: feature['first_lowered_name'] = self._lower_first(feature['name']) # Most features just check their isFooEnabled bool # but some depend on more than one bool. enabled_condition = "is%sEnabled" % feature['name'] for dependant_name in feature['depends_on']: enabled_condition += " && is%sEnabled" % dependant_name feature['enabled_condition'] = enabled_condition self._non_custom_features = filter( lambda feature: not feature['custom'], self._all_features)
def __init__(self, in_file_path): self.in_file = InFile.load_from_path(in_file_path, self.defaults, self.default_parameters)