package-visible for tests
333785
int getNodeId(long nanoTime) {
        // Check if it is a time to check for updated nodeId. We need to recheck, because if duplicate node ID
        // is assigned during a network split, this will be resolved after a cluster merge.
        // We throttle the calls to avoid contention due to the lock+unlock call in getMemberListJoinVersion().
        int nodeId = this.nodeId;
        if (nodeId != NODE_ID_OUT_OF_RANGE && nextNodeIdUpdate <= nanoTime) {
            int newNodeId = getNodeEngine().getClusterService().getMemberListJoinVersion();
            assert newNodeId >= 0 : "newNodeId=" + newNodeId;
            newNodeId += nodeIdOffset;
            nextNodeIdUpdate = nanoTime + NODE_ID_UPDATE_INTERVAL_NS;
            if (newNodeId != nodeId) {
                nodeId = newNodeId;

                // If our node ID is out of range, assign NODE_ID_OUT_OF_RANGE to nodeId
                if ((nodeId & -1 << BITS_NODE_ID) != 0) {
                    outOfRangeMembers.add(getNodeEngine().getClusterService().getLocalMember().getUuid());
                    logger.severe("Node ID is out of range (" + nodeId + "), this member won't be able to generate IDs. "
                            + "Cluster restart is recommended.");
                    nodeId = NODE_ID_OUT_OF_RANGE;
                }

                // we ignore possible double initialization
                this.nodeId = nodeId;
                if (logger.isFineEnabled()) {
                    logger.fine("Node ID assigned to '" + name + "': " + nodeId);
                }
            }
        }

        return nodeId;
    }
1347918
def find(self, package, **kwargs):
        
        if not exists(package):
            return None
        name, path = None, None
        enforce_init = kwargs.pop('enforce_init', True)
        if isdir(package):
            if isfile(join(package, '__init__.py')) or not enforce_init:
                name, path = basename(package), package
        elif isfile(package) and package.endswith('.py'):
            name, path = splitext(basename(package))[0], package
        if name and path:
            return PackageSpec(name, path)
        return None
1170453
function checkPkg(pkgDir, scopes) {
  var errors;
  try {
    var config = {packageDir: pkgDir};
    if (scopes) {
      config.scopeList = scopes;
    }
    var checked = checkDeps.sync(config);
    if (checked.error.length) {
      errors = checked.error;
    }
  } finally {
    // eslint-disable-next-line no-unsafe-finally
    return errors;
  }
}
983222
def inspect(package):
    
    team, owner, pkg = parse_package(package)

    store, pkgroot = PackageStore.find_package(team, owner, pkg)
    if pkgroot is None:
        raise CommandException("Package {package} not found.".format(package=package))

    def _print_children(children, prefix, path):
        for idx, (name, child) in enumerate(children):
            if idx == len(children) - 1:
                new_prefix = u"└─"
                new_child_prefix = u"  "
            else:
                new_prefix = u"├─"
                new_child_prefix = u"│ "
            _print_node(child, prefix + new_prefix, prefix + new_child_prefix, name, path)

    def _print_node(node, prefix, child_prefix, name, path):
        name_prefix = u"─ "
        if isinstance(node, GroupNode):
            children = list(node.children.items())
            if children:
                name_prefix = u"┬ "
            print(prefix + name_prefix + name)
            _print_children(children, child_prefix, path + name)
        elif node.metadata['q_target'] == TargetType.PANDAS.value:
            df = store.load_dataframe(node.hashes)
            assert isinstance(df, pd.DataFrame)
            types = ", ".join("%r: %s" % (name, dtype) for name, dtype in df.dtypes.items())
            if len(types) > 64:
                types = types[:63] + u"…"
            info = "shape %s, types %s" % (df.shape, types)
            print(prefix + name_prefix + name + ": " + info)
        else:
            print(prefix + name_prefix + name)

    print(store.package_path(team, owner, pkg))
    _print_children(children=pkgroot.children.items(), prefix='', path='')
376098
def main():
    
    from os import path as op
    from inspect import getfile, currentframe
    from setuptools import setup, find_packages
    from niworkflows.__about__ import (
        __packagename__,
        __author__,
        __email__,
        __maintainer__,
        __license__,
        __description__,
        __longdesc__,
        __url__,
        DOWNLOAD_URL,
        CLASSIFIERS,
        REQUIRES,
        SETUP_REQUIRES,
        LINKS_REQUIRES,
        TESTS_REQUIRES,
        EXTRA_REQUIRES,
    )

    pkg_data = {
        'niworkflows': [
            'data/t1-mni_registration*.json',
            'data/bold-mni_registration*.json',
            'reports/figures.json',
            'reports/fmriprep.yml',
            'reports/report.tpl',
        ]}

    root_dir = op.dirname(op.abspath(getfile(currentframe())))
    version = None
    cmdclass = {}
    if op.isfile(op.join(root_dir, __packagename__, 'VERSION')):
        with open(op.join(root_dir, __packagename__, 'VERSION')) as vfile:
            version = vfile.readline().strip()
        pkg_data[__packagename__].insert(0, 'VERSION')

    if version is None:
        import versioneer
        version = versioneer.get_version()
        cmdclass = versioneer.get_cmdclass()

    setup(
        name=__packagename__,
        version=version,
        description=__description__,
        long_description=__longdesc__,
        author=__author__,
        author_email=__email__,
        maintainer=__maintainer__,
        maintainer_email=__email__,
        license=__license__,
        url=__url__,
        download_url=DOWNLOAD_URL,
        classifiers=CLASSIFIERS,
        packages=find_packages(exclude=['*.tests']),
        zip_safe=False,
        # Dependencies handling
        setup_requires=SETUP_REQUIRES,
        install_requires=list(set(REQUIRES)),
        dependency_links=LINKS_REQUIRES,
        tests_require=TESTS_REQUIRES,
        extras_require=EXTRA_REQUIRES,
        # Data
        package_data=pkg_data,
        include_package_data=True,
        cmdclass=cmdclass,
    )
807891
def get_available_packages(dir)
      packages = Dir["#{Lyp.packages_dir}/**/*"].inject({}) do |m, p|
        entry_point_path = File.join(p, MAIN_PACKAGE_FILE)
        if File.file?(entry_point_path)
          package_name = p.gsub(/^#{Lyp.packages_dir}\//, '')
          m[package_name] = DependencyPackage.new(entry_point_path)
        end
        m
      end

      forced_paths = @opts[:forced_package_paths] || {}

      if @opts[:forced_package_paths]
        @opts[:forced_package_paths].each do |package, path|
          packages["#{package}@forced"] = DependencyPackage.new(File.join(path, MAIN_PACKAGE_FILE))
        end
      end

      packages
    end
1302270
def package_info(self):
        
        self.cpp_info.libs = tools.collect_libs(self)
        self.user_info.flatc = os.path.join(self.package_folder, "bin", "flatc")
711192
def packageExists(self, package):
		
		url = "%s/packages" % self.base_url
		params = {"pattern": package}
		response = requests.get(url, params=params)
		if response.status_code != requests.codes.ok:
			return False

		return True
508688
private void checkNameVisibility(Scope scope, Node name) {
    if (!name.isName()) {
      return;
    }

    Var var = scope.getVar(name.getString());
    if (var == null) {
      return;
    }

    Visibility v = checkPrivateNameConvention(
        AccessControlUtils.getEffectiveNameVisibility(
            name, var, defaultVisibilityForFiles), name);

    switch (v) {
      case PACKAGE:
        if (!isPackageAccessAllowed(var, name)) {
          compiler.report(
              JSError.make(
                  name,
                  BAD_PACKAGE_PROPERTY_ACCESS,
                  name.getString(),
                  var.getSourceFile().getName()));
        }
        break;
      case PRIVATE:
        if (!isPrivateAccessAllowed(var, name)) {
          compiler.report(
              JSError.make(
                  name,
                  BAD_PRIVATE_GLOBAL_ACCESS,
                  name.getString(),
                  var.getSourceFile().getName()));
        }
        break;
      default:
        // Nothing to do for PUBLIC and PROTECTED
        // (which is irrelevant for names).
        break;
    }
  }
1035470
def verify_package(verbose=True):
    
    results = (
        verify_directory(verbose),
        verify_experiment_module(verbose),
        verify_config(verbose),
        verify_no_conflicts(verbose),
    )

    ok = all(results)

    return ok
639946
function Package(opts) {
  this.path = opts.path;
  this.files = opts.files;
  this.metadataTypeXmlNames = opts.metadataTypeXmlNames;
  this.subscription = opts.subscription;
  this.project = opts.project;
}
213350
def parse_setup() -> Tuple[PackagesType, PackagesType, Set[str], Set[str]]:
    """"""
    essential_packages: PackagesType = {}
    test_packages: PackagesType = {}
    essential_duplicates: Set[str] = set()
    test_duplicates: Set[str] = set()

    with open('setup.py') as setup_file:
        contents = setup_file.read()

    # Parse out essential packages.
    package_string = re.search(r"""install_requires=\[[\s\n]*['"](.*?)['"],?[\s\n]*\]""",
                               contents, re.DOTALL).groups()[0].strip()
    for package in re.split(r"""['"],[\s\n]+['"]""", package_string):
        module, version = parse_package(package)
        if module in essential_packages:
            essential_duplicates.add(module)
        else:
            essential_packages[module] = version

    # Parse packages only needed for testing.
    package_string = re.search(r"""tests_require=\[[\s\n]*['"](.*?)['"],?[\s\n]*\]""",
                               contents, re.DOTALL).groups()[0].strip()
    for package in re.split(r"""['"],[\s\n]+['"]""", package_string):
        module, version = parse_package(package)
        if module in test_packages:
            test_duplicates.add(module)
        else:
            test_packages[module] = version

    return essential_packages, test_packages, essential_duplicates, test_duplicates
856071
function(location) {
  var found = false;

  while(!found) {
    if (exists(location + '/package.json')) {
      found = location;
    } else if (location !== '/') {
      location = path.dirname(location);
    } else {
      return false;
    }
  }

  return location;
}
1241496
function(sandbox) {

    function stat(filename) {
        filename = path._makeLong(filename);
        const cache = stat.cache;
        if (cache !== null) {
            const result = cache.get(filename);
            if (result !== undefined) return result;
        }
        const result = internalModuleStat(filename);
        if (cache !== null) cache.set(filename, result);
        return result;
    }
    stat.cache = null;


    function Module(id, parent) {
        this.id = id;
        this.exports = {};
        this.parent = parent;
        if (parent && parent.children) {
            parent.children.push(this);
        }

        this.filename = null;
        this.loaded = false;
        this.children = [];
    }

    Module._cache = {};
    Module._pathCache = {};
    Module._extensions = {};
    var modulePaths = [];
    Module.globalPaths = [];

    Module.wrapper = ['(function (exports, require, module, __filename, __dirname) { ', '\n});'];
    Module.wrap = function (script) {
        return Module.wrapper[0] + script + Module.wrapper[1];
    };

// given a module name, and a list of paths to test, returns the first
// matching file in the following precedence.
//
// require("a.<ext>")
//   -> a.<ext>
//
// require("a")
//   -> a
//   -> a.<ext>
//   -> a/index.<ext>

// check if the directory is a package.json dir
    const packageMainCache = {};

    function readPackage(requestPath) {
        if (hasOwnProperty(packageMainCache, requestPath)) {
            return packageMainCache[requestPath];
        }

        const jsonPath = path.resolve(requestPath, 'package.json');
        const json = internalModuleReadFile(path._makeLong(jsonPath));

        if (json === undefined) {
            return false;
        }

        try {
            var pkg = packageMainCache[requestPath] = JSON.parse(json).main;
        } catch (e) {
            e.path = jsonPath;
            e.message = 'Error parsing ' + jsonPath + ': ' + e.message;
            throw e;
        }
        return pkg;
    }

    function tryPackage(requestPath, exts, isMain) {
        var pkg = readPackage(requestPath);

        if (!pkg) return false;

        var filename = path.resolve(requestPath, pkg);
        return tryFile(filename, isMain) ||
            tryExtensions(filename, exts, isMain) ||
            tryExtensions(path.resolve(filename, 'index'), exts, isMain);
    }

// check if the file exists and is not a directory
// if using --preserve-symlinks and isMain is false,
// keep symlinks intact, otherwise resolve to the
// absolute realpath.
    function tryFile(requestPath, isMain) {
        const rc = stat(requestPath);
        if (preserveSymlinks && !isMain) {
            return rc === 0 && path.resolve(requestPath);
        }
        return rc === 0 && fs.realpathSync(requestPath);
    }

// given a path check a the file exists with any of the set extensions
    function tryExtensions(p, exts, isMain) {
        for (var i = 0; i < exts.length; i++) {
            const filename = tryFile(p + exts[i], isMain);

            if (filename) {
                return filename;
            }
        }
        return false;
    }

    var warned = false;
    Module._findPath = function (request, paths, isMain) {
        if (path.isAbsolute(request)) {
            paths = [''];
        } else if (!paths || paths.length === 0) {
            return false;
        }

        const cacheKey = JSON.stringify({request: request, paths: paths});
        if (Module._pathCache[cacheKey]) {
            return Module._pathCache[cacheKey];
        }

        var exts;
        const trailingSlash = request.length > 0 &&
            request.charCodeAt(request.length - 1) === 47/*/*/;

        // For each path
        for (var i = 0; i < paths.length; i++) {
            // Don't search further if path doesn't exist
            const curPath = paths[i];
            if (curPath && stat(curPath) < 1) continue;
            var basePath = path.resolve(curPath, request);
            var filename;

            if (!trailingSlash) {
                const rc = stat(basePath);
                if (rc === 0) {  // File.
                    if (preserveSymlinks && !isMain) {
                        filename = path.resolve(basePath);
                    } else {
                        filename = fs.realpathSync(basePath);
                    }
                } else if (rc === 1) {  // Directory.
                    if (exts === undefined)
                        exts = Object.keys(Module._extensions);
                    filename = tryPackage(basePath, exts, isMain);
                }

                if (!filename) {
                    // try it with each of the extensions
                    if (exts === undefined)
                        exts = Object.keys(Module._extensions);
                    filename = tryExtensions(basePath, exts, isMain);
                }
            }

            if (!filename) {
                if (exts === undefined)
                    exts = Object.keys(Module._extensions);
                filename = tryPackage(basePath, exts, isMain);
            }

            if (!filename) {
                // try it with each of the extensions at "index"
                if (exts === undefined)
                    exts = Object.keys(Module._extensions);
                filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain);
            }

            if (filename) {
                Module._pathCache[cacheKey] = filename;
                return filename;
            }
        }
        return false;
    };

// 'node_modules' character codes reversed
    var nmChars = [115, 101, 108, 117, 100, 111, 109, 95, 101, 100, 111, 110];
    var nmLen = nmChars.length;
    if (process.platform === 'win32') {
        // 'from' is the __dirname of the module.
        Module._nodeModulePaths = function (from) {
            // guarantee that 'from' is absolute.
            from = path.resolve(from);

            // note: this approach *only* works when the path is guaranteed
            // to be absolute.  Doing a fully-edge-case-correct path.split
            // that works on both Windows and Posix is non-trivial.
            const paths = [];
            var p = 0;
            var last = from.length;
            for (var i = from.length - 1; i >= 0; --i) {
                const code = from.charCodeAt(i);
                if (code === 92/*\*/ || code === 47/*/*/) {
                    if (p !== nmLen)
                        paths.push(from.slice(0, last) + '\\node_modules');
                    last = i;
                    p = 0;
                } else if (p !== -1 && p < nmLen) {
                    if (nmChars[p] === code) {
                        ++p;
                    } else {
                        p = -1;
                    }
                }
            }

            return paths;
        };
    } else { // posix
        // 'from' is the __dirname of the module.
        Module._nodeModulePaths = function (from) {
            // guarantee that 'from' is absolute.
            from = path.resolve(from);
            // Return early not only to avoid unnecessary work, but to *avoid* returning
            // an array of two items for a root: [ '//node_modules', '/node_modules' ]
            if (from === '/')
                return ['/node_modules'];

            // note: this approach *only* works when the path is guaranteed
            // to be absolute.  Doing a fully-edge-case-correct path.split
            // that works on both Windows and Posix is non-trivial.
            const paths = [];
            var p = 0;
            var last = from.length;
            for (var i = from.length - 1; i >= 0; --i) {
                const code = from.charCodeAt(i);
                if (code === 47/*/*/) {
                    if (p !== nmLen)
                        paths.push(from.slice(0, last) + '/node_modules');
                    last = i;
                    p = 0;
                } else if (p !== -1 && p < nmLen) {
                    if (nmChars[p] === code) {
                        ++p;
                    } else {
                        p = -1;
                    }
                }
            }

            return paths;
        };
    }


// 'index.' character codes
    var indexChars = [105, 110, 100, 101, 120, 46];
    var indexLen = indexChars.length;
    Module._resolveLookupPaths = function (request, parent) {
        if (_NATIVE_MODULES.indexOf(request) >= 0) {
            return [request, []];
        }

        var reqLen = request.length;
        // Check for relative path
        if (reqLen < 2 ||
            request.charCodeAt(0) !== 46/*.*/ ||
            (request.charCodeAt(1) !== 46/*.*/ &&
            request.charCodeAt(1) !== 47/*/*/)) {
            var paths = modulePaths;
            if (parent) {
                if (!parent.paths)
                    paths = parent.paths = [];
                else
                    paths = parent.paths.concat(paths);
            }

            // Maintain backwards compat with certain broken uses of require('.')
            // by putting the module's directory in front of the lookup paths.
            if (request === '.') {
                if (parent && parent.filename) {
                    paths.unshift(path.dirname(parent.filename));
                } else {
                    paths.unshift(path.resolve(request));
                }
            }

            return [request, paths];
        }

        // with --eval, parent.id is not set and parent.filename is null
        if (!parent || !parent.id || !parent.filename) {
            // make require('./path/to/foo') work - normally the path is taken
            // from realpath(__filename) but with eval there is no filename
            var mainPaths = ['.'].concat(Module._nodeModulePaths('.'), modulePaths);
            return [request, mainPaths];
        }

        // Is the parent an index module?
        // We can assume the parent has a valid extension,
        // as it already has been accepted as a module.
        const base = path.basename(parent.filename);
        var parentIdPath;
        if (base.length > indexLen) {
            var i = 0;
            for (; i < indexLen; ++i) {
                if (indexChars[i] !== base.charCodeAt(i))
                    break;
            }
            if (i === indexLen) {
                // We matched 'index.', let's validate the rest
                for (; i < base.length; ++i) {
                    const code = base.charCodeAt(i);
                    if (code !== 95/*_*/ &&
                        (code < 48/*0*/ || code > 57/*9*/) &&
                        (code < 65/*A*/ || code > 90/*Z*/) &&
                        (code < 97/*a*/ || code > 122/*z*/))
                        break;
                }
                if (i === base.length) {
                    // Is an index module
                    parentIdPath = parent.id;
                } else {
                    // Not an index module
                    parentIdPath = path.dirname(parent.id);
                }
            } else {
                // Not an index module
                parentIdPath = path.dirname(parent.id);
            }
        } else {
            // Not an index module
            parentIdPath = path.dirname(parent.id);
        }
        var id = path.resolve(parentIdPath, request);

        // make sure require('./path') and require('path') get distinct ids, even
        // when called from the toplevel js file
        if (parentIdPath === '.' && id.indexOf('/') === -1) {
            id = './' + id;
        }

        return [id, [path.dirname(parent.filename)]];
    };


// Check the cache for the requested file.
// 1. If a module already exists in the cache: return its exports object.
// 2. If the module is native: call `NativeModule.require()` with the
//    filename and return the result.
// 3. Otherwise, create a new module for the file and save it to the cache.
//    Then have it load  the file contents before returning its exports
//    object.
    Module._load = function (request, parent, isMain) {

        var filename = Module._resolveFilename(request, parent, isMain);

        events.emit('require', request, filename);

        if (!userOptions.reload) {
            var cachedModule = Module._cache[filename];
            if (cachedModule) {
                if (_NATIVE_MODULES.indexOf(filename) >= 0) return cachedModule;
                else return cachedModule.exports;
            }
        }

//************************** override list

        if (_NATIVE_MODULES.indexOf(filename) >= 0) {
            var res = NativeModuleRequire(filename);
            if (_.isArray(userOptions._useNativeModulesCopyList)) {
                if (userOptions._useNativeModulesCopyList.indexOf(filename) >= 0)
                    res = _.cloneDeep(res);
            }
            Module._cache[filename] = res;
            return res;
        }

        var module = new Module(filename, parent);

        if (isMain) {
            process.mainModule = module;
            module.id = '.';
        }

        Module._cache[filename] = module;

        tryModuleLoad(module, filename);

        return module.exports;
    };

    function tryModuleLoad(module, filename) {
        var threw = true;
        try {
            module.load(filename);
            threw = false;
        } finally {
            if (threw) {
                delete Module._cache[filename];
            }
        }
    }

    Module._resolveFilename = function (request, parent, isMain) {
        if (_NATIVE_MODULES.indexOf(request) >= 0) {
            return request;
        }

        var resolvedModule = Module._resolveLookupPaths(request, parent);
        var id = resolvedModule[0];
        var paths = resolvedModule[1];

        var filename = Module._findPath(request, paths, isMain);
        if (!filename) {
            var err = new Error("Cannot find module '" + request + "'");
            err.code = 'MODULE_NOT_FOUND';
            throw err;
        }
        return filename;
    };


// Given a file name, pass it to the proper extension handler.
    Module.prototype.load = function (filename) {

        assert(!this.loaded);
        this.filename = filename;
        this.paths = Module._nodeModulePaths(path.dirname(filename));

        var extension = path.extname(filename) || '.js';
        if (!Module._extensions[extension]) extension = '.js';
        Module._extensions[extension](this, filename);
        this.loaded = true;
    };


// Loads a module at the given file path. Returns that module's
// `exports` property.
    Module.prototype.require = function (path) {

        assert(path, 'missing path');
        assert(typeof path === 'string', 'path must be a string');

        // This is the require we need to change !!!!!!
        events.emit('beforeRequire', path);

        if (userOptions.Blacklist.indexOf(path) >= 0) {
            throw new Error('Use of module (' + path + ') is restricted.');
        }
        if (userOptions.Whitelist.length > 0 && userOptions.Whitelist.indexOf(path) < 0) {
            throw new Error('Module (' + path + ') is not available.');
        }
        if (!userOptions.allowExternalModules && _NATIVE_MODULES.indexOf(path) < 0) {
            throw new Error('Use of external modules is restricted, have (' + path + ')');
        }

        var resultModule = Module._load(path, this, /* isMain */ false);

        events.emit('afterRequire', resultModule);

        return resultModule;
    };


// Resolved path to process.argv[1] will be lazily placed here
// (needed for setting breakpoint when called with --debug-brk)
    var resolvedArgv;


// Run the file contents in the correct scope or sandbox. Expose
// the correct helper variables (require, module, exports) to
// the file.
// Returns exception, if any.
    Module.prototype._compile = function (content, filename) {
        // Remove shebang
        var contLen = content.length;
        if (contLen >= 2) {
            if (content.charCodeAt(0) === 35/*#*/ &&
                content.charCodeAt(1) === 33/*!*/) {
                if (contLen === 2) {
                    // Exact match
                    content = '';
                } else {
                    // Find end of shebang line and slice it off
                    var i = 2;
                    for (; i < contLen; ++i) {
                        var code = content.charCodeAt(i);
                        if (code === 10/*\n*/ || code === 13/*\r*/)
                            break;
                    }
                    if (i === contLen)
                        content = '';
                    else {
                        // Note that this actually includes the newline character(s) in the
                        // new output. This duplicates the behavior of the regular expression
                        // that was previously used to replace the shebang line
                        content = content.slice(i);
                    }
                }
            }
        }

        // create wrapper function
        var wrapper = Module.wrap(content);

        var compiledWrapper;
        if (userOptions.useSandbox && sandbox) {

            if (!vm.isContext(sandbox)) vm.createContext(sandbox);
            compiledWrapper = vm.runInContext(wrapper, sandbox,{
                filename: filename,
                lineOffset: 0,
                displayErrors: true
            });
        } else {

            compiledWrapper = vm.runInThisContext(wrapper, {
                filename: filename,
                lineOffset: 0,
                displayErrors: true
            });
        }

        var dirname = path.dirname(filename);
        var require = internalModule.makeRequireFunction.call(this);
        var args = [this.exports, require, this, filename, dirname];
        var depth = internalModule.requireDepth;
        if (depth === 0) stat.cache = new Map();
        var result = compiledWrapper.apply(this.exports, args);
        if (depth === 0) stat.cache = null;
        return result;
    };


// Native extension for .js
    Module._extensions['.js'] = function (module, filename) {
        var content = fs.readFileSync(filename, 'utf8');
        module._compile(internalModule.stripBOM(content), filename);
    };


// Native extension for .json
    Module._extensions['.json'] = function (module, filename) {
        var content = fs.readFileSync(filename, 'utf8');
        try {
            module.exports = JSON.parse(internalModule.stripBOM(content));
        } catch (err) {
            err.message = filename + ': ' + err.message;
            throw err;
        }
    };


//Native extension for .node
    Module._extensions['.node'] = function (module, filename) {
        return process.dlopen(module, path._makeLong(filename));
    };


    Module._initPaths = function () {
        const isWindows = process.platform === 'win32';

        var homeDir;
        if (isWindows) {
            homeDir = process.env.USERPROFILE;
        } else {
            homeDir = process.env.HOME;
        }

        var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];

        if (homeDir) {
            paths.unshift(path.resolve(homeDir, '.node_libraries'));
            paths.unshift(path.resolve(homeDir, '.node_modules'));
        }

        var nodePath = process.env['NODE_PATH'];
        if (nodePath) {
            paths = nodePath.split(path.delimiter).filter(function (path) {
                return !!path;
            }).concat(paths);
        }

        modulePaths = paths;

        // clone as a read-only copy, for introspection.
        Module.globalPaths = modulePaths.slice(0);
    };

    Module._initPaths();


//----- Apply New Extensions ----

    var extentionList = userOptions._extensions;
    for (var ext in extentionList) {

        Module._extensions[ext] = function (module, filename) {

            var source = stripBOM(fs.readFileSync(filename, 'utf8'));
            if (extentionList[ext].every(function (method) {
                    var userResult = null;
                    userResult = method(source, filename);

                    if (!userResult || userResult === null) userResult = source;

                    if (!util.isString(userResult)) {   // stop operation, return this value
                        module.exports = userResult;
                        return false;
                    } else {
                        source = userResult;   // set the newly set ret value
                        return true;
                    }
                })) module._compile(source, filename);
        };
    }

//------ Apply New Search Paths
    var paths = userOptions._pathList;

    if (paths.length > 0) {

        var nodePath = process.env['NODE_PATH'];
        var DefaultPaths = process.env['NODE_PATH'];
        if (!nodePath) nodePath = ""; else nodePath += path.delimiter;
        for (var i = 0; i < paths.length; i++) {
            nodePath += paths[i] + path.delimiter;
        }
        process.env['NODE_PATH'] = nodePath;
        Module._initPaths();
        process.env['NODE_PATH'] = DefaultPaths;
    }

//---- End Apply New Paths
    function resolve(request) {
        return Module._resolveFilename(request, self);
    }
    var res = Module.prototype.require;
    res.resolve = resolve;
    res.main = process.mainModule;
    res.extensions = Module._extensions;
    res.cache = Module._cache;

    return res;
}
541414
def output_package(dist):
        """"""
        if dist_is_editable(dist):
            return '%s (%s, %s)' % (
                dist.project_name,
                dist.version,
                dist.location,
            )
        return '%s (%s)' % (dist.project_name, dist.version)
490778
function getBanner (packagePath) {
  // Read package.json
  const pkg = require(packagePath)
  const { name, version, license } = pkg

  // Remove '#readme' from the URL
  const url = pkg.homepage.replace(/#.*$/, '')

  // Print an always-showing banner (with a !), this way it'll show up
  // in minified sources as well
  return `/*! ${name} v${version} | ${license} | ${url} */`
}
939128
def show_distributions(self, show):
        
        show_metadata = self.options.metadata

        #Search for any plugins with active CLI options with add_column() method
        plugins = self.get_plugin("add_column")

        #Some locations show false positive for 'development' packages:
        ignores = ["/UNIONFS", "/KNOPPIX.IMG"]

        #Check if we're in a workingenv
        #See http://cheeseshop.python.org/pypi/workingenv.py
        workingenv = os.environ.get('WORKING_ENV')
        if workingenv:
            ignores.append(workingenv)

        dists = Distributions()
        results = None
        for (dist, active) in dists.get_distributions(show, self.project_name,
                self.version):
            metadata = get_metadata(dist)
            for prefix in ignores:
                if dist.location.startswith(prefix):
                    dist.location = dist.location.replace(prefix, "")
            #Case-insensitve search because of Windows
            if dist.location.lower().startswith(get_python_lib().lower()):
                develop = ""
            else:
                develop = dist.location
            if metadata:
                add_column_text = ""
                for my_plugin in plugins:
                    #See if package is 'owned' by a package manager such as
                    #portage, apt, rpm etc.
                    #add_column_text += my_plugin.add_column(filename) + " "
                    add_column_text += my_plugin.add_column(dist) + " "
                self.print_metadata(metadata, develop, active, add_column_text)
            else:
                print(str(dist) + " has no metadata")
            results = True
        if not results and self.project_name:
            if self.version:
                pkg_spec = "%s==%s" % (self.project_name, self.version)
            else:
                pkg_spec = "%s" % self.project_name
            if show == "all":
                self.logger.error("There are no versions of %s installed." \
                        % pkg_spec)
            else:
                self.logger.error("There are no %s versions of %s installed." \
                        % \
                        (show, pkg_spec))
            return 2
        elif show == "all" and results and self.options.fields:
            print("Versions with '*' are non-active.")
            print("Versions with '!' are deployed in development mode.")