예제 #1
0
 def createUser(user_entry: str) -> UserBase:
     _id, _p = user_entry.split(" ")
     _id = int(_id)
     if _p == 'U':
         return User(_id)
     if _p == 'A':
         return Admin(_id)
     if _p == 'O':
         return Owner(_id)
     if _p == 'x':
         return Unknown(_id)
     raise ValueError(f"Wrong user entry \"{user_entry}\"!")
예제 #2
0
from users import Admin

new_admin = Admin('hi', 'ho', '99', 'irv', 'iso')
new_admin.privileges.show_privileges()
예제 #3
0
# 9-10
print("\n9-10")
from restaurant import Restaurant

biggo = Restaurant("nammsssd", "frenchhhh")
biggo.describe_restaurant()

# 9-11
print("\n9-11")
from users import Admin

admin = Admin(
    'taha',
    'khokhar',
)

admin.describe_user()

admin.privileges.privileges = [
    'can reset', 'can annihilate', 'absolute control'
]

admin.privileges.show_privileges()

# 9-12
print("9-12 is in a separate file.")

# 9-13
print("\n9-12")

from collections import OrderedDict
예제 #4
0
from users import Admin

admin = Admin('Ahmed', 'Raza', 18)

admin.privileges.show_privileges()
예제 #5
0
# Mike Wilson 22 June 2021
# This program imports users.py and calls upon its class 'Admin'.

from users import Admin

mike = Admin('mike', 'wilson', 'mmwww2413')
mike.describe_user()

mike_privileges = [
    'can reset passwords',
    'can delete accounts',
]
mike.privileges.privileges = mike_privileges

mike.privileges.show_privileges()
예제 #6
0
from users import Admin
from users import User
from users import Privileges

this = Admin('James', 'Dimes', 'Heath', 'Dr.Pepper')
that = User('John', 'Doe', '404', 'Missing Texture')

Privileges()
that.greet_user()
this.greet_user()
this.show_privileges()
예제 #7
0
from users import Admin

admin_1 = Admin('lyle', 'lemon', 'IT manager', 'frederick, md')
admin_1.privileges.show_privileges()
from users import Admin
admin = Admin('Alice',"Bob")
admin.show_privileges()
예제 #9
0
from users import User, Privileges, Admin

nkapalala = Admin('Ivan', 'Rapala', 27, '*****@*****.**')
nkapalala.privileges.funcname()
예제 #10
0
print("Task 9.10")

from restaurant import Restaurant, IceCreamStand

ice = IceCreamStand('Ice World')
ice.flavors = ['banana', 'vanilla', 'chocolate']

ice.describe_restaurant()
ice.describe_flavors()

print("Task 9.11")

from users import Admin

adrian = Admin('adrian', 'szymanski', 'zeus', '*****@*****.**',
               'adrian88szymanski', 'sport', 'poland')
adrian.describe_user()

adrian.privileges.show_privileges()

print("\nAdding privileges...")
adrian_privileges = [
    'can add posts',
    'can remove posts',
    'can suspend accounts',
]
adrian.privileges.privileges = adrian_privileges
adrian.privileges.show_privileges()

print("Task 9.12")
from users import User, Admin, Privileges

Jimmy = Admin('Jimbob', 'Orton')

Jimmy.privileges.show_privileges()
예제 #12
0
from users import User, Privileges, Admin

user_admin = Admin('jackie', 'qin')
user_admin.privilege.show_privileges()
예제 #13
0
# 9-10 Imported Restaurant
from restaurants import Restaurant

food = Restaurant('Pizza Land', 'pizza')

food.describe_restaurant()

# 9-11 Imported Admin
from users import Admin

tyson = Admin('tyson', 'nguyen', 'tysonnguyen', 22, 'oregon')
tyson.privileges.show_privileges()

# 9-12 Multiple Modules where User class in one module, and store the Privileges and Admin separately.
from user_privileges import Admin, Privileges

tyson = Admin('tyson', 'nguyen', 'tysonnguyen', 22, 'oregon')
tyson.privileges.show_privileges()
예제 #14
0
from users import Admin

me = Admin('juan', 'yu', 'male', 30,
           ['can add post', 'can delete post', 'can ban user'])
me.describe_user()
me.greet_user()
me.privileges.show_privileges()
예제 #15
0
'''
9-11. Imported Admin: Start with your work from Exercise 9-8 (page 178).
Store the classes User, Privileges, and Admin in one module. Create a separate
file, make an Admin instance, and call show_privileges() to show that
everything is working correctly.
'''

from users import Admin, User, Privileges

# make an Admin instance:
new_admin = Admin("John","Kowalsky",24,"male")

#call describe_user:
new_admin.describe_user()

# call show_privilages
new_admin.privileges.show_privileges()
from users import User, Admin, Privileges

admin = Admin('leo','david',19,'chennai')
admin.greet_user()
admin.privilege.show_privileges()

예제 #17
0
import sqlite3
from TOKEN import token
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from users import Admin, User, Option
from vk_api.keyboard import VkKeyboard, VkKeyboardColor

vk = vk_api.VkApi(token=token)
Adm = Admin()
Users = User()
Option = Option()
longpoll = VkLongPoll(vk)
picture = ''
all_photos = []


# Проверка на админа
def get_admin(group_id):
    users = (vk.method('groups.getMembers', {
        'group_id': group_id,
        "filter": 'managers'
    }))
    userManagers = []
    for i in users["items"]:
        userManagers.append(i['id'])
    return userManagers


# Вывод возможных команд

예제 #18
0
from users import Admin

Chad = Admin("Chad", "Tennent", 30, 180)

Chad.priviliges.show_priviliges()
예제 #19
0
from users import User, Privileges, Admin

privileges = Privileges('can add a post', 'can delete a post')
admin = Admin("Davi", "Carvalho", 23, privileges)
print(admin.privileges.show_privileges())
예제 #20
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 24 18:48:15 2021

@author: rdrolis
"""

from users import User, Admin, Privileges

u1 = User('jack', 'ryan', '*****@*****.**', 'jryan')
u1.info()
u1 = Admin('jack', 'ryan', '*****@*****.**', 'jryan')
u1.greet()
u1.privileges.show_privilege()
print("Adding admin privileges...")
u1_privileges = [
    'can add users',
    'can delete users',
    'can moderate discussions',
]
u1.privileges.privileges = u1_privileges
u1.privileges.show_privilege()
예제 #21
0
from users import Users
from users import Admin
from users import Privileges

network_engineer = Admin('Ron', 'Swanson', 'rswanson', '*****@*****.**')
network_engineer.show_privileges()
network_engineer.desc_user()
예제 #22
0
"""9-10. Imported Admin
Start with your work from Exercise 9-8 (page 178).
Store the classes User, Privileges and Admin in one module.
Create a separate file, make an Admin instance,
and call show_priveleges() to show that everything is working correctly."""

#importing the class
from users import Admin

#creating an admin user
anvil = Admin("søren", "bøye", "anvil", 31)

#printing privileges
anvil.privileges.show_privileges()
예제 #23
0
# root
# Caleb Bell
# imports users module and created new instance of user

from users import Admin

root = Admin('root', 'user', 'users')
root.privilege.show_privileges()

예제 #24
0
#Chapter 9 ex 8 date 02/07/17.

#Imports
from users import Admin

#Variables

#Objects
site_admin = Admin(
    "Robert", "Malone", "23", "*****@*****.**", "ramus", "password", {
        "Delete Users": True,
        "Delete Posts": False,
        "Edit Content": True,
        "Add Content": True
    })

#Functions

#Body

site_admin.check_priveledges()