Best Python code snippet using prospector_python
host.py
Source:host.py
...42 return super().create(values)43 def _bootstrap(self):44 """ Create needed directories in static """45 dirs = ['build', 'nginx', 'repo', 'sources', 'src', 'docker']46 static_path = self._get_work_path()47 static_dirs = {d: os.path.join(static_path, d) for d in dirs}48 for dir, path in static_dirs.items():49 os.makedirs(path, exist_ok=True)50 def _docker_build(self):51 """ build docker image """52 static_path = self._get_work_path()53 log_path = os.path.join(static_path, 'docker', 'docker_build.txt')54 docker_build(log_path, static_path)55 def _get_work_path(self):56 return os.path.abspath(os.path.join(os.path.dirname(__file__), '../static'))57 @api.model58 def _get_current(self):59 name = fqdn()60 return self.search([('name', '=', name)]) or self.create({'name': name})61 def get_nb_worker(self):62 icp = self.env['ir.config_parameter']63 return self.nb_worker or int(icp.sudo().get_param('runbot.runbot_workers', default=6))64 def get_running_max(self):65 icp = self.env['ir.config_parameter']66 return int(icp.get_param('runbot.runbot_running_max', default=75))67 def set_psql_conn_count(self):68 _logger.debug('Updating psql connection count...')69 self.ensure_one()...
work_joiner.py
Source:work_joiner.py
...6class WorkJoiner:7 def __init__(self, corpus_dir):8 self._corpus_dir = os.path.abspath(corpus_dir)9 def _add_work(self, tei_corpus, work):10 tree = etree.parse(self._get_work_path(work))11 tei_elements = tree.xpath('/tei:teiCorpus/tei:TEI',12 namespaces=constants.NAMESPACES)13 for tei_element in tei_elements:14 new_tei_element = deepcopy(tei_element)15 new_tei_element.attrib.pop(constants.XML + 'id', None)16 tei_corpus.append(new_tei_element)17 def _get_work_path(self, work):18 return os.path.join(self._corpus_dir, '{}.xml'.format(work))19 def join(self, output, works):20 output_path = self._get_work_path(output)21 if os.path.exists(output_path):22 raise TACLError(constants.JOIN_WORKS_EXISTING_OUTPUT_ERROR.format(23 output_path))24 tree = etree.parse(self._get_work_path(works[0]))25 tei_corpus = tree.getroot()26 for work in works[1:]:27 self._add_work(tei_corpus, work)...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!