Code Monkey home page Code Monkey logo

pynw-open-source-contribution-workshop's People

Contributors

c-rhodes avatar ogaskell avatar

Watchers

 avatar  avatar

pynw-open-source-contribution-workshop's Issues

Fix pep8 formatting errors

The yt_happy_or_sad.py scripts violates pep8 in several places. A list of these violations can be generated using flake8. First install flake8:

$ pip install flake8

Generate violations:

$ flake8 yt_happy_or_sad.py

This should list several errors, for instance line:

yt_happy_or_sad.py:5:80: E501 line too long (123 > 79 characters)

Edit the script and fix these errors.

Validate url parameter

Add a validator for the url parameter using the type argument. An argparse.ArgumentTypeError should be raised if the url passed to the script is malformed.

Fix BeautifulSoup warning

A warning is printed to stdout when running the script, here's the output:

/home/cullenrhodes/Envs/pynw-workshop/lib/python3.5/site-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 49 of the file yt_happy_or_sad.py. To get rid of this warning, change code that looks like this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "html.parser")

  markup_type=markup_type))

As the message states this warning is being printed because the HTML parser is not explicitly specified when calling BeatifulSoup on line 13. To fix this issue line 13 should be updated to the following:

soup = BeautifulSoup(response.content, 'html.parser')

Colorise script output using Colorama

We should prettify the output of the yt_happy_or_sad.py script using Colorama. If the verdict is sad then the output should be red, if the verdict is happy the output should be green.

Colorama should be added as a dependency to the requirements.txt file. After installing Colorama you can get the version using pip:

$ pip freeze | grep colorama

The output from this command can be appended to the requirements.txt like so:

$ pip freeze | grep colorama >> requirements.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.