<commit_before>#!/usr/bin/env python

import sys, os, subprocess, zipfile

"""
  This script creates an extension build. Without a command line parameter
  the file will be saved as transliterator.xpi, otherwise the command line
  parameter determines the output file name. The command line parameter can
  be -, the build will be written to stdout then.
"""

def is_ignored(path):
  return (
    path.startswith(".") or
    path == "LICENSE" or
    os.path.splitext(path)[1] in (".md", ".py", ".xpi")
  )

def add(archive, path, relpath=""):
  if is_ignored(relpath):
    return

  if os.path.isfile(path):
    archive.write(path, relpath)
  elif os.path.isdir(path):
    if relpath != "":
      relpath += "/"
    for name in os.listdir(path):
      add(archive, os.path.join(path, name), relpath + name)

def build(dir, output):
  with zipfile.ZipFile(output, "w", zipfile.ZIP_DEFLATED) as archive:
    add(archive, dir)

if __name__ == "__main__":
  basedir = os.path.dirname(sys.argv[0])
  if basedir == "":
    basedir = "."<commit_msg>Ignore .pyc files in builds<commit_after>#!/usr/bin/env python

import sys, os, subprocess, zipfile

"""
  This script creates an extension build. Without a command line parameter
  the file will be saved as transliterator.xpi, otherwise the command line
  parameter determines the output file name. The command line parameter can
  be -, the build will be written to stdout then.
"""

def is_ignored(path):
  return (
    path.startswith(".") or
    path == "LICENSE" or
    os.path.splitext(path)[1] in (".md", ".py", ".pyc", ".xpi")
  )

def add(archive, path, relpath=""):
  if is_ignored(relpath):
    return

  if os.path.isfile(path):
    archive.write(path, relpath)
  elif os.path.isdir(path):
    if relpath != "":
      relpath += "/"
    for name in os.listdir(path):
      add(archive, os.path.join(path, name), relpath + name)

def build(dir, output):
  with zipfile.ZipFile(output, "w", zipfile.ZIP_DEFLATED) as archive:
    add(archive, dir)

if __name__ == "__main__":
  basedir = os.path.dirname(sys.argv[0])
  if basedir == "":
    basedir = "."
{'fraction_non_alphanumeric': 0.14007597340930675, 'fraction_numerical': 0.001899335232668566, 'mean_word_length': 3.4829787234042553, 'pattern_counts': {'":': 6, '<': 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': '5839187', 'n_tokens_mistral': 721, 'n_tokens_neox': 712, 'n_words': 217}