The Heart and Soul of IrcBot.
558603
def handle_msg(self, c, e):
        """"""

        if e.type not in ['authenticate', 'error', 'join', 'part', 'quit']:
            nick = e.source.nick
        else:
            nick = e.source

        if e.arguments is None:
            msg = ""
        else:
            msg = " ".join(e.arguments).strip()

        # Send the response to private messages to the sending nick.
        target = nick if e.type == 'privmsg' else e.target

        def send(msg, mtype='privmsg', target=target, ignore_length=False):
            self.send(target, self.connection.real_nickname, msg, mtype, ignore_length)

        if e.type in [
                'account', 'authenticate', 'bannedfromchan', 'cap', 'ctcpreply', 'error', 'featurelist', 'nosuchnick', 'nick', 'nicknameinuse',
                'privnotice', 'welcome', 'whospcrpl'
        ]:
            self.handle_event(msg, send, c, e)
            return

        # ignore empty messages
        if not msg and e.type != 'join':
            return

        self.do_log(target, nick, msg, e.type)

        if e.type == 'mode':
            self.do_mode(target, msg, nick, send)
            return

        if e.type == 'join':
            self.handle_join(c, e, target, send)
            return

        if e.type == 'part':
            if nick == c.real_nickname:
                send("Parted channel %s" % target, target=self.config['core']['ctrlchan'])
            return

        if e.type == 'kick':
            self.handle_kick(c, e, target, send)
            return

        if e.target == self.config['core']['ctrlchan'] and self.is_admin(None, nick):
            control.handle_ctrlchan(self, msg, nick, send)

        if self.is_ignored(nick) and not self.is_admin(None, nick):
            return

        self.handle_hooks(send, nick, target, e, msg)

        # We only process hooks for notices, not commands.
        if e.type == 'pubnotice':
            return

        msg = misc.get_cmdchar(self.config, c, msg, e.type)
        cmd_name, cmdargs = self.get_cmd(msg)

        if registry.command_registry.is_registered(cmd_name):
            self.run_cmd(send, nick, target, cmd_name, cmdargs, e)
        # special commands
        elif cmd_name == 'reload':
            with self.db.session_scope() as session:
                if session.query(orm.Permissions).filter(orm.Permissions.nick == nick).count():
                    send("Aye Aye Capt'n")
454639
function(state,isInv)
		{
			for (var i = 0; i < 16; i++)
				state[i] = isInv?this.rsbox[state[i]]:this.sbox[state[i]];
			return state;
		}
1115572
def arch_to_personality(arch):
    
    if isinstance(arch, bytes):
        arch = unicode(arch)
    return _lxc.arch_to_personality(arch)
934404
function initChans() {
  var chan = irc.config.chan;
  setTimeout(function () {
    if (chan instanceof Array) {
      for (var i = 0, l = chan.length; i < l; i += 1) {
        irc.join(chan[i]);
      }
    } else {
      irc.join(chan);
    }
  }, irc.config.waitTime);
}
129843
def fopenat_rw(base_fd, path):
    

    return os.fdopen(openat(base_fd, path, os.O_RDWR), 'rb+')
591152
function ProtoIR(irType, name) {
    this.irType = irType;
    this.names = new Set(name ? [name] : undefined);
    this.start = Infinity;
    this.end = -Infinity;
    this.associatedEvents = new tr.model.EventSet();
  }
685547
private function _storePGT($pgt,$pgt_iou)
    {
        // ensure that storage is initialized
        $this->_initPGTStorage();
        // writes the PGT
        $this->_pgt_storage->write($pgt, $pgt_iou);
    }
261009
function RBTSentinel() {
  this.key = null;
  this.value = null;
  this.color = BLACK;
  this.parent = null;
  this.left = null;
  this.right = null;
}
444550
def incr(self, att, val=1):
        """"""
        if att not in self.counters:
            raise ValueError("%s is not a counter.")
        self.db.hincrby(self.key(), att, val)
554714
def i2m(self, pkt, i):
        """""""
        mask, ip = i
        ip = socket.inet_aton(ip)
        return struct.pack(">B", mask) + ip[:self.mask2iplen(mask)]
813680
function(data, cb) {
                if (corbel.Config.isNode) {
                    // in node transform to stream
                    cb(corbel.utils.toURLEncoded(data));
                } else {
                    // in browser transform to blob
                    cb(corbel.utils.dataURItoBlob(data));
                }
            }
894572
function(req, rsp, cb){
      fs.readFile(path.resolve(routerPath), function(err, buff){
        if (buff) {
          var arrs = buff2arrs(buff)
          return cb(arrs)
        } else {
          return cb(null)
        }
      })
    }
549490
function init(cb) {
	Storage.read(goblin.config.files.db, {}, function(err, db) {
		if (err) {
			return cb(err);
		}

		goblin.db = db;
		cb();
	})
}
798175
def irc_name(name)
      name.gsub('/', '-').
        gsub(/\W/, ' ').
        gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
        gsub(/([a-z\d])([A-Z])/,'\1_\2').
        gsub(/\s+/, "_").
        tr("-", "_").
        downcase
    end
143502
def url_tibiadata(self):
        """"""
        return self.get_url_tibiadata(self.world, self.category, self.vocation)
658655
def save(self, basename):
        
        # IROM data goes in its own plain binary file
        irom_segment = self.get_irom_segment()
        if irom_segment is not None:
            with open("%s0x%05x.bin" % (basename, irom_segment.addr - ESP8266ROM.IROM_MAP_START), "wb") as f:
                f.write(irom_segment.data)

        # everything but IROM goes at 0x00000 in an image file
        normal_segments = self.get_non_irom_segments()
        with open("%s0x00000.bin" % basename, 'wb') as f:
            self.write_common_header(f, normal_segments)
            checksum = ESPLoader.ESP_CHECKSUM_MAGIC
            for segment in normal_segments:
                checksum = self.save_segment(f, segment, checksum)
            self.append_checksum(f, checksum)
153241
def _connectionEstablished(self, transport):
        ''''''
        self.transport = transport
        self.transport.writeOpen()
        self.heartbeater.schedule()