-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master 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: master
Are you sure you want to change the base?
Conversation
| print("WARNING: '"+logPath+"'' doesn't exist. Attempting to create it now.") | ||
| print(f"WARNING: '{logPath}'' doesn't exist. Attempting to create it now.") | ||
| if not os.path.exists(logdir): | ||
| os.makedirs(logdir) | ||
| try: | ||
| with open(logPath) as file: | ||
| pass | ||
| except IOError as e: | ||
| print("ERROR: Unable to verify '"+logPath+"'' exists. Verify path exists and permission settings. Exiting") | ||
| print( | ||
| f"ERROR: Unable to verify '{logPath}'' exists. Verify path exists and permission settings. Exiting" | ||
| ) |
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.
Lines 16-23 refactored with the following changes:
- Use f-string instead of string concatenation [×4] (
use-fstring-for-concatenation)
| logger.debug("Deleting ElasticSearch index: " + decoded_index + " from " + server) | ||
| url = "http://" + server + ":9200/" + decoded_index + "?pretty" | ||
| logger.debug(f"Deleting ElasticSearch index: {decoded_index} from {server}") | ||
| url = f"http://{server}:9200/{decoded_index}?pretty" |
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 es_del_index refactored with the following changes:
- Use f-string instead of string concatenation [×7] (
use-fstring-for-concatenation)
| logger.debug("List all ElasticSearch indices from " + server) | ||
| logger.debug(f"List all ElasticSearch indices from {server}") | ||
| #curl -XGET 'localhost:9200/_cat/indices?v&pretty' | ||
| url = "http://" + server + ":9200/_cat/indices?v&pretty" | ||
| url = f"http://{server}:9200/_cat/indices?v&pretty" |
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 es_list_index refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation)
| logger.debug("Executing ElasticSearch command: {}".format(args)) | ||
| logger.debug(f"Executing ElasticSearch command: {args}") |
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 es_main refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| logger.info("Creating TimeSketch user: {}".format(username)) | ||
| logger.info(f"Creating TimeSketch user: {username}") |
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 create_ts_user refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| logger.info("Locally moving file at {} to {}".format(src, dest)) | ||
| logger.info(f"Locally moving file at {src} to {dest}") |
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 mv_local refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| cdqr_exec = "/usr/local/bin/cdqr.py" | ||
| logger.debug("Data Processing: {}".format(args)) | ||
| logger.debug(f"Data Processing: {args}") | ||
| if args.cdqr: | ||
| logger.debug("Attempting to process data with CDQR: {}".format(args.cdqr)) | ||
| logger.debug(f"Attempting to process data with CDQR: {args.cdqr}") | ||
| cdqr_exec = "/usr/local/bin/cdqr.py" |
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 dp_main refactored with the following changes:
- Move assignments closer to their usage (
move-assign) - Replace call to format with f-string [×3] (
use-fstring-for-formatting)
| usage = "rc_client.py <server IP address or routable domain name> <commands to send to rc_server.py>" | ||
| version = "Skadi Automation Client Version: 1.0.0" | ||
| print("Starting "+version) | ||
| print(f"Starting {version}") |
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 main refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation) - Simplify conditional into switch-like form [×3] (
switch)
| # missing associated documentation comment in .proto file | ||
| pass |
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 RCServicer.ExecuteRC refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass)
This removes the following comments ( why? ):
# missing associated documentation comment in .proto file
| def main(): | ||
| version = "Skadi Automation Server Version: 1.0.0" | ||
| print("Starting "+version) | ||
| print(f"Starting {version}") |
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 main refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
Branch
masterrefactored 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
masterbranch, then run:Help us improve this pull request!