How to use build_imports method in refurb

Best Python code snippet using refurb_python

data.py

Source: data.py Github

copy

Full Screen

...71 self._parse_src()72 # build_data73 self.build_data = Hook.hook_build_data(self.build_data, self)74 # build_imports75 self.build_imports = Hook.hook_build_imports(self.build_imports, self)76 def copy4compile(self):77 """78 将需要编译的源文件复制到编译目录79 :return:80 """81 def _copy4compile(files: typing.List[str]):82 for file in files:83 file_c = file.replace(self.config.src_dir, self.config.compile_dir)84 if os.path.exists(file):85 # 复制源文件到编译目录86 utils.copy(file, file_c)87 elif os.path.basename(file) == '__init__.py':88 # 防止目录不存在89 utils.mkdir_p(os.path.dirname(file_c))...

Full Screen

Full Screen

binfile.py

Source: binfile.py Github

copy

Full Screen

...36logger = logging.getLogger('crimson-forge.binfile')37template_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data', 'templates'))38def __build_pe(pe_binary, build_imports=True):39 builder = lief.PE.Builder(pe_binary)40 builder.build_imports(build_imports)41 builder.build()42 return bytes(builder.get_build())43def _build_pe(pe_binary, shellcode):44 # build and add the .text section45 section_text = lief.PE.Section('.text')46 section_text.characteristics = 0x6000_002047 section_text.content = shellcode48 section_text.virtual_address = 0x100049 pe_binary.add_section(section_text)50 pe_binary.optional_header.addressof_entrypoint = section_text.virtual_address51 # add imports52 # todo: these imports should be user-configurable but default to sane profiles of legitimate functionality (i.e. file operations)53 kernel32 = pe_binary.add_library('kernel32.dll')54 kernel32.add_entry('CloseHandle')...

Full Screen

Full Screen

test_build_import.py

Source: test_build_import.py Github

copy

Full Screen

1"""Doby function testing"""2from doby.build import imports3def test_build_import():4 """Test build_imports"""5 config = {6 "requirements": {7 "apple": {},8 "orange": {"builtin": True, "operator": "==", "version": "1.0.0"},9 "pear": {"builtin": False, "operator": "==", "version": "1.0.0"},10 "lime": {"builtin": False, "operator": "=="},11 }12 }13 assert imports.build_import(config) == (14 ["requests", "apple", "pear==1.0.0", "lime"],15 [16 "import logging",17 "import requests",18 "import apple",19 "import orange",20 "import pear",21 "import lime",22 "",23 ],24 )25def test_build_import_empty():26 """Test build_imports"""27 config = {}28 assert imports.build_import(config) == (29 ["requests"],30 ["import logging", "import requests", ""],...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Test strategy and how to communicate it

I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.

Rebuild Confidence in Your Test Automation

These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.

Developers and Bugs – why are they happening again and again?

Entering the world of testers, one question started to formulate in my mind: “what is the reason that bugs happen?”.

Six Agile Team Behaviors to Consider

Are members of agile teams different from members of other teams? Both yes and no. Yes, because some of the behaviors we observe in agile teams are more distinct than in non-agile teams. And no, because we are talking about individuals!

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