-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored main branch #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| def text_label3(text): return sg.Text(text+':', justification='l', size=(3, 1)) | ||
| def text_label4(text): return sg.Text(text+':', justification='l', size=(5, 1)) | ||
| def text_label3(text): | ||
| return sg.Text(f'{text}:', justification='l', size=(3, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function text_label3 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| def text_label4(text): return sg.Text(text+':', justification='l', size=(5, 1)) | ||
| def text_label3(text): | ||
| return sg.Text(f'{text}:', justification='l', size=(3, 1)) | ||
| def text_label4(text): | ||
| return sg.Text(f'{text}:', justification='l', size=(5, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function text_label4 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| def text_label6(text): return sg.Text(text+':', justification='l', size=(8, 1)) | ||
| def text_label6(text): | ||
| return sg.Text(f'{text}:', justification='l', size=(8, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function text_label6 refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| print('hashing url list: {} with length: {}'.format(list, len(list))) | ||
| print(f'hashing url list: {list} with length: {len(list)}') | ||
| while u < len(list): | ||
| print('attempting hash for {}'.format(list[u])) | ||
| print(f'attempting hash for {list[u]}') | ||
| fhash = FileHash(None, str(list[u])) | ||
| hash_list.append(fhash) | ||
| print('hash list: {}'.format(hash_list)) | ||
| print(f'hash list: {hash_list}') | ||
| if u > 0: # separate into own function and iterate though full hash list at once | ||
| if hash_list[u] == hash_list[0]: | ||
| print('################# HASH CONFIRMED ###################') | ||
| print('hash #{} matches the first url file hash'.format(u+1)) | ||
| print(f'hash #{u + 1} matches the first url file hash') | ||
| hash_verify = hash_list[0] | ||
| print('################# END CONFIRMED HASH ###############') | ||
| else: | ||
| print('################### HASH FAILED #####################') | ||
| print('hash #{} does not match the first url file hash\n'.format(u+1)) | ||
| print('first file hash: {}'.format(hash_list[0])) | ||
| print('mismatched file hash: {}'.format(hash_list[u])) | ||
| hash_verify = 'hash #{} does not match the first url file hash'.format( | ||
| u+1) | ||
| print(f'hash #{u + 1} does not match the first url file hash\n') | ||
| print(f'first file hash: {hash_list[0]}') | ||
| print(f'mismatched file hash: {hash_list[u]}') | ||
| hash_verify = f'hash #{u + 1} does not match the first url file hash' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function file_hash refactored with the following changes:
- Replace call to format with f-string [×8] (
use-fstring-for-formatting)
| print('attempting url split for {}'.format(url)) | ||
| print(f'attempting url split for {url}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function url_split refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| return requests.post(url='https://{}/{}'.format(wallet_RPC_port, url_option), | ||
| verify=False, | ||
| cert=cert, | ||
| headers = {'content-type': 'application/json'}, | ||
| json=json_data, | ||
| ).json() | ||
| return requests.post( | ||
| url=f'https://{wallet_RPC_port}/{url_option}', | ||
| verify=False, | ||
| cert=cert, | ||
| headers={'content-type': 'application/json'}, | ||
| json=json_data, | ||
| ).json() | ||
| except Exception as e: | ||
| print(e) | ||
| self._log.error('Error found while querying the wallet, {} with json {}:\n'.format(url_option, | ||
| json_data)) | ||
| self._log.error( | ||
| f'Error found while querying the wallet, {url_option} with json {json_data}:\n' | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function WalletAPIwrapper.query_wallet refactored with the following changes:
- Replace call to format with f-string [×2] (
use-fstring-for-formatting)
| self._log.info('Execution of {} took {}'.format(type(self).__name__, | ||
| datetime.now() == self.exec_starttime) + ' ' + self.additional_msg) | ||
| self._log.info( | ||
| f'Execution of {type(self).__name__} took {datetime.now() == self.exec_starttime} {self.additional_msg}' | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ContextBase.__exit__ refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
| public_keys = response['public_key_fingerprints'] | ||
| return public_keys | ||
| return response['public_key_fingerprints'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function get_fingerprints refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| address = response['address'] | ||
| return address | ||
| return response['address'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function get_address refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| data = fh.read(8192) | ||
| if not data: | ||
| if data := fh.read(8192): | ||
| m.update(data) | ||
| else: | ||
| break | ||
| m.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function sha256Checksum refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression) - Lift code into else after jump in control flow (
reintroduce-else) - Swap if/else branches (
swap-if-else-branches)
Branch
mainrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
mainbranch, then run:Help us improve this pull request!