refactoring
This commit is contained in:
@@ -138,41 +138,34 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"import os\n",
|
"import os\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def startEmulator():\n",
|
"class Emulator:\n",
|
||||||
" os.system(\"/home/frankknoll/Android/Sdk/emulator/emulator -avd Pixel_2_API_30 -no-window &\")\n",
|
|
||||||
" \n",
|
" \n",
|
||||||
"def stopEmulator():\n",
|
" @staticmethod\n",
|
||||||
" ! adb emu kill"
|
" def runWithinEmulator(runnable):\n",
|
||||||
]
|
" Emulator._startEmulator()\n",
|
||||||
},
|
" result = runnable()\n",
|
||||||
{
|
" Emulator._stopEmulator()\n",
|
||||||
"cell_type": "code",
|
" return result\n",
|
||||||
"execution_count": null,
|
" \n",
|
||||||
"id": "fb3755a6",
|
" @staticmethod\n",
|
||||||
"metadata": {},
|
" def _startEmulator():\n",
|
||||||
"outputs": [],
|
" os.system(\"/home/frankknoll/Android/Sdk/emulator/emulator -avd Pixel_2_API_30 -no-window &\")\n",
|
||||||
"source": [
|
"\n",
|
||||||
"startEmulator()"
|
" @staticmethod\n",
|
||||||
|
" def _stopEmulator():\n",
|
||||||
|
" ! adb emu kill\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "c113e49d",
|
"id": "c113e49d",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"scrolled": false
|
||||||
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"textInImage = detectTextInImage(captchaImageFile)"
|
"textInImage = Emulator.runWithinEmulator(lambda: detectTextInImage(captchaImageFile))"
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "cdf3fbe1",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"stopEmulator()"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user