Conversation
| url = 'https://accounts.google.com/o/oauth2/token' | ||
| headers = {'Content-Type': 'application/x-www-form-urlencoded'} | ||
| data = 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=' + signed_jwt | ||
| data = f'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion={signed_jwt}' |
There was a problem hiding this comment.
Function get_access_token refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| headers = { | ||
| 'X-GFE-SSL': 'yes', | ||
| 'Authorization': 'Bearer ' + access_token | ||
| } | ||
| headers = {'X-GFE-SSL': 'yes', 'Authorization': f'Bearer {access_token}'} | ||
| data = report_state_file | ||
| response = requests.post(url, headers=headers, json=data) | ||
| print('Response: ' + response.text) | ||
| print(f'Response: {response.text}') |
There was a problem hiding this comment.
Function report_state refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
| success = report_state(access_token, report_state_file) | ||
|
|
||
| if success: | ||
| if success := report_state(access_token, report_state_file): |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| "id": k, | ||
| } | ||
| DEVICE.update(v) | ||
| DEVICE |= v |
There was a problem hiding this comment.
Function rsync refactored with the following changes:
- Merge dictionary updates via the union operator (
dict-assign-update-to-union)
| for device in i['payload']['devices']: | ||
| deviceId = device['id'] | ||
| print('DEVICE ID: ' + deviceId) | ||
| print(f'DEVICE ID: {deviceId}') |
There was a problem hiding this comment.
Function onQuery refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| print('Published message with mid {}.' | ||
| .format(mid)) | ||
| print(f'Published message with mid {mid}.') |
There was a problem hiding this comment.
Function handle_publish refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| print('Subscription id {} granted with qos {}.' | ||
| .format(mid, granted_qos)) | ||
| print(f'Subscription id {mid} granted with qos {granted_qos}.') |
There was a problem hiding this comment.
Function handle_subscribe refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| print('Received message on topic {}: {}' | ||
| .format(message.topic, message.payload.decode())) | ||
| print(f'Received message on topic {message.topic}: {message.payload.decode()}') |
There was a problem hiding this comment.
Function handle_mytopic refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| print('Received message on topic {}: {}' | ||
| .format(message.topic, message.payload.decode())) | ||
| print(f'Received message on topic {message.topic}: {message.payload.decode()}') |
There was a problem hiding this comment.
Function handle_ztopic refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| print("this is authorize") | ||
| user = get_current_user() | ||
| print("Authorize User: %s" % user) | ||
| print(f"Authorize User: {user}") |
There was a problem hiding this comment.
Function authorize refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring)
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.55%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
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!