def define_configs(args): if args.config == "base": config = Config() elif args.config == "latest": config = ConfigLatest() else: raise ValueError("Invalid choice of configuration") config = read_flags(config, args) seed_tmp = time.time() config.seed = int( (seed_tmp - int(seed_tmp)) * 1e6) if args.seed is None else args.seed simulation_name = get_simulation_name(config) config.directory = directory = "{}/results/{}/{}".format( os.path.dirname(sys.argv[0]), simulation_name, config.seed) create_exp_dir(directory, scripts_to_save=[ 'configs.py', 'channel_envs.py', 'main.py', 'model.py', 'optimizers.py', 'utils.py', 'replay_buffer.py' ]) sess_config = tf.ConfigProto() sess_config.gpu_options.allow_growth = True return config, sess_config
def main(): conf = Config().parse(create_dir_flag=False) conf.name = 'TEST_' + conf.name conf.output_dir_path = util.prepare_result_dir(conf) gan = InGAN(conf) try: gan.resume(conf.test_params_path, test_flag=True) [input_tensor] = util.read_data(conf) if conf.test_video: retarget_video(gan, input_tensor, define_video_scales(conf.test_vid_scales), 8, conf.output_dir_path) if conf.test_collage: generate_collage_and_outputs(conf, gan, input_tensor) if conf.test_non_rect: test_homo(conf, gan, input_tensor) print 'Done with %s' % conf.input_image_path except KeyboardInterrupt: raise except Exception as e: # print 'Something went wrong with %s (%d/%d), iter %dk' % (input_image_path, i, n_files, snapshot_iter) print_exc()
def config_kernelGAN(afile): img_folder = os.path.dirname(afile) img_file = os.path.basename(afile) out_dir = "yoon/kernels/track2" params = [ "--input_image_path", afile, "--output_dir_path", out_dir, "--noise_scale", str(1.0), "--X4" ] conf = Config().parse(params) conf.input2 = None return conf
def main(): parser = argparse.ArgumentParser() parser.add_argument( "--detector", type=str, default="CenterNet", help="The detector name, e.g.`efficientdet`, `efficient_fcos`.") parser.add_argument( "--gpus", type=str, default="0,1,2,3", help="Use multi-gpu training or not, default False, means use one gpu." ) parser.add_argument("--cfg", type=str, default=None, help="The conifg file (yaml), if None, using default.") parser.add_argument("--num_classes", type=int, default=80, help="The number of classes, default 80 (COCO).") args = parser.parse_args() os.environ["CUDA_VISIBLE_DEVICES"] = args.gpus tf.random.set_seed(2333) # tf.config.optimizer.set_jit(True) logger = logging.getLogger() logger.setLevel(logging.INFO) logging.basicConfig(format="%(asctime)s %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S") physical_devices = tf.config.experimental.list_physical_devices("GPU") for device in physical_devices: tf.config.experimental.set_memory_growth(device, True) if args.cfg is None: cfg = build_configs(args.detector)(args.num_classes) else: cfg = Config() cfg.parse_from_yaml(args.cfg) num_gpus = len(args.gpus.strip().split(",")) if num_gpus > 1: trainer = MultiGPUTrainer(cfg=cfg, logger=logger) else: trainer = SingleGPUTrainer(cfg=cfg, logger=logger) trainer.run()
def main_loop(self): template = cv2.imread('fishing_float.png', 0) w, h = template.shape[::-1] for it in range(Config.LOOP_COUNT): self.display_stats(it) pyautogui.moveTo(Config.get_cursor_rest_place_x(), Config.get_cursor_rest_place_y(), duration=1) logger.info("1. Start fishing") # Start fishing by pressing 1 on the keyboard pyautogui.press('1') # Wait until fishing float appears on the screen time.sleep(2) logger.info("2. Fishing float is ready") # Capture game screenshot from top left corner + coordinates base_screen = ImageGrab.grab(bbox=(0, 0, Config.CAPTURE_X, Config.CAPTURE_Y)) base_screen.save('base_screenshot.png') img_rgb = cv2.imread('base_screenshot.png') img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2GRAY) logger.info("3. Base screenshot is captured") # Compare template with screenshot and try to find it with 70% accuracy res = cv2.matchTemplate(img_gray, template, cv2.TM_CCOEFF_NORMED) loc = np.where(res >= Config.TEMPLATE_RECOGNITION_THRESHOLD) if not list(zip(*loc[::-1])): logger.error("Fishing float was not found. Restarting...") self.failures += 1 if self.failures >= Config.MAX_FAILURES: logger.error("------ Bot terminated due too failures ------") break continue self.failures = 0 logger.info("4. Fishing float location found. Start fishing...") # Get position where fishing float has been found (from top left corner) x = list(zip(*loc[::-1]))[0][0] y = list(zip(*loc[::-1]))[0][1] # Magic loop (x, y - template's location on screen; w, h - template's width & height) self.fishing_loop(x, y, [0, ], w, h)
def __init__(self, ignore_class_bg, display, disp_img_id, disp_dataset, tf_model_dir): self.ignore_class_bg = ignore_class_bg self.display = display self.disp_img_id = disp_img_id self.disp_dataset = disp_dataset self.tf_model_dir = tf_model_dir self.config = Config() # BG ignoring if self.ignore_class_bg: self.nSketchClasses = self.config.nSketchClasses - 1 else: self.nSketchClasses = self.config.nSketchClasses self.upsample_mode = self.config.upsample_mode self.sketchyscene_data_base = os.path.join('..', self.config.data_base_dir) self.image_name = 'L0_sample' + str( self.disp_img_id) + '.png' # e.g. L0_sample5564.png self.image_path = os.path.join(self.sketchyscene_data_base, self.disp_dataset, 'DRAWING_GT', self.image_name) self.colorMap = scipy.io.loadmat( os.path.join(self.sketchyscene_data_base, 'colorMapC46.mat'))['colorMap'] self.tf_start_name = 'ResNet/' self.tf_weight_dict = {} self.read_tf_weight() self.pth_model_path = os.path.join( self.tf_model_dir, 'sketchyscene_deeplab101_epoch100000.pth') self.write_pytorch_weight()
def __init__(self, input_img, conf=Config(), ground_truth=None, kernels=None): # Acquire meta parameters configuration from configuration class as a class variable self.conf = conf # Read input image (can be either a numpy array or a path to an image file) self.input = input_img if type(input_img) is not str else img.imread( input_img) # For evaluation purposes, ground-truth image can be supplied. self.gt = ground_truth if type( ground_truth) is not str else img.imread(ground_truth) # Preprocess the kernels. (see function to see what in includes). self.kernels = preprocess_kernels(kernels, conf) # Prepare TF default computational graph self.model = tf.Graph() # Build network computational graph self.build_network(conf) # Initialize network weights and meta parameters self.init_sess(init_weights=True) # The first hr father source is the input (source goes through augmentation to become a father) # Later on, if we use gradual sr increments, results for intermediate scales will be added as sources. self.hr_fathers_sources = [self.input] # We keep the input file name to save the output with a similar name. If array was given rather than path # then we use default provided by the configs self.file_name = input_img if type(input_img) is str else conf.name
def is_user_ignored(user): """Checks that user should be ignored""" cfg = Config() if is_valid_user(user) and user.login.lower( ) not in cfg.properties['IGNORE_LOGINS']: return False return True
def set_pr_labels(pull, labels): """Sets new PR labels (all previously set labels are removed)""" if not labels or Config().DRY_RUN: return print("Set PR labels:", labels) # set_labels() should accept list but fails with empty "AssertionError:" pull.set_labels(labels)
def add_pr_labels(pull, labels): """Adds PR labels""" if not labels or Config().DRY_RUN: return print("Add PR labels:", labels) for label in labels: pull.add_to_labels(label)
def make_config(type, name=None): if name is None: name = type config_cls = Config.by_name(type) config_ins = config_cls.make_config() config_ins.save(EXPERIMENT_ROOT / f'{name}' / 'config.json') return config_ins.config
def __init__(self): self._cfg = Config() self.github = Github(self._cfg.GITHUB_TOKEN) self.github_org = self.github.get_organization( self._cfg.GITHUB_ORGANIZATION) self.repo = self.github.get_repo(f'{self._cfg.GITHUB_ORGANIZATION}/' f'{self._cfg.GITHUB_REPO}')
def main(): import argparse prog = argparse.ArgumentParser() prog.add_argument('--input-dir', '-i', type=str, default='input_image', help='path to image input directory.') prog.add_argument('--output-dir', '-o', type=str, default='results', help='path to image output directory.') prog.add_argument('--X4', action='store_true', help='The wanted SR scale factor') prog.add_argument('--SR', action='store_true', help='when activated - ZSSR is performed') prog.add_argument('--real', action='store_true', help='ZSSRs configuration is for real images') args = prog.parse_args() for filename in os.listdir(os.path.abspath(args.input_dir)): conf = Config().parse(create_params(filename, args)) # conf.img_name = filename # conf.input_image_path = 'input_image' # conf.output_dir_path = 'Results' + '\im_0_sf_4_4' train(conf) prog.exit(0)
def main(): """The main function - performs kernel estimation (+ ZSSR) for all images in the 'test_images' folder""" import argparse # Parse the command line arguments prog = argparse.ArgumentParser() prog.add_argument('--input-dir', '-i', type=str, default='test_images', help='path to image input directory.') prog.add_argument('--output-dir', '-o', type=str, default='results', help='path to image output directory.') prog.add_argument('--x4', action='store_true', help='The wanted SR scale factor') prog.add_argument('--SR', action='store_true', help='when activated - ZSSR is not performed') prog.add_argument('--real', action='store_true', help='ZSSRs configuration is for real images') prog.add_argument('--noise_scale', type=float, default=1., help='ZSSR uses this to partially de-noise images') args = prog.parse_args() # Run the KernelGAN sequentially on all images in the input directory for filename in os.listdir(os.path.abspath(args.input_dir)): conf = Config().parse(create_params(filename, args)) train(conf) prog.exit(0)
def _test(): """Test and debug""" Config(cli_args=['DRY_RUN=True']) dev_emails = get_dev_emails() print('dev_emails:', dev_emails) gh_api = GithubOrgApi() gh_api.get_org_emails()
def _update_config(config1, config2): """Update config1 hparams with hparams from config2""" h = merge_hparams(config1.hparams, config2.hparams) return Config(model=config1.model, hparams=h, note_sequence_augmenter=config1.note_sequence_augmenter, data_converter=config1.data_converter, train_examples_path=config1.train_examples_path, eval_examples_path=config1.eval_examples_path)
def get_label_by_team_name(team_name): """Generates labels by PR reviwer teams""" if 'admins' in team_name: return 'category: ci' cfg = Config() label = team_name re_compile_label = re.compile(rf'{cfg.GITHUB_REPO}-(.+)-maintainers') re_label = re_compile_label.match(team_name) if re_label: label = re_label.group(1).strip() return f'category: {label}'
def tune_config(type, add_name=''): configs = Config.by_name(type).tune_config() EXPERIMENT_DIR = EXPERIMENT_ROOT / f'tune-{type}-{add_name}' EXPERIMENT_DIR.mkdir(parents=True, exist_ok=True) configs_file_path = EXPERIMENT_DIR / f'configs.list' configs_file = configs_file_path.open('w') for name, config in configs: experiment_dir = EXPERIMENT_ROOT / f'{name}' experiment_dir.mkdir(parents=True, exist_ok=True) config.save(EXPERIMENT_ROOT / f'{name}' / 'config.json') configs_file.write(f'{name}\n') return len(configs)
def train(**kwargs): args = Config() args.parse(kwargs) loss_func = loss_function score_func = batch_scorer train_set = DataSet(args.sog_processed + 'train/') dev_set = DataSet(args.sog_processed + 'dev/') train_loader = DataLoader(train_set, batch_size=args.batch_size, shuffle=True, collate_fn=own_collate_fn, num_workers=20) dev_loader = DataLoader(dev_set, batch_size=args.batch_size, shuffle=True, collate_fn=own_collate_fn) vocab = pk.load(open('Predictor/Utils/sogou_vocab.pkl', 'rb')) eos_id, sos_id = vocab.token2id['<EOS>'], vocab.token2id['<BOS>'] args.eos_id = eos_id args.sos_id = sos_id model = getattr(Models, args.model_name)(matrix=vocab.matrix, args=args) trainner = Trainner_transformer(args, vocab) trainner.train(model, loss_func, score_func, train_loader, dev_loader, resume=args.resume, exp_root=args.exp_root)
def main(): """The main function - performs kernel estimation (+ ZSSR) for all images in the 'test_images' folder""" import argparse # Parse the command line arguments prog = argparse.ArgumentParser() prog.add_argument('--input-dir', '-i', type=str, default='test_images', help='path to image input directory.') prog.add_argument('--output-dir', '-o', type=str, default='results', help='path to image output directory.') prog.add_argument('--X4', action='store_true', help='The wanted SR scale factor') prog.add_argument('--SR', action='store_true', help='when activated - ZSSR is not performed') prog.add_argument('--real', action='store_true', help='ZSSRs configuration is for real images') prog.add_argument('--noise_scale', type=float, default=1., help='ZSSR uses this to partially de-noise images') prog.add_argument('--YUV', action='store_true', help='activated when images are given in YUV ') prog.add_argument('--W', type=int, default=None, help='Width of YUV images') prog.add_argument('--H', type=int, default=None, help='Heigth of YUV images') args = prog.parse_args() assert not (args.YUV and (args.W == None and args.H == None) ), "Should Specify W and H when using YUV Images" if args.YUV: print( "Default YUV format is 10-bit 420 NV12. Change \"read_yuv\" in util.y for other YUV format." ) # Run the KernelGAN sequentially on all images in the input directory for filename in os.listdir(os.path.abspath(args.input_dir)): conf = Config().parse(create_params(filename, args)) train(conf) prog.exit(0)
def __init__(self, input_img, conf=Config(), ground_truth=None, kernels=None): # Acquire meta parameters configuration from configuration class as a class variable self.conf = conf self.cuda = conf.cuda # Read input image (can be either a numpy array or a path to an image file) self.input = input_img if type(input_img) is not str else img.imread(input_img) self.Y = False if len(self.input)==2: self.Y = True #input is ndarray # For evaluation purposes, ground-truth image can be supplied. self.gt = ground_truth if type(ground_truth) is not str else img.imread(ground_truth) #gt is ndarray # Preprocess the kernels. (see function to see what in includes). self.kernels = preprocess_kernels(kernels, conf) #downsample kernel custom # Prepare TF default computational graph # declare model here severs as initial model print(self.Y) self.model = simpleNet(self.Y, inp_channels=5) # Build network computational graph #self.build_network(conf) # Initialize network weights and meta parameters self.init_parameters() # The first hr father source is the input (source goes through augmentation to become a father) # Later on, if we use gradual sr increments, results for intermediate scales will be added as sources. xv, yv = np.meshgrid(np.arange(self.input.shape[0]), np.arange(self.input.shape[1]), sparse=False, indexing='ij') xv = xv - np.min(xv) xv = xv/np.max(xv) yv = yv - np.min(yv) yv = yv/np.max(yv) xv = np.expand_dims(xv, axis=-1) yv = np.expand_dims(yv, axis=-1) new_input = np.concatenate([self.input, xv, yv], axis=2) self.raw_input = self.input self.input = new_input self.hr_fathers_sources = [self.input] # We keep the input file name to save the output with a similar name. If array was given rather than path # then we use default provided by the configs self.file_name = input_img if type(input_img) is str else conf.name
def __init__(self, input_img, conf=Config(), ground_truth=None, kernels=None): self.conf = conf self.phases = int(math.log(self.conf.scale, 2)) self.input = img.imread(input_img) self.kernels = preprocess_kernels(kernels, conf) self.hr_fathers_sources = [self.input] self.file_name = input_img if type(input_img) is str else conf.name ##################################net############################## self.device = torch.device('cpu' if conf.cpu else 'cuda') self.model = ZSSRNet(input_channels=3).to(self.device) self.downnet = Downnet().to(self.device)
def test(**kwargs): args = Config() test_set = DataSet(args.processed_folder + 'test/') test_loader = DataLoader(test_set, batch_size=args.batch_size, shuffle=True, collate_fn=own_collate_fn) vocab = pk.load(open('Predictor/Utils/vocab.pkl', 'rb')) eos_id, sos_id = vocab.token2id['<EOS>'], vocab.token2id['<BOS>'] args.eos_id = eos_id args.sos_id = sos_id model = getattr(Models, args.model_name)(matrix=vocab.matrix, args=args) load = _load('ckpt/saved_models/2018_08_20_02_12_38_0.2602508540088274', model) model = load['model'] model.to('cuda') #TODO complete load_state_dict and predict model.teacher_forcing_ratio = -100 with t.no_grad(): for data in test_loader: context, title, context_lenths, title_lenths = [ i.to('cuda') for i in data ] token_id, prob_vector, token_lenth, attention_matrix = model( context, context_lenths, title) score = batch_scorer(token_id.tolist(), title.tolist(), args.eos_id) context_word = [[vocab.from_id_token(id.item()) for id in sample] for sample in context] words = [[vocab.from_id_token(id.item()) for id in sample] for sample in token_id] title_words = [[vocab.from_id_token(id.item()) for id in sample] for sample in title] for i in zip(context_word, words, title_words): a = input('next') print(f'context:{i[0]},pre:{i[1]}, tru:{i[2]}, score:{score}')
def __init__(self): """Initialize ApiXL class.""" self.log = logging.getLogger() self.xlsx = True self.rb = None self.wb = None self.rsheet = None self.sheet = None self.sheet_names = [] self.xl_name = '' self.dir = '' self.db = Database() self.db.connect('settings.db') self.config = Config(self.db)
def __init__(self, input_img, conf=Config(), ground_truth=None, kernels=None): # Acquire meta parameters configuration from configuration class as a class variable self.conf = conf self.cuda = conf.cuda # Read input image (can be either a numpy array or a path to an image file) self.input = input_img if type(input_img) is not str else img.imread( input_img) self.Y = False if len(self.input) == 2: self.Y = True #input is ndarray # For evaluation purposes, ground-truth image can be supplied. self.gt = ground_truth if type( ground_truth) is not str else img.imread(ground_truth) #gt is ndarray # Preprocess the kernels. (see function to see what in includes). self.kernels = preprocess_kernels(kernels, conf) #downsample kernel custom # Prepare TF default computational graph # declare model here severs as initial model print(self.Y) self.model_L2H = USGan_g() self.model_H2L = High2Low() self.net_vgg = Vgg19() self.Discriminator_L = Discriminator() self.Discriminator_H = Discriminator() self.fake_L_buffer = ReplayBuffer() self.fake_H_buffer = ReplayBuffer() # Build network computational graph #self.build_network(conf) # Initialize network weights and meta parameters self.init_parameters() # The first hr father source is the input (source goes through augmentation to become a father) # Later on, if we use gradual sr increments, results for intermediate scales will be added as sources. self.hr_fathers_sources = [self.input] # We keep the input file name to save the output with a similar name. If array was given rather than path # then we use default provided by the configs self.file_name = input_img if type(input_img) is str else conf.name
def __init__(self): self.config = Config.load() urlRT = 'https://www.rottentomatoes.com/api/private/v2.0/browse\ ?page=1\ &limit=40\ &type=cf-dvd-streaming-all\ &minTomato=70' # urlRT = 'https://www.rottentomatoes.com/api/private/v2.0/browse\ # ?page=1\ # &limit=40\ # &type=top-dvd-streaming\ # &minTomato=70\ # &genres=1;2;4;5;6;8;9;10;11;13;18;14\ # &sortBy=popularity' data = requests.get(urlRT).json()['results'] self.df = json_normalize(data)
def mixed_loss(id, inputs, sample_id, sample_inputs, targets, target_lenth): """ :param inputs: [B, imaxlenth, vocabulary_size] float :param targets: [B, tmaxlenth] :param lenths: [B] :return: loss tensor [1] """ args = Config() batch_size, inp_max_lenth, vocabulary_size = inputs.size() targets = targets[:, 1:] target_lenth = target_lenth - 1 tar_max_lenth = targets.size()[-1] device = inputs.device vocabulary_size = inputs.size()[-1] flat_inputs_log = inputs.contiguous().view(-1, vocabulary_size) flat_targets = targets.contiguous().view(-1, 1) losses = t.gather(flat_inputs_log, dim=1, index=flat_targets.long()).view(*targets.size()) target_mask = lenth2mask(target_lenth, tar_max_lenth).data.float() losses = losses * target_mask # losses [B, seqlenth] losses = -(losses.sum(-1) / target_mask.sum(-1)).sum() / batch_size #sample loss flat_sample_log = sample_inputs.contiguous().view(-1, vocabulary_size) sample_losses = t.gather(flat_sample_log, dim=1, index=flat_targets.long()).view(*targets.size()) sample_losses = sample_losses * target_mask # losses [B, seqlenth] sample_losses = -(sample_losses.sum(-1) / target_mask.sum(-1)).sum() / batch_size output_rouge = t.from_numpy( np.array(batch_scorer(id, targets, args.eos_id))).float() sample_rouge = t.from_numpy( np.array(batch_scorer(sample_id, targets, args.eos_id))).float() rouge = -((output_rouge - sample_rouge) * 100).to(device) mixed_losses = rouge * sample_losses return mixed_losses, losses
def main(): """The main entry point function""" arg_parser = ArgumentParser() arg_parser.add_argument( "--cfg-file", metavar="PATH", default=Config.default_cfg_path, help=f"Path to json configuration file, e.g. {Config.default_cfg_path}" ) arg_parser.add_argument("--teams", action="store_true", help="Check GitHub teams") args, unknown_args = arg_parser.parse_known_args() Config(args.cfg_file, unknown_args) gh_api = github_api.GithubOrgApi() if args.teams: gh_api.get_org_teams() else: dev_emails = github_api.get_dev_emails() print(f'\nDeveloper emails {len(dev_emails)}:', '; '.join(dev_emails)) org_emails = gh_api.get_org_emails() print(f'\nOrg emails {len(org_emails)}:', '; '.join(org_emails)) org_pendig_invitation_emails = gh_api.get_org_invitation_emails() invite_emails = dev_emails.difference(org_emails).difference( org_pendig_invitation_emails) print(f'\nInvite emails {len(invite_emails)}:', '; '.join(invite_emails)) no_in_dev_emails = org_emails.difference(dev_emails) print( f'\nOrg members - no in developers list {len(no_in_dev_emails)}:', '; '.join(no_in_dev_emails)) valid_github_users = gh_api.get_valid_github_users(invite_emails) gh_api.invite_users(valid_github_users)
def get_dev_emails(): """ Read a file with developer emails. Supported email formats [email protected] Import from Outlook: Last_name, First_name <*****@*****.**> """ re_email = re.compile(r'.+<(.+)>') emails = set() cfg = Config() with open(cfg.properties['EMAILS_FILE_PATH']) as file_obj: for line in file_obj: line = line.strip().lower() if not line or line.startswith('#'): continue re_outlook_email = re_email.match(line) if re_outlook_email: line = re_outlook_email.group(1).strip() if not is_intel_email(line): print( f'Wrong email in {cfg.properties["EMAILS_FILE_PATH"]}: {line}' ) continue emails.add(line) return emails
def main(): """The main entry point function""" arg_parser = ArgumentParser() arg_parser.add_argument("--cfg-file", metavar="PATH", default=Config.default_cfg_path, help=f"Path to json configuration file, e.g. {Config.default_cfg_path}") arg_parser.add_argument("--teams", action="store_true", help="Check GitHub teams") arg_parser.add_argument("--no-ldap", action="store_true", help="Don't use LDAP info") args, unknown_args = arg_parser.parse_known_args() Config(args.cfg_file, unknown_args) gh_api = GithubOrgApi() if args.teams: gh_api.get_org_teams() return cfg_emails = get_dev_emails() print(f'\nCfg developer emails {len(cfg_emails)}:', '; '.join(sorted(cfg_emails))) dev_emails = set() dev_emails.update(cfg_emails) if not args.no_ldap: ldap_api = LdapApi() ldap_emails = ldap_api.get_user_emails() dev_emails.update(ldap_emails) print(f'\nLDAP developer emails {len(ldap_emails)}:', '; '.join(sorted(ldap_emails))) cfg_emails_no_in_ldap = ldap_api.get_absent_emails(cfg_emails) print(f'\nCfg developer emails - absent in LDAP at all {len(cfg_emails_no_in_ldap)}:', '; '.join(sorted(cfg_emails_no_in_ldap))) cfg_ldap_inters = cfg_emails.intersection(ldap_emails) print(f'\nCfg developer emails - present in LDAP developers {len(cfg_ldap_inters)}:', '; '.join(sorted(cfg_ldap_inters))) org_emails, org_logins_no_intel_email = gh_api.get_org_emails() print(f'\nOrg emails {len(org_emails)}:', '; '.join(sorted(org_emails))) org_emails_no_in_ldap = set() if not args.no_ldap: org_ldap_diff = org_emails.difference(ldap_emails) print(f'\nOrg member emails - absent in LDAP developers {len(org_ldap_diff)}:', '; '.join(sorted(org_ldap_diff))) for email in org_ldap_diff: user_info = ldap_api.get_user_info_by_email(email) if user_info: print_user_info(user_info, InfoLevel.PDL) else: org_emails_no_in_ldap.add(email) org_pendig_invitation_emails = gh_api.get_org_invitation_emails() invite_emails = dev_emails.difference(org_emails).difference(org_pendig_invitation_emails) print(f'\nInvite emails {len(invite_emails)}:', '; '.join(sorted(invite_emails))) valid_github_users = gh_api.get_valid_github_users(invite_emails) gh_api.invite_users(valid_github_users) print('\nCheck accounts below and remove from the GitHub organization and cfg list') cfg_emails_no_in_org = sorted(cfg_emails.difference(org_emails)) print(f'\nCfg developer emails - absent in GitHub organization {len(cfg_emails_no_in_org)}:', '; '.join(cfg_emails_no_in_org)) org_emails_no_in_dev = sorted(org_emails.difference(dev_emails)) print(f'\nOrg member emails - absent in cfg and LDAP developers {len(org_emails_no_in_dev)}:', '; '.join(org_emails_no_in_dev)) print(f'\nOrg member emails - absent in LDAP at all {len(org_emails_no_in_ldap)}:', '; '.join(sorted(org_emails_no_in_ldap))) print(f'\nOrg member logins - absent Intel email {len(org_logins_no_intel_email)}:', '; '.join(sorted(org_logins_no_intel_email)))