<commit_before># -*- coding: utf-8 -*-

import re
from decimal import Decimal, getcontext
from parser import parser_re

def cleanup(parts):
    latdir = (parts['latdir'] or parts['latdir2']).upper()
    longdir = (parts['longdir'] or parts['longdir2']).upper()

    latdir = latdir[0]
    longdir = longdir[0]

    latdeg = parts.get('latdeg','00')

    longdeg = parts.get('longdeg','00')

    latmin = parts.get('latmin','00') or '00'
    longmin = parts.get('longmin','00') or '00'

    latdecsec = parts.get('latdecsec','')
    longdecsec = parts.get('longdecsec','')

    if (latdecsec and longdecsec):
        latmin += latdecsec
        longmin += longdecsec
        latsec = '00'
        longsec = '00'
    else:
        latsec = parts.get('latsec','') or '00'
        longsec = parts.get('longsec','') or '00'

    return [latdir, latdeg, latmin, latsec, longdir, longdeg, longmin, longsec]

def convert(latdir, latdeg, latmin, latsec, longdir, longdeg, longmin, longsec):
    """
    >>> convert('N','50','30','30','W','50','30','30')
    (Decimal('50.50833333'), Decimal('-50.50833333'))

    """
    getcontext().prec=10

    latitude = Decimal(latdeg)
    <commit_msg>Add doctest for cleanup(); alter doctest for convert() to improve test coverage.<commit_after># -*- coding: utf-8 -*-

import re
from decimal import Decimal, getcontext
from parser import parser_re

def cleanup(parts):
    """
    >>> cleanup({'latdir': 'south', 'longdir': 'west',
    ...          'latdeg':'60','latmin':'30',
    ...          'longdeg':'50','longmin':'40'})
    ['S', '60', '30', '00', 'W', '50', '40', '00']

    >>> cleanup({'latdir': 'south', 'longdir': 'west',
    ...          'latdeg':'60','latmin':'30', 'latdecsec':'.50',
    ...          'longdeg':'50','longmin':'40','longdecsec':'.90'})
    ['S', '60', '30.50', '00', 'W', '50', '40.90', '00']

    """
    
    latdir = (parts['latdir'] or parts['latdir2']).upper()
    longdir = (parts['longdir'] or parts['longdir2']).upper()

    latdir = latdir[0]
    longdir = longdir[0]

    latdeg = parts.get('latdeg','00')

    longdeg = parts.get('longdeg','00')

    latmin = parts.get('latmin','00') or '00'
    longmin = parts.get('longmin','00') or '00'

    latdecsec = parts.get('latdecsec','')
    longdecsec = parts.get('longdecsec','')

    if (latdecsec and longdecsec):
        latmin += latdecsec
        longmin += longdecsec
        latsec = '00'
        longsec = '00'
    else:
        latsec = parts.get('latsec','') or '00'
        longsec = parts.get('longsec','') or '00'

    return [latdir, latdeg, latmin, latsec, longdir, longdeg, longmin, longsec]

def convert(latdir, latdeg, latmin, latsec, longdir, longdeg, longmin, longsec):
    """
    >>> convert('S','50','30','30','W','50','30','30')
    (Decimal('-50.50833333'), Decimal('-50.50833333'))

    """
    getcontext().prec=10

    latitude = Decimal(latdeg)
    
{'fraction_non_alphanumeric': 0.21076233183856502, 'fraction_numerical': 0.057261124525698516, 'mean_word_length': 3.2028985507246377, 'pattern_counts': {'":': 0, '<': 3, '<?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': '204895', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1009, 'n_words': 218}