File size: 2,152 Bytes
c7f4bd0 |
1 2 |
{"nwo":"AloneMonkey\/frida-ios-dump","sha":"56e99b2138fc213fa759b3aeb9717a1fb4ec6a59","path":"dump.py","language":"python","identifier":"cmp_to_key","parameters":"(mycmp)","argument_list":"","return_statement":"return K","docstring":"Convert a cmp= function into a key= function","docstring_summary":"Convert a cmp= function into a key= function","docstring_tokens":["Convert","a","cmp","=","function","into","a","key","=","function"],"function":"def cmp_to_key(mycmp):\n \"\"\"Convert a cmp= function into a key= function\"\"\"\n\n class K:\n def __init__(self, obj):\n self.obj = obj\n\n def __lt__(self, other):\n return mycmp(self.obj, other.obj) < 0\n\n def __gt__(self, other):\n return mycmp(self.obj, other.obj) > 0\n\n def __eq__(self, other):\n return mycmp(self.obj, other.obj) == 0\n\n def __le__(self, other):\n return mycmp(self.obj, other.obj) <= 0\n\n def __ge__(self, other):\n return mycmp(self.obj, other.obj) >= 0\n\n def __ne__(self, other):\n return mycmp(self.obj, other.obj) != 0\n\n return K","function_tokens":["def","cmp_to_key","(","mycmp",")",":","class","K",":","def","__init__","(","self",",","obj",")",":","self",".","obj","=","obj","def","__lt__","(","self",",","other",")",":","return","mycmp","(","self",".","obj",",","other",".","obj",")","<","0","def","__gt__","(","self",",","other",")",":","return","mycmp","(","self",".","obj",",","other",".","obj",")",">","0","def","__eq__","(","self",",","other",")",":","return","mycmp","(","self",".","obj",",","other",".","obj",")","==","0","def","__le__","(","self",",","other",")",":","return","mycmp","(","self",".","obj",",","other",".","obj",")","<=","0","def","__ge__","(","self",",","other",")",":","return","mycmp","(","self",".","obj",",","other",".","obj",")",">=","0","def","__ne__","(","self",",","other",")",":","return","mycmp","(","self",".","obj",",","other",".","obj",")","!=","0","return","K"],"url":"https:\/\/github.com\/AloneMonkey\/frida-ios-dump\/blob\/56e99b2138fc213fa759b3aeb9717a1fb4ec6a59\/dump.py#L169-L194"}
|