This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class World: | |
"""Class to contain the properties of the World. | |
:param yearly_population: World's population by year | |
:type arg: dict | |
:ivar yearly_population: Internal attribute to hold the world population. | |
:vartype yearly_population: dict | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class World: | |
"""Class to contain the properties of the World. | |
Args: | |
yearly_population (dict): World's population by year | |
Attributes: | |
yearly_population (dict): Internal attribute to hold the world population. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class World: | |
"""Class to contain the properties of the World. | |
Parameters | |
---------- | |
yearly_population : dict | |
World's population by year | |
Attributes | |
---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class World: | |
"""Class to contain the properties of the World. | |
:param yearly_population: World's population by year | |
:ivar yearly_population: Internal attribute to hold the world population. | |
""" | |
def __init__(self, yearly_population: dict): | |
self.yearly_population: dict = yearly_population |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[flake8] | |
# W291 trailing whitespace | |
# W292 no newline at end of file | |
# W293 blank line contains whitespace | |
# E203 whitespace before ':' | |
ignore = W291,W292,W293,E203 | |
max-line-length = 100 | |
max-complexity = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[flake8] | |
# W291 trailing whitespace | |
# W292 no newline at end of file | |
# W293 blank line contains whitespace | |
# E203 whitespace before ':' | |
ignore = W291,W292,W293,E203 | |
max-line-length = 100 | |
max-complexity = 10 | |
[pydocstyle] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class World: | |
"""Class to contain the properties of the World. | |
:param yearly_population: World's population by year | |
:ivar yearly_population: Internal attribute to hold the world population. | |
""" | |
def __init__(self, yearly_population: dict): | |
self.yearly_population: dict = yearly_population |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def population(self, year: int) -> int: | |
"""Obtain the population in the world for a given year. | |
:param year: Year of which the population wants to be known. | |
:returns: Population for that year. 0 if the year was not found. | |
""" | |
return self.yearly_population.get(year, 0) | |
def population_on_2020(self) -> int: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tutorial-python-quality-code-env | |
channels: | |
- defaults | |
- conda-forge | |
dependencies: | |
- python=3.8.3 | |
- flake8=3.8.2 | |
- pydocstyle=4.0.1 | |
- mypy=0.770 | |
- black=19.10b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash -e | |
environment_header=$(head -n 1 environment.yml) | |
environment_name=${environment_header/name: /} | |
conda remove --yes --quiet -n "${environment_name}" --all | |
conda env create --quiet --force -f environment.yml |
OlderNewer