<commit_before>import optparse, os, pickle

config = {'charity':False,
          'propagate_factor':2,
          'accept_latency':2000}

def setup():
  parser = optparse.OptionParser()
  parser.add_option('-c',
                    '--charity',
                    dest='charity',
                    default=None,
                    action="store_true",
                    help='Sets whether you accept rewardless bounties')
  parser.add_option('-l',
                    '--latency',
                    dest='accept_latency',
                    default=None,
                    help='Maximum acceptable latency from a server')
  parser.add_option('-f',
                    '--propagation-factor',
                    dest='propagate_factor',
                    default=None,
                    help='Minimum funds:reward ratio you\'ll propagate bounties at')        
  (options, args) = parser.parse_args()

  print "options parsed"
  overrides = options.__dict__
  
  if os.path.exists("settings.conf"):
    config.update(pickle.load(open("settings.conf","r")))
    print overrides
    print config
  else:
    pickle.dump(config,open("settings.conf","w"))
  kill = []
  for key in overrides:
    if overrides.get(key) is None:
      kill += [key]
  for key in kill:
    overrides.pop(key)
  config.update(overrides)
<commit_msg>Moved settings to data folder<commit_after>import optparse, os, pickle

config = {'charity':False,
          'propagate_factor':2,
          'accept_latency':2000}

def setup():
  parser = optparse.OptionParser()
  parser.add_option('-c',
                    '--charity',
                    dest='charity',
                    default=None,
                    action="store_true",
                    help='Sets whether you accept rewardless bounties')
  parser.add_option('-l',
                    '--latency',
                    dest='accept_latency',
                    default=None,
                    help='Maximum acceptable latency from a server')
  parser.add_option('-f',
                    '--propagation-factor',
                    dest='propagate_factor',
                    default=None,
                    help='Minimum funds:reward ratio you\'ll propagate bounties at')        
  (options, args) = parser.parse_args()

  print "options parsed"
  overrides = options.__dict__
  
  if os.path.exists("data" + os.sep + "settings.conf"):
    config.update(pickle.load(open("settings.conf","r")))
    print overrides
    print config
  else:
    if not os.path.exists("data" + os.sep + "settings.conf"):
      os.mkdir("data")
    pickle.dump(config,open("data" + os.sep + "settings.conf","w"))
  kill = []
  for key in overrides:
    if overrides.get(key) is None:
      kill += [key]
  for key in kill:
    overrides.pop(key)
  config.update(overrides)

{'fraction_non_alphanumeric': 0.12522234080398434, 'fraction_numerical': 0.0035574528637495554, 'mean_word_length': 1.9170124481327802, 'pattern_counts': {'":': 0, '<': 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': '1156254', 'n_tokens_mistral': 833, 'n_tokens_neox': 794, 'n_words': 170}