Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
407 additions
and
2 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 |
---|---|---|
@@ -1,2 +1,36 @@ | ||
# mbot-and-chatbot-project | ||
python and mblock programming | ||
### Getting started | ||
There are various things you can do to quickly and efficiently configure your Codio Box to your exact requirements. | ||
|
||
### GUI Applications and the Virtual Desktop | ||
The Virtual Desktop allows you auto develop GUI based applications using any programming language. You can install a Virtual Desktop in your Box. You can then start the desktop and view it within the Codio IDE or in a new browser tab. | ||
|
||
[Virtual Desktop documentation](https://codio.com/docs/ide/boxes/installsw/gui/) | ||
|
||
|
||
### Command line access and the Terminal window | ||
All Codio Boxes provide sudo level privileges to the underlying Ubuntu server. This means you can install and configure any component you like. You access the terminal from the **Tools->Terminal** menu item. | ||
|
||
### Debugger | ||
The Codio IDE comes with a powerful visual debugger. Currently we support Python, Java, C, C++ and NodeJS. Other languages can be added on request. | ||
|
||
[Debugger documentation](https://codio.com/docs/ide/features/debugging/) | ||
|
||
|
||
### Content authoring and assessments | ||
Codio comes with a very powerful content authoring tool, Codio Guides. Guides is also where you create all forms of auto-graded assessments. | ||
|
||
- [Guides documentation](https://codio.com/docs/content/authoring/overview/) | ||
- [Assessments documentation](https://codio.com/docs/content/authoring/assessments/) | ||
|
||
### Templating Box configurations and projects | ||
Codio offers two very powerful templating options so you can create new projects from those templates with just a couple of clicks. **Stacks** allow you to create snapshots of the Box’s underlying software configuration. You can then create new projects from a Stack avoiding having to configure anew each time you start a new project. **Starter Packs** allow you to template an entire project, including workspace code. | ||
|
||
- [Stacks documentation](https://codio.com/docs/project/stacks/) | ||
- [Starter Packs documentation](https://codio.com/docs/project/packs/) | ||
|
||
### Install software | ||
You can always install software onto your Box using the command line. However, Codio offers a shortcut for commonly installed components that can be accessed from the **Tools->Install Software** menu. | ||
|
||
We can easily add new items to the Install Software screen, so feel free to submit requests. | ||
|
||
[Install Software documentation](https://codio.com/docs/ide/boxes/installsw/box-parts/) |
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,13 @@ | ||
Requirement already satisfied: sqlparse>=0.2.2 in c:\users\sonde oluwaseun\appdata\local\programs\python\python38-32\lib\site-packages (from django>=1.11->djangorestframework) (0.3.1) | ||
Requirement already satisfied: pytz in c:\users\sonde oluwaseun\appdata\local\programs\python\python38-32\lib\site-packages (from django>=1.11->djangorestframework) (2019.3) | ||
Requirement already satisfied: asgiref~=3.2 in c:\users\sonde oluwaseun\appdata\local\programs\python\python38-32\lib\site-packages (from django>=1.11->djangorestframework) (3.2.5) | ||
Installing collected packages: djangorestframework | ||
Successfully installed djangorestframework-3.11.0 | ||
|
||
# C:\Users\SONDE OLUWASEUN>conda install -c conda-forge djangorestframework | ||
# 'conda' is not recognized as an internal or external command, | ||
# operable program or batch file. | ||
|
||
# C:\Users\SONDE OLUWASEUN> | ||
|
||
# C:\Users\SONDE OLUWASEUN> |
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,13 @@ | ||
(c) 2018 Microsoft Corporation. All rights reserved. | ||
|
||
C:\>django-admin startproject chatbotproject | ||
|
||
|
||
|
||
C:\>cd chatbotproject | ||
|
||
|
||
|
||
C:\chatbotproject>python manage.py startapp fitnessbot | ||
|
||
C:\chatbotproject>python manage.py runserver |
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,122 @@ | ||
""" | ||
Django settings for chatbotproject project. | ||
Generated by 'django-admin startproject' using Django 3.0.4. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.0/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/3.0/ref/settings/ | ||
""" | ||
|
||
import os | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = 'g8(@dho!7-+&bsm3ek73mfju$*k=94hqf!5!p1$h6$=2j%4_#&' | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = [] | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'rest_framework' | ||
'fitnessbot' | ||
] | ||
|
||
MIDDLEWARE = [ | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
] | ||
|
||
ROOT_URLCONF = 'chatbotproject.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'chatbotproject.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | ||
} | ||
} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/3.0/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'UTC' | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/3.0/howto/static-files/ | ||
|
||
STATIC_URL = '/static/' |
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,24 @@ | ||
"""chatbotproject URL Configuration | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/3.0/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.contrib import admin | ||
from django.urls import path | ||
from fitnessbot import views | ||
|
||
urlpatterns = [ | ||
path('admin/', admin.site.urls), | ||
url(r'^admin/'admin.site.urls), | ||
url(r'^idealweight/',views.IdealWeight) | ||
] |
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,22 @@ | ||
from django.shortcuts import render | ||
from django.http import Http404 | ||
from rest_framework.views import ApiView | ||
from rest_framework.decorators import api_view | ||
from rest_framework.response import Response | ||
from rest_framework import status | ||
from django.http import JsonResponse | ||
from django.core import serializers | ||
from django.conf import settings | ||
import json | ||
|
||
|
||
# Create your views here. | ||
@api_view(["POST"]) | ||
def ProperWeight(heightvalue): | ||
try: | ||
height=json.loads(heightvalue.body) | ||
weight=str(height*15) | ||
|
||
return JsonResponse("Ideal weight should be:"weight+"kg" safe=False) | ||
except ValueError as e: | ||
return Response(e.args[0],status.HTTP_400_BAD_REQUEST) |
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,26 @@ | ||
# CREATING ANOTHER SUB CLASS | ||
crunches="3pm daily" | ||
weightlifting="5pm daily" | ||
yogaclass="1pm daily" | ||
salsaclass="7pm daily" | ||
# groupExerciseclasses(male,female) | ||
|
||
|
||
|
||
|
||
def groupExerciseclasses(gender): | ||
exercises=[crunches,weightlifting,salsaclass,yogaclass] | ||
if gender=="male": | ||
print ("crunches",crunches,"and","weightlifting",weightlifting,"is avaliable") | ||
return"" | ||
elif gender=="female": | ||
print ("yogaclass",yogaclass,"salsaclass","and",salsaclass,"is avaliable") | ||
return"" | ||
else: | ||
return "impossible" | ||
while True: | ||
gender=input("PLEASE ENTER YOUR GENDER:") | ||
print(groupExerciseclasses(gender)) | ||
if gender=="No": | ||
break | ||
|
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,23 @@ | ||
# Accessing the attribute set in the parent class | ||
class ballgames: | ||
def __init__(self,name,avail,price): | ||
self.name= name | ||
self.avail= avail | ||
self.price= price | ||
|
||
def sport(self): | ||
return "{}{}{}".format(self.name,self.avail,self.price) | ||
|
||
class indoor(ballgames): | ||
pass | ||
|
||
ballgames_1=indoor("basketball","weekdays",20) | ||
ballgames_2=indoor("volleyball","weekends",15) | ||
|
||
print (ballgames_1.avail) | ||
print (ballgames_2.avail) | ||
|
||
|
||
|
||
|
||
|
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,27 @@ | ||
# Passing in an extra attribute | ||
class ballgames: | ||
def __init__(self,name,avail,price): | ||
self.name= name | ||
self.avail= avail | ||
self.price= price | ||
|
||
def sport(self): | ||
return "{}{}{}".format(self.name,self.avail,self.price) | ||
|
||
|
||
# ballgames_1=indoor("basketball","weekdays",20,2000) | ||
# ballgames_2=indoor("volleyball","weekends",15,1800) | ||
|
||
class indoor(ballgames): | ||
def __init__(self,name,avail,price,exp_cal): | ||
super().__init__(name,avail,price) | ||
self.exp_cal=exp_cal | ||
ballgames_1=indoor("Basketball","weekdays",20,2000) | ||
ballgames_2=indoor("volleyball","weekends",15,1800) | ||
|
||
|
||
|
||
|
||
|
||
print (ballgames_1.avail) | ||
print (ballgames_2.exp_cal) |
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,60 @@ | ||
class ballgames: | ||
def __init__(self,name,avail,price): | ||
self.name= name | ||
self.avail= avail | ||
self.price= price | ||
|
||
def sport(self): | ||
return "{}{}{}".format(self.name,self.avail,self.price) | ||
class indoor(ballgames): | ||
|
||
|
||
def __init__(self,name,avail,price,exp_cal): | ||
super().__init__(name,avail,price) | ||
self.exp_cal=exp_cal | ||
ballgames_1=indoor("Basketball","weekdays","20",2000) | ||
ballgames_2=indoor("volleyball","weekends",15,1800) | ||
|
||
|
||
|
||
|
||
|
||
class instructor(ballgames): | ||
|
||
|
||
def __init__(self,name,avail,price,ballgames=None): | ||
super().__init__(name,avail,price) | ||
if ballgames is None: | ||
self.ballgames=[] | ||
else: | ||
self.ballgames=ballgames | ||
|
||
def add_ball(self,ball): | ||
if ball not in self.ballgames: | ||
self.ballgames.append(ball) | ||
|
||
def remove_ball(self,ball): | ||
if ball in self.ballgames: | ||
self.ballgames.append(ball) | ||
|
||
# def remove_ball (self,ball): | ||
# if ball in self.ballgames: | ||
# self.ballgames.remove(ball) | ||
|
||
def print_balls(self): | ||
for ball in self.ballgames: | ||
# print(ball.nameprice()) | ||
|
||
ballgames_1=indoor("basketball","weekdays",20,2000) | ||
ballgames_2=indoor("volleyball","weekends",15,1800) | ||
|
||
|
||
|
||
instr_1=instructor("sonde", "weekdays", 50, [ballgames_1]) | ||
|
||
print(instr_1.name) | ||
|
||
instr_1.add_ball(ballgames_1) | ||
|
||
instr_1.print_balls() | ||
|
Oops, something went wrong.