★ wanayoo — archive 1999 https://github.com/python-discord/code-jam-1/pull/7Nouvelle recherche | Portail wanayoo
Skip to content
This repository has been archived by the owner. It is now read-only.

Team 18 #7

Open
wants to merge 48 commits into
base: master
from
Open

Team 18 #7

wants to merge 48 commits into from

Conversation

@theGordHoard
Copy link

@theGordHoard theGordHoard commented Mar 23, 2018

Woot

Fix Pipfile dependencies
Sneks
Add a print statement so we can open our pull request
@gdude2002 gdude2002 changed the title WIP Team 18 Team 18 Mar 23, 2018
theGordHoard and others added 8 commits Mar 23, 2018
Exclude virtualenv from Flake8 linting. Again.
double spaces hurt me
Allows you to get human readable level of danger
Copy link
Member

@lemonsaurus lemonsaurus left a comment

get_danger is both a fun idea, and particularly well written. rattle.py should match this level of quality. Docstrings, type hinting and some more comments would help a lot.

h = len(otherword) - len(word)
word += '~' * h
return word
'''

This comment has been minimized.

@lemonsaurus

lemonsaurus Mar 24, 2018
Member

docstring before helper functions please.

@@ -0,0 +1,45 @@
# rattle - easy word similarity detection
def check_word(word, wordset, threshold=0.8):
def get_shortest(x, y):

This comment has been minimized.

@lemonsaurus

lemonsaurus Mar 24, 2018
Member

These helper functions should also have docstrings.

length_diff_multiplier = 1.08
mp_count = 1
shorter = ''
if shortest == word:

This comment has been minimized.

@lemonsaurus

lemonsaurus Mar 24, 2018
Member

This function desperately needs block comments. runs a bit hot.

theGordHoard and others added 15 commits Mar 24, 2018
[UPDATE] Ignored a silly rule from flake8.
…d fixed a core issue with the command.
from discord.ext.commands import AutoShardedBot, Context, command

from ..tools import rattle

This comment has been minimized.

@gdude2002

gdude2002 Mar 25, 2018
Contributor

Please no relative imports.

log = logging.getLogger(__name__)
db = load(open('bot/cogs/snek.pickledb', 'rb')) # are we going to move this db elsewhere?
SNAKE_NAMES = db.keys() # make a list of common names for snakes, used for random snake and autocorrect
DEBUG = True

This comment has been minimized.

@gdude2002

gdude2002 Mar 25, 2018
Contributor

Hardcoded debug mode?

embed.set_footer(text="Information from Wikipedia and snakedatabase.org. Information has been " \
"automatically fetched and may not be accurate.")
await ctx.send(embed=embed)

# Any additional commands can be placed here. Be creative, but keep it to a reasonable amount!

This comment has been minimized.

@gdude2002

gdude2002 Mar 25, 2018
Contributor

With 12 hours to go, you have no extra functionality!

Because we need more functionality .
theGordHoard and others added 21 commits Mar 25, 2018
Debug is now based on the presence of the environment variable SNAKES_DEBUG
Copy link

@Zwork101 Zwork101 left a comment

Very few issues, and nothing major. You did a great job documenting the project making your code clear. Can't wait to see what you'll make next Jam!

parent = command.parent

if parent and command:
help_command = (self.bot.get_command("help"), parent.name, command.name)

This comment has been minimized.

@Zwork101

Zwork101 Apr 3, 2018

Including the ( and ) is unnecessary, you can accomplish the same feat with simply

help_command = self.bot.get_command("help"), parent.name, command.name
f"Sorry, an unexpected error occurred. Please let us know!\n\n```{e}```"
)
raise e.original
log.error(f"COMMAND ERROR: '{e}'")

This comment has been minimized.

@Zwork101

Zwork101 Apr 3, 2018

This isn't logged if a non-expected CommandInvokeError happens. You could either wrap the ifs in a try - finally block, however just logging the error before you raise it would be fine.


log.debug(f"{before.display_name} roles changing from {before_role_names} to {after_role_names}")

if OWNER_ROLE in role_ids:

This comment has been minimized.

@Zwork101

Zwork101 Apr 3, 2018

You do this process twice, you should make a function that does this. Don't repeat yourself 😉

DEBUG = environ.get('SNAKES_DEBUG', None)
dprint = print if DEBUG else lambda *a, **k: None # -1 index is used for easy temp debug hardcode

SNEK_FACTS = json.loads(open('bot/cogs/facts.json', 'r', encoding='utf-8').read())

This comment has been minimized.

@Zwork101

Zwork101 Apr 3, 2018

You never close this file, or the snek,picklebd file.

class NoGuessError(Exception):
def __init__(self, message='', debugdata=None):
self.message = message
self.debugdata = debugdata

This comment has been minimized.

@Zwork101

Zwork101 Apr 3, 2018

This is python, let's use _ where there should be a space:

class NoGuessError(Exception):
    def __init__(self, message='', debug_data=None):
        self.message = message
        self.debug_data = debug_data
'💀💀': 'Venomous, harmful',
'💀💀💀': 'Venomous, dangerous',
'💀💀💀💀': 'Venomous, very dangerous',
'💀💀💀💀💀': 'Venomous, extremely dangerous.'

This comment has been minimized.

@Zwork101

Zwork101 Apr 3, 2018

Could this be moved into a json file, that's already loaded?

"Tumblr_m2g660GN9z1qcwgmzo1_1280.png/revision/latest?cb=20120611212456"
scient = 'Chironex fleckeri'
length = '9.8 ft'
custom = True

This comment has been minimized.

@Zwork101

Zwork101 Apr 3, 2018

These 3 sneks fall under the same issue as the danger dict. Move this data into a json file!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.