<commit_before>//
//  Location.swift
//  MYNZ
//
//  Created by <NAME> on 4/9/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit
import CoreLocation
import Parse

class Location: NSObject, CLLocationManagerDelegate {

	// MARK: - Variables
	var locationManager = CLLocationManager()
	var lastLocation: CLLocation?

	static let sharedInstance = Location()

	// MARK: - Methods

	// Returning user's current location
	func getLocation(handler: ((loc: CLLocation!, error: NSError!) -> ())) {
		requestLocation()
		if let location = locationManager.location {

			lastLocation = location
			handler(loc: location, error: nil)
		} else {
			let error = NSError(domain: "No location available", code: 1, userInfo: nil)
			handler(loc: nil, error: error)
		}
	}

	// Requesting user's permission for Location Services access
	func requestLocation() {

		// For use in foreground
		self.locationManager.requestWhenInUseAuthorization()

		if CLLocationManager.locationServicesEnabled() {
			locationManager.delegate = self
			locationManager.desiredAccuracy = kCLLocationAccuracyBest
			locationManager.startUpdatingLocation()
		}
	}

  func getCity(handler:((city:String) -> ()))
	{
		let geoCoder = CLGeocoder()

		if let loc = lastLocation {
			let location = CLLocation(latitude: loc.coordinate.latitude, longitude: loc.coordinate.longitude)
			geoCoder.reverseGeocodeLocation(location) {
        (placemarks, error) -> Void in
        
        let placeArray = placemarks as [CLPlacemark]!
        var placeMark: CLPlacemark!
        placeMark = placeArray?[0]

				if let city = placeMark.addressDictionary?["City"] as? NSString {
					handler(city: city as String)
        } else {
          handler(city: "")
        }
			}
		}
	}

	// MARK: - CLLocationManagerDelegate

	@objc func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {

		// Updating locationManager.location for getLocation()
		locationManager = manager

		// Sending NSNotification for MapDropViewController to update it's MapView
		if locations.first?.distanceFromLocation(lastLocation!) > 10 {
			NSNotificationCenter.defaultCenter().postNotificationName("updateMap", object: nil)
		}

		TrapManager.sharedInstance.explodeCheck()
	}
}
<commit_msg>linting corrections<commit_after>//
//  Location.swift
//  MYNZ
//
//  Created by <NAME> on 4/9/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit
import CoreLocation
import Parse

class Location: NSObject, CLLocationManagerDelegate {

	// MARK: - Variables
	var locationManager = CLLocationManager()
	var lastLocation: CLLocation?

	static let sharedInstance = Location()

	// MARK: - Methods

	// Returning user's current location
	func getLocation(handler: ((loc: CLLocation!, error: NSError!) -> ())) {
		requestLocation()
		if let location = locationManager.location {

			lastLocation = location
			handler(loc: location, error: nil)
		} else {
			let error = NSError(domain: "No location available", code: 1, userInfo: nil)
			handler(loc: nil, error: error)
		}
	}

	// Requesting user's permission for Location Services access
	func requestLocation() {

		// For use in foreground
		self.locationManager.requestWhenInUseAuthorization()

		if CLLocationManager.locationServicesEnabled() {
			locationManager.delegate = self
			locationManager.desiredAccuracy = kCLLocationAccuracyBest
			locationManager.startUpdatingLocation()
		}
	}

  func getCity(handler:((city: String) -> ())) {
		let geoCoder = CLGeocoder()

		if let loc = lastLocation {
			let location = CLLocation(latitude: loc.coordinate.latitude, longitude: loc.coordinate.longitude)
			geoCoder.reverseGeocodeLocation(location) {
        (placemarks, error) -> Void in
        
        let placeArray = placemarks as [CLPlacemark]!
        var placeMark: CLPlacemark!
        placeMark = placeArray?[0]

				if let city = placeMark.addressDictionary?["City"] as? NSString {
					handler(city: city as String)
        } else {
          handler(city: "")
        }
			}
		}
	}

	// MARK: - CLLocationManagerDelegate

	@objc func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {

		// Updating locationManager.location for getLocation()
		locationManager = manager

		// Sending NSNotification for MapDropViewController to update it's MapView
		if locations.first?.distanceFromLocation(lastLocation!) > 10 {
			NSNotificationCenter.defaultCenter().postNotificationName("updateMap", object: nil)
		}

		TrapManager.sharedInstance.explodeCheck()
	}
}

{'fraction_non_alphanumeric': 0.10496267018006149, 'fraction_numerical': 0.005270092226613966, 'mean_word_length': 3.764644351464435, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '1514273', 'n_tokens_mistral': 1477, 'n_tokens_neox': 1316, 'n_words': 338}