sia_tp_sample / Ape__samsungctl.jsonl
shahp7575's picture
commit files to HF hub
3a7f06a
{"nwo":"Ape\/samsungctl","sha":"81cf14aa138c32ff10aaa424864d6fc92b987322","path":"samsungctl\/remote_websocket.py","language":"python","identifier":"RemoteWebsocket.close","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Close the connection.","docstring_summary":"Close the connection.","docstring_tokens":["Close","the","connection","."],"function":"def close(self):\n \"\"\"Close the connection.\"\"\"\n if self.connection:\n self.connection.close()\n self.connection = None\n logging.debug(\"Connection closed.\")","function_tokens":["def","close","(","self",")",":","if","self",".","connection",":","self",".","connection",".","close","(",")","self",".","connection","=","None","logging",".","debug","(","\"Connection closed.\"",")"],"url":"https:\/\/github.com\/Ape\/samsungctl\/blob\/81cf14aa138c32ff10aaa424864d6fc92b987322\/samsungctl\/remote_websocket.py#L38-L43"}
{"nwo":"Ape\/samsungctl","sha":"81cf14aa138c32ff10aaa424864d6fc92b987322","path":"samsungctl\/remote_websocket.py","language":"python","identifier":"RemoteWebsocket.control","parameters":"(self, key)","argument_list":"","return_statement":"","docstring":"Send a control command.","docstring_summary":"Send a control command.","docstring_tokens":["Send","a","control","command","."],"function":"def control(self, key):\n \"\"\"Send a control command.\"\"\"\n if not self.connection:\n raise exceptions.ConnectionClosed()\n\n payload = json.dumps({\n \"method\": \"ms.remote.control\",\n \"params\": {\n \"Cmd\": \"Click\",\n \"DataOfCmd\": key,\n \"Option\": \"false\",\n \"TypeOfRemote\": \"SendRemoteKey\"\n }\n })\n\n logging.info(\"Sending control command: %s\", key)\n self.connection.send(payload)\n time.sleep(self._key_interval)","function_tokens":["def","control","(","self",",","key",")",":","if","not","self",".","connection",":","raise","exceptions",".","ConnectionClosed","(",")","payload","=","json",".","dumps","(","{","\"method\"",":","\"ms.remote.control\"",",","\"params\"",":","{","\"Cmd\"",":","\"Click\"",",","\"DataOfCmd\"",":","key",",","\"Option\"",":","\"false\"",",","\"TypeOfRemote\"",":","\"SendRemoteKey\"","}","}",")","logging",".","info","(","\"Sending control command: %s\"",",","key",")","self",".","connection",".","send","(","payload",")","time",".","sleep","(","self",".","_key_interval",")"],"url":"https:\/\/github.com\/Ape\/samsungctl\/blob\/81cf14aa138c32ff10aaa424864d6fc92b987322\/samsungctl\/remote_websocket.py#L45-L62"}
{"nwo":"Ape\/samsungctl","sha":"81cf14aa138c32ff10aaa424864d6fc92b987322","path":"samsungctl\/remote_legacy.py","language":"python","identifier":"RemoteLegacy.__init__","parameters":"(self, config)","argument_list":"","return_statement":"","docstring":"Make a new connection.","docstring_summary":"Make a new connection.","docstring_tokens":["Make","a","new","connection","."],"function":"def __init__(self, config):\n if not config[\"port\"]:\n config[\"port\"] = 55000\n\n \"\"\"Make a new connection.\"\"\"\n self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n if config[\"timeout\"]:\n self.connection.settimeout(config[\"timeout\"])\n\n self.connection.connect((config[\"host\"], config[\"port\"]))\n\n payload = b\"\\x64\\x00\" \\\n + self._serialize_string(config[\"description\"]) \\\n + self._serialize_string(config[\"id\"]) \\\n + self._serialize_string(config[\"name\"])\n packet = b\"\\x00\\x00\\x00\" + self._serialize_string(payload, True)\n\n logging.info(\"Sending handshake.\")\n self.connection.send(packet)\n self._read_response(True)","function_tokens":["def","__init__","(","self",",","config",")",":","if","not","config","[","\"port\"","]",":","config","[","\"port\"","]","=","55000","self",".","connection","=","socket",".","socket","(","socket",".","AF_INET",",","socket",".","SOCK_STREAM",")","if","config","[","\"timeout\"","]",":","self",".","connection",".","settimeout","(","config","[","\"timeout\"","]",")","self",".","connection",".","connect","(","(","config","[","\"host\"","]",",","config","[","\"port\"","]",")",")","payload","=","b\"\\x64\\x00\"","+","self",".","_serialize_string","(","config","[","\"description\"","]",")","+","self",".","_serialize_string","(","config","[","\"id\"","]",")","+","self",".","_serialize_string","(","config","[","\"name\"","]",")","packet","=","b\"\\x00\\x00\\x00\"","+","self",".","_serialize_string","(","payload",",","True",")","logging",".","info","(","\"Sending handshake.\"",")","self",".","connection",".","send","(","packet",")","self",".","_read_response","(","True",")"],"url":"https:\/\/github.com\/Ape\/samsungctl\/blob\/81cf14aa138c32ff10aaa424864d6fc92b987322\/samsungctl\/remote_legacy.py#L12-L32"}
{"nwo":"Ape\/samsungctl","sha":"81cf14aa138c32ff10aaa424864d6fc92b987322","path":"samsungctl\/remote_legacy.py","language":"python","identifier":"RemoteLegacy.close","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Close the connection.","docstring_summary":"Close the connection.","docstring_tokens":["Close","the","connection","."],"function":"def close(self):\n \"\"\"Close the connection.\"\"\"\n if self.connection:\n self.connection.close()\n self.connection = None\n logging.debug(\"Connection closed.\")","function_tokens":["def","close","(","self",")",":","if","self",".","connection",":","self",".","connection",".","close","(",")","self",".","connection","=","None","logging",".","debug","(","\"Connection closed.\"",")"],"url":"https:\/\/github.com\/Ape\/samsungctl\/blob\/81cf14aa138c32ff10aaa424864d6fc92b987322\/samsungctl\/remote_legacy.py#L40-L45"}
{"nwo":"Ape\/samsungctl","sha":"81cf14aa138c32ff10aaa424864d6fc92b987322","path":"samsungctl\/remote_legacy.py","language":"python","identifier":"RemoteLegacy.control","parameters":"(self, key)","argument_list":"","return_statement":"","docstring":"Send a control command.","docstring_summary":"Send a control command.","docstring_tokens":["Send","a","control","command","."],"function":"def control(self, key):\n \"\"\"Send a control command.\"\"\"\n if not self.connection:\n raise exceptions.ConnectionClosed()\n\n payload = b\"\\x00\\x00\\x00\" + self._serialize_string(key)\n packet = b\"\\x00\\x00\\x00\" + self._serialize_string(payload, True)\n\n logging.info(\"Sending control command: %s\", key)\n self.connection.send(packet)\n self._read_response()\n time.sleep(self._key_interval)","function_tokens":["def","control","(","self",",","key",")",":","if","not","self",".","connection",":","raise","exceptions",".","ConnectionClosed","(",")","payload","=","b\"\\x00\\x00\\x00\"","+","self",".","_serialize_string","(","key",")","packet","=","b\"\\x00\\x00\\x00\"","+","self",".","_serialize_string","(","payload",",","True",")","logging",".","info","(","\"Sending control command: %s\"",",","key",")","self",".","connection",".","send","(","packet",")","self",".","_read_response","(",")","time",".","sleep","(","self",".","_key_interval",")"],"url":"https:\/\/github.com\/Ape\/samsungctl\/blob\/81cf14aa138c32ff10aaa424864d6fc92b987322\/samsungctl\/remote_legacy.py#L47-L58"}
{"nwo":"Ape\/samsungctl","sha":"81cf14aa138c32ff10aaa424864d6fc92b987322","path":"samsungctl\/interactive.py","language":"python","identifier":"run","parameters":"(remote)","argument_list":"","return_statement":"","docstring":"Run interactive remote control application.","docstring_summary":"Run interactive remote control application.","docstring_tokens":["Run","interactive","remote","control","application","."],"function":"def run(remote):\n \"\"\"Run interactive remote control application.\"\"\"\n curses.wrapper(_control, remote)","function_tokens":["def","run","(","remote",")",":","curses",".","wrapper","(","_control",",","remote",")"],"url":"https:\/\/github.com\/Ape\/samsungctl\/blob\/81cf14aa138c32ff10aaa424864d6fc92b987322\/samsungctl\/interactive.py#L45-L47"}