How to use _mono_re method in autopy

Best Python code snippet using autopy Github


Full Screen

...29 def methods(self) -> list:30 classes = (y for x, y in self.members.items() if inspect.isclass(y))31 return _getmembers(classes)32 @staticmethod33 def _mono_re(pattern: str):34 return re.compile(r'`(%s)`' % pattern, re.MULTILINE)35 @property36 def token_re(self) -> object:37 return self._mono_re(_re_keywords(self.tokens))38 @property39 def function_re(self) -> object:40 return self._mono_re(_re_keywords(self.functions) +41 _re_keywords(x + "()" for x in self.functions))42 @property43 def class_re(self) -> object:44 return self._mono_re(_re_keywords(self.classes))45 @property46 def module_re(self) -> object:47 return self._mono_re(_re_keywords(self.modules))48 def sub_method(self, matchobj: object) -> str:49 name = if name.endswith("()"):51 name = name[:-2]52 method = self.methods.get(name)53 if method is None:54 return fmt = r':attr:`%s`' if isinstance(method, property) else r':meth:`%s`'56 return fmt % name57 def transform_docstring(self,58 docstr: str,59 name: str,60 what: str,61 obj: object) -> str:62 # Tokenize keywords.63 docstr = self.token_re.sub(r':token:`\1`', docstr)64 # Automatically insert attributes for local hyperlinking.65 docstr = self.function_re.sub(r':func:`\1`', docstr)66 docstr = self.class_re.sub(r':class:`\1`', docstr)67 docstr = self.module_re.sub(r':module:`\1`', docstr)68 if what in ("method", "class", "attribute"):69 docstr = self._mono_re(r'[\w()]+').sub(self.sub_method, docstr)70 # Treat `text` as monospace (like Markdown).71 docstr = re.sub(r'([^:]|^)`(.*?)`', r'\1``\2``', docstr,72 flags=re.MULTILINE | re.DOTALL)73 # Automatically italicize "Exceptions:"74 docstr = re.sub(r'(\b)(Exceptions:)', r'\1`\2`', docstr)75 # Automatically format code blocks.76 docstr = re.sub("(\s*\n)+((\n?( |\t)(\w.*))+)",77 "\n::\n" + r'\2', docstr, re.MULTILINE)78 return docstr79class Sphinx(object):80 def __init__(self, app):81 = app82 self.modules = ["autopy.%s" % x for x in autopy.__all__]83 self.nodoc = set()...

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:


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

Run autopy 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?