Return a tuple with the removed and added facts since last run.
557470
def changes(self):
        
        try:
            return self.added, self.removed
        finally:
            self.added = list()
            self.removed = list()
22725
def current_fact_index(self):
        """"""
        facts_ids = [fact.id for fact in self.facts]
        return facts_ids.index(self.current_fact.id)
559197
def _group_changes(cur, wanted, remove=False):
    '''
    
    '''
    old = set(cur)
    new = set(wanted)
    if (remove and old != new) or (not remove and not new.issubset(old)):
        return True
    return False
259637
def recent_state(self):
        
        expected_len = self.history_len - 1
        if len(self._current_episode) >= expected_len:
            return [k.state for k in self._current_episode[-expected_len:]]
        else:
            states = [np.zeros(self.state_shape, dtype=self.dtype)] * (expected_len - len(self._current_episode))
            states.extend([k.state for k in self._current_episode])
            return states
873706
def remove_dups(head):
    
    hashset = set()
    prev = Node()
    while head:
        if head.val in hashset:
            prev.next = head.next
        else:
            hashset.add(head.val)
            prev = head
        head = head.next
60158
def clearData(self):
        """"""
        self._counts = np.zeros_like(self._bins)
        self.histo.setOpts(height=self._counts)
161213
def last_modified(self, last_modified):
        """"""
        self._indicator_data['lastModified'] = self._utils.format_datetime(
            last_modified, date_format='%Y-%m-%dT%H:%M:%SZ'
        )
443690
def last_modified(self):
        
        resource_list = self.traffic_incident()
        last_modified = namedtuple('last_modified', 'last_modified')
        if len(resource_list) == 1 and resource_list[0] is None:
            return None
        else:
            try:
                return [last_modified(resource['lastModified'])
                        for resource in resource_list]
            except (KeyError, TypeError):
                return [last_modified(resource['LastModifiedUTC'])
                        for resource in resource_list]
1224687
def changed(self):
        """"""
        if not self.instance.pk:
            return {}
        saved = self.saved_data.items()
        current = self.current()
        return dict((k, v) for k, v in saved if v != current[k])
1011886
def new_with_atts_removed(self, *attributes):
        """"""
        return FmtStr(*[Chunk(bfs.s, bfs.atts.remove(*attributes))
                        for bfs in self.chunks])
526464
def to_tuple(self):
        """"""
        return (
            self.data_type,
            self.unit,
            self.analysis_period,
            self.metadata
        )
521828
Facts and(Fact... moreFacts) {
    return new Facts(Iterables.concat(facts, asList(moreFacts)));
  }
813484
def added(self):
        '''
        
        '''
        def _added(diffs, prefix):
            keys = []
            for key in diffs.keys():
                if isinstance(diffs[key], dict) and 'old' not in diffs[key]:
                    keys.extend(_added(diffs[key],
                                       prefix='{0}{1}.'.format(prefix, key)))
                elif diffs[key]['old'] == self.NONE_VALUE:
                    if isinstance(diffs[key]['new'], dict):
                        keys.extend(
                            _added(diffs[key]['new'],
                                   prefix='{0}{1}.'.format(prefix, key)))
                    else:
                        keys.append('{0}{1}'.format(prefix, key))
            return keys

        return sorted(_added(self._diffs, prefix=''))
339518
def listTheExtras(self, deleteAlso):
        
        # get list of extras
        extras = configobj.get_extra_values(self)
        # extras is in format: [(sections, key), (sections, key), ]
        # but we need: [(sections, key, result), ...] - set all results to
        # a bool just to make it the right shape.  BUT, since we are in
        # here anyway, make that bool mean something - hide info in it about
        # whether that extra item is a section (1) or just a single par (0)
        #
        # simplified, this is:  expanded = [ (x+(abool,)) for x in extras]
        expanded = [ (x+ \
                       ( bool(len(x[0])<1 and hasattr(self[x[1]], 'keys')), ) \
                     ) for x in extras]
        retval = ''
        if expanded:
            retval = flattened2str(expanded, extra=1)
        # but before we return, delete them (from ourself!) if requested to
        if deleteAlso:
            for tup_to_del in extras:
                target = self
                # descend the tree to the dict where this items is located.
                # (this works because target is not a copy (because the dict
                #  type is mutable))
                location = tup_to_del[0]
                for subdict in location: target = target[subdict]
                # delete it
                target.pop(tup_to_del[1])

        return retval
994847
def _get_changes(self):
        ''''''
        result = dict( (f['id'], f.get('value','')) for f in self._data if f.get('changed', False) )
        self._clear_changes
        return result
1258695
def get_facts(self):
        """"""
        commands = []
        commands.append('show version')
        commands.append('show hostname')
        commands.append('show interfaces')

        result = self.device.run_commands(commands)

        version = result[0]
        hostname = result[1]
        interfaces_dict = result[2]['interfaces']

        uptime = time.time() - version['bootupTimestamp']

        interfaces = [i for i in interfaces_dict.keys() if '.' not in i]
        interfaces = string_parsers.sorted_nicely(interfaces)

        return {
            'hostname': hostname['hostname'],
            'fqdn': hostname['fqdn'],
            'vendor': u'Arista',
            'model': version['modelName'],
            'serial_number': version['serialNumber'],
            'os_version': version['internalVersion'],
            'uptime': int(uptime),
            'interface_list': interfaces,
        }
1099931
def changes(self):
        
        output = []
        if self.status() is self.UNMODIFIED:
            output = [self.formatter % (' ', self.key, self.old_value)]
        elif self.status() is self.ADDED:
            output.append(self.formatter % ('+', self.key, self.new_value))
        elif self.status() is self.REMOVED:
            output.append(self.formatter % ('-', self.key, self.old_value))
        elif self.status() is self.MODIFIED:
            output.append(self.formatter % ('-', self.key, self.old_value))
            output.append(self.formatter % ('+', self.key, self.new_value))
        return output