| Conditions | 3 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | import getpass |
||
| 8 | def determineUser(self, passedUserValue): |
||
| 9 | """Determine the name of the user creating provenance. |
||
| 10 | |||
| 11 | The following methods will be tried to determine the username; |
||
| 12 | 1) The passedUserValue argument if not None |
||
| 13 | 2) The configuration file or setting has a value for the key user |
||
| 14 | 3) The OS username. |
||
| 15 | |||
| 16 | Args: |
||
| 17 | passedUserValue (str): This value will override any other method |
||
| 18 | to determine the username. |
||
| 19 | |||
| 20 | Returns: |
||
| 21 | string: The username or handle of the user. |
||
| 22 | """ |
||
| 23 | if passedUserValue is not None: |
||
| 24 | return passedUserValue |
||
| 25 | if self.config.user: |
||
| 26 | return self.config.user |
||
| 27 | else: |
||
| 28 | return getpass.getuser() |
||
| 29 |