-
Notifications
You must be signed in to change notification settings - Fork 1
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
| if(operation==1): | ||
| if (operation==1): | ||
| delate_qury+=" AND " | ||
| elif(operation==2): | ||
| delate_qury+=" OR " | ||
| else: | ||
| 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 MainControl.check_and_or refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass)
| mycursor.execute("SELECT * FROM "+table_name) | ||
| mycursor.execute(f"SELECT * FROM {table_name}") |
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 MainControl.read refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| create_qury = "Insert into "+str(table_name)+" ( " | ||
| create_qury = f"Insert into {str(table_name)} ( " | ||
| for i in range(len(colum)): | ||
| create_qury+=str(colum[i]) | ||
| if (i != len(colum)-1 ): | ||
| create_qury+="," | ||
| else: | ||
| create_qury+=") " | ||
| create_qury += "," if (i != len(colum)-1 ) else ") " | ||
| create_qury+="VALUES (" | ||
| for i in range(len(values)): | ||
| check_string_type(create_qury,values[i]) | ||
| if (i != len(values)-1 ): | ||
| create_qury+="," | ||
| else: | ||
| create_qury+=") " | ||
| create_qury += "," if (i != len(values)-1 ) else ") " |
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 MainControl.create refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation) - Replace if statement with if expression [×2] (
assign-if-exp)
| update_qury = "UPDATE "+table_name+" SET "+str(change_colum)+" = " | ||
| update_qury = f"UPDATE {table_name} SET {str(change_colum)} = " | ||
| check_string_type(update_qury,new_value) | ||
| update_qury += " WHERE " | ||
| for i in range(len(colum_condition)): | ||
| update_qury += str(colum_condition[i])+" = " | ||
| update_qury += f"{str(colum_condition[i])} = " |
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 MainControl.update refactored with the following changes:
- Use f-string instead of string concatenation [×5] (
use-fstring-for-concatenation)
| delate_qury = "DELETE FROM "+table_name+" WHERE " | ||
| delate_qury = f"DELETE FROM {table_name} WHERE " | ||
| for i in range(len(colum)): | ||
| delate_qury+=str(colum[i])+" = " | ||
| delate_qury += f"{str(colum[i])} = " |
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 MainControl.delete refactored with the following changes:
- Use f-string instead of string concatenation [×3] (
use-fstring-for-concatenation)
| mydb = mysql.connector.connect( | ||
| return mysql.connector.connect( | ||
| host=self.host, | ||
| user=self.user, | ||
| password=self.password, | ||
| database="TeamUp" | ||
| database="TeamUp", | ||
| ) | ||
| return mydb | ||
| except: | ||
| raise ("check your database") | ||
| return null |
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 DataBase.connectMySQL refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable) - Remove unreachable code (
remove-unreachable-code)
| M=MainControl.MainControl() | ||
| H=M.read("Student") | ||
| self.window.XP.setText(str(self.window.XP.text())+" : "+str(H[0][4])) | ||
| self.window.XP.setText(f"{str(self.window.XP.text())} : {str(H[0][4])}") |
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 MainView.submit_button refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
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!