示例#1
0
    def registerLibrarian(self, name, location, age, aadharId, empId):
        '''
        Verifies the aadhar_id and checks if it already is used to create a librarian.
        Registers a librarian.
        ...
        Parameters
        ----------
        name : str
            Name of the user
        location : str
            Resedential city of the User
        age: int
            Age of the User
        aadhar_id: str
            Address proof of the user
        empID : str
            Identity card of the employee

        Returns
        -------
        A dictionary: With "Status" as key and Bool as value.

        '''
        res = {"registration_status": True}
        if aadharId in self.librarians:
            res = {
                "registration_status": False,
                "message": f"{aadharId} is already a librarian"
            }
            return res
        if aadharId in self.members:
            res = {
                "registration_status":
                False,
                "message":
                f"{aadharId} is a student. Only employees can become librarians"
            }
            return res

        self.librarians[aadharId] = Librarian(name, location, age, aadharId,
                                              empId)
        return res
b1 = Book('Shoe Dog', 'Phil Knight', '2015', 312)
b1.addBookItem('123hg', 'H1B2')
b1.addBookItem('124hg', 'H1B3')

b1.printBook()

catalog = Catalog()

b = catalog.addBook('Shoe Dog', 'Phil Knight', '2015', 312)
catalog.addBookItem(b, '123hg', 'H1B2')
catalog.addBookItem(b, '124hg', 'H1B4')
catalog.addBookItem(b, '125hg', 'H1B5')

b = catalog.addBook('Moonwalking with Einstien', 'J Foer', '2017', 318)
catalog.addBookItem(b, '463hg', 'K1B2')

catalog.displayAllBooks()

m1 = Member("Vish", "Bangalore", 23, 'asljlkj22', 'std1233')

librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')
print(m1)
print(librarian)

b = catalog.searchByName('Shoe Dog')
print(b)

m1.viewBooks()

catalog.removeBookItem('Shoe Dog', '124hg')
catalog.displayAllBooks()
catalog._removeBookItem('124hg')
catalog.displayAllBooks()
catalog.searchByName('Shoe Dog')
catalog.searchByAuthor("Phil Knight")
catalog.searchByPublishDate("2015")
catalog.searchBookByMinPages(300)
catalog._removeBook("Shoe Dog")
catalog.displayAllBooks()
print("\n\n")
sys.stdout.flush()

print("Testing User.py:", "\n")
print("\n")
print("Testing Librarian and its functions:", "\n")
librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')
print(librarian)
librarian.addBook('Shoe Dog', 'Phil Knight', '2015', 312)
librarian.addBookItem("Shoe Dog", '123hg', 'H1B2')
librarian.addBookItem("Shoe Dog", '124hg', 'H1B4')
librarian.addBookItem("Shoe Dog", '125hg', 'H1B5')
librarian.addBook('Moonwalking with Einstien', 'J Foer', '2017', 318)
librarian.addBookItem('Moonwalking with Einstien', '463hg', 'K1B2')
librarian.addBookItem('Moonwalking with Einstien', '466hg', 'K1B5')
librarian.displayAllBooks()
librarian.removeBookItemFromCatalog("125hg")
librarian.displayAllBooks()
librarian.removeBook("Shoe Dog")
librarian.displayAllBooks()
librarian.addBook('Shoe Dog', 'Phil Knight', '2015', 312)
librarian.addBookItem("Shoe Dog", '123hg', 'H1B2')
            book = input("name of book you want to return")
            student = input("enter your name")
            m1.return_book(book, student)

        elif choice == 4:
            book_name = input("enter the name of the book")
            Catalog.searchbyname(book_name)
            print("\n")

        elif choice == 5:
            author = input("enter the name of the author")
            Catalog.searchbyauthor(author)
            print("\n")

        elif choice == 6:
            libr = Librarian("Shekhar suman", "howrah", 23, 456782125, "Na")
            book_name = input("name of the book which is going to be added")
            quantity = int(input())
            author = input("name of the author")
            publish_date = input("enter publish year")
            pages = input("total number of pages in book")
            libr.addBook(book_name, quantity, author, publish_date, pages)
            print("\n")

        elif choice == 7:
            book_name = input("name of the book which is going to be added")
            quantity = int(input())
            author = input("name of the author")
            publish_date = input("enter publish year")
            pages = input("total number of pages in book")
            libr.removebook(book_name, quantity, author, publish_date, pages)
示例#5
0
from User import Member
from User import Librarian

lib = Librarian('Gopal', 'Indore', 24, '994400555515', 'GOP975')
print(lib)
lib.addBook('Thermodynamics', 'P.K. Nag', 'June 1989', '1279')
lib.addBookItem('Thermodynamics', 'BTXPB5929C', 'T101')
lib.addBookItem('Thermodynamics', 'BTXPB5929C', 'T102')
lib.addBook('Machine Design', 'R.S. Khurmi', 'Februaru 1990', '2087')
lib.addBookItem('Machine Design', 'CDFTC6432B', 'M201')
lib.addBookItem('Machine Design', 'CDFTC6432B', 'M201')
lib.addBook('Theory of Machines', 'Dr. A.G. Ambekar', 'September 1985', '2745')
lib.addBookItem('Theory of Machines', 'SMNQS6664A', 'TM301')
lib.addBookItem('Theory of Machines', 'SMNQS6664A', 'TM302')
lib.viewBooks()
lib.removeBookItem('SMNQS6664A')
lib.viewBooks()
lib.removeBook('Theory of Machines')
lib.viewBooks()

member1 = Member('Aditya', 'Indore', 24, '9424534453', 'ADI942')
member2 = Member('Harish', 'Indore', 25, '9791457862', 'HAR979')
print(member2)
member1.viewBooks()
member1.reserveBook('Thermodynamics')
member2.reserveBook('Machine Design')
member1.viewBooks()

lib.viewissuedBookItems()
lib.viewIssuerInfo()
# -*- coding: utf-8 -*-
from User import Member, Librarian
from Catalog import Catalog

#creating useres
user1 = Member("prasanna","bangalore",22,"zxcc8765","std123")
user2 = Member("prashanth","bangalore",23,"zxcc5765","std143")

#creating a librarian
lib1 = Librarian("admin","mysore",34,"avcgh4352","emp123")

#adding book and book items
book = lib1.addBook("harry potter","william",2001,500)
lib1.addBookItem(book,"123zxc43","h101")
lib1.addBookItem(book,"123zxc44","h102")
lib1.addBookItem(book,"123zxc45","h103")
lib1.addBookItem(book,"123zxc46","h104")

book = lib1.addBook("ironman","jhon",2005,300)
lib1.addBookItem(book,"125zgc10","g101")
lib1.addBookItem(book,"125zgc11","g102")
lib1.addBookItem(book,"125zgc12","g103")
lib1.addBookItem(book,"125zgc13","g104")

book = lib1.addBook("attitude","xyz",2016,350)
lib1.addBookItem(book,"765zgc10","h101")
lib1.addBookItem(book,"765zgc12","s102")

lib1.displayBooks()#displaying the inventory
print("\n\n")
# -*- coding: utf-8 -*-

from User import Member
from User import Librarian

lib = Librarian("Naveen", "AP", 22, "AA123", "EMP123")
print(lib)

lib.addBook('Shoe Dog','Phil Knight', "2015",400)
lib.addBookItem("Shoe Dog", "isbn1", "H1B1")
lib.addBookItem("Shoe Dog", "isbn3", "H1B2")
lib.displayAllBooks()
lib.addBook('Progrmming','imran khan', "1999",500)
lib.addBookItem("Progrmming", "isbn4", "H1C1")
lib.addBookItem("Progrmming", "isbn6", "H1C2")
lib.displayAllBooks()
lib.addBook('Python','reema thareja', "200",320)
lib.addBookItem("Python", "isbn7", "H1D1")
lib.addBookItem("Python", "isbn9", "H1D2")
lib.displayAllBooks()


lib.removeBook("Python")
lib.displayAllBooks()

lib.removeBookItemFromCatalog("isbn1")
lib.displayAllBooks()


m1 = Member("Sharma", "Ap", 20, "AA990", "STUID112")
print(m1)
示例#8
0
catalog.addBookItem(b, '125hg', 'H1B5')

b = catalog.addBook('Moonwalking with Einstien', 'J Foer', '2017', 318)
catalog.addBookItem(b, '463hg', 'K1B2')

catalog.displayAllBooks()
# removing book item
catalog.removeBookItem('Shoe Dog', '124hg')
catalog.displayAllBooks()

# serching a book
b = catalog.searchByName('Shoe Dog')
print(b)

#librarian object
librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')
# librarian adding book
l = librarian.addBook(catalog, 'How to write clean code', 'David', '2020', 150)
l1 = Book('How to write clean code', 'David', '2020', 150)
# librarian adding book items
librarian.addBookItem(l, '1234hg', 'H1B2')
librarian.addBookItem(l, '1235hg', 'H1B2')
catalog.displayAllBooks()
# librarian removing bookitem we need to paas class object for calling class methods
librarian.removeBookItemFromCatalog(catalog, l1, 'How to write clean code',
                                    '1234hg')
# librarian removing book
librarian.removeBook(catalog, 'Shoe Dog')

# memeber Object
m1 = Member("Vish", "Bangalore", 23, 'asljlkj22', 'std1233')
from User import Member, Librarian


lib = Librarian("Sumit yadav", "Mumbai", 30, "PUNE199", "JSPM1111")
print(lib)
lib.addBook("Crack IELTS", "Pravin Choudhari", "2015")
lib.addBookItem("Crack IELTS", "001aa", "B1")
lib.addBookItem("Crack IELTS", "002aa", "B2")
lib.addBook("Crack coding round", "Saurabh Jadhav", "2002")
lib.addBookItem("Crack coding round", "001ab", "C1")
lib.addBookItem("Crack coding round", "002ab", "C2")
lib.addBook("Theory of everything", "Stephen hawking", "2012")
lib.addBookItem("Theory of everything", "001ac", "D1")
lib.addBookItem("Theory of everything", "002ac", "D2")
lib.addBookItem("Theory of everything", "003ac", "D2")
lib.viewBooks()
lib.removeBookItem("001ac")
lib.viewBooks()
lib.removeBook("Crack coding round")
lib.viewBooks()


member1 = Member("Ashwani Devesh Kashyap", "Mumbai", 23, "ADK4321", "NESS4321")
member2 = Member("Shivani Kashyap", "Surat", 19, "SK1234", "MSU8765")
member3 = Member("Navneet Kashyap", "Patna", 21, "NK9876", "JSPM1715")
print(member1)
print(member2)
print(member3)
member1.viewBooks()
member1.search_by_book_name("Theory of everything")
member1.search_by_book_name("The magic of thinking big")
import sys
from Book import Book
from Catalog import Catalog
from User import Librarian
from User import Member

m1 = Member("Vish", "Bangalore", 23, 'asljlkj22', 'std1233')

lib = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')
lib.addBook('Shoe Dog', 'Phil Knight', "Biography", '2015')
lib.addBookItem("Shoe Dog", "123pk", "H1B1")
lib.addBookItem("Shoe Dog", "124pk", "H1B2")
lib.addBook('Kafka On The Shore', 'Haruki Murakami', "Fiction", '2002')
lib.addBookItem("Kafka On The Shore", "854hm", "C1B1")
lib.addBookItem("Kafka On The Shore", "685hm", "C1B2")
lib.addBook('The Fault In Our Stars', 'John Green', "Romance", '2012')
lib.addBookItem("The Fault In Our Stars", "957jg", "R1B1")
lib.addBookItem("The Fault In Our Stars", "985jg", "R1B2")

b = lib.addBook('Moonwalking with Einstien', 'J Foer', 'Adventure', '2017')
lib.addBookItem(b, '463hg', 'K1B2')

while (True):
    print("welocome to the {} library.please Enter your choice".format(
        lib.name))
    print("1", "display_books")
    print("2", "Issue_book")
    print("3", "Return book")
    print("4", "Search book By book_Name")
    print("5", "Search book By Author_Name")
    print("\n")
示例#11
0
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 10 14:45:46 2020

@author: ali
"""
from User import Member
from User import Librarian

lib = Librarian("John Doe", "Mumbai", 30, "AJSK8549", "EMP58964")
print(lib)
lib.addBook('Shoe Dog', 'Phil Knight', "Biography", '2015')
lib.addBookItem("Shoe Dog", "123pk", "H1B1")
lib.addBookItem("Shoe Dog", "124pk", "H1B2")
lib.addBook('Kafka On The Shore', 'Haruki Murakami', "Fiction", "2002")
lib.addBookItem("Kafka On The Shore", "854hm", "C1B1")
lib.addBookItem("Kafka On The Shore", "685hm", "C1B2")
lib.addBook('The Fault In Our Stars', 'John Green', "Romance", "2012")
lib.addBookItem("The Fault In Our Stars", "957jg", "R1B1")
lib.addBookItem("The Fault In Our Stars", "985jg", "R1B2")
lib.viewBooks()
lib.removeBookItem("985jg")
lib.viewBooks()
lib.removeBook("The Fault In Our Stars")
lib.viewBooks()

member1 = Member("Niel", "Mumbai", 23, "ABCD4321", "STUD4321")
member2 = Member("Nitin", "Mumbai", 23, "DCBA4321", "STUD8765")
print(member2)
member1.viewBooks()
member1.searchByTitle("Kafka On The Shore")
示例#12
0
catalog.addBookItem(b, '124hg', 'H1B4')
catalog.addBookItem(b, '125hg', 'H1B5')

b = catalog.addBook('Moonwalking with Einstien', 'J Foer', '2017', 318)
catalog.addBookItem(b, '463hg', 'K1B2')

catalog.displayAllBooks()

catalog.searchByName('Lean In')
catalog.searchByAuthor('J.K.Rowling')

m1 = Member("Vish", "Bangalore", 23, 'asljlkj22', 'std1233')
m2 = Member("Chaitali", "Pune", 28, 'chaitali123', 'HS1166')
m3 = Member("Jane", "Punr", 25, 'jane123', 'HS1177')

librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')
print(m1)
print(librarian)

#m1.issueBook

librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')

lib1 = librarian.addBook('Lean In', 'Sheryl Sandberg', 2018, 600)
catalog.addBookItem(lib1, '454hs', 'H1B6')
catalog.addBookItem(lib1, '456hs', 'H1B7')

lib2 = librarian.addBook('Harry Potter', 'J.K.Rowling', 2013, 600)
catalog.addBookItem(lib2, '545hs', 'H2B1')
catalog.addBookItem(lib2, '656hs', 'H2B2')
librarian.removeBook('Harry Potter')
示例#13
0
# catalog.addBookItem(b, '123hg','H1B2',"#2222")
# catalog.addBookItem(b, '124hg','H1B4',"#6858")
# catalog.addBookItem(b, '125hg','H1B5',"#6833")

# b = catalog.addBook('Moonwalking with Einstien','J Foer', '2017',318)
# catalog.addBookItem(b, '463hg','K1B2',"#2343")

# b = catalog.addBook('The Harry Potter',"Jack daniel","2001",500)
# b = catalog.addBook('The Age of altron',"Jack daniel","2002",534)
# b = catalog.addBook('The Marvel king',"Jack daniel","2003",556)

# catalog.displayDifferentBooks()
# catalog.displayAllBookItems()
# print(catalog.searchByName("Shoe Dog"))

librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')
print(librarian)

print("---------------------------------------------------")
print("From library class persepective")
print("---------------------------------------------------")

# l = catalog.searchByAuthor('Jack daniel')
# print(l)

# print(catalog.__dict__)

two_states = librarian.addBook(catalog, "2 states", "Chetan Bhagat", '2010',
                               340)
librarian.addBookItem(catalog, two_states, '554hg', 'S1B2', "#2287")
librarian.addBookItem(catalog, two_states, '555hg', 'S1B4', "#2284")
# -*- coding: utf-8 -*-

from User import Member
from User import Librarian

lib = Librarian("Akhila Madhu", "Kerala", 22, "ED65845", "33541567")
print(lib)

lib.addBook('Shoe Dog', 'Phil Knight', "2015", 312)
lib.addBookItem("Shoe Dog", "123pk", "H1B1")
lib.addBook('Iron Man', 'Tony Stark', "2001", 800)
lib.addBookItem("Iron Man", "123im", "I1B1")
lib.addBook('Moonwalking with Einstien', 'J Foer', "2017", 318)
lib.addBookItem("Moonwalking with Einstien", "325ad", "A1B1")
lib.addBookItem("Moonwalking with Einstien", "326ad", "A1B2")
lib.addBook('Harry Potter', 'J K Rowling', "1997", "312")
lib.addBookItem("Harry Potter", "854hm", "C1B1")

lib.displayAllBooks()
lib.removeBookItemFromCatalog("325ad")
lib.displayAllBooks()
lib.removeBook("Moonwalking with Einstien")
lib.displayAllBooks()

member1 = Member("Ron", "Pune", 21, "LID547895", "STU343231")

member2 = Member("Rhea", "Kerala", 20, "LID43218", "STU656461")

member2.searchByName("Shoe Dog")
member1.searchByAuthor("Steve")
member1.searchByAuthor("Tony Stark")
示例#15
0
from Book import Book
from Catalog import Catalog
from User import Member, Librarian

catalog = Catalog()


#reference to Librarian class object
librarian = Librarian("Awantik","Bangalore",34,'asljlkj22','zeke101') 
#details of librarian
print (librarian)
# adding a book by librarian
b2 =librarian.addBook("This is Going to Hurt: Secret Diaries of a Junior Doctor","Adam Key",'2017', 302,catalog)
#adding details
librarian.addBookItem(b2,'234c','l203',catalog)

#displaying all the books till now added
librarian.displayAddedBook(catalog)

#library remove book
librarian.removeBook('Shoe Dog',catalog)


librarian.addBookItem(b2,'235c','1204',catalog)

librarian.removeBookItemFromCatalog(catalog,"This is Going to Hurt: Secret Diaries of a Junior Doctor",'235c')
catalog.addBookItem(b, '125hg','H1B5')

b = catalog.addBook('Einstien','J ', '2017',318)
catalog.addBookItem(b, '463hg','K1B2')

b = catalog.addBook('C','E Balguruswamy', '1985',319)
catalog.addBookItem(b, '473A','K1B3')

b = catalog.addBook('Verses','Walker', '2011',320)
catalog.addBookItem(b, '483B','K1B4')

catalog.displayAllBooks()

m1 = Member("pavan","hassan",23,'asljlk@j22','std1233')

librarian = Librarian("veeresh", "Bangalore",24,'asljlk@j32', 'zeke101') 
print (m1)
print (librarian)

b = catalog.searchByName('python')
print (b)

b = catalog.searchByName('C')
print (b)

b = catalog.searchByAuthor('dennis')
print (b)

#catalog.removeBookItem('Shoe Dog','124hg')
#catalog.displayAllBooks()
#m1.issueBook
示例#17
0
# -*- coding: utf-8 -*-
from Book import Book
from Catalog import Catalog
from User import Member, Librarian

librarian = Librarian("Awantik", "Bangalore", 34, 'asljlkj22', 'zeke101')

book1 = librarian.addBook('A novel', 'Ashish Kaul', 2020, 242)
book2 = librarian.addBook('Moonwalking with Einstien', 'J Foer', 2017, 318)
book3 = librarian.addBook('I heard you paint houses', 'Charles Brandt', 2004,
                          338)

librarian.addBookItem(book1, '101hg', 'H1A1')
librarian.addBookItem(book1, '102hg', 'H1A2')
librarian.addBookItem(book1, '103hg', 'H1A3')

librarian.addBookItem(book2, '201hg', 'H1B1')
librarian.addBookItem(book2, '202hg', 'H1B2')

librarian.addBookItem(book3, '301hg', 'H1C1')
librarian.addBookItem(book3, '302hg', 'H1C2')

# librarian.removeBookFromCatalog('A novel')
# librarian.removeBookItem('A novel', '102hg')

librarian.displayAllBooks()

member1 = Member("Ashish", "Bangalore", 23, 'asljlkj22', 'std1233')

# print(member1.searchByAuthor('J Foer'))
# member1.displayAllBooks()
示例#18
0
catalog = Catalog()

b = catalog.addBook('Shoe Dog','Phil Knight', '2015',312)
catalog.addBookItem(b, '123hg','H1B2')
catalog.addBookItem(b, '123hg','H1B4')
catalog.addBookItem(b, '123hg','H1B5')

b = catalog.addBook('Moonwalking with Einstien','J Foer', '2017',318)
catalog.addBookItem(b, '463hg','K1B2')

catalog.displayAllBooks()

m1 = Member("Vish","Bangalore",23,'asljlkj22','std1233')
m1.issueBook('Shoe Dog','123hg')
catalog.displayAllBooks()
m1.returnBook('Shoe Dog','123hg','H1B2')
librarian = Librarian("Awantik","Bangalore",34,'asljlkj22','zeke101')
librarian.addBook('Shoe Dog','Phil Knight', '2015',312)
# librarian.removeBook('Shoe Dog')
# librarian.removeBookItemFromCatalog(b,'123hg')
print (m1)
print (librarian)

b = catalog.searchByName('Shoe Dog')
print (b)


catalog.removeBookItem('Shoe Dog','124hg')
catalog.displayAllBooks()

#m1.issueBook