| Total Complexity | 0 |
| Total Lines | 45 |
| Duplicated Lines | 35.56 % |
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | |||
| 2 | |||
| 3 | #Start orthanc Server. |
||
| 4 | |||
| 5 | #Random spot check 5 DCM files to ensure they all have the same MRN number. |
||
| 6 | |||
| 7 | # |
||
| 8 | |||
| 9 | #Check Table. |
||
| 10 | |||
| 11 | #If table MRN |
||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | #Retrieve and store subject files location (argument) |
||
| 16 | |||
| 17 | # |
||
| 18 | |||
| 19 | |||
| 20 | import sys |
||
| 21 | import os |
||
| 22 | import argparse |
||
| 23 | import getpass |
||
| 24 | import logging |
||
| 25 | |||
| 26 | logging.basicConfig(stream=sys.stdout, level=logging.INFO) |
||
| 27 | logger = logging.getLogger('upload_bom') |
||
| 28 | |||
| 29 | View Code Duplication | if __name__ == '__main__': |
|
|
|
|||
| 30 | |||
| 31 | parser = argparse.ArgumentParser(description=__doc__) |
||
| 32 | parser.add_argument('-u', '--user', dest='email', type=str, help='Username/Email used for login') |
||
| 33 | parser.add_argument('-p', '--production', dest='production', action='store_true', help='Example of boolean arg') |
||
| 34 | parser.add_argument('-o', '--option', dest='option', type=str, help='Example of str arg') |
||
| 35 | |||
| 36 | parser.add_argument('file', metavar='file', type=str, help='Example of a positional argument') |
||
| 37 | |||
| 38 | args = parser.parse_args() |
||
| 39 | logger.info('--------------') |
||
| 40 | |||
| 41 | # Never ask for a password in command-line. Manually ask for it here |
||
| 42 | password = getpass.getpass() |
||
| 43 | |||
| 44 | logger.info('Hello World!') |
||
| 45 |