<commit_before>import re
import unicodedata
import urllib
import flask

app = flask.Flask(__name__)

character_names = { "\n": "LF", "\r": "CR", "\t": "TAB" }

# Load the Unicode blocks list from our file.
unicode_blocks = []
with open("unidata-blocks.txt") as f:
  for line in f:
    if line.strip() == "" or line[0] == "#": continue
    m = re.match("([0-9A-F]+)\.\.([0-9A-F]+); (.*)", line)
    unicode_blocks.append({
      "start": int(m.group(1), 16),
      "end": int(m.group(2), 16),
      "name": m.group(3),
    })

def lookup_block(c):
  c = ord(c)
  for block in unicode_blocks:
    if block["start"] <= c <= block["end"]:
      return block["name"]
  return None
<commit_msg>improve readability: c => character<commit_after>import re
import unicodedata
import urllib
import flask

app = flask.Flask(__name__)

character_names = { "\n": "LF", "\r": "CR", "\t": "TAB" }

# Load the Unicode blocks list from our file.
unicode_blocks = []
with open("unidata-blocks.txt") as f:
  for line in f:
    if line.strip() == "" or line[0] == "#": continue
    m = re.match("([0-9A-F]+)\.\.([0-9A-F]+); (.*)", line)
    unicode_blocks.append({
      "start": int(m.group(1), 16),
      "end": int(m.group(2), 16),
      "name": m.group(3),
    })

def lookup_block(character):
  character = ord(character)
  for block in unicode_blocks:
    if block["start"] <= character <= block["end"]:
      return block["name"]
  return None

{'fraction_non_alphanumeric': 0.2034965034965035, 'fraction_numerical': 0.016783216783216783, 'mean_word_length': 3.349544072948328, 'pattern_counts': {'":': 14, '<': 7, '<?xml version=': 0, '>': 4, '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': '1471256', 'n_tokens_mistral': 549, 'n_tokens_neox': 520, 'n_words': 137}