How to use get_full_type_name method in refurb

Best Python code snippet using refurb_python

idadex.py

Source:idadex.py Github

copy

Full Screen

...268 else:269 start += 1270 return deco[start:].replace('<', '_').replace('>', '_')271 @staticmethod272 def get_full_type_name(longname):273 if not longname:274 return "unknown"275 return Dex.decorate_java_typename(longname)276 #---------------------------------------------------------------------------277 def get_short_method_name(self, method):278 res = Dex.get_short_type_name(self.get_type_string(method.cname))279 res += '.'280 res += self.get_method_name(method.id)281 res += '@'282 res += self.get_string(method.proto_shorty)283 return res284 def get_full_method_name(self, method):285 res = Dex.get_full_type_name(self.get_type_string(method.proto_ret))286 res += ' '287 res += self.get_full_type_name(self.get_type_string(method.cname))288 res += '.'289 res += self.get_method_name(method.id)290 def get_call_method_name(self, method):291 shorty = self.get_string(method.proto_shorty)292 res = Dex._primitive_type_label(shorty[0])293 res += ' '294 res += Dex.get_short_type_name(self.get_type_string(method.cname))295 res += '.'296 res += self.get_method_name(method.id)297 res += '('298 last_idx = len(shorty) - 1299 for s in range(1, last_idx + 1):300 res += Dex._primitive_type_label(shorty[s])301 if s != last_idx:302 res += ", "303 res += ')'304 return res305 def get_field(self, method_idx):306 val = self.nn_fieldtab.supval(method_idx, Dex.FIELDTAB_DESCR)307 if len(val) != ctypes.sizeof(dex_field):308 print "bad data in FIELDTAB_DESCR for index 0x%X" % method_idx309 return None310 field = get_struct(val,0, dex_field)311 return field312 #---------------------------------------------------------------------------313 def get_full_field_name(self, field_idx, field, field_name):314 res = Dex.get_full_type_name(self.get_type_string(field.type))315 res += ' '316 res += Dex.get_full_type_name(self.get_type_string(field_idx))317 res += '.'318 res += field_name if field_name else self.get_field_name(field_idx)319 return res320 #---------------------------------------------------------------------------321 def get_short_field_name(self, field_idx, field, field_name):322 res = Dex.get_short_type_name(self.get_type_string(field.ctype))323 res += '_'324 res += field_name if field_name else self.get_field_name(field_idx)325#---------------------------------------------------------------------------326if __name__ == '__main__':327 dex = Dex()328 # reproduce IDA function header329 f = idaapi.get_func(here())330 if not f:331 print "ERROR: must be in a function!"332 exit(1)333 func_start_ea = f.start_ea334 methno = dex.get_method_idx(func_start_ea)335 func_method = dex.get_method(methno)336 if func_method is None:337 print "ERROR: Missing method info"338 exit(1)339 out = ""340 # Return type341 out += Dex.access_string(func_method.access_flags) + " "342 method_proto = dex.get_type_string(func_method.proto_ret)343 if method_proto:344 out += Dex.get_full_type_name(method_proto)345 else:346 out += "%x" % func_method.proto_ret347 out += ' '348 # Class name349 method_classnm = dex.get_type_string(func_method.cname)350 if method_classnm:351 out += Dex.get_full_type_name(method_classnm)352 else:353 out += "%x" % func_method.cname354 out += '.'355 # Method name356 method_name = dex.get_method_name(methno)357 if method_name:358 out += method_name359 else:360 out += "%x" % methno361 # Method parameters362 if func_method.nparams == 0:363 print out + "()"364 else:365 print out + "("366 out = ""367 maxp = min(func_method.nparams, 32)368 start_reg = func_method.reg_total - func_method.reg_params369 if func_method.access_flags & Dex.ACCESS_FLAGS["static"] == 0:370 start_reg += 1371 for i in range(0, maxp):372 ptype = dex.get_type_string(func_method.proto_params[i])373 out = " %s " % dex.get_full_type_name(ptype)374 regbuf = "v%u" % start_reg375 start_reg += 1376 r = idaapi.find_regvar(f, f.start_ea, regbuf)377 if r is None:378 out += regbuf379 if Dex.is_wide_type(ptype):380 out += ':'381 regbuf = "v%u" % start_reg382 start_reg += 1383 else:384 out += r.user385 out += ')' if i + 1 == maxp else ','...

Full Screen

Full Screen

sheets.py

Source:sheets.py Github

copy

Full Screen

1import pandas as pd2def get_full_type_name(sheet_name):3 """[由於每個會期之評鑑種類名稱皆不同,透過此函式統一轉化評鑑種類名稱為 xx 委員會格式]4 Arguments:5 sheet_name {[string]} -- [評鑑種類]6 Returns:7 [string] -- [內政委員會 等評鑑種類名稱]8 """9 rate_types = ["內政委員會", "外交及國防委員會", "經濟委員會", "財政委員會", "交通委員會", "司法及法制委員會", "教育及文化委員會", "社會福利及衛生環境委員會"]10 if "委員會" in sheet_name:11 return sheet_name12 for rate_type in rate_types:13 # sheet_name = '教育文化' return '教育及文化委員會'14 if sheet_name[-2:] in rate_type:15 return rate_type16 break17 else:18 # sheet_name = '社福衛環' return '社會福利及衛生環境委員會'19 return rate_types[-1]20def get_sheets(session):21 """[取得該會期所有評鑑表格, e.g. 內政, 外交國防...]22 Arguments:23 session {[int]} -- [第幾會期]24 Returns:25 [dict] -- [回傳依據評鑑種類分類之評鑑 DataFrame]26 """27 xl = pd.ExcelFile(f"../../data/raw/citizen_congress_watch/9-{session}.xlsx")28 sheet_names = xl.sheet_names[1:9] if "說明" in xl.sheet_names[0] else xl.sheet_names[0:8] # see all sheet names29 # print(sheet_names)30 df_dict = {}31 for sheet_name in sheet_names:32 rate_type = get_full_type_name(sheet_name)33 df = xl.parse(sheet_name)34 df = df.dropna(how="all")35 df_dict[rate_type] = df...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run refurb automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful