Skip to content

Conversation

@SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/ax-cogs master
git merge --ff-only FETCH_HEAD
git reset HEAD^

url = choice(query_find)
elif not images:
url = query_find[0]
url = choice(query_find) if images else query_find[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AdvancedGoogle.images refactored with the following changes:

self.servers[server.id]["status"] = not self.servers[server.id]["status"]
if "emotes" not in self.servers[server.id]:
self.servers[server.id]["emotes"] = dict()
self.servers[server.id]["emotes"] = {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Emote.set refactored with the following changes:

self.servers[server.id] = dict({"status": False})
if "emotes" not in self.servers[server.id]:
self.servers[server.id]["emotes"] = dict()
self.servers[server.id]["emotes"] = {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Emote.add refactored with the following changes:

self.servers[server.id] = dict({"status": False})
if "emotes" not in self.servers[server.id]:
self.servers[server.id]["emotes"] = dict()
self.servers[server.id]["emotes"] = {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Emote.remove refactored with the following changes:

self.servers[server.id] = dict({"status": False})
if "emotes" not in self.servers[server.id]:
self.servers[server.id]["emotes"] = dict()
self.servers[server.id]["emotes"] = {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Emote.edit refactored with the following changes:

Comment on lines +43 to -51
if multi < 0:
neg = True
multi = abs(multi)
if multi and type(content) is not list:
if multi < 0:
neg = True
multi = abs(multi)
content = [content.lower()] * multi
else:
if multi < 0:
neg = True
multi = abs(multi)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Lootbox.add refactored with the following changes:

Comment on lines -143 to +140
itemis = dict()
itemis = {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Lootbox.append refactored with the following changes:

Comment on lines -174 to +171
itemis = dict()
itemis = {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Lootbox.remove refactored with the following changes:

Comment on lines -296 to +297
# create servers.json if not there
# put in default values
default = {}
if not os.path.isfile('data/lootbox/servers.json'):
print('Creating default lootbox servers.json...')
# create servers.json if not there
# put in default values
default = {}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function check_files refactored with the following changes:

return True
else:
return True
return author.id == server.owner.id or author.id in bookkeeper
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Points.permcheck refactored with the following changes:

Comment on lines -90 to +88
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Points.add refactored with the following changes:

Comment on lines -153 to +163
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
if server.id not in self.db:
self.db[server.id] = {}
if not name:
if name:
if name.id in self.db[server.id]:
del self.db[server.id][name.id]
self.save_db()
await self.bot.say("{} has been deleted from the list.".format(name.display_name))
else:
await self.bot.say("{} is not in the list, please make sure they have been added first to "
"the list.".format(name.display_name))
return
else:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Points.remove refactored with the following changes:

Comment on lines -242 to +240
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Points._add refactored with the following changes:

Comment on lines -309 to +307
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
if name is None:
await self.bot.say("{} was not found, please check the spelling and also make "
"sure that the member name being entered is a member in your Discord and "
"that its the same as their Discord name / nickname.".format(namea))
return
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Points._remove refactored with the following changes:

return False
else:
return True
return role in [r.name.lower() for r in author.roles]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function The100.permcheck refactored with the following changes:

Comment on lines -123 to +120
users = []
for z in x[y]:
users.append(z["user"]["gamertag"])
users = [z["user"]["gamertag"] for z in x[y]]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function The100.games refactored with the following changes:

Comment on lines -168 to +165
server = ctx.message.server
if ctx.invoked_subcommand is None or \
isinstance(ctx.invoked_subcommand, commands.Group):
server = ctx.message.server
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function The100.set refactored with the following changes:

Comment on lines -191 to +192
return
elif answer.content.lower().strip() == "yes":
self.db[server.id]["token"] = token
await self.bot.say("Token overwritten")
dataIO.save_json(self.json, self.db)
return
else:
await self.bot.say("Action cancelled")
return
return
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function The100.token refactored with the following changes:

Comment on lines -223 to +222
return
elif answer.content.lower().strip() == "yes":
self.db[server.id]["role"] = role
await self.bot.say("role overwritten")
dataIO.save_json(self.json, self.db)
return
else:
await self.bot.say("Action cancelled")
return
return
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function The100.role refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant