def main(): lums = University("LUMS") eecs = Department(lums, "EECS"); civil = Department(lums, "CIVIL"); me = Department(lums, "MECHANICAL"); lums.Print();
def setUp(self): self.managers = [ Manager("Bill", "Gates", 1000, 10), Manager("Mark", "Zuckerberg", 900, 3), Manager("Sergey", "Brin", 900, 1), Manager("Steve", "Jobs", 800, 8) ] self.depart = Department(self.managers) self.employees = [ Designer("tom", "taylor", 800, 10, self.managers[0], effect_coeff=0.5), Developer("dev1", "java", 500, 2, self.managers[0]), Developer("dev2", "js", 500, 6, self.managers[0]), Designer("armani", "jeans", 1200, 3, self.managers[1], effect_coeff=1), Designer("dolce", "gabbana", 800, 6, self.managers[1]), Developer("dev3", "basic", 500, 0.5, self.managers[1]), Developer("dev4", "python", 500, 6) ] self.employees_salary_expected = [730, 500, 1100] self.managers_salary_expected = [1870] self.wrong_list = ["vasya", "petya", "kolya", 15, True]
def calculate_department(self): department = None for position_token in split(self.position, '/'): department = Department.department_for_keyword(position_token.lower()) if department is not None: break return department
def mutate(self, info, name, department): q = Department.get_query(info) subject_department = q.filter_by(id=department).one() new_subject = SubjectModel(name=name, department=subject_department) db_session.add(new_subject) db_session.commit() return CreateSubject(id=new_subject.id, name=new_subject.name, department=new_subject.department)
def test_ini(self): #тут був __init__ замість test_init emp_1 = Salaried_emp("Denis", "Shevchenka", "06.09.2001", "head", 120000) emp_2 = Hourly_emp("Viktor", "Stryiska", "24.04.2001", "analyst", 12, 180) self.employees = (emp_1, emp_2) self.location = Location(8, "BA") self.department = Department("BA", "Denis", self.location, self.employees)
def mutate(self, info, name, department): q = Department.get_query(info) teacher_department = q.filter_by(id=department).first() new_teacher = TeacherModel(name=name, department=teacher_department) db_session.add(new_teacher) db_session.commit() return CreateTeacher(id=new_teacher.id, name=new_teacher.name, department=teacher_department)
def test_all_in_one(self): loc_1 = Location(8, "BA") assert ("Room 8. Department: BA" == str(loc_1)) assert (8 == loc_1.get_room()) assert (loc_1.get_department == "BA") emp_1 = Salaried_emp("Denis", "Shevchenka", "06.09.2001", "head", 120000) emp_2 = Hourly_emp("Viktor", "Stryiska", "24.04.2001", "analyst", 12, 180) assert (isinstance(emp_1, Employee)) assert (isinstance(emp_2, Employee)) assert (emp_1.name == "Denis") assert ("Shevchenka" == emp_1.address) assert ("06.09.2001" == emp_1.birthday) assert ("head" == emp_1.position) assert (120000 == emp_1.salary) assert (12 == emp_2.worked_h) assert (180 == emp_2.salary_p_h) assert (( str(emp_1) == "Salaried_emp<Denis lives in Shevchenka street. Position: head. Birthday: 06.09.2001. Salary per month: $120000" )) assert (( str(emp_1) == "Hourly_emp<Viktor lives in Stryiska street. Position: analyst. Birthday: 24.04.2001. Salary per hour: $180. Worked hours per day: 12" )) # changes to 180 employee_list = (emp_1, emp_2) dep_1 = Department("BA", "Denis", loc_1, employee_list) # workers should be in tuple assert (isinstance(dep_1.workers, tuple)) # location must be instance of Location class assert (isinstance(dep_1.location, Location)) assert (dep_1.get_location() == "Room 8. Department: BA") assert (dep_1.sum_salary() == 60000) assert ( dep_1.get_inf_workers() == "Denis lives in Shevchenka street. Position: manager. Birthday: 06.09.2001. Salary per month: $30000\nHourly_emp<Viktor lives in Stryiska street. Position: analyst. Birthday: 24.04.2001. Salary per hour: $180. Worked hours per day: $1000" )
def main(): manO = Manager("Ola", "Anton", 250, 3, 3) desP = Designer("Peta", "Petrov", 200, 2, 0.5, manO) desO = Designer("Ooo", "Eee", 250, 3, 0.8, manO) devI = Developer("Ivan", "Ivanov", 300, 3, manO) devR = Developer("Ryslan", "Ruslanov", 400, 5, manO) devD = Developer("Ddd", "Ddd", 500, 6, manO) desV = Designer("Vvv", "Vvv", 600, 10, 0.9, manO) manA = Manager("Aaa", "Aaa", 250, 3, 3) depart = Department() for i in range(len(Human.humans)): Human.humans[i].getEmployee() print('\n') #devI.getEmployee() #manO.getEmployee() #desO.getEmployee() #desP.getEmployee() depart.manList() depart.salary() manO.teamAdd(devI, desO, desP, devR, devD, desV, manA) manO.printSallary() devI.printSallary() desP.printSallary()
def setUp(self) -> None: """Initialize setup object""" self.department = Department("Emergency") self.department1 = Department("Surgery") self.read_mock = Mock() self.department._write_to_file = self.read_mock self.doctor1 = Doctor("George", "Bush", "1982-2-28", "97334 Oak Bridge , Vancouver, Vancouver, BC", 2, False, 125, 190000) self.patient1 = Patient("Jose", "McDonald", "1970-12-12", "3432 Newtons, Richmond, BC", 1, False, 590) self.doctor2 = Doctor("Johnny", "Kenedy", "1984-1-30", "1444 Oakway, North Vancouver, Vancouver, BC", 1, False, 123, 150000) self.patient2 = Patient("Bill", "Stark", "1970-12-12", "1111 Columbia, New Westminster, BC", 2, False, 589, 10000) self.patient3 = Patient("Tony", "Stark", "1960-9-2", "1111 Columbia, New Westminster, BC", 12, False, 589)
def __init__(self): self.sum_hours=sum_hours self.instructors_hours=instructors_hours self.instructors_names=instructor_names self.instructors_hours_empty=instructors_hours_empty self.cscourses =[] self.itcourses =[] self.iscourses =[] self.courses= [] self.departments1=[] self.instructors = [] self.instructors.append(ahmed) self.instructors.append(mohamed) self.instructors.append(ali) self.cscourses.append(selected) self.cscourses.append(operating_system) self.iscourses.append(ethics) self.iscourses.append(database2) self.itcourses.append(network) self.itcourses.append(electronics) self.courses.append(selected) self.courses.append(operating_system) self.courses.append(ethics) self.courses.append(database2) self.courses.append(network) self.courses.append(electronics) self.csdept = Department("cs", self.cscourses) self.isdept = Department("is", self.iscourses) self.itdept = Department("it", self.itcourses) self.departments1.append(self.csdept) self.departments1.append(self.isdept) self.departments1.append(self.itdept)
from store import Store num_args = len(sys.argv) if num_args == 1: user = User(100) elif num_args == 2: user = User(int(sys.argv[1])) else: print("Usage: store.py [money]") sys.exit(1) departments = { 23: Department(23, "Groceries", [ Product("Bananas", 0.60), Product("Avos", 2.60), Product("Watermelon", 1.60) ]), 9: Department(9, "Books", [ Product("Game of Thrones", 10.60), Product("Working in Public", 12.60), Product("Watermelon Chronicles", 1.60) ]), 13: Department(13, "Electronics", [ Product("Samsung 4k TV", 300.60), Product("Iphone SE", 2000.60), Product("Pixel 4a", 1000.60) ]), 7:
#!/usr/bin/python # -*- coding: utf-8 -*- from config import crawler_config from department import Department dep = Department(u'의학과', u'H3HBDC') dep.load_lectures() for lecture in dep.lecture_group.iter_lectures(): subject_code = lecture.data['subject_code'] name = lecture.data['name'] lecture_code = lecture.data['lecture_code'] time = '' for entry in lecture.data['time']: time += str(entry) print '%s\t%s\t%s\t%s' % (subject_code, name, lecture_code, time)
class DepartmentTest(unittest.TestCase): def setUp(self): self.department = Department('produce') def test_getDeptName(self): self.assertEqual(str(self.department.getDeptName()), 'produce')
def setUp(self): self.department = Department('produce')
TESTEMPLOYEES = ((1, 'Douglas Adams', datetime(1942, 7, 6)), (2, 'Sherlock Holmes', datetime(1887, 3, 15)), (3, 'Albert Einstein', datetime(1915, 11, 25)), (4, 'Sir John A Macdonald', datetime(1867, 8, 1)), (5, 'Theodore Roosevelt', datetime(1901, 9, 14))) TESTDEPARTMENTS = ((101, 'Sci-Fi Comedy', datetime(2010, 10, 1)), (102, 'Mystery', datetime(2012, 2, 13)), (103, 'Physics', datetime(2014, 5, 14)), (104, 'Politics', datetime(2016, 7, 28)), (201, 'POTUS', datetime(1776, 7, 4))) def populate_employees(employees_class): employees = employees_class() for number, name, date in TESTEMPLOYEES: employees.add_employee(Employee(number, name, date)) return employees employees1 = populate_employees(Employees1) employees2 = populate_employees(Employees2) employees3 = populate_employees(Employees3) departments = Departments() for number, name, date in TESTDEPARTMENTS: departments.add_department(Department(number, name, date))
def __init__(self, name, supervisor, budget, meeting_place, is_awesome): Department.__init__(self, supervisor, budget, meeting_place, is_awesome) self.__is_awesome = is_awesome
print("-----------------------------------") print("--------- Adam ERP --------") print("-----------------------------------") print('[ 사용자 메뉴 ]\n') print('1 - 인사 관리') print('2 - 프로젝트 관리') print('3 - 부서 관리') print('4 - 프로그램 종료') print("-----------------------------------") if __name__ == '__main__': # Project -----> Employee em = Employee() pj = Project(em) # Employee --> Department dp = Department() while True: print_menu() print("메뉴를 선택하세요 : ", end='') selected = input() if int(selected) == 1: em.executeJob(dp) elif int(selected) == 2: pj.execute_job() elif int(selected) == 3: dp.execute_job() elif int(selected) == 4: break
def add_department(): name = input('Department Name: ') code = input('Department Code: ') return Department(name, code)
#coding: utf-8 ################################## # Работа с классами # ################################## from person import Person from department import Department from manager import Manager Bob = Person(age = 56, job = "Tester") Bob.setName("Bob Oden") Bob.setPay(1000) Bob.giveRaise(100) John = Person("John Smith", "Programmer", 1e6, 17) Tom = Manager("Tom mi", 100, 20) Tom.giveRaise(8, 8) #Bob.newdata = "something" не рекомендуется присоединять аттрибуты за пределами класса development = Department(Bob, John) development.addMember(Tom) development.giveRaises(10) development.showAll()
def load_departments(self): department_rows = self.database.get_departments() for department_row in department_rows: department = Department(department_row[1]) department.id = department_row[0] self.departments[department.id] = department
# -*- coding: UTF-8 -*- import random from faker import Faker from department import Department, DepartmentDAO def getLocation(): levels = [1, 2, 3, 4, 5] areas = ["A", "B", "C", "D", "E"] return f"{random.choice(levels)}楼{random.choice(areas)}区" fake = Faker("zh_CN") names = ("骨科门诊", "内科门诊", "妇科门诊", "针灸推拿科", "后滘门诊部", "急诊科", "骨伤一科(关节骨科)", "骨伤二科(创伤骨科)", "骨伤三科(脊柱骨科)", "骨伤四科(老年骨科)", "运动医学-关节镜科", " 妇二科(不孕不育科)", "重症医学科", "麻醉科", "医务科", "护理部", "药剂科", "医技功能室", "检验科", "放射科", "儿科门诊", "肛肠科门诊", "皮肤科门诊", "口腔科", "内科门诊", "内科住院部", "骨科门诊", "外科门诊", "眼耳鼻咽喉科", "妇科门诊", "急诊科", "妇科住院部", "针灸推拿科", "骨外科住院部", "山村门诊部", "脑病科", "康复科", "医教科", "护理部", "卫防科", "药剂科", "医技功能室", "检验科", "放射科") for i in range(len(names)): deptName = names[i] deptID = i + 1 location = getLocation() phone = fake.phone_number() dept = Department(deptID, deptName, location, phone) print(dept) DepartmentDAO.add(dept)
import time, requests from flask import Flask, render_template, jsonify, request, redirect, url_for from department import Department from deviceCount import devCount from random import randint from device import Device from getRequest import getData from getPi import getPi import os app = Flask(__name__) dep = Department() device = [] @app.context_processor def inject_user(): return dict(depID = dep.depID) @app.route("/") def renderRoot(): if(not dep.depID): return render_template("area.html") return redirect(url_for("update")) @app.route("/update") def update(): dev = devCount() devPi = getPi() for i in range(dev):
import json, os, re, smtplib, urllib, yaml from book import Book from department import Department, ChildrensLit, NotifyAboutEverything, SpanishInterestGroup ATOM_NAMESPACE = 'http://www.w3.org/2005/Atom' # The feed element ATOM = "{%s}" % ATOM_NAMESPACE # replaces the % and the s and replaces it follwed by anything after % config = yaml.safe_load(open('conf/evergreen.yml')) config.update(yaml.safe_load(open('conf/output.yml'))) departments = [] departments_config = yaml.safe_load(open('conf/departments.yml')) for d in departments_config['departments']: data = d.values()[0] departments.append(Department(d.keys()[0], ','.join(data['emails']), data['regex'])) # Add custom departments to the list departments.append(SpanishInterestGroup('*****@*****.**')) departments.append(NotifyAboutEverything('*****@*****.**')) departments.append(ChildrensLit('*****@*****.**')) if 'shelving_location' in config: if isinstance(config['shelving_location'], list): loc_string = '©Location='.join(str(location) for location in config['shelving_location']) else: loc_string = str(config['shelving_location']) feed_url = 'http://' + config['opac_host'] + '/opac/extras/browse/atom-full/item-age/' + config['org_unit'] + '/1/' + str(config['num_items_to_fetch']) + '?status=0&status=1&status=6&status=7©Location=' + loc_string # the URL that will return all the data we need else: feed_url = 'http://' + config['opac_host'] + '/opac/extras/browse/atom-full/item-age/' + config['org_unit'] + '/1/' + str(config['num_items_to_fetch']) + '?status=0&status=1&status=6&status=7'
def ensure_department_existance(department_id): if not len( graph.data( "match (d:Department) where space_ship.get_hex_ident(d.ident) = '%s' return d.ident as ident" % department_id)) > 0: Department(ident=department_id).save()
def __init__(self): Department.__init__(self,"IT")
from ccs import Ccs from faculty import Faculty print("Program for Request , allotment and avaialblity ") print("Choose which Sector you want to select ") print("1:Department \n 2:Coordinator \n 3:Faculty") key = input("Enter the Choice here") if key == "1": password = input("Enter the key before selecting Department Sector") if password == "dep123": d = Department() work = input( "What do you want \n 1:Request for training \n 2:Request for Fresher Training " ) if work == "1": rid = input("enter request id") fieldid = input("Enter name of the your field id ") date = input("Enter the date") d.req_for_training(rid, fieldid, date) elif work == "2": rid = input("enter request id") fieldid = "basic" date = input("Enter date here") d.request_for_fresher_training(fieldid, date)
def create_department(self, name): department = Department(name) self.database.insert_department(department) self.departments[department.id] = department return department
# user will pass in either 0 or 1 command-line arguments to the program num_args = len(sys.argv) # if they pass in 0, we'll default their money to 100 if num_args == 1: user = User(100) # if they pass in 1 argument (a number), set their money to that amount elif num_args == 2: user = User(int(sys.argv[1])) else: print("Usage: store.py [money]") sys.exit(1) departments = { 23: Department(23, "Groceries", [Product("Bananas", 1), Product("Avocados", 2), Product("Watermelons", 4)]), 9: Department(9, "Books", [Product("Game of Thrones", 10), Product("Working in Public", 25), Product("Twilight", 10)]), 13: Department(13, "Electronics", [Product("Samsung 4K TV", 300), Product("iPhone SE", 400), Product("Pixel 4A", 350)]), 7: Department(7, "Clothes", [Product("Graphic T's", 20), Product("Kanye Sweater", 700), Product("Sketchers High Tops", 50)]), 15: Department(15, "Toys", [Product("Lightsaber", 200), Product("Nerf Guns", 200), Product("Settlers of Catan", 40), Product("Nintendo Lego Set", 150)]) } store = Store("Quarantine Store", departments) # print the store's welcome message print(store) # print user's status print(user, '\n') while True:
self.departments = departments def __str__(self): return f"Wecome to the Quarantine store! Have a nice shopping experience!" def print_departments(self): for id in self.departments: print(self.departments[id]) print() departments = { 23: Department(23, "Groceries", [ Product("Bananas", 0.60), Product("Avocados", 2), Product("Watermelons", 6) ]), 9: Department(9, "Books", [ Product("Game of Thrones", 10), Product("Fahrenheit 451", 15), Product("Working in Public", 25) ]), 13: Department(13, "Electronics", [ Product("Samsung 4K TV", 300), Product("iPhone SE", 400), Product("Pixel 4A", 100) ]), 7:
elif work == "3": type_ = input("Enter the type of the Employee") empid = input("Enter the empid of the Employee") e.update_employee_type(type_, empid) else: print("Wrong Choice") else: print("You have Entered Wrong Password") elif key == "2": password = input("Enter the password for Updating Database of Department") if password == "dept123": d = Department() name = input("Enter name of the department") project = input("Enter the name of the project") deptid = input("Enter the Department ID") d.add_department(name, project, deptid) else: print("You have Entered Wrong Password") elif key == "3": password = input("Enter the password for Updating Database of coordinator") if password == "cod123": c = Coordinator() name = input("Enter Name of the Coordinator") cid = input("Enter your Coordinator Id")
def main(): managers = [ Manager("Bill", "Gates", 1000, 10), Manager("Mark", "Zuckerberg", 900, 3), Manager("Sergey", "Brin", 900, 1), Manager("Steve", "Jobs", 800, 8) ] employees = [ Designer("tom", "taylor", 800, 10, managers[0], effect_coeff=0.5), Developer("dev1", "java", 500, 2, managers[0]), Developer ("dev2", "js", 500, 6, managers[0]), Designer("armani", "jeans", 1200, 3, managers[1], effect_coeff=1), Designer("dolce", "gabbana", 800, 6, managers[1]), Developer ("dev3", "basic", 500, 0.5, managers[1]), Developer ("dev4", "python", 500, 6) ] depart = Department(managers) wrong_list = ["vasya","petya","kolya", 15, True] depart.give_salary() depart.add_team_members(managers[-1], employees[-1::]) # employees[-1].set_manager(managers[-1]) depart.give_salary() depart.add_team_members(managers[-2], employees[-1::]) #employees[-1].set_manager(managers[-2]) depart.give_salary() depart.add_team_members(managers[1], employees[-1::]) # employees[-1].set_manager() depart.give_salary() depart.add_team_members(managers[0], employees) depart.give_salary() depart.add_team_members(managers[-1], []) depart.give_salary() depart.add_team_members(managers[-1], wrong_list) depart.give_salary() wrong_list.extend(employees[-1::]) depart.add_team_members(managers[-1], wrong_list) depart.give_salary() depart.add_team_members(managers[-1], managers[:-1:]) depart.give_salary()
from department import Department from department_collection import Departments TESTEMPLOYEES = ( (1, 'Douglas Adams', datetime(1942, 7, 6)), (2, 'Sherlock Holmes', datetime(1887, 3, 15)), (3, 'Albert Einstein', datetime(1915, 11, 25)), (4, 'Sir John A Macdonald', datetime(1867, 8, 1)), (5, 'Theodore Roosevelt', datetime(1901, 9, 14)) ) employees = Employees() for empid, name, hiredate in TESTEMPLOYEES: employees.add_employee( Employee(empid, name, hiredate) ) TESTDEPARTMENTS = ( (101, 'Sci-Fi Commedy', datetime(2010, 10, 1)), (102, 'Mystery', datetime(2012, 2, 13)), (103, 'Physics', datetime(2014, 5, 14)), (104, 'Politics', datetime(2016, 7, 28)), (201, 'POTUS', datetime(1776, 7, 4)) ) departments = Departments() for deptid, name, date_established in TESTDEPARTMENTS: departments.add_department( Department(deptid, name, date_established) )
from employee import Employee from task import Task from boss import Boss from department import Department d = [] e = [] d.append(Department('Дизайн')) d.append(Department('Фронтэнд')) d.append(Department('Бэкэнд')) e.append(Boss('Марк')) e.append(Employee('Иван')) e.append(Employee('Алексей')) e.append(Employee('Сергей')) e.append(Boss('Денис')) e.append(Employee('Ярослав')) e.append(Employee('Кирилл')) e.append(Employee('Леонтий')) e.append(Boss('Данил')) e.append(Employee('Андрей')) e.append(Employee('Никита')) e.append(Employee('Владимир')) for i in range(12): if i < 4: e[i].assigndepartment(d[0]) d[0].addemployee(e[i]) if i >= 4 and i < 8: e[i].assigndepartment(d[1]) d[1].addemployee(e[i]) if i >= 8: e[i].assigndepartment(d[2]) d[2].addemployee(e[i])