MCPcopy
hub / github.com/StevenBlack/hosts / prompt_for_move

Function prompt_for_move

updateHostsFile.py:453–489  ·  view source on GitHub ↗

Prompt the user to move the newly created hosts file to its designated location in the OS. Parameters ---------- finalfile : file The file object that contains the newly created hosts data. moveparams : kwargs Dictionary providing additional parameters for m

(finalfile, **moveparams)

Source from the content-addressed store, hash-verified

451
452
453def prompt_for_move(finalfile, **moveparams):
454 """
455 Prompt the user to move the newly created hosts file to its designated
456 location in the OS.
457
458 Parameters
459 ----------
460 finalfile : file
461 The file object that contains the newly created hosts data.
462 moveparams : kwargs
463 Dictionary providing additional parameters for moving the hosts file
464 into place. Currently, those fields are:
465
466 1) auto
467 2) replace
468 3) skipstatichosts
469
470 Returns
471 -------
472 movefile : bool
473 Whether or not the final hosts file was moved.
474 """
475
476 skipstatichosts = moveparams["skipstatichosts"]
477
478 if moveparams["replace"] and not skipstatichosts:
479 movefile = True
480 elif moveparams["auto"] or skipstatichosts:
481 movefile = False
482 else:
483 prompt = "Do you want to replace your existing hosts file with the newly generated file?"
484 movefile = query_yes_no(prompt)
485
486 if movefile:
487 movefile = move_hosts_file_into_place(finalfile)
488
489 return movefile
490
491
492# End Prompt the User

Callers 2

prompt_for_moveMethod · 0.90
mainFunction · 0.85

Calls 2

query_yes_noFunction · 0.85

Tested by 1

prompt_for_moveMethod · 0.72