<commit_before>part of isomorphic_dart.components;

typedef ApplicationView({State state, Subject<Action> updates, ClientFactory clientFactory});

var _applicationView = registerComponent(() => new _ApplicationView());

ApplicationView applicationView = ({State state, Subject<Action> updates, ClientFactory clientFactory}) {
  return _applicationView({"state": state, "updates": updates, "clientFactory": clientFactory});
};

class _ApplicationView extends Component {
  State get _state => props["state"];
  Subject<Action> get _updates => props["updates"];
  ClientFactory get _clientFactory => props["clientFactory"];

  final _search = new Subject<String>();
  final _selectMovie = new Subject<Movie>();

  void componentDidMount(rootNode) {
    _search.stream
        .flatMapLatest((term) => new EventStream.fromFuture(_searchMovies(term)))
        .listen((result) {
          var term = result.first;
          var movies = result.last;
          _updates.add(showSearch(term, movies));
        });

    _selectMovie.stream
        .listen((movie) => _updates.add(showMovie(movie)));
  }

  Future<Iterable<Movie>> _searchMovies(String term) {
    var omdbApi = new OmdbClient(_clientFactory);
    return omdbApi.search(term)
        .then((movies) => movies.map((json) => new Movie.fromJson(json)))
        .then((movies) => [term, movies]);
  }

  render() {
    return div({}, [
        h1({}, "IMDB Dart"),
        _renderPath(_state.path, _state.data),
    ]);
  }

  _renderPath(String path, Map data) {
    if (path == "/") {
      return homeView(_search);
    } else if (path.startsWith("/search")) {
      var movies = data["movies"].map((json) => new Movie.fromJson(json));
      return searchResultsView(data["term"], movies, _selectMovie);
    } else if (path.startsWith("/movie")) {
      var movie = new Movie.fromJson(data["movie"]);
      return movieDetailView(movie);
    } else {
      throw new ArgumentError("Undefined route `$path`");
    }
  }
}<commit_msg>_searchMovies shouldn't create tuple<commit_after>part of isomorphic_dart.components;

typedef ApplicationView({State state, Subject<Action> updates, ClientFactory clientFactory});

var _applicationView = registerComponent(() => new _ApplicationView());

ApplicationView applicationView = ({State state, Subject<Action> updates, ClientFactory clientFactory}) {
  return _applicationView({"state": state, "updates": updates, "clientFactory": clientFactory});
};

class _ApplicationView extends Component {
  State get _state => props["state"];
  Subject<Action> get _updates => props["updates"];
  ClientFactory get _clientFactory => props["clientFactory"];

  final _search = new Subject<String>();
  final _selectMovie = new Subject<Movie>();

  void componentDidMount(rootNode) {
    _search.stream
        .flatMapLatest((term) => new EventStream.fromFuture(_searchMovies(term).then((movies) => [term, movies])))
        .listen((result) {
          var term = result.first;
          var movies = result.last;
          _updates.add(showSearch(term, movies));
        });

    _selectMovie.stream
        .listen((movie) => _updates.add(showMovie(movie)));
  }

  Future<Iterable<Movie>> _searchMovies(String term) {
    var omdbApi = new OmdbClient(_clientFactory);
    return omdbApi.search(term).then((movies) => movies.map((json) => new Movie.fromJson(json)));
  }

  render() {
    return div({}, [
        h1({}, "IMDB Dart"),
        _renderPath(_state.path, _state.data),
    ]);
  }

  _renderPath(String path, Map data) {
    if (path == "/") {
      return homeView(_search);
    } else if (path.startsWith("/search")) {
      var movies = data["movies"].map((json) => new Movie.fromJson(json));
      return searchResultsView(data["term"], movies, _selectMovie);
    } else if (path.startsWith("/movie")) {
      var movie = new Movie.fromJson(data["movie"]);
      return movieDetailView(movie);
    } else {
      throw new ArgumentError("Undefined route `$path`");
    }
  }
}
{'fraction_non_alphanumeric': 0.14780426599749058, 'fraction_numerical': 0.0005018820577164366, 'mean_word_length': 3.9088669950738915, 'pattern_counts': {'":': 6, '<': 17, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4651087', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1145, 'n_words': 263}