<commit_before>//
//  CircleProgressView.swift
//  CircleProgressView
//
//  Created by <NAME> on 22/04/2017.
//  Copyright © 2017 cedric. All rights reserved.
//

import UIKit

open class CircleProgressView: UIView {
    /**
     Progress value that will be used by CircleProgressView to draw circle.
     
     This value can be set to .none to make this view disappear.
     
     This value must be between 0 and 100.
     */
    open var progress: Double? = .none {
        didSet {
            // Cleaning all possible previous layers
            self.layer.sublayers?.forEach({ (lay) in
                lay.removeFromSuperlayer()
            })
            
            // Testing values
            if let p = progress {
                if p < 0 || p >= 100 { // Invalid value or 100
                    self.progress = .none
                } else {
                    if p == 0 { // Dashed circle
                        self.drawOuterCircle(dashed: true)
                    } else { // Full circle with value
                        // Draw outer circle
                        self.drawOuterCircle(dashed: false)
                        
                        // Draw inner disc
                        self.drawInnerDisc(with: p)
                    }
                }
            } else { // Progress == .none
                self.isHidden = true
            }
        }
    }
    <commit_msg>fixed a bug caused by setting to invalid value or 100 then setting to a vlid value<commit_after>//
//  CircleProgressView.swift
//  CircleProgressView
//
//  Created by <NAME> on 22/04/2017.
//  Copyright © 2017 cedric. All rights reserved.
//

import UIKit

open class CircleProgressView: UIView {
    /**
     Progress value that will be used by CircleProgressView to draw circle.
     
     This value can be set to .none to make this view disappear.
     
     This value must be between 0 and 100.
     */
    open var progress: Double? = .none {
        didSet {
            // Cleaning all possible previous layers
            self.layer.sublayers?.forEach({ (lay) in
                lay.removeFromSuperlayer()
            })
            
            // Testing values
            if let p = progress {
                if p < 0 || p >= 100 { // Invalid value or 100
                    self.progress = .none
                } else {
                    self.isHidden = false
                    if p == 0 { // Dashed circle
                        self.drawOuterCircle(dashed: true)
                    } else { // Full circle with value
                        // Draw outer circle
                        self.drawOuterCircle(dashed: false)
                        
                        // Draw inner disc
                        self.drawInnerDisc(with: p)
                    }
                }
            } else { // Progress == .none
                self.isHidden = true
            }
        }
    }
    
{'fraction_non_alphanumeric': 0.07836456558773425, 'fraction_numerical': 0.01737649063032368, 'mean_word_length': 1.0926585887384177, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2968172', 'n_tokens_mistral': 778, 'n_tokens_neox': 696, 'n_words': 242}