Ejemplo n.º 1
0
    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]
Ejemplo n.º 2
0
def main():
    dev_1 = Developer('John', 'Smith', 50000, "Python")
    dev_2 = Developer('Test', 'User', 50000, "Java")

    mgr_1 = Manager('Guy', 'Kustin', 90000, [dev_1])

    mgr_1.print_emps()

    print("using __add__ : {}".format(
        dev_1 + dev_2))  # uses the __add__ method in Employee

    print(mgr_1.pay_per_months(2))
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
 def developer(self, instance):
     home_screen = APP.root.current_screen
     from developer import Developer
     self.developer = Developer()
     APP.root.add_widget(self.developer)
     APP.root.current = "developer"
     APP.root.remove_widget(home_screen)
Ejemplo n.º 5
0
def openInput(name):
    # Open text file and store bag of lines
    file_contents = open(input_files[name], 'r')
    with file_contents as fc:
        content = fc.readlines()

    # Parse first line into a Map object
    width, height = content[0].split(' ')
    office = Office(name, width, height, content[1:int(height) + 1])

    num_devs = int(content[int(height) + 1])
    developers = [
        Developer(line)
        for line in content[int(height) + 2:int(height) + 2 + num_devs]
    ]
    developers = developers.sort(
        key=lambda developers:
        (developers.ci, developers.bi, developers.num_s),
        reverse=True)

    manager_start = int(height) + 1 + num_devs + 1
    num_managers = int(content[manager_start])

    managers = [Manager(line) for line in content[manager_start + 1:]]
    managers = managers.sort(key=lambda managers: (managers.ci, managers.bi),
                             reverse=True)

    # Return both Map and Customer objects
    return office, developers, managers
Ejemplo n.º 6
0
def main():
    manager_one = Manager("Georgi", 4000)
    manager_two = Manager("Tsvetomir", 5000)
    manager_three = Manager("Spasimir The Boss", 7000)
    developer_one = Developer("Atanas", 2500)
    developer_two = Developer("Ivan", 3000)
    developer_three = Developer("Petar", 3500)
    developer_four = Developer("Anastas", 4000)
    developer_five = Developer("Evgeni", 4000)

    manager_one.add(developer_one)
    manager_one.add(developer_two)
    manager_two.add(developer_three)
    manager_two.add(developer_four)
    manager_three.add(developer_five)
    manager_three.add(manager_one)
    manager_three.add(manager_two)

    manager_three.print_data()
Ejemplo n.º 7
0
 def do_add_developer(self, args):
     if len(args.split(" ")) < 3:
         print("Specify name, age and oss projects")
     else:
         print("Adding new developer to our list...")
         devs.append(
             Developer(
                 args.split(" ")[0],
                 args.split(" ")[1],
                 args.split(" ")[2]))
         self.do_show_list(devs)
Ejemplo n.º 8
0
 def random_employee(employee_type):
     if employee_type == 'developer':
         return Developer(**Developer.random_attrs())
     if employee_type == 'sales':
         return Sales(**Sales.random_attrs())
     if employee_type == 'project_manager':
         return ProjectManager(**ProjectManager.random_attrs())
     if employee_type == 'support':
         return Support(**Support.random_attrs())
     err_msg = (
         '{} employee type is not supported.\n'.format(type),
         'Allowed values are: \'developer\', \'project_manager\', \'sales\' or \'support\'',
     )
     raise ValueError(err_msg)
Ejemplo n.º 9
0
def test_assign_the_name_of_the_developer_in_construction( name ):
    developer = Developer( name )
    assert developer.name == name
Ejemplo n.º 10
0
            self.employees = employees

    def add_empl(self, emp):
        if emp not in self.employees:
            self.employees.append(emp)

    def remove_emp(self, emp):
        if emp in self.employees:
            self.employees.remove(emp)

    def print_emps(self):
        for emp in self.employees:
            print('-->', emp.full_name)


if __name__ == "__main__":
    dev_1 = Developer("John", "Doe", 80000, "Python")
    dev_2 = Developer("Jane", "Doe", 150000, "JavaScript")
    mgr_1 = Manager("Josefine", "Lopez", 200000, [dev_1])
    print(mgr_1.email)
    print("==================")
    mgr_1.add_empl(dev_2)
    mgr_1.print_emps()
    print("==================")
    mgr_1.remove_emp(dev_1)
    mgr_1.print_emps()
    print(isinstance(mgr_1, Employee))
    print(isinstance(dev_1, Employee))
    print(isinstance(mgr_1, Developer))
    print(issubclass(Manager, Employee))
Ejemplo n.º 11
0
print('Employee 2 New Raise Amount: ', emp_2.raise_amount)
emp_2.apply_raise()
print('Employee 2 New Pay: ', emp_2.pay)
print('\n')

print('Number of Employees Created: ', Employee.num_of_employees)

# =============================================================================
print('\n')
print('-' * 100)
print('Developer Sub Class Example')
print('-' * 100)
print('\n')

# Instantiating instances
dev_1 = Developer('Arin', 'Blue', 40000, 'Python')

print('---------- Developer 1 ----------')
print(dev_1.get_full_name())
print(dev_1.email)
print('Developer 1 Pay: ', dev_1.pay)
print('Developer 1 Raise Amount: ', dev_1.raise_amount)
dev_1.apply_raise()
print('Developer 1 New Pay: ', dev_1.pay)
print('\n')

# =============================================================================
print('\n')
print('-' * 100)
print('Manager Sub Class Example')
print('-' * 100)
Ejemplo n.º 12
0
 def develop_details(self):
     self.app = Developer(self.root, self.id)
Ejemplo n.º 13
0
        filters = args.split(" ")
        if 'DESC' in filters[args_len - 1]:
            reverse = True
            filters.remove('DESC')
        else:
            reverse = False

        print("==============================")
        self.do_show_list(self.sort_by_attributes(devs, filters, reverse))

    def sort_by_attributes(self, devs, filters, reverse):
        sorted_devs = []
        sorted_devs = sorted(devs, key=attrgetter(*filters), reverse=reverse)
        return sorted_devs


if __name__ == '__main__':
    print("Setting up initial list...")
    devs = [
        Developer("John", 29, 3),
        Developer("Linda", 29, 5),
        Developer("Robert", 24, 1),
        Developer("Amanda", 21, 8),
        Developer("Lawrence", 32, 2),
        Developer("Steven", 24, 4)
    ]
    prompt = MyPrompt()
    prompt.do_show_list(devs)
    prompt.prompt = '> '
    prompt.cmdloop('Starting prompt... Type help for list of commands')
 def mutate(self, scrum_team) -> None:
     developer = Developer(self.__dict__["name"])
     for skill in self.__dict__["skills"]:
         developer.learn(skill)
     scrum_team._developers.append(developer)
Ejemplo n.º 15
0
        if employees is None:
            self._employees = []
        else:
            self._employees = employees

    def addEmp(self, emp):
        if emp not in self._employees:
            self._employees.append(emp)

    def remEmp(self, emp):
        if emp in self._employees:
            self._employees.remove(emp)

    def displayEmp(self):
        for emp in self._employees:
            print("<-- ", emp.fullName())


dev_1 = Developer("Amin", "Balad", "15000", "Facebook", "PHP")
dev_2 = Developer("Arab", "Dahir", "80000", "Facebook", "C++")
mn1 = Manager('Hassan', 'Mohamed', '88000', 'Facebook', [dev_1])
mn1.addEmp(dev_2)
mn1.remEmp(dev_1)

if __name__ == "__main__":
    pass
    print(mn1.displayEmp())
    # We can take advantage with built in functions -isinstance and issubclass
    print(isinstance(Manager, Developer))
    print(issubclass(Manager, Employee))
Ejemplo n.º 16
0
def test_should_always_grab_a_positive_number_of_maxibons( name, mtg ):
    developer = Developer( name, mtg )
    assert developer.maxibonsToGrab() >= 0
Ejemplo n.º 17
0
    def setUp(self):

        self.dev_1 = Developer('Radek', 'Warowny', 5000, 'Python')
        self.dev_2 = Developer('Tina', 'Reid', 8000, 'Java')
from manager import Manager
from developer import Developer

dev1 = Developer("rox", 34000, "Java")
dev2 = Developer("bob", 50000, "java")
dev3 = Developer("tim", 7000,  "Python")
dev4 = Developer("nina", 7000,  "java")
dev5 = Developer("hana", 7000,  "Python")

devs = [dev1, dev2, dev3, dev4, dev5]

mgr = Manager("Mo", 70000, devs)

print("Java Developers:")
java_devs = mgr.all_java_devs()
for dev in java_devs:
    print(dev.name)

print()

print("Python Developers:")
python_devs = mgr.all_python_devs()
for dev in python_devs:
    print(dev.name)
 def developer_data(self):
     self.new_window = Toplevel(self.root)
     self.app = Developer(self.new_window)
Ejemplo n.º 20
0
 def setUp(self):
     self.dev1 = Developer('tim')
     self.dev2 = Developer('tom')
     self.dev3 = Developer('tina')