Best Python code snippet using fMBT_python
songparser.py
Source:songparser.py  
...157    @_("WORD", "CHORD_SYMBOL")158    def chord_part(self, p):159        return p160    @_("SPACE")161    def skip_space(self, p):162        pass163    @_("")164    def skip_space(self, p):165        pass166    @_("PUNCTUATION_NO_COMMA", ",")167    def punctuation(self, p):168        return p.value169    170@dataclass171class Song:172    name: str173    options: ty.Mapping[str, str]174    body: ty.List[Block]175@dataclass176class Command:177    name: str178    args: ty.List[Atom]...conllu_to_txt.py
Source:conllu_to_txt.py  
1import string23NO_SPACE = 'SpaceAfter=No'4CUSTOM_PUNCTUATION_SET = set(string.punctuation + '`' + 'â')56def conll_to_txt_with_space_after(list_with_words):7	to_print = ''8	prev_comment = ''9	for word in list_with_words[:-1]:  # под -1 Ð»ÐµÐ¶Ð¸Ñ extra_space10		token = word[1]11		comment = word[-1]12		if token == '``' or token == '''':13			token = '"'14		elif token == '--':15			token = 'â'	16		if prev_comment == NO_SPACE or to_print == '':17			to_print += token18		else:19			to_print += ' ' 20			to_print += token21		prev_comment = comment22	return to_print2324def conll_to_txt_without_space_after(list_with_words):25	to_print = ''26	has_text_for_sent = False27	skip_space = False28	has_opening_quotation = False29	for word in list_with_words[:-1]:  # под -1 Ð»ÐµÐ¶Ð¸Ñ extra_space30		token = word[1]  31		if to_print == '':32			if token == '``':33				to_print += '"'34				skip_space = True35				has_opening_quotation = True36			else:37				to_print += token38		elif skip_space:39			if token == '``':40				to_print += '"'41				skip_space = True42				has_opening_quotation = True43			else:44				to_print += token45				skip_space = False46		elif token == '''':47			to_print += '"'48		elif set(token).issubset(CUSTOM_PUNCTUATION_SET):49			if token == '``':50				to_print += ' "'51				skip_space = True52				has_opening_quotation = True53			elif token == '"' or token == '\'\'':54				if has_opening_quotation:55					to_print += '"'56					has_opening_quotation = False57				else:58					to_print += ' "'59					skip_space = True 60					has_opening_quotation = True61			elif token == '--' or token == 'â':62				to_print += ' â'63			elif token == '-':64				to_print += '-'65				skip_space = True66			else:67				to_print += token68		else:69			to_print += ' ' 70			to_print += token
...__init__.py
Source:__init__.py  
1import numpy as np, pandas as pd2from scipy.stats import wilcoxon3def wilcoxon_statistical_test(data1, data2):4    stat, p = wilcoxon(data1, data2)5    print('stat=%.3f, p=%.3f' % (stat, p))6    if p > 0.05:7        print('Probably the same distribution')8    else:9        print('Probably different distributions')10    return stat, p11        12def get_Manchester_Syntax(concept_name: str) -> str:13    result = ''14    is_existential = True15    skip_space = False16    for c in concept_name:17        if c == 'â':18            is_existential = False19            skip_space = True20        if c == 'â':21            is_existential = True22            skip_space = True23        if not c in ['â', 'â', '.', 'â', 'â', ' ', '¬', 'â¤', 'â¥']:24            result += c25        if c == 'â':26            result += 'or'27        if c == 'â':28            result += 'and'29        if c == '.' and is_existential:30            result += ' some '31        if c == '.' and not is_existential:32            result += ' only '33        if c == '¬':34            result += 'not '35        if c == 'â¤':36            result += 'Thing' # DLFoil config may not support Thing, # hint: manually replace all Thing by some class name37        if c == 'â¥':38            result += 'Nothing' # Should be Nothing, but Nothing is mostly not supported by DLFoil config on some knowledge bases, tips: manually replace Nothing or thing by some class name39        if c == ' ' and skip_space:40            skip_space = False41        elif c == ' ' and not skip_space:42            result += c...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!!
