How to use the pyquery.cssselectpatch.JQueryTranslator function in pyquery

To help you get started, we’ve selected a few pyquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gawel / pyquery / docs / conf.py View on Github external
release = version
            break
del pkg_dir, setup, path

try:
    from pyquery.cssselectpatch import JQueryTranslator
except ImportError:
    pass
else:
    with open('pseudo_classes.rst', 'w') as fd:
        fd.write('=========================\n')
        fd.write('Using pseudo classes\n')
        fd.write('=========================\n')
        for k in sorted(dir(JQueryTranslator)):
            if k.startswith('xpath_'):
                attr = getattr(JQueryTranslator, k)
                doc = getattr(attr, '__doc__', '') or ''
                doc = doc.strip()
                if doc.startswith('Common implementation'):
                    continue
                k = k[6:]
                if '_' not in k or not doc:
                    continue
                k, t = k.split('_', 1)
                if '_' in t:
                    continue
                if t == 'function':
                    k += '()'
                fd.write('\n\n:%s\n' % k)
                fd.write('==================\n\n')
                fd.write(doc.strip('..').replace('        ', '    '))
github gawel / pyquery / docs / conf.py View on Github external
version = version.strip()
            version = version.strip("'\"")
            release = version
            break
del pkg_dir, setup, path

try:
    from pyquery.cssselectpatch import JQueryTranslator
except ImportError:
    pass
else:
    with open('pseudo_classes.rst', 'w') as fd:
        fd.write('=========================\n')
        fd.write('Using pseudo classes\n')
        fd.write('=========================\n')
        for k in sorted(dir(JQueryTranslator)):
            if k.startswith('xpath_'):
                attr = getattr(JQueryTranslator, k)
                doc = getattr(attr, '__doc__', '') or ''
                doc = doc.strip()
                if doc.startswith('Common implementation'):
                    continue
                k = k[6:]
                if '_' not in k or not doc:
                    continue
                k, t = k.split('_', 1)
                if '_' in t:
                    continue
                if t == 'function':
                    k += '()'
                fd.write('\n\n:%s\n' % k)
                fd.write('==================\n\n')