How to use linkcode_resolve method in pandera

Best Python code snippet using pandera_python

github_link.py

Source:github_link.py Github

copy

Full Screen

...21def setup(app):22 app.add_config_value('github_user', None, 'env')23 app.add_config_value('github_project', None, 'env')24 app.connect('html-page-context', add_doc_link)25 def linkcode_resolve(domain, info):26 """ Resolves provided object to corresponding github URL27 """28 # TODO: js?29 if domain != 'py':30 return None31 if not (app.config.github_user and app.config.github_project):32 return None33 module, fullname = info['module'], info['fullname']34 # TODO: attributes/properties don't have modules, maybe try to look35 # them up based on their cached host object?36 if not module:37 return None38 obj = importlib.import_module(module)39 for item in fullname.split('.'):...

Full Screen

Full Screen

linkcode.py

Source:linkcode.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2"""3 sphinx.ext.linkcode4 ~~~~~~~~~~~~~~~~~~~5 Add external links to module code in Python object descriptions.6 :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.7 :license: BSD, see LICENSE for details.8"""9from docutils import nodes10import sphinx11from sphinx import addnodes12from sphinx.errors import SphinxError13from sphinx.locale import _14if False:15 # For type annotation16 from typing import Any, Dict, Set # NOQA17 from sphinx.application import Sphinx # NOQA18class LinkcodeError(SphinxError):19 category = "linkcode error"20def doctree_read(app, doctree):21 # type: (Sphinx, nodes.Node) -> None22 env = app.builder.env23 resolve_target = getattr(env.config, 'linkcode_resolve', None)24 if not callable(env.config.linkcode_resolve):25 raise LinkcodeError(26 "Function `linkcode_resolve` is not given in conf.py")27 domain_keys = dict(28 py=['module', 'fullname'],29 c=['names'],30 cpp=['names'],31 js=['object', 'fullname'],32 )33 for objnode in doctree.traverse(addnodes.desc):34 domain = objnode.get('domain')35 uris = set() # type: Set[unicode]36 for signode in objnode:37 if not isinstance(signode, addnodes.desc_signature):38 continue39 # Convert signode to a specified format40 info = {}41 for key in domain_keys.get(domain, []):42 value = signode.get(key)43 if not value:44 value = ''45 info[key] = value46 if not info:47 continue48 # Call user code to resolve the link49 uri = resolve_target(domain, info)50 if not uri:51 # no source52 continue53 if uri in uris or not uri:54 # only one link per name, please55 continue56 uris.add(uri)57 onlynode = addnodes.only(expr='html')58 onlynode += nodes.reference('', '', internal=False, refuri=uri)59 onlynode[0] += nodes.inline('', _('[source]'),60 classes=['viewcode-link'])61 signode += onlynode62def setup(app):63 # type: (Sphinx) -> Dict[unicode, Any]64 app.connect('doctree-read', doctree_read)65 app.add_config_value('linkcode_resolve', None, '')...

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 pandera 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