def create_env(env, force): create_dir("envs") create_dir(env_path(env)) create_dir(zip_path(env)) create_dir(source_path(env)) create_dir(filtered_path(env)) create_dir(book_path(env)) write_string_to_file(config_path(env), default_config(), force) write_string_to_file(filter_logic_path(env), default_filter_logic(), force)
def new_user(): student_login = '' while student_login == '': student_login = input('login insper: ').strip() student_key = create_key(f'students/{student_login}.key') student_name = input('nome completo: ') student_avatar = input('imagem de avatar: ') s = Student(student_login, student_name, student_avatar, []) write_string_to_file(f'students/{student_login}', s.toJSON()) save_encrypted(f'students/{student_login}-achievements', student_key, '[]')
def newUser(): student_login = '' while student_login == '': student_login = input('login insper: ').strip() student_key = create_key(f'students/{student_login}.key') student_name = input('nome completo: ') ghname = input('usuário do github: ') s = Student(student_login, student_name, ghname, []) write_string_to_file(f'students/{student_login}', s.toJSON()) save_encrypted(f'students/{student_login}-achievements', student_key, '[]')
return ''.join(ret) def encrypt(plain): #alphabet = get_alphabet() key = ALPHABET[:] random.shuffle(key) encryption = dict(zip(alphabet, key)) #build an encrypted string ciphertext = '' for letter in plain: try: ciphertext += encryption[letter] except: ciphertext += letter return ciphertext # read the plaintext file PLAINTEXT = read_file_to_string(INPUT_FILENAME) PLAINTEXT = remove_extra_symbols(PLAINTEXT) print('\n plain text: \n', PLAINTEXT) # encrypt CRYPTED_TEXT = encrypt(PLAINTEXT.lower()) print('\n encrypted text: \n', CRYPTED_TEXT) write_string_to_file(OUPUT_FILENAME, CRYPTED_TEXT)
parser.add_argument('--force', action="store_true", help='force') args = parser.parse_args() ################################################### print(args) if args.create: reponame = args.create print("creating {} as {}".format(reponame, repopath())) if args.force: rmtree(repopath()) create_dir(repopath()) write_string_to_file(repoconfigpath(), read_string_from_file("repotemplate.json", "{}"), force=args.force) if args.populate: reponame = args.populate if args.force: print("removing .git") rmtree(repofilepath(".git")) subprocess.Popen(["git", "init"], cwd=str(Path(repopath()))).wait() configjson = readrepoconfigjson() gituser = configjson["gituser"] gitpass = configjson["gitpass"] gitmail = configjson["gitmail"] project = configjson["project"] projectTitle = project["title"] projectDescription = project["description"]