Code Duplication    Length = 48-63 lines in 2 locations

scripts/create-consolidated-report.gmp.py 1 location

@@ 99-161 (lines=63) @@
96
    return period_start, period_end
97
98
99
def parse_args(args: Namespace) -> Namespace:  # pylint: disable=unused-argument
100
    """ Parsing args ... """
101
102
    parser = ArgumentParser(
103
        prefix_chars='+',
104
        add_help=False,
105
        formatter_class=RawTextHelpFormatter,
106
        description=HELP_TEXT,
107
    )
108
109
    parser.add_argument(
110
        '+h',
111
        '++help',
112
        action='help',
113
        help='Show this help message and exit.',
114
    )
115
116
    parser.add_argument(
117
        '+p',
118
        '++period',
119
        nargs=2,
120
        type=str,
121
        required=True,
122
        dest='period',
123
        help=(
124
            'Choose a time period that is filtering the tasks.\n'
125
            'Use the date format YYYY/MM/DD.'
126
        ),
127
    )
128
129
    parser.add_argument(
130
        '+t',
131
        '++tags',
132
        nargs='+',
133
        type=str,
134
        dest='tags',
135
        help=(
136
            'Filter the tasks by given tag(s).\n'
137
            'If you pass more than on tag, they will be concatenated with '
138
            or '\n'
139
            'You can pass tag names, tag ids or tag name=value to this argument'
140
        ),
141
    )
142
143
    filter_args = parser.add_mutually_exclusive_group()
144
145
    filter_args.add_argument(
146
        '++filter-terms',
147
        nargs='+',
148
        type=str,
149
        dest='filter_term',
150
        help='Filter the results by given filter terms.',
151
    )
152
153
    filter_args.add_argument(
154
        '++filter-id',
155
        type=str,
156
        dest='filter_id',
157
        help='Filter the results by given filter id.',
158
    )
159
160
    script_args, _ = parser.parse_known_args()
161
    return script_args
162
163
164
def generate_task_filter(

scripts/create_cve_report_from_json.gmp.py 1 location

@@ 515-562 (lines=48) @@
512
    )
513
514
515
def parse_args(args: Namespace) -> Namespace:  # pylint: disable=unused-argument
516
    """ Parsing args ... """
517
518
    parser = ArgumentParser(
519
        prefix_chars='+',
520
        add_help=False,
521
        formatter_class=RawTextHelpFormatter,
522
        description=HELP_TEXT,
523
    )
524
525
    parser.add_argument(
526
        '+h',
527
        '++help',
528
        action='help',
529
        help='Show this help message and exit.',
530
    )
531
532
    parser.add_argument(
533
        '++create-list',
534
        nargs='?',
535
        type=str,
536
        choices=('no_creation', 'recreate', 'create'),
537
        const='create',
538
        default='no_creation',
539
        dest="create_list",
540
        help="Create the CPE to CVE helper list",
541
    )
542
543
    parser.add_argument(
544
        '+l',
545
        '++list',
546
        type=str,
547
        dest="list",
548
        required=True,
549
        help="Create the CPE to CVE helper list",
550
    )
551
552
    parser.add_argument(
553
        '+f',
554
        '++file',
555
        type=str,
556
        dest="json_file",
557
        help="File that should be parsed",
558
    )
559
560
    args, _ = parser.parse_known_args()
561
562
    return args
563
564
565
def main(gmp, args):