<commit_before># ===============================================================================
# Copyright 2011 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================
# =============enthought library imports=======================

# =============standard library imports ========================
import time
import glob
import os
import sys

import serial


# =============local library imports  ==========================
from communicator import Communicator, process_response, prep_str, remove_eol_func
from pychron.globals import globalv


def get_ports():
    keyspan = glob.glob('/dev/tty.U*')
    usb = glob.glob('/dev/tty.usb*')
    return keyspan + usb


class SerialCommunicator(Communicator):
    """
        Base Class for devices that communicate using a rs232 serial port.
        Using Keyspan serial converter is the best option for a Mac
        class is built on top of pyserial. Pyserial is used to create a handle and
        this class uses the handle to read and write.
        handles are created when a serial device is opened
        setup args are loaded using load(). this method should be overwritten to
        load specific items.

    """

    # char_write = False

    _auto_find_handle = False
    _auto_write_handle = False
    baudrate = None
    port = None
    bytesize = None
    parity = None<commit_msg>fixed serial communicator for rpi<commit_after># ===============================================================================
# Copyright 2011 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================
# =============enthought library imports=======================

# =============standard library imports ========================
import time
import glob
import os
import sys

import serial


# =============local library imports  ==========================
from communicator import Communicator, process_response, prep_str, remove_eol_func
from pychron.globals import globalv


def get_ports():
    usb = glob.glob('/dev/tty.usb*')
    if sys.platform == 'darwin':
        keyspan = glob.glob('/dev/tty.U*')
    else:
        keyspan = glob.glob('/dev/ttyU*')

    return keyspan + usb


class SerialCommunicator(Communicator):
    """
        Base Class for devices that communicate using a rs232 serial port.
        Using Keyspan serial converter is the best option for a Mac
        class is built on top of pyserial. Pyserial is used to create a handle and
        this class uses the handle to read and write.
        handles are created when a serial device is opened
        setup args are loaded using load(). this method should be overwritten to
        load specific items.

    """

    # char_write = False

    _auto_find_handle = False
    _auto_write_handle = False
    baudrate = None
    port = None
    bytesize = None
    parity = None
{'fraction_non_alphanumeric': 0.19069296914516945, 'fraction_numerical': 0.00556398583712696, 'mean_word_length': 3.93142144638404, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2273326', 'n_tokens_mistral': 980, 'n_tokens_neox': 916, 'n_words': 423}