attempt to find the stack (and optionally the step) from loaded middleware
507577
function findMiddleware (state, spec) {
  const parts = spec.split('.')
  const stackName = parts[ 0 ]
  const stepName = parts[ 1 ]
  const stack = state.stacks[ stackName ]
  if (!stack) {
    throw new Error(`A stack named '${stackName}' was specified but not found`)
  } else if (!stepName) {
    return stack
  }
  if (!stack.calls[ stepName ]) {
    throw new Error(`A step named '${stepName}' for stack '${stackName}' was specified but not found`)
  }
  // a new name is warranted so that we don't end up over-writing a previous step name
  // or have a future name over-write this
  const newName = [ stackName, stepName ].join(':')
  return { name: newName, call: stack.calls[ stepName ] }
}
331332
function findModuleVersion(modulePath, load) {
  if (modulePath) {
    var pjson = path.join(modulePath, 'package.json');
    if (fs.existsSync(pjson)) {
      return load(pjson).version;
    }
  }
  return process.version;
}
289797
function StackTrace$$getSync(opts) {
            opts = _merge(_options, opts);
            var err = _generateError();
            var stack = _isShapedLikeParsableError(err) ? ErrorStackParser.parse(err) : StackGenerator.backtrace(opts);
            return _filtered(stack, opts.filter);
        }
555216
def _guess_caller():
    
    import inspect
    global _caller_path

    caller = inspect.stack()[1]
    caller_module = inspect.getmodule(caller[0])
    if hasattr(caller_module, '__file__'):
        _caller_path = os.path.abspath(caller_module.__file__)
    return _caller_path
1214848
private String getStackName() {
        String res = null;
        if (object() != null && object().stackName() != null) {
            res = object().stackName();
        } else if (getFirstKeyPart() instanceof String) {
            res = (String) getFirstKeyPart();
        }
        return res;
    }
1046485
function extractStacktrace( e, offset ) {
	offset = offset === undefined ? 4 : offset;

	var stack, include, i;

	if ( e.stack ) {
		stack = e.stack.split( "\n" );
		if ( /^error$/i.test( stack[ 0 ] ) ) {
			stack.shift();
		}
		if ( fileName ) {
			include = [];
			for ( i = offset; i < stack.length; i++ ) {
				if ( stack[ i ].indexOf( fileName ) !== -1 ) {
					break;
				}
				include.push( stack[ i ] );
			}
			if ( include.length ) {
				return include.join( "\n" );
			}
		}
		return stack[ offset ];

	// Support: Safari <=6 only
	} else if ( e.sourceURL ) {

		// exclude useless self-reference for generated Error objects
		if ( /qunit.js$/.test( e.sourceURL ) ) {
			return;
		}

		// for actual exceptions, this is useful
		return e.sourceURL + ":" + e.line;
	}
}
1229894
function() {
            var next = steps.indexOf( activeStep ) + 1;
            next = next < steps.length ? steps[ next ] : steps[ 0 ];

            return goto( next );
        }
629007
function findOwnerStack(instance) {
    if (!instance) {
      return [];
    }

    var stack = [];
    do {
      stack.push(instance);
    } while (instance = instance._currentElement._owner);
    stack.reverse();
    return stack;
  }
150692
def findCaller(self, stack_info=False, callers=0):
        
        f = logging.currentframe()
        #On some versions of IronPython, currentframe() returns None if
        #IronPython isn't run with -X:Frames.
        if f is not None:
            if callers > 0:
                # yes we can!
                co = f.f_code
                logger.debug2("%s:%s", co.co_filename, co.co_name)
            f = f.f_back
        rv = "(unknown file)", 0, "(unknown function)", None
        countdown = callers
        while hasattr(f, "f_code"):
            co = f.f_code
            filename = os.path.normcase(co.co_filename)
            if callers > 0:
                # yes we can!
                logger.debug2("%s:%s", co.co_filename, co.co_name)
            if filename in(_srcfile, logging._srcfile):
                f = f.f_back
                continue
            if countdown > 0:
                f = f.f_back
                countdown -= 1
                continue
            sinfo = None
            if stack_info:
                sio = io.StringIO()
                sio.write('Stack (most recent call last):\n')
                traceback.print_stack(f, file=sio)
                sinfo = sio.getvalue()
                if sinfo[-1] == '\n':
                    sinfo = sinfo[:-1]
                sio.close()
            rv = (co.co_filename, f.f_lineno, co.co_name, sinfo)
            break
        return rv
232979
function parseStacktrace(e, scriptName) {
    var UNKNOWN_FUNCTION = '<unknown>';
    var node = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;
    var lines = e.stacktrace.split('\n');
    var stack = [];
    var parts;
    var element;

    for (var i = 0, j = lines.length; i < j; ++i) {
        if ((parts = node.exec(lines[i]))) {
            element = {
                'file': parts[2],
                'method': parts[1] || UNKNOWN_FUNCTION,
                'line': parts[2] === scriptName ? +parts[3] - scriptContentLineOffset : +parts[3],
                'column': parts[4] ? +parts[4] : null
            };
        } else {
            continue;
        }
        stack.push(element);
    }

    return stack;
}
43902
function(event, opt_lookForEndEvent) {
      var sf;
      var stack;
      if (opt_lookForEndEvent) {
        sf = event.esf;
        stack = event.estack;
      } else {
        sf = event.sf;
        stack = event.stack;
      }
      if (stack !== undefined && sf !== undefined) {
        this.model_.importWarning({
          type: 'stack_frame_and_stack_error',
          message: 'Event at ' + event.ts +
              ' cannot have both a stack and a stackframe.'
        });
        return undefined;
      }

      if (stack !== undefined)
        return this.model_.resolveStackToStackFrame_(event.pid, stack);
      if (sf === undefined)
        return undefined;

      var stackFrame = this.model_.stackFrames['g' + sf];
      if (stackFrame === undefined) {
        this.model_.importWarning({
          type: 'sample_import_error',
          message: 'No frame for ' + sf
        });
        return;
      }
      return stackFrame;
    }
1056298
private Scope peek() throws JSONException {
		if (this.stack.isEmpty()) {
			throw new JSONException("Nesting problem");
		}
		return this.stack.get(this.stack.size() - 1);
	}
1344683
function getCallerFile () {
  const prepareStackTraceOrig = Error.prepareStackTrace
  let callerfile = 'unknown'

  try {
    Error.prepareStackTrace = function (error, stack) { return stack } // eslint-disable-line handle-callback-err

    const err = new Error()
    let currentfile = err.stack.shift().getFileName()

    // pop off the error stack until we find a file that is not this one :)
    while (err.stack.length) {
      callerfile = err.stack.shift().getFileName()
      if (currentfile !== callerfile) break
    }
  } finally {
    Error.prepareStackTrace = prepareStackTraceOrig
  }

  return callerfile
}
1188035
final boolean tryPushStack(Completion c) {
    Completion h = stack;
    lazySetNext(c, h);
    return U.compareAndSwapObject(this, STACK, h, c);
  }
936180
def _parse_stack_cfg(content):
    '''
    
    '''
    try:
        obj = salt.utils.yaml.safe_load(content)
        if isinstance(obj, list):
            return obj
    except Exception as e:
        pass
    return content.splitlines()
950869
public static Stack getStack() {
        Stack stack = interceptionContexts.get();
        if (stack == null) {
            stack = new Stack(interceptionContexts);
            interceptionContexts.set(stack);
        }
        return stack;
    }
890364
def _get_stack(self, orchestration_client, stack_name):
        """"""

        try:
            stack = orchestration_client.stacks.get(stack_name)
            self.log.info("Stack found, will be doing a stack update")
            return stack
        except HTTPNotFound:
            self.log.info("No stack found, will be doing a stack create")