-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
213 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[MASTER] | ||
|
||
ignore=tests | ||
|
||
[MESSAGE CONTROL] | ||
|
||
disable=raw-checker-failed, | ||
bad-inline-option, | ||
locally-disabled, | ||
file-ignored, | ||
suppressed-message, | ||
useless-suppression, | ||
deprecated-pragma, | ||
use-symbolic-message-instead, | ||
missing-module-docstring, | ||
missing-function-docstring, | ||
missing-class-docstring | ||
|
||
[FORMAT] | ||
|
||
max-line-length=80 | ||
max-nested-blocks=2 | ||
max-statements=15 | ||
max-module-lines=100 | ||
single-line-if-stmt=true | ||
|
||
[REFACTORING] | ||
|
||
[DESIGN] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,93 @@ | ||
from varasto import Varasto | ||
|
||
|
||
def main(): | ||
mehua = Varasto(100.0) | ||
olutta = Varasto(100.0, 20.2) | ||
def tiedot_varastosta(varasto: Varasto): | ||
print(f"saldo = {varasto.saldo}") | ||
print(f"tilavuus = {varasto.tilavuus}") | ||
print(f"paljonko_mahtuu = {varasto.paljonko_mahtuu()}") | ||
|
||
print("Luonnin jälkeen:") | ||
print(f"Mehuvarasto: {mehua}") | ||
print(f"Olutvarasto: {olutta}") | ||
|
||
print("Olut getterit:") | ||
print(f"saldo = {olutta.saldo}") | ||
print(f"tilavuus = {olutta.tilavuus}") | ||
print(f"paljonko_mahtuu = {olutta.paljonko_mahtuu()}") | ||
def status_tulostus(lista: list): | ||
for tup in lista: | ||
print(f"{tup[0]}: {tup[1]}") | ||
|
||
|
||
def varaston_muokkaus(varasto, muokkaus, maara, varaston_nimi): | ||
if muokkaus == "lisaa": | ||
varasto.lisaa_varastoon(maara) | ||
print(f"Lisätään {maara}") | ||
elif muokkaus == "ota": | ||
varasto.ota_varastosta(maara) | ||
print(f"Otetaan {maara}") | ||
print(f"{varaston_nimi}: {varasto}") | ||
|
||
|
||
def tulosta_varasto(alku, lisays=0): | ||
varasto = Varasto(alku, lisays) | ||
tuloste = f"Varasto({alku}" | ||
if lisays: | ||
tuloste += f", {lisays}" | ||
tuloste += ")" | ||
if not lisays: | ||
tuloste += ";" | ||
print(tuloste) | ||
print(varasto) | ||
|
||
print("Mehu setterit:") | ||
print("Lisätään 50.7") | ||
mehua.lisaa_varastoon(50.7) | ||
print(f"Mehuvarasto: {mehua}") | ||
print("Otetaan 3.14") | ||
mehua.ota_varastosta(3.14) | ||
print(f"Mehuvarasto: {mehua}") | ||
|
||
def tulosta_virhetilanteet(): | ||
print("Virhetilanteita:") | ||
print("Varasto(-100.0);") | ||
huono = Varasto(-100.0) | ||
print(huono) | ||
tulosta_varasto(-100.0) | ||
tulosta_varasto(100.0, -50.7) | ||
|
||
print("Varasto(100.0, -50.7)") | ||
huono = Varasto(100.0, -50.7) | ||
print(huono) | ||
|
||
def olut1(olutta: Varasto): | ||
print(f"Olutvarasto: {olutta}") | ||
print("olutta.lisaa_varastoon(1000.0)") | ||
olutta.lisaa_varastoon(1000.0) | ||
print(f"Olutvarasto: {olutta}") | ||
|
||
|
||
def mehu1(mehua: Varasto): | ||
print(f"Mehuvarasto: {mehua}") | ||
print("mehua.lisaa_varastoon(-666.0)") | ||
mehua.lisaa_varastoon(-666.0) | ||
print(f"Mehuvarasto: {mehua}") | ||
|
||
|
||
def olut2(olutta: Varasto): | ||
print(f"Olutvarasto: {olutta}") | ||
print("olutta.ota_varastosta(1000.0)") | ||
saatiin = olutta.ota_varastosta(1000.0) | ||
print(f"saatiin {saatiin}") | ||
print(f"Olutvarasto: {olutta}") | ||
|
||
|
||
def mehu2(mehua: Varasto): | ||
print(f"Mehuvarasto: {mehua}") | ||
print("mehua.otaVarastosta(-32.9)") | ||
saatiin = mehua.ota_varastosta(-32.9) | ||
print(f"saatiin {saatiin}") | ||
print(f"Mehuvarasto: {mehua}") | ||
|
||
|
||
def main(): | ||
mehua = Varasto(100.0) | ||
olutta = Varasto(100.0, 20.2) | ||
|
||
print("Luonnin jälkeen:") | ||
status_tulostus([("Mehuvarasto", mehua), ("Olutvarasto", olutta)]) | ||
print("Olut getterit:") | ||
tiedot_varastosta(olutta) | ||
|
||
print("Mehu setterit:") | ||
varaston_muokkaus(mehua, "lisaa", 50.7, "Mehuvarasto") | ||
varaston_muokkaus(mehua, "ota", 3.14, "Mehuvarasto") | ||
tulosta_virhetilanteet() | ||
olut1(olutta) | ||
mehu1(mehua) | ||
olut2(olutta) | ||
mehu2(mehua) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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