AREPL-vscode
AREPL-vscode copied to clipboard
AREPL not showing all variables info ?
Describe the bug
Hello, I'm currently studying python and I've noticed that AREPL isn't showing all the infos of certain variables that I created and also in a weird order, if you take a look at the screenshot, the variable "kids" just show the repr string instead of all the info equally stored like the variables [brunch, early-bird, dinner], not to mention the position where it is showed is random, I've re-wrote this code from scratch and before, instead of showing the repr string, it would me show the
variable id? (i am not sure the name of it, sorry). I think it is a bug, but i am not sure since I'm just a beginner, so I apologize in advance if its just bad coding that I did.
I am posting the screenshot, and the whole code. Thank you in advance.

class Menu:
def __init__(self, name, items, start_time, end_time):
self.name = name
self.items = items
self.start_time = start_time
self.end_time = end_time
def __repr__(self):
return "{self.name} menu available from {self.start_time} to {self.end_time}".format(self=self)
def calculate_bill(self, purchased_items):
bill = 0
for item in purchased_items:
bill += self.items[item]
return bill
brunch = Menu("Brunch", {
'pancakes': 7.50,
'waffles': 9.00,
'burger': 11.00,
'home fries': 4.50,
'coffee': 1.50,
'espresso': 3.00,
'tea': 1.00,
'mimosa': 10.50,
'orange juice': 3.50
}, 1100, 1600)
early_bird = Menu("Eaarly-bird", {
'salumeria plate': 8.00,
'salad and breadsticks (serves 2, no refills)': 14.00,
'pizza with quattro formaggi': 9.00,
'duck ragu': 17.50,
'mushroom ravioli (vegan)': 13.50,
'coffee': 1.50,
'espresso': 3.00
}, 1500, 1800)
dinner = Menu("Dinner", {
'crostini with eggplant caponata': 13.00,
'ceaser salad': 16.00,
'pizza with quattro formaggi': 11.00,
'duck ragu': 19.50,
'mushroom ravioli (vegan)': 13.50,
'coffee': 2.00,
'espresso': 3.00
}, 1700, 2300)
kids = Menu("Kids", {
'chicken nuggets': 6.50,
'fusilli with wild mushrooms': 12.00,
'apple juice': 3.00
}, 1100, 2100)
menus = [brunch, early_bird, dinner, kids]
#print(brunch)
#print(brunch.calculate_bill(["pancakes", "home fries", "coffee"]))
#print(early_bird.calculate_bill(["salumeria plate", "mushroom ravioli (vegan)"]))
class Franchise():
def __init__(self, address, menus):
self.address = address
self.menus = menus
def __repr__(self):
return "{self.address}".format(self=self)
def available_menus(self, time):
available_menu = []
for menu in self.menus:
if time >= menu.start_time and time <= menu.end_time:
available_menu.append(menu)
return available_menu
flagship_store = Franchise("1232 West End Road", menus)
new_installment = Franchise("12 East Mulberry Street", menus)
#print(flagship_store.available_menus(1200))
#print(new_installment)```
Other Information (please complete the following information):
- OS: windows 10
- Python Version : Python 3.9.1
You found a bug, nice catch! I'm not sure why this happening unfortunately. Note that you can still see properties of the kids class in "menus" of "flagship_store"
Also note that if you want to change "Kids menu available from 1100 to 2100" to something else you can change the repr method. Just make sure the repr method returns a string. If you want repr to show all class properties you can import json and change it to return json.dumps(self.__dict__, indent=4)
oh thank you for the response and the tips! I'm glad it was actually a bug instead of me reporting something it was my own fault. I noticed that the more code I was writing the more that bug would appear, like not only kids, but also dinner would become the exact same thing as kids.
This should be fixed with 2.0.5. Try it out and let me know what you think! :)
from flask import Flask
app = Flask(name) #creating the Flask class object
@app.route('/') #decorator drfines the def home(): return "hello, this is our first flask website"
if name =='main': app.run(debug = True)
flask reportmissingimports