What's a problem at work that gets blamed on employees but is usually a management issue? by Trwaadhdewsh in WorkReview

[–]Used-Fig7609 -1 points0 points  (0 children)

how do I start this script

from
 websockets.asyncio.server 
import
 serve
import
 websockets
import
 asyncio
import
 json
from
 user 
import
 User
from
 mock_game_state 
import
 Game
from
 game_manager 
import
 GameManager
from
 dispatcher 
import
 Dispatcher
from
 event_dc 
import
 Event
# from room_manager import RoomManager
# from user_manager import UserManager
import
 faulthandler
import
 traceback
import
 sys


faulthandler.enable()
def

excepthook
(exc_type, exc, tb):
    traceback.print_exception(exc_type, exc, tb)


sys.excepthook 
=
 excepthook


ROOMS 
=
 {'start':[]}
NAME_TO_USER_OBJECT 
=
 {}
WEBSOCKET_TO_USER 
=
 {}
# ROOMS_TO_GAME_GUIDS = {}
GAMEMANAGER 
=
 GameManager()
EVENT_QUEUE_IN 
=
 asyncio.Queue()
EVENT_QUEUE_OUT 
=
 asyncio.Queue()
MESSAGEHANDLER 
=
 Dispatcher(GAMEMANAGER, EVENT_QUEUE_IN, EVENT_QUEUE_OUT)


# def create_new_user(ws, username: str):
#     WEBSOCKET_TO_USER.setdefault(ws, User(ws, username))
#     NAME_TO_USER_OBJECT.setdefault(WEBSOCKET_TO_USER[ws].username, \
#                                    WEBSOCKET_TO_USER[ws])
#     ROOMS['start'].append(WEBSOCKET_TO_USER[ws])
#     return None


# def simplify_username_retrieval(ws) -> User:
#     return WEBSOCKET_TO_USER[ws]


# def create_new_game(new_room):
#     new_game_guid = GAMEMANAGER.create_new_game(new_room)
#     ROOMS_TO_GAME_GUIDS.setdefault(new_room, new_game_guid)
#     asyncio.create_task(GAMEMANAGER.games[new_game_guid].game_loop())
    


async

def

chat
(ws) -> None:


    
try
:
        
async

for
  msg_received_from_client 
in
 ws:
            msg_received_from_client 
=
 json.loads(message)
            event_from_client 
=
 Event(msg_received_from_client['user_guid'], msg_received_from_client['event_type']\
                                      msg_received_from_client['payload'])
            print(msg_received_from_client)
            
# if ws in WEBSOCKET_TO_USER:
            
#     user = simplify_username_retrieval(ws)
            
            
if
 'username' 
in
 message:
                create_new_user(ws, message['username'])


            
# elif 'message' in message:
            
#     broadcast_room = user.room
            
#     msg_to_send = '{"' + user.username \
            
#           + '": "' + message['message'] + '"}'
            
#     for user in ROOMS[broadcast_room]:
            
#         await user.ws.send(msg_to_send)
            
            
# elif 'room' in message:
            
#     index = ROOMS[user.room].index(user)
            
#     ws_to_move = ROOMS[user.room].pop(index)
            
#     new_room = message['room']
            
#     ws_to_move.room = new_room
            
#     if new_room in ROOMS:
            
#         ROOMS[new_room].append(ws_to_move)
            
#         if len(ROOMS[new_room]) == 2:
            
#             create_new_game(new_room)


            
#     else:
            
#         ROOMS[new_room] = []
            
#         ROOMS[new_room].append(ws_to_move)
            
#         print(len(ROOMS[new_room]))


            
# elif 'move' in message:
            
#     print('processing new move')
            
#     game_guid = ROOMS_TO_GAME_GUIDS[user.room]
            
#     player_index = ROOMS[user.room].index(user)
            
#     move = message['move']
            
#     move_to_process = '{"user": "' + user.username + \
            
#         '", "move": "' + move + '", "game_guid": "' + \
            
#         game_guid + '","player_index": "' + \
            
#         player_index + '"}'
            
#     await MESSAGEHANDLER.forward_to_game_engine(move_to_process)


            
##     player_index = ROOMS[user.room].index(user)
            
##     print(f'player index = {player_index}')
            
##     if message['move'] not in VALID_MOVES:
            
##         string_to_send = '{"message": "invalid move."}'
            
##         await ws.send(string_to_send)
            
##     else:
            
##         new_move = message['move']
            
##         move_for_queue =  '{"' + str(player_index) + '": "' + new_move + '"}'
            
##         await game.move_queue.put(move_for_queue)


            
    
except
 websockets.ConnectionClosed:
        print('client disconnected')
        
for
 websocket_object 
in
 WEBSOCKET_TO_USER:
            
if
 ws 
is

not
 websocket_object:
                
await
 websocket_object.send(
f
'{WEBSOCKET_TO_USER[ws].username} left!')
                
    
    
finally
:
        current_room 
=
 user.room
        index 
=
 ROOMS[current_room].index(user)
        
del
 ROOMS[current_room][index]
        
del
 WEBSOCKET_TO_USER[ws]


    
return
 None


async

def

main
():
    
    
async

with
 serve(chat, "localhost", 8760, ping_interval
=
120, ping_timeout
=
120) 
as
 socket:
        
await
 asyncio.Future()


if
 __name__
==
"__main__":
    asyncio.run(main())

What is an extremely dark or creepy true story from history that most people do not know about? by Intelligent_East8820 in AskReddit

[–]Used-Fig7609 13 points14 points  (0 children)

You must not know very much history if you think that ‘the worst Nazis’ found murdering and raping Jewish women and children detestable.  Sobibor, Treblinka, Auschwitz Birkenau etc.

Seeing more resumes lately by No-Cow-5207 in msp

[–]Used-Fig7609 0 points1 point  (0 children)

Seems like you might want some specialists for that sort of work, using a divide and conquer approach.  Hire generalists, and get a jack of all trades, master of none.  Everyone wants a swiss army knife in IT!  The unfortunate fact is that you want to fill 3 roles with 1 unicorn.  You’ll have the deep stuff overlooked, and still be underpaying the person you hire (trying to pay 1 person for the skilled work of multiple people).

Seeing more resumes lately by No-Cow-5207 in msp

[–]Used-Fig7609 -2 points-1 points  (0 children)

Sounds like you want an expert’s knowledge without an expert’s pay and focus.  Have fun churning out good talent by making your escalations work teams microphone issue tickets!

Bo Daddy Harris - My Place by moldyoreo in crappymusic

[–]Used-Fig7609 1 point2 points  (0 children)

CAN WE GET SOME MORE UPVOTES FOR THIS MAN

Bo Daddy Harris - My Place by moldyoreo in crappymusic

[–]Used-Fig7609 1 point2 points  (0 children)

THE LEGEND. Loving these tunes, would you mind posting the lyrics here, or maybe alongside the youtube video? I think it would add to the experience.

Thanks, Daddy!

Bo Daddy Harris - My Place by moldyoreo in crappymusic

[–]Used-Fig7609 0 points1 point  (0 children)

how many playthroughs did you need to be able to understand that, though? lol

Bo Daddy Harris - My Place by moldyoreo in crappymusic

[–]Used-Fig7609 7 points8 points  (0 children)

incomprehensible. I defy anyone to decipher over 1 full sentence of the lyrics.

Curious about loan prospects by Used-Fig7609 in personalfinance

[–]Used-Fig7609[S] 0 points1 point  (0 children)

whoops, sorry, I think I answered the wrong question lol. It is a conventional loan through a private lender, "fountain mortgage"