FIXME refactor this mammoth using submethods...
492602
public String[] reportDiff(String[] textOnLeft, String[] textOnRight)
	{
		List<String> _report = new LinkedList<String>();
		int _currentLeft = 0;
		int _currentRight = 0;

		while (_currentLeft < textOnLeft.length || _currentRight < textOnRight.length)
		{
			if (_currentLeft < textOnLeft.length && _currentRight < textOnRight.length)
			{
				// normal case
				String _left = getTextLine(textOnLeft, _currentLeft);
				String _right = getTextLine(textOnRight, _currentRight);
				if (isIgnoreEmptyLines())
				{
					boolean _hasSkippedLine = false;
					if (0 == _left.length())
					{
						++_currentLeft;
						_hasSkippedLine = true;
					}
					if (0 == _right.length())
					{
						++_currentRight;
						_hasSkippedLine = true;
					}
					if (_hasSkippedLine) continue;
				}
				if (_left.equals(_right))
				{
					++_currentLeft;
					++_currentRight;
					continue;
				}
				else
				{
					// find the range of the difference
					int _foundLeft = findNextMatchingLine(textOnLeft, _currentLeft, _right);

					int _foundRight = findNextMatchingLine(textOnRight, _currentRight, _left);

					if (-1 == _foundLeft && -1 == _foundRight)
					{
						// maybe only this line is different
						outputReportLine(_report, myTemplateOnLeft, textOnLeft, _currentLeft);
						_currentLeft++;

						outputReportLine(_report, myTemplateOnRight, textOnRight, _currentRight);
						_currentRight++;
					}
					else if (-1 == _foundLeft)
					{
						// added lines on right
						outputReportLine(_report, myTemplateOnLeft, textOnLeft, _currentLeft);
						_currentLeft++;

						++_foundRight;
						outputRangeOfTextInReport(_report, myTemplateOnRight, textOnRight, _currentRight, _foundRight);
						_currentRight = _foundRight;
					}
					else if (-1 == _foundRight)
					{
						// added lines on left
						++_foundLeft;
						outputRangeOfTextInReport(_report, myTemplateOnLeft, textOnLeft, _currentLeft, _foundLeft);
						_currentLeft = _foundLeft;

						outputReportLine(_report, myTemplateOnRight, textOnRight, _currentRight);
						_currentRight++;
					}
					else
					{
						// 2 possibilities, find the minimum range size
						++_foundLeft;
						int _leftSize = _foundLeft - _currentLeft;

						++_foundRight;
						int _rightSize = _foundRight - _currentRight;

						if (_leftSize < _rightSize)
						{
							// choose left edits
							outputRangeOfTextInReport(_report, myTemplateOnLeft, textOnLeft, _currentLeft, _foundLeft);
							_currentLeft = _foundLeft + 1;

							outputReportLine(_report, myTemplateOnRight, textOnRight, _currentRight);
							_currentRight++;
						}
						else
						{
							// choose right edits
							outputReportLine(_report, myTemplateOnLeft, textOnLeft, _currentLeft);
							_currentLeft++;

							outputRangeOfTextInReport(_report, myTemplateOnRight, textOnRight, _currentRight, _foundRight);
							_currentRight = _foundRight + 1;
						}
					}
					_report.add(REPORT_LINE__EMPTY);
				}
			}
			else if (_currentLeft < textOnLeft.length)
			{
				// supplemental lines on left
				String _line = getTextLine(textOnLeft, _currentLeft);
				if (!(isIgnoreEmptyLines() && 0 == _line.length()))
				{
					outputReportLine(_report, myTemplateOnLeft, textOnLeft, _currentLeft);
				}
				++_currentLeft;
			}
			else if (_currentRight < textOnRight.length)
			{
				// supplemental lines on right
				String _line = getTextLine(textOnRight, _currentRight);
				if (!(isIgnoreEmptyLines() && 0 == _line.length()))
				{
					outputReportLine(_report, myTemplateOnRight, textOnRight, _currentRight);
				}
				_currentRight++;
			}
		}

		return _report.toArray(new String[_report.size()]);
	}
407120
def apply(self, transformation, node):
        '''
        
        '''
        assert issubclass(transformation, (Transformation, Analysis))
        a = transformation()
        a.attach(self)
        res = a.apply(node)

        # the transformation updated the AST, so analyse may need to be rerun
        # we could use a finer-grain caching system, and provide a way to flag
        # some analyses as `unmodified' by the transformation, as done in LLVM
        # (and PIPS ;-)
        if a.update:
            self._cache.clear()
        return res
635917
def memoize_method(method):
    """"""
    cache = {}

    @functools.wraps(method)
    def wrapper(self, *args, **kwargs):
        """Caching wrapper."""
        key = (args, tuple(sorted(kwargs.items())))
        if key in cache:
            return cache[key]
        else:
            result = method(self, *args, **kwargs)
            cache[key] = result
            return result

    return wrapper
252782
def transform(self, attrs):
        """"""
        self.collect(attrs)
        self.add_missing_implementations()
        self.fill_attrs(attrs)
1290616
private void addCompilationErrorOnCustomMethodNode(InnerClassNode node, String methodName, Parameter[] parameters) {
        MethodNode existingMethodNode = node.getMethod(methodName, parameters);
        // if there is a user-defined methodNode, add compiler error msg and continue
        if (existingMethodNode != null && !isSynthetic(existingMethodNode))  {
            addError("\"" +methodName + "\" implementations are not supported on static inner classes as " +
                    "a synthetic version of \"" + methodName + "\" is added during compilation for the purpose " +
                    "of outer class delegation.",
                    existingMethodNode);
        }
    }
511909
def _compose_mro(cls, types):  # noqa
    
    bases = set(cls.__mro__)

    # Remove entries which are already present in the __mro__ or unrelated.
    def is_related(_type):
        return (  # :off
            _type not in bases and
            hasattr(_type, '__mro__') and
            issubclass(cls, _type)
        )  # :on

    types = [n for n in types if is_related(n)]

    # Remove entries which are strict bases of other entries (they will end up
    # in the MRO anyway.
    def is_strict_base(_typ):
        for other in types:
            if _typ != other and _typ in other.__mro__:
                return True
        return False

    types = [n for n in types if not is_strict_base(n)]
    # Subclasses of the ABCs in *types* which are also implemented by
    # *cls* can be used to stabilize ABC ordering.
    type_set = set(types)
    mro = []
    for typ in types:
        found = []
        for sub in typ.__subclasses__():
            if sub not in bases and issubclass(cls, sub):
                found.append([s for s in sub.__mro__ if s in type_set])
        if not found:
            mro.append(typ)
            continue
        # Favor subclasses with the biggest number of useful bases
        found.sort(key=len, reverse=True)
        for sub in found:
            for subcls in sub:
                if subcls not in mro:
                    mro.append(subcls)
    return _c3_mro(cls, abcs=mro)
390061
def method_missing(method, *args, &block)
      
      attribute = ActiveSupport::Inflector.camelize(method.to_s, false)
  
      if attribute =~ /=$/
        attribute = attribute.chop
        return super unless self.attributes.include?(attribute)
        self.changed_attributes[attribute] = args[0]
        self.attributes[attribute] = args[0]
      else
        return super unless self.attributes.include?(attribute)
        self.attributes[attribute]
      end 
            
    end
627391
function resolveMethods(classDoc) {
  let methods = classDoc.members.filter(member => member.hasOwnProperty('parameters'));

  if (classDoc.inheritedDoc) {
    methods = methods.concat(resolveMethods(classDoc.inheritedDoc));
  }

  return methods;
}
1073867
function fixHttpMethod (fn, name) {
  if (fn.http && fn.http.verb && fn.http.verb.toLowerCase() === 'put') {
    fn.http.verb = 'patch'
  }
}
34200
def method_wrapper(m):
    """"""

    if m.is_simple:
        def simple_method(self):
            """TODO: no docstring!"""
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, unwrap(self)))

        return simple_method

    elif m.input_transform is not None:
        def transform_method(self, *args, **kwargs):
            """TODO: no docstring!"""
            request = m.input_transform(self, *args, **kwargs)
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, request))

        return transform_method

    elif m.static:
        def static_method(cls, *args, **kwargs):
            """TODO: no docstring!"""
            request = make_static_request(m, *args, **kwargs)
            return apply_transform(
                cls.__stub__(__server__), m.output_transform,
                grpc_call(cls.__stub__(__server__), m, request))

        return static_method

    else:
        def request_method(self, *args, **kwargs):
            """TODO: no docstring!"""
            request = make_request(self, m, *args, **kwargs)
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, request))

        return request_method
399476
def refactor_organize_imports(self):
        """"""
        refactor = ImportOrganizer(self.project)
        changes = refactor.organize_imports(self.resource)
        return translate_changes(changes)
710740
def _teardown(self):
        '''
        
        '''
        # __new__ is a super-special case in that even when stubbing a class
        # which implements its own __new__ and subclasses object, the
        # "Class.__new__" reference is a staticmethod and not a method (or
        # function). That confuses the "was_object_method" logic in
        # StubFunction which then fails to delattr and from then on the class
        # is corrupted. So skip that teardown and use a __new__-specific case.
        setattr(self._instance, self._attr, staticmethod(self._new))
        StubNew._cache.pop(self._type)
124496
function fixTemplateContext(template, fix) {
    var _template_r = template.r;
    template.r = function(contextStack) {
        var context = contextStack[contextStack.length-1];
        contextStack[contextStack.length-1] = fix(context);
        return _template_r.apply(this,arguments);
    };
}
949721
def fix_2to3(source,
             aggressive=True, select=None, ignore=None, filename='',
             where='global', verbose=False):
    """"""
    if not aggressive:
        return source

    select = select or []
    ignore = ignore or []

    return refactor(source,
                    code_to_2to3(select=select,
                                 ignore=ignore,
                                 where=where,
                                 verbose=verbose),
                    filename=filename)
122484
function (method) {
            if (this.subviews.length !== 0) {
                var params = slice.call(arguments);
                params.shift();
                _.each(this.subviews, function (s) {
                    if (s[method]) {
                        s[method].apply(s, params);
                    }
                });
            }
        }
379485
function mergeMethods(builder) {
      var methods = builder.methods();
      _.each(methods, function (fn, methodName) {
        // e.g.: users.getUserInfo
        self._methods[util.format('%s.%s', name, methodName)] = fn;
      });
    }
463956
def _flatten_subclass_tree(cls):
    
    subclasses = frozenset(cls.__subclasses__())
    children = frozenset(toolz.concat(map(_flatten_subclass_tree, subclasses)))
    return frozenset({cls}) | subclasses | children