def set_template_remote_kickstarts(self, template): """ Sets whether or not the server is configured to template remote kickstarts. """ self.template_remote_kickstarts = utils.input_boolean(template) return True
def __setattr__(self, name, value): if name in DEFAULTS: try: if DEFAULTS[name][1] == "str": value = str(value) elif DEFAULTS[name][1] == "int": value = int(value) elif DEFAULTS[name][1] == "bool": if utils.input_boolean(value): value = 1 else: value = 0 elif DEFAULTS[name][1] == "float": value = float(value) elif DEFAULTS[name][1] == "list": value = utils.input_string_or_list(value) elif DEFAULTS[name][1] == "dict": value = utils.input_string_or_dict(value)[1] except: raise AttributeError self.__dict__[name] = value if not utils.update_settings_file(self.to_dict()): raise AttributeError return 0 else: raise AttributeError
def __setattr__(self,name,value): if DEFAULTS.has_key(name): try: if DEFAULTS[name][1] == "str": value = str(value) elif DEFAULTS[name][1] == "int": value = int(value) elif DEFAULTS[name][1] == "bool": if utils.input_boolean(value): value = 1 else: value = 0 elif DEFAULTS[name][1] == "float": value = float(value) elif DEFAULTS[name][1] == "list": value = utils.input_string_or_list(value) elif DEFAULTS[name][1] == "dict": value = utils.input_string_or_hash(value)[1] except: raise AttributeError, "failed to set %s to %s" % (name,str(value)) self.__dict__[name] = value if not utils.update_settings_file(self.to_datastruct()): raise AttributeError, "failed to save the settings file!" return 0 else: raise AttributeError, name
def __setattr__(self, name, value): if DEFAULTS.has_key(name): try: if DEFAULTS[name][1] == "str": value = str(value) elif DEFAULTS[name][1] == "int": value = int(value) elif DEFAULTS[name][1] == "bool": if utils.input_boolean(value): value = 1 else: value = 0 elif DEFAULTS[name][1] == "float": value = float(value) elif DEFAULTS[name][1] == "list": value = utils.input_string_or_list(value) elif DEFAULTS[name][1] == "dict": value = utils.input_string_or_hash(value)[1] except: raise AttributeError, "failed to set %s to %s" % (name, str(value)) self.__dict__[name] = value utils.update_settings_file(name, value) return 0 else: raise AttributeError, name
def __setattr__(self, name, value): if name in DEFAULTS: try: if DEFAULTS[name][1] == "str": value = str(value) elif DEFAULTS[name][1] == "int": value = int(value) elif DEFAULTS[name][1] == "bool": if utils.input_boolean(value): value = 1 else: value = 0 elif DEFAULTS[name][1] == "float": value = float(value) elif DEFAULTS[name][1] == "list": value = utils.input_string_or_list(value) elif DEFAULTS[name][1] == "dict": value = utils.input_string_or_hash(value)[1] except: raise AttributeError self.__dict__[name] = value if not utils.update_settings_file(self.to_datastruct()): raise AttributeError return 0 else: raise AttributeError
def set_enable_menu(self,enable_menu): """ Sets whether or not the profile will be listed in the default PXE boot menu. This is pretty forgiving for YAML's sake. """ self.enable_menu = utils.input_boolean(enable_menu) return True
def set_enable_menu(self, enable_menu): """ Sets whether or not the profile will be listed in the default PXE boot menu. This is pretty forgiving for YAML's sake. """ self.enable_menu = utils.input_boolean(enable_menu) return True
def set_repos_enabled(self,repos_enabled): """ If true, allows per-system to start Monit to monitor system services such as apache. If monit is not running it will start the service. If false, no management of monit will take place. If monit is not running it will not be started. If monit is running it will not be stopped or restarted. """ self.repos_enabled = utils.input_boolean(repos_enabled) return True
def set_repos_enabled(self, repos_enabled): """ If true, allows per-system to start Monit to monitor system services such as apache. If monit is not running it will start the service. If false, no management of monit will take place. If monit is not running it will not be started. If monit is running it will not be stopped or restarted. """ self.repos_enabled = utils.input_boolean(repos_enabled) return True
def init(self): os.system('clear') self.number_of_players = utils.input_number('Number of players: ') self.number_of_decks = utils.input_number('Number of decks: ') self.table_bet = utils.input_number('Initial table bet: ') self.five_card_rule = utils.input_boolean('Activate five card rule: ') self.players = [ Player(i) for i in range(1, self.number_of_players + 1) ] self.deck = Deck(self.number_of_decks) self.dealer = Dealer()
def set_netboot_enabled(self, netboot_enabled): """ If true, allows per-system PXE files to be generated on sync (or add). If false, these files are not generated, thus eliminating the potential for an infinite install loop when systems are set to PXE boot first in the boot order. In general, users who are PXE booting first in the boot order won't create system definitions, so this feature primarily comes into play for programmatic users of the API, who want to initially create a system with netboot enabled and then disable it after the system installs, as triggered by some action in kickstart %post. For this reason, this option is not surfaced in the CLI, output, or documentation (yet). Use of this option does not affect the ability to use PXE menus. If an admin has machines set up to PXE only after local boot fails, this option isn't even relevant. """ self.netboot_enabled = utils.input_boolean(netboot_enabled) return True
def set_netboot_enabled(self,netboot_enabled): """ If true, allows per-system PXE files to be generated on sync (or add). If false, these files are not generated, thus eliminating the potential for an infinite install loop when systems are set to PXE boot first in the boot order. In general, users who are PXE booting first in the boot order won't create system definitions, so this feature primarily comes into play for programmatic users of the API, who want to initially create a system with netboot enabled and then disable it after the system installs, as triggered by some action in kickstart %post. For this reason, this option is not surfaced in the CLI, output, or documentation (yet). Use of this option does not affect the ability to use PXE menus. If an admin has machines set up to PXE only after local boot fails, this option isn't even relevant. """ self.netboot_enabled = utils.input_boolean(netboot_enabled) return True
def set_is_dir(self, is_dir): """ If true, treat file resource as a directory. Templates are ignored. """ self.is_dir = utils.input_boolean(is_dir) return True
def set_enable_gpxe(self,enable_gpxe): """ Sets whether or not the profile will use gPXE for booting. """ self.enable_gpxe = utils.input_boolean(enable_gpxe) return True
def main(): print('Initializing...') base_path = os.path.dirname(sys.argv[0]) images_paths = [ os.path.normpath(os.path.join(base_path, 'datasets/', wwu_muenster_images_path)), os.path.normpath(os.path.join(base_path, 'datasets/', arte_lab_images_path)) ] masks_paths = [ os.path.normpath(os.path.join(base_path, 'datasets/', wwu_muenster_masks_path)), os.path.normpath(os.path.join(base_path, 'datasets/', arte_lab_masks_path)) ] models_path = os.path.normpath(os.path.join(base_path, 'models/')) # Load data images = None masks = None for images_path, masks_path in zip(images_paths, masks_paths): images = storage.load_datamap(images_path, datamap=images) masks = storage.load_datamap(masks_path, datamap=masks) # Create dataset dataset = datasets.create_dataset(images, masks, rescale=(256, 256)) # Augment dataset dataset = datasets.augment_dataset(dataset, new_size=2500) # Create model model = models.create_model() model.summary() loss_function = { 'mse': tf.keras.losses.MeanSquaredError(name='mse'), 'mae': tf.keras.losses.MeanAbsoluteError(name='mae'), 'bce': tf.keras.losses.BinaryCrossentropy(name='bce') }[sys.argv[1]] if len(sys.argv) > 1 else tf.keras.losses.MeanSquaredError(name='mse') epochs = int(sys.argv[2]) if len(sys.argv) > 2 else 20 print(loss_function) # Load weights if utils.input_boolean('Load weights?'): try: model.load_weights(os.path.join(models_path, loss_function.name)) except Exception as ex: print('Load error!') print(ex) # Predict images (pre-training) print('Showing pre-training example predictions...') for index in range(5): predictions = model.predict(np.array([dataset.images[index]])) utils.print_prediction(dataset.images[index], dataset.labels[index], predictions[0]) # Train model models.train_model( dataset, model, loss_function=loss_function, epochs=epochs ) # Predict images (post-training) print('Showing post-training example predictions...') for index in range(5): predictions = model.predict(np.array([dataset.images[index]])) utils.print_prediction(dataset.images[index], dataset.labels[index], predictions[0]) # Save weights if utils.input_boolean('Save weights?'): try: model.save_weights(os.path.join(models_path, loss_function.name)) except Exception as ex: print('Save error!') print(ex) print('Terminating...') return model
def set_mirror_locally(self, value): self.mirror_locally = utils.input_boolean(value) return True
def set_ipv6_autoconfiguration(self,truthiness): self.ipv6_autoconfiguration = utils.input_boolean(truthiness) return True
def set_mirror_locally(self,value): self.mirror_locally = utils.input_boolean(value) return True
def set_is_definition(self, isdef): self.is_definition = utils.input_boolean(isdef) return True
def set_static(self, truthiness, interface): intf = self.__get_interface(interface) intf["static"] = utils.input_boolean(truthiness) return True
def set_management(self, truthiness, interface): intf = self.__get_interface(interface) intf["management"] = utils.input_boolean(truthiness) return True
def set_enable_gpxe(self, enable_gpxe): """ Sets whether or not the profile will use gPXE for booting. """ self.enable_gpxe = utils.input_boolean(enable_gpxe) return True
def set_static(self,truthiness,interface): intf = self.__get_interface(interface) intf["static"] = utils.input_boolean(truthiness) return True
def set_management(self,truthiness,interface): intf = self.__get_interface(interface) intf["management"] = utils.input_boolean(truthiness) return True
def set_keep_updated(self, keep_updated): """ This allows the user to disable updates to a particular repo for whatever reason. """ self.keep_updated = utils.input_boolean(keep_updated) return True
def set_ipv6_autoconfiguration(self, truthiness): self.ipv6_autoconfiguration = utils.input_boolean(truthiness) return True
def set_keep_updated(self,keep_updated): """ This allows the user to disable updates to a particular repo for whatever reason. """ self.keep_updated = utils.input_boolean(keep_updated) return True