<commit_before>import string
import numpy as np
import matplotlib.pyplot as plt

def lettotup(pos):
    let = dict(zip(string.ascii_lowercase,[ord(c)%32 for c in string.ascii_lowercase]))
    return (int(pos[0])-1,let[pos[1]]-1)

# TODO: Test
def test_ship(board,ship):
    def is_out_of_bounds():
        def outbounds(x,y,sx,sy):
            return x < 0 or y < 0 or x => sx or y =>y
        return (outbounds(ship[0],ship[1],board.shape[0],board.shape[1]) or
                outbounds(ship[0] + ship[2]-1, ship[1] + ship[3] -1,
                    board.shape[0],board.shape[1]))
    def is_legal():
        for jj in xrange(ship[1], ship[3]):
            for ii in xrange(ship[0], ship[2]):
                if board[jj][ii] == 'x' or  board [jj][ii] == 'n':
                    return false
    return not ( is_out_of_bounds() && is_legal() )<commit_msg>Apparently I forgot && as well<commit_after>import string
import numpy as np
import matplotlib.pyplot as plt

def lettotup(pos):
    let = dict(zip(string.ascii_lowercase,[ord(c)%32 for c in string.ascii_lowercase]))
    return (int(pos[0])-1,let[pos[1]]-1)

# TODO: Test
def test_ship(board,ship):
    def is_out_of_bounds():
        def outbounds(x,y,sx,sy):
            return x < 0 or y < 0 or x => sx or y =>y
        return (outbounds(ship[0],ship[1],board.shape[0],board.shape[1]) or
                outbounds(ship[0] + ship[2]-1, ship[1] + ship[3] -1,
                    board.shape[0],board.shape[1]))
    def is_legal():
        for jj in xrange(ship[1], ship[3]):
            for ii in xrange(ship[0], ship[2]):
                if board[jj][ii] == 'x' or  board [jj][ii] == 'n':
                    return false
    return not ( is_out_of_bounds() and is_legal() )
{'fraction_non_alphanumeric': 0.15916955017301038, 'fraction_numerical': 0.02768166089965398, 'mean_word_length': 2.584710743801653, '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': '5059879', 'n_tokens_mistral': 645, 'n_tokens_neox': 617, 'n_words': 153}