See ECMA357 13.3.2
779338
QName constructQName(XMLLibImpl lib, Context cx, Object namespace, Object name) {
        String nameString = null;
        if (name instanceof QName) {
            if (namespace == Undefined.instance) {
                return (QName)name;
            } else {
                nameString = ((QName)name).localName();
            }
        }
        if (name == Undefined.instance) {
            nameString = "";
        } else {
            nameString = ScriptRuntime.toString(name);
        }

        if (namespace == Undefined.instance) {
            if ("*".equals(nameString)) {
                namespace = null;
            } else {
                namespace = lib.getDefaultNamespace(cx);
            }
        }
        Namespace namespaceNamespace = null;
        if (namespace == null) {
            //    leave as null
        } else if (namespace instanceof Namespace) {
            namespaceNamespace = (Namespace)namespace;
        } else {
            namespaceNamespace = lib.newNamespace(ScriptRuntime.toString(namespace));
        }
        String q_localName = nameString;
        String q_uri;
        String q_prefix;
        if (namespace == null) {
            q_uri = null;
            q_prefix = null;    //    corresponds to undefined; see QName class
        } else {
            q_uri = namespaceNamespace.uri();
            q_prefix = namespaceNamespace.prefix();
        }
        return newQName(lib, q_uri, q_localName, q_prefix);
    }
857095
function litmus() {
  var awsURL = !!CONFIG && !!CONFIG.aws && !!CONFIG.aws.url ? CONFIG.aws.url : false;

  return gulp.src('dist/**/*.html')
    .pipe($.if(!!awsURL, $.replace(/=('|")(\/?assets\/img)/g, "=$1"+ awsURL)))
    .pipe($.litmus(CONFIG.litmus))
    .pipe(gulp.dest('dist'));
}
888781
function (comm_manager, notebook) {
    base.ManagerBase.apply(this);
    // Managers are stored in *reverse* order, so that _managers[0] is the most recent.
    WidgetManager._managers.unshift(this);

    // Attach a comm manager
    this.notebook = notebook;
    this.keyboard_manager = notebook.keyboard_manager;
    this.comm_manager = comm_manager;

    var widget_md = notebook.metadata.widgets

    // Steps that needs to be done:
    // 1. Register comm target
    // 2. Get any widget state from the kernel and open comms with existing state
    // 3. Check saved state for widgets, and restore any that would not overwrite
    //    any live widgets.

    // Register with the comm manager. (1)
    this.comm_manager.register_target(this.comm_target_name, _.bind(this.handle_comm_open,this));

    // Attempt to reconstruct any live comms by requesting them from the back-end (2).
    var that = this;
    this._get_comm_info().then(function(comm_ids) {

        // Create comm class instances from comm ids (2).
        var comm_promises = Object.keys(comm_ids).map(function(comm_id) {
            return that._create_comm(that.comm_target_name, comm_id);
        });

        // Send a state request message out for each widget comm and wait
        // for the responses (2).
        return Promise.all(comm_promises).then(function(comms) {
            return Promise.all(comms.map(function(comm) {
                var update_promise = new Promise(function(resolve, reject) {
                    comm.on_msg(function (msg) {
                        base.put_buffers(msg.content.data.state, msg.content.data.buffer_paths, msg.buffers);
                        // A suspected response was received, check to see if
                        // it's a state update. If so, resolve.
                        if (msg.content.data.method === 'update') {
                            resolve({
                                comm: comm,
                                msg: msg
                            });
                        }
                    });
                });
                comm.send({
                    method: 'request_state'
                }, that.callbacks());
                return update_promise;
            }));
        }).then(function(widgets_info) {
            return Promise.all(widgets_info.map(function(widget_info) {
                return that.new_model({
                    model_name: widget_info.msg.content.data.state._model_name,
                    model_module: widget_info.msg.content.data.state._model_module,
                    model_module_version: widget_info.msg.content.data.state._model_module_version,
                    comm: widget_info.comm,
                }, widget_info.msg.content.data.state);
            }));
        }).then(function() {
            // Now that we have mirrored any widgets from the kernel...
            // Restore any widgets from saved state that are not live (3)
            if (widget_md && widget_md['application/vnd.jupyter.widget-state+json']) {
                var state = notebook.metadata.widgets['application/vnd.jupyter.widget-state+json'];
                state = that.filterExistingModelState(state);
                return that.set_state(state);
            }
        }).then(function() {
            // Rerender cells that have widget data
            that.notebook.get_cells().forEach(function(cell) {
                var rerender = cell.output_area && cell.output_area.outputs.find(function(output) {
                    return output.data && output.data[MIME_TYPE];
                });
                if (rerender) {
                    that.notebook.render_cell_output(cell);
                }
            });
        });
    });

    // Create the actions and menu
    this._init_actions();
    this._init_menu();
}
229742
function collationNotSupported(server, cmd) {
  return cmd && cmd.collation && server.ismaster && server.ismaster.maxWireVersion < 5;
}
667910
function getModuleMapSync(dir) {
  var map = {};

  fs
    .readdirSync(dir)
    .filter(function(filename) {
      return filename !== 'index.js';
    })
    .forEach(function(filename) {
      var filePath = path.join(dir, filename);
      var Stats = fs.lstatSync(filePath);
      var isLink = Stats.isSymbolicLink();
      var isDir = Stats.isDirectory();
      var isFile = Stats.isFile();
      var isJS = filename.indexOf('.js') > -1;

      if (!isLink && isDir) {
        map[filename] = getModuleMapSync(filePath);
      }

      else if (!isLink && isFile && isJS) {
        var entityName = filename.replace('.js', '');
        map[entityName] = true;
      }
    });

  return map;
}
1025147
function getRoot(cwd, filename, smap) {
    var relativePath = path.relative(cwd, filename);

    var segments = relativePath.split('node_modules');

    var sourceRoot = smap.getProperty('sourceRoot') || '/source/' + relativePath;

    if (segments.length <= 1) {
        return sourceRoot;
    } else {
        return sourceRoot
            .replace(/^\/source\//, '/source/' + pathToPackage());
    }

    // it works, somehow ¯\_(ツ)_/¯
    function pathToPackage() {
        var upToNodeModules = segments
            .slice(0, -1)
            .concat('/')
            .join('node_modules');

        var packageName = segments[segments.length - 1]
            .split('/', 2)[1]
            + '/';

        return upToNodeModules + packageName;
    }
}
758260
function (less, pluginManager) {
        var version = less.version;

        var options = this.options;

        // won't work before 2.4.0
        if (options.autoImport && (version[0] > 2 || version[1] >= 4)) {
            require('./injector').install(less, pluginManager);
        }

        if (options.uniqueDirectives) {
            require('./unique-directives').install(less, pluginManager);
        }

        // needed before 2.3.0
        if (version[1] < 3) {
            require('./custom-functions').install(less, pluginManager);
        }
    }
1073284
function (dimName, axisIndex, dataZoomModel, ecModel) {

    /**
     * @private
     * @type {string}
     */
    this._dimName = dimName;

    /**
     * @private
     */
    this._axisIndex = axisIndex;

    /**
     * @private
     * @type {Array.<number>}
     */
    this._valueWindow;

    /**
     * @private
     * @type {Array.<number>}
     */
    this._percentWindow;

    /**
     * @private
     * @type {Array.<number>}
     */
    this._dataExtent;

    /**
     * {minSpan, maxSpan, minValueSpan, maxValueSpan}
     * @private
     * @type {Object}
     */
    this._minMaxSpan;

    /**
     * @readOnly
     * @type {module: echarts/model/Global}
     */
    this.ecModel = ecModel;

    /**
     * @private
     * @type {module: echarts/component/dataZoom/DataZoomModel}
     */
    this._dataZoomModel = dataZoomModel;

    // /**
    //  * @readOnly
    //  * @private
    //  */
    // this.hasSeriesStacked;
}
771895
function getVersionSCXML(machineName, versionKey) {
        let route = getVersionModelRoute(machineName, versionKey);
        return fs.readFileSync(repositoryPath + "/" + route).toString('utf8');
    }
239944
def call_env_check_consistency(cls, kb_app, builder: StandaloneHTMLBuilder,
                                   sphinx_env: BuildEnvironment):
        

        for callback in EventAction.get_callbacks(kb_app,
                                                  SphinxEvent.ECC):
            callback(kb_app, builder, sphinx_env)
561114
function (options, mCb) {
		const aws = options.infra.api;
		getElbMethod(options.params.elbType || 'classic', 'list', (elbResponse) => {
			const elb = getConnector({
				api: elbResponse.api,
				region: options.params.region,
				keyId: aws.keyId,
				secretAccessKey: aws.secretAccessKey
			});
			const ec2 = getConnector({
				api: 'ec2',
				region: options.params.region,
				keyId: aws.keyId,
				secretAccessKey: aws.secretAccessKey
			});
			elb[elbResponse.method]({}, function (err, response) {
				if (err) {
					return mCb(err);
				}
				async.map(response.LoadBalancerDescriptions, function (lb, callback) {
					async.parallel({
						subnets: function (callback) {
							if (lb && lb.Subnets && Array.isArray(lb.Subnets) && lb.Subnets.length > 0) {
								let sParams = {SubnetIds: lb.Subnets};
								ec2.describeSubnets(sParams, callback);
							}
							else {
								return callback(null, null);
							}
						},
						instances: function (callback) {
							let iParams = {LoadBalancerName: lb.LoadBalancerName};
							elb.describeInstanceHealth(iParams, callback);
						}
					}, function (err, results) {
						return callback(err, helper[elbResponse.helper]({
							lb,
							region: options.params.region,
							subnets: results.subnets ? results.subnets.Subnets : [],
							instances: results.instances ? results.instances.InstanceStates : []
						}));
					});
				}, mCb);
			});
		});
	}
1016650
function convert( $manager, $sourceMimeData, &$destinationMimeData, $filters = false )
    {
        $argumentList = array();
        $executable = $this->Executable;
        if ( eZSys::osType() == 'win32' and $this->ExecutableWin32 )
            $executable = $this->ExecutableWin32;
        else if ( eZSys::osType() == 'mac' and $this->ExecutableMac )
            $executable = $this->ExecutableMac;
        else if ( eZSys::osType() == 'unix' and $this->ExecutableUnix )
            $executable = $this->ExecutableUnix;
        if ( $this->Path )
            $executable = $this->Path . eZSys::fileSeparator() . $executable;
        if ( eZSys::osType() == 'win32' )
            $executable = "\"$executable\"";

        $argumentList[] = $executable;

        if ( $this->PreParameters )
            $argumentList[] = $this->PreParameters;

        $frameRangeParameters = $this->FrameRangeParameters;
        if ( $frameRangeParameters && isset( $frameRangeParameters[$sourceMimeData['name']] ) )
        {
            $sourceMimeData['url'] .= $frameRangeParameters[$sourceMimeData['name']];
        }

        $argumentList[] = eZSys::escapeShellArgument( $sourceMimeData['url'] );

        $qualityParameters = $this->QualityParameters;
        if ( $qualityParameters and
             isset( $qualityParameters[$destinationMimeData['name']] ) )
        {
            $qualityParameter = $qualityParameters[$destinationMimeData['name']];
            $outputQuality = $manager->qualityValue( $destinationMimeData['name'] );
            if ( $outputQuality )
            {
                $qualityArgument = eZSys::createShellArgument( $qualityParameter, array( '%1' => $outputQuality ) );
                $argumentList[] = $qualityArgument;
            }
        }

        if ( $filters !== false )
        {
            foreach ( $filters as $filterData )
            {
                $argumentList[] = $this->textForFilter( $filterData );
            }
        }

        $destinationURL = $destinationMimeData['url'];
        if ( $this->UseTypeTag )
            $destinationURL = $this->tagForMIMEType( $destinationMimeData ) . $this->UseTypeTag . $destinationURL;
        $argumentList[] = eZSys::escapeShellArgument( $destinationURL );

        if ( $this->PostParameters )
            $argumentList[] = $this->PostParameters;

        $systemString = implode( ' ', $argumentList );
        eZPerfLogger::accumulatorStart( 'imagemagick_image_conversion', 'Image conversion' );
        system( $systemString, $returnCode );
        eZPerfLogger::accumulatorStop( 'imagemagick_image_conversion' );

        if ( $returnCode == 0 )
        {
            if ( !file_exists( $destinationMimeData['url'] ) )
            {
                eZDebug::writeError( 'Unknown destination file: ' . $destinationMimeData['url'] . " when executing '$systemString'", 'eZImageShellHandler(' . $this->HandlerName . ')' );
                return false;
            }
            $this->changeFilePermissions( $destinationMimeData['url'] );
            return true;
        }
        else
        {
            eZDebug::writeWarning( "Failed executing: $systemString, Error code: $returnCode", __METHOD__ );
            return false;
        }

    }
172551
function nodeW3CValidator (validationPath, userOptions, done) {
	const spinner = ora(`${pkg.name} - processing ...`).start();
	let options = getOptions(userOptions);
	let execPath = [vnuCmd].concat(getArgvFromObject(options), fileset.sync(validationPath));

	// console.log(execPath.join(' '));
	exec(execPath.join(' '), function (err, stdout, stderr) {
		let output = stdout;

		if (err === null) {
			spinner.succeed(`${pkg.name} - no errors`);
		} else {
			output = stderr;
			if (options.outputAsHtml) {
				output = renderHtml(output);
			}
			spinner.fail(`${pkg.name} - found errors`);
		}

		done(err, output);
	});
}
549124
def get_base_ami(awsclient, owners):
    
    client_ec2 = awsclient.get_client('ec2')
    image_filter = [
        {
            'Name': 'state',
            'Values': [
                'available',
            ]
        },
    ]

    latest_ts = maya.MayaDT(0).datetime(naive=True)
    latest_version = StrictVersion('0.0.0')
    latest_id = None
    for i in client_ec2.describe_images(
            Owners=owners,
            Filters=image_filter
            )['Images']:
        m = re.search(r'(Ops_Base-Image)_(\d+.\d+.\d+)_(\d+)$', i['Name'])
        if m:
            version = StrictVersion(m.group(2))
            #timestamp = m.group(3)
            creation_date = parse_ts(i['CreationDate'])

            if creation_date > latest_ts and version >=latest_version:
                latest_id = i['ImageId']
                latest_ts = creation_date
                latest_version = version

    return latest_id
980358
function JSM(context, config) {
  this.context   = context;
  this.config    = config;
  this.state     = config.init.from;
  this.observers = [context];
}
477018
function initAwsStuff(region = DEFAULT_REGION) {
    ec2 = new AWS.EC2({ region });
    // ecr = new AWS.ECR({ region });
    s3 = new AWS.S3();
    sts = new AWS.STS();

    SSM = new AwsSSM(region);
    ECR = new AwsECR(region);
    CF = new AwsCF(region);
}
256019
function getEC2IAMRole(callback) {
		httpRequest({host: EC2_METADATA_HOST, path: SECURITY_CREDENTIALS_RESOURCE}, null, function(error, role, httpResponse) {
			callback(error, _.isString(role) ? role.trim() : role, httpResponse);
		});
	}