<commit_before># coding=utf-8
import argparse
import os
import sys
import time
import traceback

from modules.Logger import Logger
from modules.Poloniex import Poloniex
import modules.Configuration as Config
import modules.MaxToLend as MaxToLend
import modules.Data as Data
import modules.Lending as Lending

os.chdir(os.path.dirname(sys.argv[0]))  # Allow relative paths

parser = argparse.ArgumentParser()  # Start args.
parser.add_argument("-cfg", "--config", help="Location of custom configuration file, overrides settings below")
parser.add_argument("-dry", "--dryrun", help="Make pretend orders", action="store_true")
args = parser.parse_args()  # End args.
# Start handling args.
dry_run = bool(args.dryrun)
if args.config:
    config_location = args.config
else:
    config_location = 'default.cfg'
# End handling args.

Config.init(config_location)
# Config format: Config.get(category, option, default_value=False, lower_limit=False, upper_limit=False)
# A default_value "None" means that the option is required and the bot will not run without it.
# Do not use lower or upper limit on any config options which are not numbers.
# Define the variable from the option in the module where you use it.
output_currency = Config.get('BOT', 'outputCurrency', 'BTC')
end_date = Config.get('BOT', 'endDate')
json_output_enabled = Config.has_option('BOT', 'jsonfile') and Config.has_option('BOT', 'jsonlogsize')


log = Logger(Config.get('BOT', 'jsonfile', ''), Config.get('BOT', 'jsonlogsize', -1))
api = Poloniex(Config.get("API", "apikey", None), Config.get("API", "secret", None))
MaxToLend.init(Config, log)
Data.init(api, log)<commit_msg>Only change working dir if needed (#177)<commit_after># coding=utf-8
import argparse
import os
import sys
import time
import traceback

from modules.Logger import Logger
from modules.Poloniex import Poloniex
import modules.Configuration as Config
import modules.MaxToLend as MaxToLend
import modules.Data as Data
import modules.Lending as Lending

try:
    open('default.cfg.example', 'r')
except IOError:
    os.chdir(os.path.dirname(sys.argv[0]))  # Allow relative paths

parser = argparse.ArgumentParser()  # Start args.
parser.add_argument("-cfg", "--config", help="Location of custom configuration file, overrides settings below")
parser.add_argument("-dry", "--dryrun", help="Make pretend orders", action="store_true")
args = parser.parse_args()  # End args.
# Start handling args.
dry_run = bool(args.dryrun)
if args.config:
    config_location = args.config
else:
    config_location = 'default.cfg'
# End handling args.

Config.init(config_location)
# Config format: Config.get(category, option, default_value=False, lower_limit=False, upper_limit=False)
# A default_value "None" means that the option is required and the bot will not run without it.
# Do not use lower or upper limit on any config options which are not numbers.
# Define the variable from the option in the module where you use it.
output_currency = Config.get('BOT', 'outputCurrency', 'BTC')
end_date = Config.get('BOT', 'endDate')
json_output_enabled = Config.has_option('BOT', 'jsonfile') and Config.has_option('BOT', 'jsonlogsize')


log = Logger(Config.get('BOT', 'jsonfile', ''), Config.get('BOT', 'jsonlogsize', -1))
api = Poloniex(Config.get("API", "apikey", None), Config.get("API", "secret", None))
MaxToLend.init(Config, log)
Data.init(api, log)
{'fraction_non_alphanumeric': 0.12437074326325141, 'fraction_numerical': 0.0026650873556411016, 'mean_word_length': 5.649606299212598, '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': '5579909', 'n_tokens_mistral': 1038, 'n_tokens_neox': 1034, 'n_words': 334}