How to use recurse method in hypothesis

Best Python code snippet using hypothesis

makeRecursorPassAdvanced.ts

Source:makeRecursorPassAdvanced.ts Github

copy

Full Screen

1import { recurseAnnotationTemplate } from './recurseAnnotationTemplate.ts';2import { recurseAnnotationType } from './recurseAnnotationType.ts';3import { recurseBlock } from './recurseBlock.ts';4import { recurseExpression } from './recurseExpression.ts';5import { recurseExpressionBinary } from './recurseExpressionBinary.ts';6import { recurseExpressionCall } from './recurseExpressionCall.ts';7import { recurseExpressionFunction } from './recurseExpressionFunction.ts';8import { recurseExpressionIdentifier } from './recurseExpressionIdentifier.ts';9import { recurseExpressionLiteral } from './recurseExpressionLiteral.ts';10import { recurseExpressionLookup } from './recurseExpressionLookup.ts';11import { recurseExpressionObject } from './recurseExpressionObject.ts';12import { recurseExpressionParenthesis } from './recurseExpressionParenthesis.ts';13import { recurseExpressionRun } from './recurseExpressionRun.ts';14import { recurseExpressionTyping } from './recurseExpressionTyping.ts';15import { recurseExpressionUnary } from './recurseExpressionUnary.ts';16import { recurseModule } from './recurseModule.ts';17import { recurseStatement } from './recurseStatement.ts';18import { recurseStatementBlock } from './recurseStatementBlock.ts';19import { recurseStatementCondition } from './recurseStatementCondition.ts';20import { recurseStatementEmpty } from './recurseStatementEmpty.ts';21import { recurseStatementExport } from './recurseStatementExport.ts';22import { recurseStatementExpression } from './recurseStatementExpression.ts';23import { recurseStatementImport } from './recurseStatementImport.ts';24import { recurseStatementReturn } from './recurseStatementReturn.ts';25import { recurseStatementTypedef } from './recurseStatementTypedef.ts';26import { recurseStatementUnsafe } from './recurseStatementUnsafe.ts';27import { recurseStatementVariable } from './recurseStatementVariable.ts';28import { recurseStatementWhile } from './recurseStatementWhile.ts';29import { recurseType } from './recurseType.ts';30import { recurseTypeBinary } from './recurseTypeBinary.ts';31import { recurseTypeFunction } from './recurseTypeFunction.ts';32import { recurseTypeIdentifier } from './recurseTypeIdentifier.ts';33import { recurseTypeObject } from './recurseTypeObject.ts';34import { recurseTypeParenthesis } from './recurseTypeParenthesis.ts';35import { recurseTypePrimitive } from './recurseTypePrimitive.ts';36import { RecursorAdvanced, RecursorAdvancedFunction } from './RecursorAdvanced.ts';37import { RecursorPass, RecursorPassFunction, RecursorPassHolder, RecursorPassStandard } from './RecursorPass.ts';38import { RecursorStack } from './RecursorStack.ts';39function make<Ast, Scope>(40 stack: RecursorStack<Scope>,41 pass: RecursorPassHolder,42 standard: RecursorPassStandard<Ast>,43 advanced?: RecursorAdvancedFunction<Ast, Scope>,44): RecursorPassFunction<Ast> {45 return (ast: Ast) => {46 if (advanced) {47 const child = stack.push();48 advanced(pass.value!, ast, child);49 stack.pop();50 } else {51 standard(pass.value!, ast);52 }53 };54}55export function makeRecursorPassAdvanced<Scope>(56 advanceds: RecursorAdvanced<Scope>,57 scoper?: (parent: Scope) => Scope,58): (scope: Scope) => RecursorPass {59 return (scope: Scope) => {60 const stack = new RecursorStack(scope, scoper ?? ((v) => v));61 const pass: RecursorPassHolder = {};62 pass.value = {63 recurseModule: make(stack, pass, recurseModule, advanceds.recurseModule),64 recurseBlock: make(stack, pass, recurseBlock, advanceds.recurseBlock),65 recurseExpression: make(stack, pass, recurseExpression, advanceds.recurseExpression),66 recurseExpressionCall: make(stack, pass, recurseExpressionCall, advanceds.recurseExpressionCall),67 recurseExpressionIdentifier: make(stack, pass, recurseExpressionIdentifier, advanceds.recurseExpressionIdentifier),68 recurseExpressionFunction: make(stack, pass, recurseExpressionFunction, advanceds.recurseExpressionFunction),69 recurseExpressionObject: make(stack, pass, recurseExpressionObject, advanceds.recurseExpressionObject),70 recurseExpressionRun: make(stack, pass, recurseExpressionRun, advanceds.recurseExpressionRun),71 recurseExpressionLookup: make(stack, pass, recurseExpressionLookup, advanceds.recurseExpressionLookup),72 recurseExpressionLiteral: make(stack, pass, recurseExpressionLiteral, advanceds.recurseExpressionLiteral),73 recurseExpressionUnary: make(stack, pass, recurseExpressionUnary, advanceds.recurseExpressionUnary),74 recurseExpressionBinary: make(stack, pass, recurseExpressionBinary, advanceds.recurseExpressionBinary),75 recurseExpressionTyping: make(stack, pass, recurseExpressionTyping, advanceds.recurseExpressionTyping),76 recurseExpressionParenthesis: make(stack, pass, recurseExpressionParenthesis, advanceds.recurseExpressionParenthesis),77 recurseAnnotationType: make(stack, pass, recurseAnnotationType, advanceds.recurseAnnotationType),78 recurseAnnotationTemplate: make(stack, pass, recurseAnnotationTemplate, advanceds.recurseAnnotationTemplate),79 recurseType: make(stack, pass, recurseType, advanceds.recurseType),80 recurseTypeParenthesis: make(stack, pass, recurseTypeParenthesis, advanceds.recurseTypeParenthesis),81 recurseTypeIdentifier: make(stack, pass, recurseTypeIdentifier, advanceds.recurseTypeIdentifier),82 recurseTypePrimitive: make(stack, pass, recurseTypePrimitive, advanceds.recurseTypePrimitive),83 recurseTypeBinary: make(stack, pass, recurseTypeBinary, advanceds.recurseTypeBinary),84 recurseTypeFunction: make(stack, pass, recurseTypeFunction, advanceds.recurseTypeFunction),85 recurseTypeObject: make(stack, pass, recurseTypeObject, advanceds.recurseTypeObject),86 recurseStatement: make(stack, pass, recurseStatement, advanceds.recurseStatement),87 recurseStatementImport: make(stack, pass, recurseStatementImport, advanceds.recurseStatementImport),88 recurseStatementExport: make(stack, pass, recurseStatementExport, advanceds.recurseStatementExport),89 recurseStatementVariable: make(stack, pass, recurseStatementVariable, advanceds.recurseStatementVariable),90 recurseStatementTypedef: make(stack, pass, recurseStatementTypedef, advanceds.recurseStatementTypedef),91 recurseStatementBlock: make(stack, pass, recurseStatementBlock, advanceds.recurseStatementBlock),92 recurseStatementWhile: make(stack, pass, recurseStatementWhile, advanceds.recurseStatementWhile),93 recurseStatementCondition: make(stack, pass, recurseStatementCondition, advanceds.recurseStatementCondition),94 recurseStatementReturn: make(stack, pass, recurseStatementReturn, advanceds.recurseStatementReturn),95 recurseStatementUnsafe: make(stack, pass, recurseStatementUnsafe, advanceds.recurseStatementUnsafe),96 recurseStatementExpression: make(stack, pass, recurseStatementExpression, advanceds.recurseStatementExpression),97 recurseStatementEmpty: make(stack, pass, recurseStatementEmpty, advanceds.recurseStatementEmpty),98 };99 return pass.value;100 };...

Full Screen

Full Screen

legacy.js

Source:legacy.js Github

copy

Full Screen

1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3exports.getElementsByTagType = exports.getElementsByTagName = exports.getElementById = exports.getElements = exports.testElement = void 0;4var domhandler_1 = require("domhandler");5var querying_1 = require("./querying");6var Checks = {7 tag_name: function (name) {8 if (typeof name === "function") {9 return function (elem) { return (0, domhandler_1.isTag)(elem) && name(elem.name); };10 }11 else if (name === "*") {12 return domhandler_1.isTag;13 }14 return function (elem) { return (0, domhandler_1.isTag)(elem) && elem.name === name; };15 },16 tag_type: function (type) {17 if (typeof type === "function") {18 return function (elem) { return type(elem.type); };19 }20 return function (elem) { return elem.type === type; };21 },22 tag_contains: function (data) {23 if (typeof data === "function") {24 return function (elem) { return (0, domhandler_1.isText)(elem) && data(elem.data); };25 }26 return function (elem) { return (0, domhandler_1.isText)(elem) && elem.data === data; };27 },28};29/**30 * @param attrib Attribute to check.31 * @param value Attribute value to look for.32 * @returns A function to check whether the a node has an attribute with a particular value.33 */34function getAttribCheck(attrib, value) {35 if (typeof value === "function") {36 return function (elem) { return (0, domhandler_1.isTag)(elem) && value(elem.attribs[attrib]); };37 }38 return function (elem) { return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value; };39}40/**41 * @param a First function to combine.42 * @param b Second function to combine.43 * @returns A function taking a node and returning `true` if either44 * of the input functions returns `true` for the node.45 */46function combineFuncs(a, b) {47 return function (elem) { return a(elem) || b(elem); };48}49/**50 * @param options An object describing nodes to look for.51 * @returns A function executing all checks in `options` and returning `true`52 * if any of them match a node.53 */54function compileTest(options) {55 var funcs = Object.keys(options).map(function (key) {56 var value = options[key];57 return Object.prototype.hasOwnProperty.call(Checks, key)58 ? Checks[key](value)59 : getAttribCheck(key, value);60 });61 return funcs.length === 0 ? null : funcs.reduce(combineFuncs);62}63/**64 * @param options An object describing nodes to look for.65 * @param node The element to test.66 * @returns Whether the element matches the description in `options`.67 */68function testElement(options, node) {69 var test = compileTest(options);70 return test ? test(node) : true;71}72exports.testElement = testElement;73/**74 * @param options An object describing nodes to look for.75 * @param nodes Nodes to search through.76 * @param recurse Also consider child nodes.77 * @param limit Maximum number of nodes to return.78 * @returns All nodes that match `options`.79 */80function getElements(options, nodes, recurse, limit) {81 if (limit === void 0) { limit = Infinity; }82 var test = compileTest(options);83 return test ? (0, querying_1.filter)(test, nodes, recurse, limit) : [];84}85exports.getElements = getElements;86/**87 * @param id The unique ID attribute value to look for.88 * @param nodes Nodes to search through.89 * @param recurse Also consider child nodes.90 * @returns The node with the supplied ID.91 */92function getElementById(id, nodes, recurse) {93 if (recurse === void 0) { recurse = true; }94 if (!Array.isArray(nodes))95 nodes = [nodes];96 return (0, querying_1.findOne)(getAttribCheck("id", id), nodes, recurse);97}98exports.getElementById = getElementById;99/**100 * @param tagName Tag name to search for.101 * @param nodes Nodes to search through.102 * @param recurse Also consider child nodes.103 * @param limit Maximum number of nodes to return.104 * @returns All nodes with the supplied `tagName`.105 */106function getElementsByTagName(tagName, nodes, recurse, limit) {107 if (recurse === void 0) { recurse = true; }108 if (limit === void 0) { limit = Infinity; }109 return (0, querying_1.filter)(Checks.tag_name(tagName), nodes, recurse, limit);110}111exports.getElementsByTagName = getElementsByTagName;112/**113 * @param type Element type to look for.114 * @param nodes Nodes to search through.115 * @param recurse Also consider child nodes.116 * @param limit Maximum number of nodes to return.117 * @returns All nodes with the supplied `type`.118 */119function getElementsByTagType(type, nodes, recurse, limit) {120 if (recurse === void 0) { recurse = true; }121 if (limit === void 0) { limit = Infinity; }122 return (0, querying_1.filter)(Checks.tag_type(type), nodes, recurse, limit);123}...

Full Screen

Full Screen

wscript_build

Source:wscript_build Github

copy

Full Screen

1#!/usr/bin/env python2# top level waf build script for samba43import os4srcdir = "."5import samba_version6# mark this as a top level build, for source3 rules7bld.env.toplevel_build = True8bld.env.use_intree_heimdal = True9bld.env.suffix3 = "3"10# create separate build groups for building the asn1 and et compiler, then11# building the C from ASN1 and IDL, and finally the main build process12bld.SETUP_BUILD_GROUPS()13bld.AUTOCLEANUP_STALE_FILES()14# enable building of public headers in the build tree15bld.env.build_public_headers = 'include/public'16# these are includes which appear in public headers, but with #ifdef conditional17# compilation, so they are safe18bld.env.public_headers_skip = ['param/param_proto.h', 'lib/ldb_compat.h']19# force headers to use SAMBA4 rules20bld.env.public_headers_replace = { '#if _SAMBA_BUILD_ == 4' : '#if 1 /* _SAMBA_BUILD_ == 4 */' }21samba_version.load_version(bld.env)22bld.SAMBA_MKVERSION('version.h')23# bld.ENABLE_MAGIC_ORDERING()24bld.RECURSE('lib/replace')25bld.RECURSE('lib/talloc')26bld.RECURSE('lib/tdb')27bld.RECURSE('lib/tevent')28bld.RECURSE('source4/lib/ldb')29bld.RECURSE('source4/dynconfig')30bld.RECURSE('lib/util/charset')31bld.RECURSE('source4/scripting/python')32bld.RECURSE('source4/param')33bld.RECURSE('source4/librpc')34bld.RECURSE('source4/dsdb')35bld.RECURSE('source4/smbd')36bld.RECURSE('source4/cluster')37bld.RECURSE('source4/smbd')38bld.RECURSE('source4/libnet')39bld.RECURSE('source4/auth')40bld.RECURSE('auth')41bld.RECURSE('lib/iniparser/src')42bld.RECURSE('nsswitch')43bld.RECURSE('nsswitch/libwbclient')44bld.RECURSE('source4/lib/samba3')45bld.RECURSE('source4/lib/socket')46bld.RECURSE('source4/lib/ldb-samba')47bld.RECURSE('source4/lib/tls')48bld.RECURSE('source4/lib/registry')49bld.RECURSE('source4/lib/messaging')50bld.RECURSE('source4/lib/events')51bld.RECURSE('source4/lib/cmdline')52bld.RECURSE('lib/socket_wrapper')53bld.RECURSE('lib/nss_wrapper')54bld.RECURSE('lib/uid_wrapper')55bld.RECURSE('lib/popt')56bld.RECURSE('source4/lib/stream')57bld.RECURSE('lib/util')58bld.RECURSE('lib/tdr')59bld.RECURSE('lib/tsocket')60bld.RECURSE('lib/crypto')61bld.RECURSE('lib/torture')62bld.RECURSE('lib/zlib')63bld.RECURSE('source4/lib')64bld.RECURSE('source4/lib/com')65bld.RECURSE('source4/dns_server')66bld.RECURSE('source4/echo_server')67bld.RECURSE('source4/smb_server')68bld.RECURSE('source4/rpc_server')69bld.RECURSE('source4/ldap_server')70bld.RECURSE('source4/web_server')71bld.RECURSE('source4/winbind')72bld.RECURSE('source4/nbt_server')73bld.RECURSE('source4/wrepl_server')74bld.RECURSE('source4/cldap_server')75bld.RECURSE('source4/ntp_signd')76bld.RECURSE('source4/samba_tool')77bld.RECURSE('source4/utils')78bld.RECURSE('source4/ntvfs')79bld.RECURSE('source4/ntptr')80bld.RECURSE('source4/torture')81bld.RECURSE('librpc')82bld.RECURSE('source4/client')83bld.RECURSE('source4/libcli')84bld.RECURSE('libcli/smb')85bld.RECURSE('libcli/cldap')86bld.RECURSE('lib/subunit/c')87bld.RECURSE('source4/kdc')88bld.RECURSE('lib/smbconf')89bld.RECURSE('lib/async_req')90bld.RECURSE('libcli/security')91bld.RECURSE('libcli/ldap')92bld.RECURSE('libcli/nbt')93bld.RECURSE('libcli/netlogon')94bld.RECURSE('libcli/auth')95bld.RECURSE('libcli/drsuapi')96bld.RECURSE('libcli/echo')97bld.RECURSE('libcli/samsync')98bld.RECURSE('libcli/registry')99bld.RECURSE('source4/lib/policy')100bld.RECURSE('libcli/named_pipe_auth')101bld.RECURSE('source4/heimdal_build')102bld.RECURSE('libcli/smbreadline')103bld.RECURSE('codepages')104bld.RECURSE('source4/setup')105bld.RECURSE('source4/scripting')106bld.RECURSE('pidl')107bld.RECURSE('lib')108bld.RECURSE('libds/common')109if bld.env.enable_s3build:110 bld.RECURSE('source3')111bld.RECURSE('testsuite/headers')112# install some extra empty directories113bld.INSTALL_DIRS("", "${LOCKDIR} ${SYSCONFDIR} ${LOCKDIR} ${PIDDIR} ${LOCALSTATEDIR}/lib ${PRIVATEDIR}/smbd.tmp/messaging")...

Full Screen

Full Screen

recurse.js

Source:recurse.js Github

copy

Full Screen

...40 });41 it('recurse files', function(done) {42 var filesPath = allFiles[0];43 var count = 0;44 file.recurse(getPath('var/recurse/simple'), function(filepath, relative, filename) {45 if (filename) {46 assert.equal(true, filesPath.indexOf(filepath) != -1);47 48 if (++count == filesPath.length) {49 done();50 }51 }52 });53 });54 it('recurseSync files', function() {55 var filesPath = [];56 file.recurseSync(getPath('var/recurse/filter'), function(filepath, relative, filename) {57 if (filename) {58 filesPath.push(filepath);...

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