557aef062fd907e6dec11acfa5525d2d859d29a7,dino/db/rdbms/handler.py,DatabaseRdbms,leave_room,#DatabaseRdbms#Any#Any#,245

Before Change



    @with_session
    def leave_room(self, user_id: str, room_id: str) -> None:
        raise NotImplementedError()

    @with_session
    def join_room(self, user_id: str, user_name: str, room_id: str, room_name: str) -> None:
        room = self.session.query(Rooms).filter(Rooms.uuid == room_id).first()

After Change



    @with_session
    def leave_room(self, user_id: str, room_id: str) -> None:
        room = self.session.query(Rooms).filter(Rooms.uuid == room_id).first()
        if room is None:
            raise NoSuchRoomException(room_id)

        user = self.session.query(Users)\
            .join(Users.rooms)\
            .filter(Users.uuid == user_id)\
            .filter(Rooms.uuid == room_id)\
            .first()

        if user is None:
            // user is not in the room, so nothing to do
            return

        room = user.rooms[0]
        room.users.remove(user)
        self.session.commit()

    @with_session
    def join_room(self, user_id: str, user_name: str, room_id: str, room_name: str) -> None:
        room = self.session.query(Rooms).filter(Rooms.uuid == room_id).first()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: thenetcircle/dino
Commit Name: 557aef062fd907e6dec11acfa5525d2d859d29a7
Time: 2016-10-19
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: leave_room


Project Name: thenetcircle/dino
Commit Name: 6279a1e15c55b651bb5669546483a6c551552c6b
Time: 2016-10-19
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: delete_acl


Project Name: snorkel-team/snorkel
Commit Name: 958c796ba3a6fb884eb5a4a1a830f7c810c0c408
Time: 2016-12-08
Author: ajratner@gmail.com
File Name: snorkel/viewer.py
Class Name: Viewer
Method Name: __init__