cythonevparser


Namecythonevparser JSON
Version 0.15 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/cythonevparser
Summaryeventparser parser for Android
upload_time2024-09-13 05:08:46
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords uiautomator events
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# eventparser parser for Android

### Tested against Windows 10 / Python 3.11 / Anaconda / BlueStacks

### pip install cythonevparser

### Cython and a C compiler must be installed!

```PY
import time
import re as regexpython
import regex as re
from cythonevparser import clean_cache, create_temp_memdisk, EvParse
from cythondfprint import add_printer
import pandas as pd
from exceptdrucker import errwrite
import shutil
import os

import subprocess

add_printer(1)



def sendcmd(openshell, inputcmd, shell=True, timeout=10):
    try:
        p = subprocess.run(
            openshell,
            input=inputcmd if isinstance(inputcmd, bytes) else inputcmd.encode(),
            shell=shell,
            env=os.environ,
            cwd=os.getcwd(),
            capture_output=True,
            timeout=10,
        )
        return p.stdout, p.stderr, p.returncode
    except Exception as e:
        print(e)
    return None, None, None


def iskeyboardshown():
    try:
        stdout, stderr, returncode = sendcmd(
            openshell, keyboard_shown, shell=False, timeout=10
        )
        print(stdout, stderr, returncode)
        if b"mVisibleBound=true" in stdout and b"mInputShown=true" in stdout:
            return True
        return False
    except Exception as fe:
        errwrite()
    return False



clean_cache()
adb_exe = shutil.which("adb")
device_serial = "127.0.0.1:5560"
elements2check_regex = regexpython.compile(
    r"(?:(?:StateListAnimatorButton)|(?:p\.ral)|(?:android\.widget\.NumberPicker\$CustomEditText)|(?:AppCompatCheckBox))"
)
elements2check_min_area = 0.0001
elements2check_max_area = 50
sleep_after_each_dataframe = 0.1
screen_width = 720
screen_height = 1280

keyboard_shown = b'dumpsys input_method | grep -E "mInputShown|mVisibleBound"'
openshell = [
    adb_exe,
    "-s",
    device_serial,
    "shell",
]
create_temp_memdisk(
    memdisk_path="/media/ramdisk",
    adb_path=adb_exe,
    device_serial=device_serial,
    memdisk_size="128M",
    shell=False,
    su_exe="su",
)
evp = EvParse(
    adb_exe=adb_exe,
    device_serial=device_serial,
    field_size=50,
    record_count=50,
    sleep_between_each_scan=0.001,
    regex_nogil=True,
    device_shell="shell",
    uiautomator_cmd=b"uiautomator events",
    sleep_after_starting_thread=5,
    thread_daemon=True,
    uiautomator_kill_cmd=b"pkill uiautomator",
    timeout_scan=0.1,
    screen_width=screen_width,
    screen_height=screen_height,
    subproc_shell=False,
    with_children=False,
    add_screenshot=False,
    screenshot_kwargs=None,
    input_tap_center_x="aa_center_x",
    input_tap_center_y="aa_center_y",
    input_tap_input_cmd="input touchscreen tap",
    input_tap_kwargs=None,
    sendevent_mouse_move_start_x="aa_start_x",
    sendevent_mouse_move_start_y="aa_start_y",
    sendevent_mouse_move_end_x="aa_end_x",
    sendevent_mouse_move_end_y="aa_end_y",
    sendevent_mouse_move_y_max=65535,
    sendevent_mouse_move_x_max=65535,
    sendevent_mouse_move_inputdev="/dev/input/event5",
    sendevent_mouse_move_add=True,
    sendevent_mouse_move_kwargs=None,
    sendevent_mouse_move_su_exe="su",
    sendevent_mouse_move_sh_device="sh",
    sendevent_mouse_move_cwd_on_device="/media/ramdisk",
    sendevent_mouse_move_qty_blocks=4 * 24,
    debug=True,
    limited_mouse_move=True,
    scroll_x_begin_center_offset=30,
    scroll_y_begin_center_offset=30,
    scroll_x_end_center_offset=30,
    scroll_y_end_center_offset=30,
    add_move_and_tap=True,
)
callback_function_kwargs = {}
callback_function_kwargs["regex_to_check"] = rb"\bcom\..*"
callback_function_kwargs["regex_flags"] = re.IGNORECASE
evp.kill_ui_automator(["sh"])
time.sleep(5)
allresultdata = []

# b'[Inscreva-se gr\xc3\xa1tis]'
foundall = False
goodresults = []
result = evp.start_event_parser(
    callback_function=evp.callback_function,
    max_timeout=0.1,
    callback_function_kwargs=callback_function_kwargs,
    sleep_between_each_scan=0.01,
    print_elements=False,
)
myemail = "mariadanada@maya.com"
mypassword = "bonadnxa!Dx71"
evp.data_array[:] = b""
screenshotfolder = r"C:\savedshots"
df = pd.DataFrame()
rotcount = 0
emailput = False
killfirst = False
F = set()
# collected_frames = []
# last_resultstmp = []
while not foundall:
    try:
        time.sleep(2)
        dfx = evp.parse_elements_dataframe(with_children=True, with_windows=True)
        # collected_frames.append(dfx)
        evp.last_results.clear()
        for name, group in (
            dfx.loc[
                (dfx.aa_area > 0)
                & (dfx.aa_area_percentage < 50)
                & (dfx.aa_all_my_children.str.len() < 2)
                & (~dfx.aa_pflag_invalidated.str.contains("I", regex=False, na=False))
                & dfx.aa_enabled.str.contains("E", regex=False, na=False)
                & (~dfx.aa_visibility.str.contains("I", regex=False, na=False))
                & (dfx.aa_pflag_dirty_mask.str.contains(".", regex=False, na=False))
                & (
                    dfx.aa_clickable.str.contains("C", regex=False, na=False)
                    | (dfx.bb_misc_clickable.fillna(False))
                )
                & (dfx.aa_start_y > 0)
                & (dfx.aa_end_y < screen_height)
                & (
                    ~dfx.aa_classname.str.contains(
                        "StateListAnimatorImageButton", regex=False, na=False
                    )
                )
            ]
            .sort_values(by=["aa_end_x"], ascending=True)
            .groupby(
                [
                    "aa_original_string",
                    "aa_start_x",
                    "aa_start_y",
                    "aa_center_x",
                    "aa_center_y",
                ]
            )
        ):
            item = group.iloc[0]
            goodresults.clear()
            evp.starttime.clear()
            item.aa_mouse_move()
            evp.starttime.append(time.time())
            result = evp.start_event_parser(
                callback_function=evp.callback_function,
                max_timeout=0.1,
                callback_function_kwargs=callback_function_kwargs,
                sleep_between_each_scan=0.05,
                print_elements=False,
            )
            if evp.last_results:
                # last_resultstmp.append(evp.last_results)
                fra = item.to_frame().T
                dfi = pd.DataFrame(evp.last_results, dtype="object")
                goodresults.append(
                    pd.concat(
                        [
                            fra.loc[fra.index.repeat(len(dfi))].reset_index(drop=True),
                            dfi.rename(
                                columns={k: f"cc_{k}" for k in dfi.columns}
                            ).reset_index(drop=True),
                        ],
                        axis=1,
                    ).assign(dd_routcounter=rotcount, dd_matchcounter=range(len(dfi)))
                )
                rotcount += 1
                evp.last_results.clear()
            else:
                continue
            df = pd.concat(goodresults, ignore_index=True)
            df.ds_color_print_all()
            goodresults.clear()
            if F == {0, 1, 2, 3, 4, 5, 6, 7, 8}:
                F.clear()
                foundall = True
                break
            if F == {0, 1, 2, 3, 4, 5, 6, 7}:
                try:
                    agreee = dfx.loc[
                        dfx.aa_element_id.str.contains("agree")
                    ].drop_duplicates(subset="aa_center_y")
                    if not agreee.empty:
                        for k, i in agreee.iterrows():
                            i.aa_move_and_tap(0.001)
                        F.add(8)
                        break
                except Exception:
                    errwrite()
            if F == {0, 1, 2, 3, 4, 5, 6}:
                try:
                    gender_button = df.loc[
                        ((df.cc_Text == b"[Masculino]") | (df.cc_Text == b"[Feminino]"))
                        & df.aa_element_id.str.contains("gender_button")
                    ]
                    if not gender_button.empty:
                        gender_button.iloc[0].aa_mouse_move()
                        gender_button.iloc[0].aa_input_tap()
                        F.add(7)
                        break
                except Exception:
                    errwrite()
            if F == {0, 1, 2, 3, 4, 5}:
                try:
                    avancarbutton1 = df.loc[
                        (df.aa_element_id.str.contains("next", regex=False, na=False))
                        & (df.cc_Text == b"[Avan\xc3\xa7ar]")
                        & (df.cc_ClassName == b"android.widget.Button")
                    ]
                    if not avancarbutton1.empty:
                        avancarbutton2 = avancarbutton1.sort_values(
                            by=["dd_matchcounter", "aa_start_y"],
                        )
                        avancarbutton2.iloc[0].aa_move_and_tap(0.001)
                        F.add(6)
                        break
                except Exception:
                    errwrite()
            if F == {0, 1, 2, 3, 4}:
                try:
                    numpick = (
                        dfx.loc[
                            (
                                dfx.aa_element_id.str.contains(
                                    r"id/(?:(?:year)|(?:month)|(?:day))\s*$",
                                    regex=True,
                                    na=False,
                                )
                            )
                        ]
                        .drop_duplicates(
                            subset=[
                                "aa_element_id",
                            ]
                        )
                        .sort_values(by=["aa_element_id"], ascending=False)
                    )
                    if not numpick.empty:
                        dada = ["01", "m", "1987"][::-1]
                        indi = 0

                        for k, i in numpick.iterrows():
                            try:
                                i.aa_move_and_tap(0.001)
                                texttosend = dada[indi]
                                time.sleep(0.2)
                                sendcmd(
                                    openshell,
                                    inputcmd=f"input text '{texttosend}'",
                                    shell=False,
                                    timeout=10,
                                )
                                time.sleep(0.2)
                                indi += 1
                            except Exception:
                                errwrite()
                        evp.last_results.clear()
                        time.sleep(0.5)
                        for k, i in numpick.iterrows():
                            i.aa_move_and_tap(0.001)
                            break
                        evp.starttime.append(time.time())
                        result = evp.start_event_parser(
                            callback_function=evp.callback_function,
                            max_timeout=0.1,
                            callback_function_kwargs=callback_function_kwargs,
                            sleep_between_each_scan=0.05,
                            print_elements=True,
                        )
                        yearbin = dada[0].encode()
                        for r in evp.last_results:
                            try:
                                if yearbin in r["Text"]:
                                    break
                            except Exception:
                                errwrite()
                        else:
                            break
                        F.add(5)
                        break
                except Exception:
                    errwrite()
            if F == {0, 1, 2, 3}:
                try:
                    avancarbutton1 = df.loc[
                        (df.cc_Text == b"[Avan\xc3\xa7ar]")
                        & (df.cc_ClassName == b"android.widget.Button")
                        & (df.aa_element_id.str.contains("next", regex=False, na=False))
                    ]
                    if not avancarbutton1.empty:
                        avancarbutton2 = avancarbutton1.sort_values(
                            by=["dd_matchcounter", "aa_start_y"],
                        )
                        avancarbutton2.iloc[0].aa_move_and_tap(0.001)
                        F.add(4)
                        break
                except Exception:
                    errwrite()
            if F == {0, 1, 2}:
                try:
                    textfield1 = df.loc[
                        (df.cc_Text == b"[]")
                        & (df.cc_ClassName == b"android.widget.EditText")
                        & (df.aa_element_id.str.contains("aid=", regex=False, na=False))
                    ]
                    if not textfield1.empty:
                        textfield2 = textfield1.sort_values(
                            by=["dd_matchcounter", "aa_start_y"],
                        )
                        textfield2.iloc[0].aa_move_and_tap(0.001)
                        sendcmd(
                            openshell,
                            inputcmd=f"input text '{mypassword}'",
                            shell=False,
                            timeout=10,
                        )
                        F.add(3)
                        break
                except Exception:
                    errwrite()
            if F == {0, 1}:
                try:
                    avancarbutton1 = df.loc[
                        (df.cc_Text == b"[Avan\xc3\xa7ar]")
                        & (df.cc_ClassName == b"android.widget.Button")
                        & (df.aa_element_id.str.contains("next", regex=False, na=False))
                    ]
                    if not avancarbutton1.empty:
                        avancarbutton2 = avancarbutton1.sort_values(
                            by=["dd_matchcounter", "aa_start_y"],
                        )
                        avancarbutton2.iloc[0].aa_move_and_tap(0.001)
                        F.add(2)
                        break
                except Exception:
                    errwrite()
            if F == {0}:
                try:
                    textfield1 = df.loc[
                        (df.cc_Text == b"[]")
                        & (df.cc_ClassName == b"android.widget.EditText")
                        & (df.aa_element_id.str.contains("aid=", regex=False, na=False))
                    ]
                    if not textfield1.empty:
                        textfield2 = textfield1.sort_values(
                            by=["dd_matchcounter", "aa_start_y"],
                        )
                        textfield2.iloc[0].aa_move_and_tap()
                        sendcmd(
                            openshell,
                            inputcmd=f"input text '{myemail}'",
                            shell=False,
                            timeout=10,
                        )
                        F.add(1)
                        break
                except Exception:
                    errwrite()
            if F == set():
                try:
                    withrighttext = df.loc[
                        (
                            df.cc_Text.apply(
                                lambda x: b"[Inscreva-se gr\xc3\xa1tis]" in x
                            )
                        )
                        & df.aa_classname.str.contains(
                            "StateListAnimatorButton", regex=False, na=False
                        )
                        & df.cc_ClassName.apply(lambda x: b"android.widget.Button" in x)
                        & (
                            df.aa_element_id.str.contains(
                                r"^\s*$", regex=True, na=False
                            )
                        )
                    ]
                    if not withrighttext.empty:
                        withrighttext2 = withrighttext.sort_values(
                            by=["aa_start_y", "dd_matchcounter"],
                        )
                        withrighttext2.iloc[0].aa_move_and_tap(0.001)
                        F.add(0)
                        break
                except Exception:
                    errwrite()
    except Exception as fe:
        errwrite()
    except KeyboardInterrupt:
        break

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/cythonevparser",
    "name": "cythonevparser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "uiautomator, events",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ca/77/9ec1ed25b2a034630f1ba8971b6bb6551501e606560583fe60416f52a0cc/cythonevparser-0.15.tar.gz",
    "platform": null,
    "description": "\r\n# eventparser parser for Android\r\n\r\n### Tested against Windows 10 / Python 3.11 / Anaconda / BlueStacks\r\n\r\n### pip install cythonevparser\r\n\r\n### Cython and a C compiler must be installed!\r\n\r\n```PY\r\nimport time\r\nimport re as regexpython\r\nimport regex as re\r\nfrom cythonevparser import clean_cache, create_temp_memdisk, EvParse\r\nfrom cythondfprint import add_printer\r\nimport pandas as pd\r\nfrom exceptdrucker import errwrite\r\nimport shutil\r\nimport os\r\n\r\nimport subprocess\r\n\r\nadd_printer(1)\r\n\r\n\r\n\r\ndef sendcmd(openshell, inputcmd, shell=True, timeout=10):\r\n    try:\r\n        p = subprocess.run(\r\n            openshell,\r\n            input=inputcmd if isinstance(inputcmd, bytes) else inputcmd.encode(),\r\n            shell=shell,\r\n            env=os.environ,\r\n            cwd=os.getcwd(),\r\n            capture_output=True,\r\n            timeout=10,\r\n        )\r\n        return p.stdout, p.stderr, p.returncode\r\n    except Exception as e:\r\n        print(e)\r\n    return None, None, None\r\n\r\n\r\ndef iskeyboardshown():\r\n    try:\r\n        stdout, stderr, returncode = sendcmd(\r\n            openshell, keyboard_shown, shell=False, timeout=10\r\n        )\r\n        print(stdout, stderr, returncode)\r\n        if b\"mVisibleBound=true\" in stdout and b\"mInputShown=true\" in stdout:\r\n            return True\r\n        return False\r\n    except Exception as fe:\r\n        errwrite()\r\n    return False\r\n\r\n\r\n\r\nclean_cache()\r\nadb_exe = shutil.which(\"adb\")\r\ndevice_serial = \"127.0.0.1:5560\"\r\nelements2check_regex = regexpython.compile(\r\n    r\"(?:(?:StateListAnimatorButton)|(?:p\\.ral)|(?:android\\.widget\\.NumberPicker\\$CustomEditText)|(?:AppCompatCheckBox))\"\r\n)\r\nelements2check_min_area = 0.0001\r\nelements2check_max_area = 50\r\nsleep_after_each_dataframe = 0.1\r\nscreen_width = 720\r\nscreen_height = 1280\r\n\r\nkeyboard_shown = b'dumpsys input_method | grep -E \"mInputShown|mVisibleBound\"'\r\nopenshell = [\r\n    adb_exe,\r\n    \"-s\",\r\n    device_serial,\r\n    \"shell\",\r\n]\r\ncreate_temp_memdisk(\r\n    memdisk_path=\"/media/ramdisk\",\r\n    adb_path=adb_exe,\r\n    device_serial=device_serial,\r\n    memdisk_size=\"128M\",\r\n    shell=False,\r\n    su_exe=\"su\",\r\n)\r\nevp = EvParse(\r\n    adb_exe=adb_exe,\r\n    device_serial=device_serial,\r\n    field_size=50,\r\n    record_count=50,\r\n    sleep_between_each_scan=0.001,\r\n    regex_nogil=True,\r\n    device_shell=\"shell\",\r\n    uiautomator_cmd=b\"uiautomator events\",\r\n    sleep_after_starting_thread=5,\r\n    thread_daemon=True,\r\n    uiautomator_kill_cmd=b\"pkill uiautomator\",\r\n    timeout_scan=0.1,\r\n    screen_width=screen_width,\r\n    screen_height=screen_height,\r\n    subproc_shell=False,\r\n    with_children=False,\r\n    add_screenshot=False,\r\n    screenshot_kwargs=None,\r\n    input_tap_center_x=\"aa_center_x\",\r\n    input_tap_center_y=\"aa_center_y\",\r\n    input_tap_input_cmd=\"input touchscreen tap\",\r\n    input_tap_kwargs=None,\r\n    sendevent_mouse_move_start_x=\"aa_start_x\",\r\n    sendevent_mouse_move_start_y=\"aa_start_y\",\r\n    sendevent_mouse_move_end_x=\"aa_end_x\",\r\n    sendevent_mouse_move_end_y=\"aa_end_y\",\r\n    sendevent_mouse_move_y_max=65535,\r\n    sendevent_mouse_move_x_max=65535,\r\n    sendevent_mouse_move_inputdev=\"/dev/input/event5\",\r\n    sendevent_mouse_move_add=True,\r\n    sendevent_mouse_move_kwargs=None,\r\n    sendevent_mouse_move_su_exe=\"su\",\r\n    sendevent_mouse_move_sh_device=\"sh\",\r\n    sendevent_mouse_move_cwd_on_device=\"/media/ramdisk\",\r\n    sendevent_mouse_move_qty_blocks=4 * 24,\r\n    debug=True,\r\n    limited_mouse_move=True,\r\n    scroll_x_begin_center_offset=30,\r\n    scroll_y_begin_center_offset=30,\r\n    scroll_x_end_center_offset=30,\r\n    scroll_y_end_center_offset=30,\r\n    add_move_and_tap=True,\r\n)\r\ncallback_function_kwargs = {}\r\ncallback_function_kwargs[\"regex_to_check\"] = rb\"\\bcom\\..*\"\r\ncallback_function_kwargs[\"regex_flags\"] = re.IGNORECASE\r\nevp.kill_ui_automator([\"sh\"])\r\ntime.sleep(5)\r\nallresultdata = []\r\n\r\n# b'[Inscreva-se gr\\xc3\\xa1tis]'\r\nfoundall = False\r\ngoodresults = []\r\nresult = evp.start_event_parser(\r\n    callback_function=evp.callback_function,\r\n    max_timeout=0.1,\r\n    callback_function_kwargs=callback_function_kwargs,\r\n    sleep_between_each_scan=0.01,\r\n    print_elements=False,\r\n)\r\nmyemail = \"mariadanada@maya.com\"\r\nmypassword = \"bonadnxa!Dx71\"\r\nevp.data_array[:] = b\"\"\r\nscreenshotfolder = r\"C:\\savedshots\"\r\ndf = pd.DataFrame()\r\nrotcount = 0\r\nemailput = False\r\nkillfirst = False\r\nF = set()\r\n# collected_frames = []\r\n# last_resultstmp = []\r\nwhile not foundall:\r\n    try:\r\n        time.sleep(2)\r\n        dfx = evp.parse_elements_dataframe(with_children=True, with_windows=True)\r\n        # collected_frames.append(dfx)\r\n        evp.last_results.clear()\r\n        for name, group in (\r\n            dfx.loc[\r\n                (dfx.aa_area > 0)\r\n                & (dfx.aa_area_percentage < 50)\r\n                & (dfx.aa_all_my_children.str.len() < 2)\r\n                & (~dfx.aa_pflag_invalidated.str.contains(\"I\", regex=False, na=False))\r\n                & dfx.aa_enabled.str.contains(\"E\", regex=False, na=False)\r\n                & (~dfx.aa_visibility.str.contains(\"I\", regex=False, na=False))\r\n                & (dfx.aa_pflag_dirty_mask.str.contains(\".\", regex=False, na=False))\r\n                & (\r\n                    dfx.aa_clickable.str.contains(\"C\", regex=False, na=False)\r\n                    | (dfx.bb_misc_clickable.fillna(False))\r\n                )\r\n                & (dfx.aa_start_y > 0)\r\n                & (dfx.aa_end_y < screen_height)\r\n                & (\r\n                    ~dfx.aa_classname.str.contains(\r\n                        \"StateListAnimatorImageButton\", regex=False, na=False\r\n                    )\r\n                )\r\n            ]\r\n            .sort_values(by=[\"aa_end_x\"], ascending=True)\r\n            .groupby(\r\n                [\r\n                    \"aa_original_string\",\r\n                    \"aa_start_x\",\r\n                    \"aa_start_y\",\r\n                    \"aa_center_x\",\r\n                    \"aa_center_y\",\r\n                ]\r\n            )\r\n        ):\r\n            item = group.iloc[0]\r\n            goodresults.clear()\r\n            evp.starttime.clear()\r\n            item.aa_mouse_move()\r\n            evp.starttime.append(time.time())\r\n            result = evp.start_event_parser(\r\n                callback_function=evp.callback_function,\r\n                max_timeout=0.1,\r\n                callback_function_kwargs=callback_function_kwargs,\r\n                sleep_between_each_scan=0.05,\r\n                print_elements=False,\r\n            )\r\n            if evp.last_results:\r\n                # last_resultstmp.append(evp.last_results)\r\n                fra = item.to_frame().T\r\n                dfi = pd.DataFrame(evp.last_results, dtype=\"object\")\r\n                goodresults.append(\r\n                    pd.concat(\r\n                        [\r\n                            fra.loc[fra.index.repeat(len(dfi))].reset_index(drop=True),\r\n                            dfi.rename(\r\n                                columns={k: f\"cc_{k}\" for k in dfi.columns}\r\n                            ).reset_index(drop=True),\r\n                        ],\r\n                        axis=1,\r\n                    ).assign(dd_routcounter=rotcount, dd_matchcounter=range(len(dfi)))\r\n                )\r\n                rotcount += 1\r\n                evp.last_results.clear()\r\n            else:\r\n                continue\r\n            df = pd.concat(goodresults, ignore_index=True)\r\n            df.ds_color_print_all()\r\n            goodresults.clear()\r\n            if F == {0, 1, 2, 3, 4, 5, 6, 7, 8}:\r\n                F.clear()\r\n                foundall = True\r\n                break\r\n            if F == {0, 1, 2, 3, 4, 5, 6, 7}:\r\n                try:\r\n                    agreee = dfx.loc[\r\n                        dfx.aa_element_id.str.contains(\"agree\")\r\n                    ].drop_duplicates(subset=\"aa_center_y\")\r\n                    if not agreee.empty:\r\n                        for k, i in agreee.iterrows():\r\n                            i.aa_move_and_tap(0.001)\r\n                        F.add(8)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == {0, 1, 2, 3, 4, 5, 6}:\r\n                try:\r\n                    gender_button = df.loc[\r\n                        ((df.cc_Text == b\"[Masculino]\") | (df.cc_Text == b\"[Feminino]\"))\r\n                        & df.aa_element_id.str.contains(\"gender_button\")\r\n                    ]\r\n                    if not gender_button.empty:\r\n                        gender_button.iloc[0].aa_mouse_move()\r\n                        gender_button.iloc[0].aa_input_tap()\r\n                        F.add(7)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == {0, 1, 2, 3, 4, 5}:\r\n                try:\r\n                    avancarbutton1 = df.loc[\r\n                        (df.aa_element_id.str.contains(\"next\", regex=False, na=False))\r\n                        & (df.cc_Text == b\"[Avan\\xc3\\xa7ar]\")\r\n                        & (df.cc_ClassName == b\"android.widget.Button\")\r\n                    ]\r\n                    if not avancarbutton1.empty:\r\n                        avancarbutton2 = avancarbutton1.sort_values(\r\n                            by=[\"dd_matchcounter\", \"aa_start_y\"],\r\n                        )\r\n                        avancarbutton2.iloc[0].aa_move_and_tap(0.001)\r\n                        F.add(6)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == {0, 1, 2, 3, 4}:\r\n                try:\r\n                    numpick = (\r\n                        dfx.loc[\r\n                            (\r\n                                dfx.aa_element_id.str.contains(\r\n                                    r\"id/(?:(?:year)|(?:month)|(?:day))\\s*$\",\r\n                                    regex=True,\r\n                                    na=False,\r\n                                )\r\n                            )\r\n                        ]\r\n                        .drop_duplicates(\r\n                            subset=[\r\n                                \"aa_element_id\",\r\n                            ]\r\n                        )\r\n                        .sort_values(by=[\"aa_element_id\"], ascending=False)\r\n                    )\r\n                    if not numpick.empty:\r\n                        dada = [\"01\", \"m\", \"1987\"][::-1]\r\n                        indi = 0\r\n\r\n                        for k, i in numpick.iterrows():\r\n                            try:\r\n                                i.aa_move_and_tap(0.001)\r\n                                texttosend = dada[indi]\r\n                                time.sleep(0.2)\r\n                                sendcmd(\r\n                                    openshell,\r\n                                    inputcmd=f\"input text '{texttosend}'\",\r\n                                    shell=False,\r\n                                    timeout=10,\r\n                                )\r\n                                time.sleep(0.2)\r\n                                indi += 1\r\n                            except Exception:\r\n                                errwrite()\r\n                        evp.last_results.clear()\r\n                        time.sleep(0.5)\r\n                        for k, i in numpick.iterrows():\r\n                            i.aa_move_and_tap(0.001)\r\n                            break\r\n                        evp.starttime.append(time.time())\r\n                        result = evp.start_event_parser(\r\n                            callback_function=evp.callback_function,\r\n                            max_timeout=0.1,\r\n                            callback_function_kwargs=callback_function_kwargs,\r\n                            sleep_between_each_scan=0.05,\r\n                            print_elements=True,\r\n                        )\r\n                        yearbin = dada[0].encode()\r\n                        for r in evp.last_results:\r\n                            try:\r\n                                if yearbin in r[\"Text\"]:\r\n                                    break\r\n                            except Exception:\r\n                                errwrite()\r\n                        else:\r\n                            break\r\n                        F.add(5)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == {0, 1, 2, 3}:\r\n                try:\r\n                    avancarbutton1 = df.loc[\r\n                        (df.cc_Text == b\"[Avan\\xc3\\xa7ar]\")\r\n                        & (df.cc_ClassName == b\"android.widget.Button\")\r\n                        & (df.aa_element_id.str.contains(\"next\", regex=False, na=False))\r\n                    ]\r\n                    if not avancarbutton1.empty:\r\n                        avancarbutton2 = avancarbutton1.sort_values(\r\n                            by=[\"dd_matchcounter\", \"aa_start_y\"],\r\n                        )\r\n                        avancarbutton2.iloc[0].aa_move_and_tap(0.001)\r\n                        F.add(4)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == {0, 1, 2}:\r\n                try:\r\n                    textfield1 = df.loc[\r\n                        (df.cc_Text == b\"[]\")\r\n                        & (df.cc_ClassName == b\"android.widget.EditText\")\r\n                        & (df.aa_element_id.str.contains(\"aid=\", regex=False, na=False))\r\n                    ]\r\n                    if not textfield1.empty:\r\n                        textfield2 = textfield1.sort_values(\r\n                            by=[\"dd_matchcounter\", \"aa_start_y\"],\r\n                        )\r\n                        textfield2.iloc[0].aa_move_and_tap(0.001)\r\n                        sendcmd(\r\n                            openshell,\r\n                            inputcmd=f\"input text '{mypassword}'\",\r\n                            shell=False,\r\n                            timeout=10,\r\n                        )\r\n                        F.add(3)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == {0, 1}:\r\n                try:\r\n                    avancarbutton1 = df.loc[\r\n                        (df.cc_Text == b\"[Avan\\xc3\\xa7ar]\")\r\n                        & (df.cc_ClassName == b\"android.widget.Button\")\r\n                        & (df.aa_element_id.str.contains(\"next\", regex=False, na=False))\r\n                    ]\r\n                    if not avancarbutton1.empty:\r\n                        avancarbutton2 = avancarbutton1.sort_values(\r\n                            by=[\"dd_matchcounter\", \"aa_start_y\"],\r\n                        )\r\n                        avancarbutton2.iloc[0].aa_move_and_tap(0.001)\r\n                        F.add(2)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == {0}:\r\n                try:\r\n                    textfield1 = df.loc[\r\n                        (df.cc_Text == b\"[]\")\r\n                        & (df.cc_ClassName == b\"android.widget.EditText\")\r\n                        & (df.aa_element_id.str.contains(\"aid=\", regex=False, na=False))\r\n                    ]\r\n                    if not textfield1.empty:\r\n                        textfield2 = textfield1.sort_values(\r\n                            by=[\"dd_matchcounter\", \"aa_start_y\"],\r\n                        )\r\n                        textfield2.iloc[0].aa_move_and_tap()\r\n                        sendcmd(\r\n                            openshell,\r\n                            inputcmd=f\"input text '{myemail}'\",\r\n                            shell=False,\r\n                            timeout=10,\r\n                        )\r\n                        F.add(1)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n            if F == set():\r\n                try:\r\n                    withrighttext = df.loc[\r\n                        (\r\n                            df.cc_Text.apply(\r\n                                lambda x: b\"[Inscreva-se gr\\xc3\\xa1tis]\" in x\r\n                            )\r\n                        )\r\n                        & df.aa_classname.str.contains(\r\n                            \"StateListAnimatorButton\", regex=False, na=False\r\n                        )\r\n                        & df.cc_ClassName.apply(lambda x: b\"android.widget.Button\" in x)\r\n                        & (\r\n                            df.aa_element_id.str.contains(\r\n                                r\"^\\s*$\", regex=True, na=False\r\n                            )\r\n                        )\r\n                    ]\r\n                    if not withrighttext.empty:\r\n                        withrighttext2 = withrighttext.sort_values(\r\n                            by=[\"aa_start_y\", \"dd_matchcounter\"],\r\n                        )\r\n                        withrighttext2.iloc[0].aa_move_and_tap(0.001)\r\n                        F.add(0)\r\n                        break\r\n                except Exception:\r\n                    errwrite()\r\n    except Exception as fe:\r\n        errwrite()\r\n    except KeyboardInterrupt:\r\n        break\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "eventparser parser for Android",
    "version": "0.15",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/cythonevparser"
    },
    "split_keywords": [
        "uiautomator",
        " events"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f78d8ff6c8eacebc09491848ca992f57b52f9b5194084e874ca58350f54c75ad",
                "md5": "c4b4598e69cdde0b8065b418616447a6",
                "sha256": "07281f99513e77331e8b912de5796bec8832533e51db90c5e8bbb2f0f021906a"
            },
            "downloads": -1,
            "filename": "cythonevparser-0.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c4b4598e69cdde0b8065b418616447a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 54502,
            "upload_time": "2024-09-13T05:08:45",
            "upload_time_iso_8601": "2024-09-13T05:08:45.192650Z",
            "url": "https://files.pythonhosted.org/packages/f7/8d/8ff6c8eacebc09491848ca992f57b52f9b5194084e874ca58350f54c75ad/cythonevparser-0.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca779ec1ed25b2a034630f1ba8971b6bb6551501e606560583fe60416f52a0cc",
                "md5": "07ee0e4e327f5ae8e86985b3f29a7e5d",
                "sha256": "21924ba95a264bbf68ed9de648877a694ea2806939fde455e9c28e20296eb0ef"
            },
            "downloads": -1,
            "filename": "cythonevparser-0.15.tar.gz",
            "has_sig": false,
            "md5_digest": "07ee0e4e327f5ae8e86985b3f29a7e5d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 55520,
            "upload_time": "2024-09-13T05:08:46",
            "upload_time_iso_8601": "2024-09-13T05:08:46.929497Z",
            "url": "https://files.pythonhosted.org/packages/ca/77/9ec1ed25b2a034630f1ba8971b6bb6551501e606560583fe60416f52a0cc/cythonevparser-0.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-13 05:08:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "cythonevparser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cythonevparser"
}
        
Elapsed time: 0.34086s