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

@@ 399-446 (lines=48) @@
396
    )
397
398
399
def parse_args(args: Namespace) -> Namespace:  # pylint: disable=unused-argument
400
    """ Parsing args ... """
401
402
    parser = ArgumentParser(
403
        prefix_chars='+',
404
        add_help=False,
405
        formatter_class=RawTextHelpFormatter,
406
        description=HELP_TEXT,
407
    )
408
409
    parser.add_argument(
410
        '+h',
411
        '++help',
412
        action='help',
413
        help='Show this help message and exit.',
414
    )
415
416
    parser.add_argument(
417
        '++create-list',
418
        nargs='?',
419
        type=str,
420
        choices=('no_creation', 'recreate', 'create'),
421
        const='create',
422
        default='no_creation',
423
        dest="create_list",
424
        help="Create the CPE to CVE helper list",
425
    )
426
427
    parser.add_argument(
428
        '+l',
429
        '++list',
430
        type=str,
431
        dest="list",
432
        required=True,
433
        help="Create the CPE to CVE helper list",
434
    )
435
436
    parser.add_argument(
437
        '+f',
438
        '++file',
439
        type=str,
440
        dest="json_file",
441
        help="File that should be parsed",
442
    )
443
444
    args, _ = parser.parse_known_args()
445
446
    return args
447
448
449
def get_cpe(gmp, cpe):