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

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