<commit_before>//
//  ViewController.swift
//  DVB
//
//  Created by <NAME> on 05/06/2016.
//  Copyright (c) 2016 <NAME>. All rights reserved.
//

import UIKit
import DVB

class ViewController: UITableViewController {

    var departures: [Departure]? {
        didSet {
            DispatchQueue.main.async {
                [weak self] in
                self?.tableView.reloadData()
            }
        }
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        refresh()
    }

    func refresh() {
        UIApplication.shared.isNetworkActivityIndicatorVisible = true

        Departure.monitor(id: "33000028") { result in
            switch result {
            case .failure(let error):
                print(error)
                break
            case .success(let response):
                self.departures = response.departures
            }
            UIApplication.shared.isNetworkActivityIndicatorVisible = false
        }
    }

    @IBAction func refreshButtonTapped(_ sender: UIBarButtonItem) {
        refresh()
    }

    override func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        guard let departures = departures else { return 0 }
        return departures.count
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "departureCell") ?? UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: "departureCell")

        guard let departures = departures else { return cell }

        let departure = departures[indexPath.row]

        cell.textLabel?.text = "\(departure.line) \(departure.direction)"
//        cell.detailTextLabel?.text = departure.eta == 0 ? "now" : "\(departure.eta) min"
        cell.detailTextLabel?.text = departure.fancyEta
        cell.imageView?.image = UIImage(named: departure.mode.dvbIdentifier)

        return cell
    }

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath, animated: true)
    }
}
<commit_msg>use stop find in example code<commit_after>//
//  ViewController.swift
//  DVB
//
//  Created by <NAME> on 05/06/2016.
//  Copyright (c) 2016 <NAME>. All rights reserved.
//

import UIKit
import DVB

class ViewController: UITableViewController {

    var departures: [Departure]? {
        didSet {
            DispatchQueue.main.async { [weak self] in
                self?.tableView.reloadData()
            }
        }
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        refresh()
    }

    func refresh() {
        UIApplication.shared.isNetworkActivityIndicatorVisible = true

        Stop.find(query: "Hauptbahnhof") { result in
            guard let resp = result.success else { return }
            guard let hbf = resp.stops.first else { return }

            Departure.monitor(id: hbf.id) { result in
                guard let resp = result.success else { return }
                self.departures = resp.departures

                UIApplication.shared.isNetworkActivityIndicatorVisible = false
            }
        }
    }

    @IBAction func refreshButtonTapped(_ sender: UIBarButtonItem) {
        refresh()
    }

    override func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        guard let departures = departures else { return 0 }
        return departures.count
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "departureCell") ?? UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: "departureCell")

        guard let departures = departures else { return cell }

        let departure = departures[indexPath.row]

        cell.textLabel?.text = "\(departure.line) \(departure.direction)"
//        cell.detailTextLabel?.text = departure.eta == 0 ? "now" : "\(departure.eta) min"
        cell.detailTextLabel?.text = departure.fancyEta
        cell.imageView?.image = UIImage(named: departure.mode.dvbIdentifier)

        return cell
    }

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath, animated: true)
    }
}

{'fraction_non_alphanumeric': 0.09511343804537521, 'fraction_numerical': 0.008726003490401396, 'mean_word_length': 2.419090231170768, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '5754558', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1252, 'n_words': 307}