<commit_before>from modules.basemodule import BaseModule
import mapper.libmapper
import collections
import json
import os
import pprint
import re
import shutil
import time


class Mapper(BaseModule):
    def help(self, args):
        strs = ["Commands:"]
        for cmd in self.commands.keys():
            strs.append(cmd)
        self.log('\n'.join(strs))

    def current(self):
        return self.gmcp['room']['info']['num']

    def here(self, args):
        if args:
            this = int(args[0])
        else:
            this = self.current()

        just_exits = self.m.getRoomExits(this)
        exits = {}
        for dir, tgt in just_exits.items():
            data = self.m.getExitData(this, tgt)
            data = json.loads(data) if data else {}
            exits[dir] = {'dst': tgt, 'data': data}

        self.log('\n' + pprint.pformat({
            'num': this,
            'name': self.m.getRoomName(this),
            'data': self.m.getRoomData(this),
            'coords': self.m.getRoomCoords(this),
            'exits': exits,
            }))

    def path(self, there):
        if there in self.data['bookmarks']:
            there = self.data['bookmarks'][there]
        else:
            try:
                there = int(there)
            except ValueError:
                self.log("No such bookmark")
                return

        this = self.current()
        if this == there:
            self.log("Already there!")
            return ''
        then = time.time()
        path = self.m.findPath(this, there)
        self.log("{} (found in {} seconds)".format(path, time.time() - then))
        return path

    def go(self, room):
        self.send(self.path(room).replace(';', '\n'))

    def bookmarks(self, args):
        self.log('Bookmarks:\n' + pprint.pformat(self.data['bookmarks']))

    def bookmark(self, args):
        arg = ' '.join(args)
        self.data['bookmarks'][arg] = self.current()
        self.bookmarks([])

    def draw(self, args, sizeX=None, sizeY=None):
        # Draw room at x,y,z. Enumerate exits. For each exit target, breadth-first, figure out its new dimensions, rinse, repeat.
        # █▓▒░
        oneArea = len(args) == 1 and args[0] == 'all'<commit_msg>fix pathing to nonexistent rooms<commit_after>from modules.basemodule import BaseModule
import mapper.libmapper
import collections
import json
import os
import pprint
import re
import shutil
import time


class Mapper(BaseModule):
    def help(self, args):
        strs = ["Commands:"]
        for cmd in self.commands.keys():
            strs.append(cmd)
        self.log('\n'.join(strs))

    def current(self):
        return self.gmcp['room']['info']['num']

    def here(self, args):
        if args:
            this = int(args[0])
        else:
            this = self.current()

        just_exits = self.m.getRoomExits(this)
        exits = {}
        for dir, tgt in just_exits.items():
            data = self.m.getExitData(this, tgt)
            data = json.loads(data) if data else {}
            exits[dir] = {'dst': tgt, 'data': data}

        self.log('\n' + pprint.pformat({
            'num': this,
            'name': self.m.getRoomName(this),
            'data': self.m.getRoomData(this),
            'coords': self.m.getRoomCoords(this),
            'exits': exits,
            }))

    def path(self, there):
        if there in self.data['bookmarks']:
            there = self.data['bookmarks'][there]
        else:
            try:
                there = int(there)
            except ValueError:
                self.log("No such bookmark")
                return

        this = self.current()
        if this == there:
            self.log("Already there!")
            return ''
        then = time.time()
        path = self.m.findPath(this, there)
        self.log("{} (found in {} seconds)".format(path, time.time() - then))
        return path

    def go(self, room):
        path = self.path(room)
        if path:
            self.send(path.replace(';', '\n'))

    def bookmarks(self, args):
        self.log('Bookmarks:\n' + pprint.pformat(self.data['bookmarks']))

    def bookmark(self, args):
        arg = ' '.join(args)
        self.data['bookmarks'][arg] = self.current()
        self.bookmarks([])

    def draw(self, args, sizeX=None, sizeY=None):
        # Draw room at x,y,z. Enumerate exits. For each exit target, breadth-first, figure out its new dimensions, rinse, repeat.
        # █▓▒░
        oneArea = len(args) == 1 and args[0] == 'all'
{'fraction_non_alphanumeric': 0.14235190097259062, 'fraction_numerical': 0.001326259946949602, 'mean_word_length': 1.9421326397919376, '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': '64149', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1389, 'n_words': 343}