return False def get_random_emoji(): all_emoji = sh.get_emoji()["emoji"] return random.choice(list(all_emoji.keys())) if __name__ == "__main__": testing_slack_channel = None if len(sys.argv) > 1: testing_slack_channel = sys.argv[1] config_data = read_config_file("config.env") CREDENTIALS = get_conf_or_env("CREDENTIALS", config_data) CREDENTIALS_FILE = get_conf_or_env("CREDENTIALS_FILE", config_data, "credentials.json") WORKBOOK = get_conf_or_env("WORKBOOK", config_data) WORKSHEET_META_TAB = get_conf_or_env("WORKSHEET_META_TAB", config_data) SLACK_TOKEN = get_conf_or_env("SLACK_TOKEN", config_data) SLACK_USERNAME = get_conf_or_env("SLACK_USERNAME", config_data) SLACK_ICON_URL = get_conf_or_env("SLACK_ICON_URL", config_data) WORKSHEET_PEOPLE_TAB = get_conf_or_env("WORKSHEET_PEOPLE_TAB", config_data) required_variables = ( "WORKBOOK WORKSHEET_META_TAB SLACK_TOKEN SLACK_USERNAME SLACK_ICON_URL" .split(" ")) for variable in required_variables: if eval(variable) is None:
elif calendar_type == 'Next' and today >= prev_date and today < curr_date: return True return False def get_random_emoji(): all_emoji = sh.get_emoji()['emoji'] return random.choice(list(all_emoji.keys())) if __name__ == '__main__': testing_slack_channel = None if len(sys.argv) > 1: testing_slack_channel = sys.argv[1] config_data = read_config_file('config.env') CREDENTIALS_FILE = get_conf_or_env('CREDENTIALS_FILE', config_data, 'credentials.json') WORKBOOK = get_conf_or_env('WORKBOOK', config_data) WORKSHEET_META_TAB = get_conf_or_env('WORKSHEET_META_TAB', config_data) SLACK_TOKEN = get_conf_or_env('SLACK_TOKEN', config_data) SLACK_USERNAME = get_conf_or_env('SLACK_USERNAME', config_data) SLACK_ICON_URL = get_conf_or_env('SLACK_ICON_URL', config_data) WORKSHEET_PEOPLE_TAB = get_conf_or_env('WORKSHEET_PEOPLE_TAB', config_data) required_variables = 'CREDENTIALS_FILE WORKBOOK WORKSHEET_META_TAB SLACK_TOKEN SLACK_USERNAME SLACK_ICON_URL'.split(' ') for variable in required_variables: if eval(variable) is None: logger.error('Missing ' + variable) exit(1) sh = SlackHelper(SLACK_TOKEN)
import random from slack_helper import SlackHelper from sheet_helper import GSheetHelper from util import get_conf_or_env, read_config_file FORMAT = "%(asctime)-15s %(message)s" logging.basicConfig(format=FORMAT, level=logging.INFO) logger = logging.getLogger("quiz") if __name__ == "__main__": config_data = read_config_file("config.env") CREDENTIALS_FILE = get_conf_or_env( "CREDENTIALS_FILE", config_data, "credentials.json" ) SLACK_TOKEN = get_conf_or_env("SLACK_TOKEN", config_data) sh = SlackHelper(SLACK_TOKEN) gh = GSheetHelper(CREDENTIALS_FILE) rows = gh.get_rows("Quiz questions", "Questions") row = random.choice(rows) answer_choices = [row[x] for x in ("Answer", "Choice A", "Choice B", "Choice C")] random.shuffle(answer_choices) msg = row["Question"] + "\n" + "\n".join(answer_choices) sh.send_message(
user_data[assignee][issue_type + '_cnt'] += 1 user_data[assignee][issue_type + '_story_points'] += int(story_points) logger.info('User\tSP\tStories\tBugs') for user, story_points in user_story_point_sum.most_common(100): logger.info('%s\t%s\t%s', user, story_points, user_data[user]) if __name__ == '__main__': start_date = sys.argv[1] end_date = sys.argv[2] config_data = read_config_file('config.env') JIRA_URL = get_conf_or_env('JIRA_URL', config_data) JIRA_USERNAME = get_conf_or_env('JIRA_USERNAME', config_data) JIRA_TOKEN = get_conf_or_env('JIRA_TOKEN', config_data) JIRA_SQUAD_LABELS = get_conf_or_env('JIRA_SQUAD_LABELS', config_data) required_variables = 'JIRA_URL JIRA_USERNAME JIRA_TOKEN JIRA_SQUAD_LABELS'.split( ' ') for variable in required_variables: if eval(variable) is None: logger.error('Missing ' + variable) exit(1) JIRA_SQUAD_LABELS = JIRA_SQUAD_LABELS.split(',') ja = JiraAnalysis(JIRA_URL, JIRA_USERNAME, JIRA_TOKEN, JIRA_SQUAD_LABELS)
user_data[assignee][issue_type + "_cnt"] += 1 user_data[assignee][issue_type + "_story_points"] += int(story_points) logger.info("User\tSP\tStories\tBugs") for user, story_points in user_story_point_sum.most_common(100): logger.info("%s\t%s\t%s", user, story_points, user_data[user]) if __name__ == "__main__": start_date = sys.argv[1] end_date = sys.argv[2] config_data = read_config_file("config.env") JIRA_URL = get_conf_or_env("JIRA_URL", config_data) JIRA_USERNAME = get_conf_or_env("JIRA_USERNAME", config_data) JIRA_TOKEN = get_conf_or_env("JIRA_TOKEN", config_data) JIRA_TEAM_LABELS = get_conf_or_env("JIRA_TEAM_LABELS", config_data) required_variables = "JIRA_URL JIRA_USERNAME JIRA_TOKEN JIRA_TEAM_LABELS".split( " ") for variable in required_variables: if eval(variable) is None: logger.error("Missing ", variable) sys.exit(1) JIRA_TEAM_LABELS = JIRA_TEAM_LABELS.split(",") ja = JiraAnalysis(JIRA_URL, JIRA_USERNAME, JIRA_TOKEN, JIRA_TEAM_LABELS)
user_story_point_sum.update({assignee: int(story_points)}) if self.get_issue_type(issue) == 'bug': user_bugs[assignee] += 1 logger.info('User\tSP\tBugs') for user, story_points in user_story_point_sum.most_common(100): logger.info('%s\t%s\t%s', user, story_points, user_bugs[user]) if __name__ == '__main__': start_date = sys.argv[1] end_date = sys.argv[2] config_data = read_config_file('config.env') JIRA_URL = get_conf_or_env('JIRA_URL', config_data) JIRA_USERNAME = get_conf_or_env('JIRA_USERNAME', config_data) JIRA_PASSWORD = get_conf_or_env('JIRA_PASSWORD', config_data) JIRA_SQUAD_LABELS = get_conf_or_env('JIRA_SQUAD_LABELS', config_data) required_variables = 'JIRA_URL JIRA_USERNAME JIRA_PASSWORD JIRA_SQUAD_LABELS'.split( ' ') for variable in required_variables: if eval(variable) is None: logger.error('Missing ' + variable) exit(1) JIRA_SQUAD_LABELS = JIRA_SQUAD_LABELS.split(',') ja = JiraAnalysis(JIRA_URL, JIRA_USERNAME, JIRA_PASSWORD,
import logging import random from slack_helper import SlackHelper from sheet_helper import GSheetHelper from util import get_conf_or_env, read_config_file FORMAT = '%(asctime)-15s %(message)s' logging.basicConfig(format=FORMAT, level=logging.INFO) logger = logging.getLogger('quiz') if __name__ == '__main__': config_data = read_config_file('config.env') CREDENTIALS_FILE = get_conf_or_env('CREDENTIALS_FILE', config_data, 'credentials.json') SLACK_TOKEN = get_conf_or_env('SLACK_TOKEN', config_data) sh = SlackHelper(SLACK_TOKEN) gh = GSheetHelper(CREDENTIALS_FILE) rows = gh.get_rows('Quiz questions', 'Questions') row = random.choice(rows) answer_choices = [ row[x] for x in ('Answer', 'Choice A', 'Choice B', 'Choice C') ] random.shuffle(answer_choices) msg = row['Question'] + '\n' + '\n'.join(answer_choices)