<commit_before>package com.edinarobotics.zephyr.parts;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;

/**
 * Wraps the Cypress access into this class. Handles getting input from the 
 * Driver Station Enhanced IO
 */
public class CypressComponents {
    private DriverStationEnhancedIO cypress;
    /**
     * Creates an instance of the DriverStationEnhancedIO for the cypress.
     */
    public CypressComponents(){
        cypress = DriverStation.getInstance().getEnhancedIO();
    }
    
    /**
     * Returns the state of a digital input on the DriverStationEnhancedIO.
     * Defaults to {@code false}.
     * @param port The digital input number on the DriverStationEnhancedIO to
     * get.
     * @return The value of the digital input on the DriverStationEnhancedIO
     * input set. Or {@code false} if any exception occurs when fetching.
     */
    public boolean getDigital(int port){
        try{
            return cypress.getDigital(port);
        }
        catch(Exception e){
            return false;
        }
    }
    
    /**
     * Returns the state of all digital inputs on the DriverStationEnhancedIO
     * set. Defaults to {@code 0}.
     * @return The state of all inputs on the DriverStationEnhancedIO board
     * or {@code 0} if any exception occurs while fetching.
     */
    public short getDigitals(){
        try{
            return cypress.getDigitals();
        }catch(Exception e){<commit_msg>Add better exception handling to CypressComponents.<commit_after>package com.edinarobotics.zephyr.parts;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;

/**
 * Wraps the Cypress access into this class. Handles getting input from the 
 * Driver Station Enhanced IO
 */
public class CypressComponents {
    private DriverStationEnhancedIO cypress;
    /**
     * Creates an instance of the DriverStationEnhancedIO for the cypress.
     */
    public CypressComponents(){
        cypress = DriverStation.getInstance().getEnhancedIO();
    }
    
    /**
     * Returns the state of a digital input on the DriverStationEnhancedIO.
     * Defaults to {@code false}.
     * @param port The digital input number on the DriverStationEnhancedIO to
     * get.
     * @return The value of the digital input on the DriverStationEnhancedIO
     * input set. Or {@code false} if any exception occurs when fetching.
     */
    public boolean getDigital(int port){
        try{
            return cypress.getDigital(port);
        }
        catch(Exception e){
            e.printStackTrace();
            return false;
        }
    }
    
    /**
     * Returns the state of all digital inputs on the DriverStationEnhancedIO
     * set. Defaults to {@code 0}.
     * @return The state of all inputs on the DriverStationEnhancedIO board
     * or {@code 0} if any exception occurs while fetching.
     */
    public short getDigitals(){
        try{
            return cypress.getDigitals();
        }catch(Exception e){
{'fraction_non_alphanumeric': 0.07778142435182146, 'fraction_numerical': 0.0013127666557269445, 'mean_word_length': 2.5985832349468714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5214430', 'n_tokens_mistral': 848, 'n_tokens_neox': 833, 'n_words': 285}